|
@@ -1,5 +1,6 @@
|
|
|
const settingsService = require('../../store/settings-store.js')
|
|
const settingsService = require('../../store/settings-store.js')
|
|
|
const themeService = require('../../store/theme-store.js')
|
|
const themeService = require('../../store/theme-store.js')
|
|
|
|
|
+const bootloaderService = require('../../features/bootloader/service.js')
|
|
|
const transport = require('../../transport/ble-core.js')
|
|
const transport = require('../../transport/ble-core.js')
|
|
|
const {
|
|
const {
|
|
|
createPageToast
|
|
createPageToast
|
|
@@ -37,6 +38,7 @@ Page({
|
|
|
...transport.getState(),
|
|
...transport.getState(),
|
|
|
...parameterGroupService.getState(),
|
|
...parameterGroupService.getState(),
|
|
|
...manualRtuService.getState(),
|
|
...manualRtuService.getState(),
|
|
|
|
|
+ ...bootloaderService.getState(),
|
|
|
logs: decorateLogs(transport.getState().logs, 'hex'),
|
|
logs: decorateLogs(transport.getState().logs, 'hex'),
|
|
|
logMode: 'hex',
|
|
logMode: 'hex',
|
|
|
logModeToggleText: getLogModeToggleText('hex'),
|
|
logModeToggleText: getLogModeToggleText('hex'),
|
|
@@ -59,6 +61,7 @@ Page({
|
|
|
this.pageToast = createPageToast(this, this.data)
|
|
this.pageToast = createPageToast(this, this.data)
|
|
|
this.lastSyncedSlaveAddress = ''
|
|
this.lastSyncedSlaveAddress = ''
|
|
|
transport.init()
|
|
transport.init()
|
|
|
|
|
+ bootloaderService.init()
|
|
|
parameterGroupService.init()
|
|
parameterGroupService.init()
|
|
|
settingsService.init()
|
|
settingsService.init()
|
|
|
themeService.init()
|
|
themeService.init()
|
|
@@ -107,6 +110,10 @@ Page({
|
|
|
this.unsubscribeManualRtu = manualRtuService.subscribe((manualState) => {
|
|
this.unsubscribeManualRtu = manualRtuService.subscribe((manualState) => {
|
|
|
this.setData(getManualStatePayload(manualState))
|
|
this.setData(getManualStatePayload(manualState))
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ this.unsubscribeBootloader = bootloaderService.subscribe((bootloaderState) => {
|
|
|
|
|
+ this.setData(bootloaderState)
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onShow() {
|
|
onShow() {
|
|
@@ -151,6 +158,11 @@ Page({
|
|
|
this.unsubscribeManualRtu()
|
|
this.unsubscribeManualRtu()
|
|
|
this.unsubscribeManualRtu = null
|
|
this.unsubscribeManualRtu = null
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (this.unsubscribeBootloader) {
|
|
|
|
|
+ this.unsubscribeBootloader()
|
|
|
|
|
+ this.unsubscribeBootloader = null
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
noop() {},
|
|
noop() {},
|
|
@@ -314,6 +326,36 @@ Page({
|
|
|
this.setData(nextState)
|
|
this.setData(nextState)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ chooseFirmwareFile() {
|
|
|
|
|
+ if (this.data.isBootloaderBusy) return
|
|
|
|
|
+
|
|
|
|
|
+ bootloaderService.chooseFirmwareFile('auto')
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ startFirmwareUpgrade() {
|
|
|
|
|
+ if (!this.data.connectedDevice || !this.data.isFirmwareReady || this.data.isBootloaderBusy) return
|
|
|
|
|
+
|
|
|
|
|
+ bootloaderService.startUpgrade()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ readProgramChecksum() {
|
|
|
|
|
+ if (!this.data.connectedDevice || this.data.isBootloaderBusy) return
|
|
|
|
|
+
|
|
|
|
|
+ bootloaderService.readProgramChecksum()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ handshakeBootloader() {
|
|
|
|
|
+ if (!this.data.connectedDevice || this.data.isBootloaderBusy) return
|
|
|
|
|
+
|
|
|
|
|
+ bootloaderService.sendHandshakeKeepAlive()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ exitBootloader() {
|
|
|
|
|
+ if (!this.data.connectedDevice || this.data.isBootloaderBusy) return
|
|
|
|
|
+
|
|
|
|
|
+ bootloaderService.exitBootloader()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
async sendStorageAccessProtocolFrame() {
|
|
async sendStorageAccessProtocolFrame() {
|
|
|
try {
|
|
try {
|
|
|
if (!this.data.connectedDevice) {
|
|
if (!this.data.connectedDevice) {
|