fix: close serial port when re-pairing fails

This commit is contained in:
Vlad Stan
2022-09-27 17:35:27 +03:00
parent f1670c3153
commit a8b90bd595

View File

@@ -610,10 +610,10 @@ async function serialSigner(path) {
} }
}, },
handleCheckPairingResponse: async function (res = '') { handleCheckPairingResponse: async function (res = '') {
const [statusCode, encryptedMessage] = res.split(' ') const [statusCode, message] = res.split(' ')
switch (statusCode) { switch (statusCode) {
case '0': case '0':
const controlText = await this.decryptData(encryptedMessage) const controlText = await this.decryptData(message)
if (controlText == PAIRING_CONTROL_TEXT) { if (controlText == PAIRING_CONTROL_TEXT) {
this.$q.notify({ this.$q.notify({
type: 'positive', type: 'positive',
@@ -629,6 +629,16 @@ async function serialSigner(path) {
}) })
} }
break break
case '1':
this.closeSerialPort()
this.$q.notify({
type: 'warning',
message:
'Re-pairing failed. Remove (forget) device and try again!',
caption: `Error: ${message}`,
timeout: 10000
})
break
default: default:
// noting to do here yet // noting to do here yet
break break