2021-09-24 12:03:57 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import "./Keycard"
|
|
|
|
import "../shared/keycard"
|
|
|
|
|
|
|
|
// this will be the entry point. for now it opens all keycard-related dialogs in sequence for test
|
|
|
|
Item {
|
|
|
|
property var onClosed: function () {}
|
2021-09-27 13:55:39 +00:00
|
|
|
property bool connected: false
|
|
|
|
|
2021-09-24 12:03:57 +00:00
|
|
|
id: keycardView
|
|
|
|
anchors.fill: parent
|
|
|
|
Component.onCompleted: {
|
2021-09-29 13:23:28 +00:00
|
|
|
insertCard.open()
|
|
|
|
keycardModel.startConnection()
|
2021-09-27 13:55:39 +00:00
|
|
|
}
|
|
|
|
|
2021-09-24 12:03:57 +00:00
|
|
|
CreatePINModal {
|
|
|
|
id: createPinModal
|
|
|
|
onClosed: function () {
|
2021-09-30 11:52:46 +00:00
|
|
|
keycardView.onClosed()
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PairingModal {
|
|
|
|
id: pairingModal
|
|
|
|
onClosed: function () {
|
2021-09-30 11:52:46 +00:00
|
|
|
if (!pairingModal.submitted) {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PINModal {
|
|
|
|
id: pinModal
|
|
|
|
onClosed: function () {
|
2021-09-30 11:52:46 +00:00
|
|
|
keycardView.onClosed()
|
2021-09-27 07:36:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertCard {
|
|
|
|
id: insertCard
|
2021-09-27 13:55:39 +00:00
|
|
|
onCancel: function() {
|
2021-09-24 12:03:57 +00:00
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
|
|
|
}
|
2021-09-30 11:52:46 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
id: connection
|
|
|
|
target: keycardModel
|
|
|
|
ignoreUnknownSignals: true
|
|
|
|
|
|
|
|
onCardUnpaired: {
|
|
|
|
pairingModal.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
onCardPaired: {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//TODO: support the states below
|
|
|
|
|
|
|
|
onCardPreInit: {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
|
|
|
|
|
|
|
onCardFrozen: {
|
|
|
|
keycardView.onClosed()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
onCardBlocked: {
|
|
|
|
keycardView.onClosed()
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: handle these by showing an error an prompting for another card
|
|
|
|
// later add factory reset option for the NoFreeSlots case
|
|
|
|
|
|
|
|
onCardNoFreeSlots: {
|
|
|
|
//status-lib currently always returns availableSlots = 0 so we end up here
|
|
|
|
//keycardView.onClosed()
|
|
|
|
pairingModal.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
onCardNotKeycard: {
|
|
|
|
keycardView.onClosed()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-09-24 12:03:57 +00:00
|
|
|
}
|