diff --git a/build/icon.icns b/build/icon.icns index 53b062e..93862c0 100644 Binary files a/build/icon.icns and b/build/icon.icns differ diff --git a/build/icon.ico b/build/icon.ico index cac7ed1..2587fa4 100644 Binary files a/build/icon.ico and b/build/icon.ico differ diff --git a/build/icon.png b/build/icon.png index 5283ae1..fc94133 100644 Binary files a/build/icon.png and b/build/icon.png differ diff --git a/build/iconset/icon_128x128.png b/build/iconset/icon_128x128.png index 64a0f10..3043cc9 100644 Binary files a/build/iconset/icon_128x128.png and b/build/iconset/icon_128x128.png differ diff --git a/build/iconset/icon_128x128@2x.png b/build/iconset/icon_128x128@2x.png index 7bfb9db..3c30478 100644 Binary files a/build/iconset/icon_128x128@2x.png and b/build/iconset/icon_128x128@2x.png differ diff --git a/build/iconset/icon_16x16.png b/build/iconset/icon_16x16.png index b2d1ba7..560ad3b 100644 Binary files a/build/iconset/icon_16x16.png and b/build/iconset/icon_16x16.png differ diff --git a/build/iconset/icon_16x16@2x.png b/build/iconset/icon_16x16@2x.png index c6f5eaa..6a27736 100644 Binary files a/build/iconset/icon_16x16@2x.png and b/build/iconset/icon_16x16@2x.png differ diff --git a/build/iconset/icon_256x256.png b/build/iconset/icon_256x256.png index 7bfb9db..3c30478 100644 Binary files a/build/iconset/icon_256x256.png and b/build/iconset/icon_256x256.png differ diff --git a/build/iconset/icon_256x256@2x.png b/build/iconset/icon_256x256@2x.png index 1f6bbed..90f492c 100644 Binary files a/build/iconset/icon_256x256@2x.png and b/build/iconset/icon_256x256@2x.png differ diff --git a/build/iconset/icon_32x32.png b/build/iconset/icon_32x32.png index c6f5eaa..6a27736 100644 Binary files a/build/iconset/icon_32x32.png and b/build/iconset/icon_32x32.png differ diff --git a/build/iconset/icon_32x32@2x.png b/build/iconset/icon_32x32@2x.png index 4ccb97d..d88b23c 100644 Binary files a/build/iconset/icon_32x32@2x.png and b/build/iconset/icon_32x32@2x.png differ diff --git a/build/iconset/icon_512x512.png b/build/iconset/icon_512x512.png index 1f6bbed..90f492c 100644 Binary files a/build/iconset/icon_512x512.png and b/build/iconset/icon_512x512.png differ diff --git a/build/iconset/icon_512x512@2x.png b/build/iconset/icon_512x512@2x.png index dbc65c5..fc94133 100644 Binary files a/build/iconset/icon_512x512@2x.png and b/build/iconset/icon_512x512@2x.png differ diff --git a/package.json b/package.json index 35f2258..ae76377 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sensecap_sensorhub_cfg_tool_ng", "description": "SenseCAP Sensor Hub Configuration Tool NG", - "version": "2.0.4", + "version": "2.0.5", "homepage": "https://github.com/Seeed-Solution/SenseCAP-Sensor-Hub-Configuration-Tool-NG", "repository": { "type": "git", diff --git a/src/assets/logo.png b/src/assets/logo.png index 532768b..7bcf696 100644 Binary files a/src/assets/logo.png and b/src/assets/logo.png differ diff --git a/src/assets/sensecap.png b/src/assets/sensecap.png index 9002cfa..0cedc77 100644 Binary files a/src/assets/sensecap.png and b/src/assets/sensecap.png differ diff --git a/src/assets/sensecap_logo_1024pt.png b/src/assets/sensecap_logo_1024pt.png deleted file mode 100644 index 9a654fd..0000000 Binary files a/src/assets/sensecap_logo_1024pt.png and /dev/null differ diff --git a/src/assets/sensecap_logo_1024pt.png.png b/src/assets/sensecap_logo_1024pt.png.png new file mode 100644 index 0000000..fc94133 Binary files /dev/null and b/src/assets/sensecap_logo_1024pt.png.png differ diff --git a/src/background.js b/src/background.js index c2e1122..1363bcb 100644 --- a/src/background.js +++ b/src/background.js @@ -22,7 +22,7 @@ const { once, EventEmitter } = require('events') const { crc16kermit } = require('crc') const crypto = require('crypto') -let appName = "SenseCAP Sensor Hub Configuration Tool NG" +let appName = "Sensor Hub Configuration Tool NG" app.name = appName const logger = require("electron-log") @@ -67,6 +67,9 @@ let binCmdQueue = [] //other global var let menuContext = 'unknown' let autoUpdateTimeHandler = null +let exportFileName ='' +let startReadMeasuredData =false +let writerStream /** * The Menu's locale only follows the system, the user selection from the GUI doesn't affect @@ -524,6 +527,7 @@ async function sendToTerm(str) { // ASCII Protocol function parseLine(line) { logger.debug(`parseLine: ${line}`) + let line_ram = line line = line.trim() let found @@ -547,6 +551,7 @@ function parseLine(line) { serial.write('c') } } + startReadMeasuredData = false; return } @@ -590,8 +595,32 @@ function parseLine(line) { ee.emit('menu-context-change', menuContext) return } + + found = line.match(/start read measurement data/i) + if( found && (exportFileName != '') ) { + logger.debug('start read measurement data') + startReadMeasuredData = true; + winGeneral.webContents.send('export-measured-data-end', true) + writerStream = fs.createWriteStream(exportFileName); + return + } + + found = line.match(/end read measurement data/i) + if( found && startReadMeasuredData ) { + logger.debug('end read measurement data') + startReadMeasuredData = false; + winGeneral.webContents.send('export-measured-data-end', false) + exportFileName = '' + writerStream.end(); + return + } + if( startReadMeasuredData == true) { + + writerStream.write(line_ram,'UTF8'); + } } + parser.on('data', (line) => { parseLine(line) }) @@ -1236,6 +1265,43 @@ ipcMain.handle('save-to-file', async (event, configProfileJson) => { } }) + +ipcMain.handle('read-measured-data', async (event, data) => { + + logger.info('handle read-measured-data call ...') + + exportFileName =''; + + let now = new Date() + let datetimeStr = dateFormat(now, "yyyymmdd-HHMMss") + let path = `Measurement-Data-${datetimeStr}.csv` + + let {canceled, filePath} = await dialog.showSaveDialog({ + defaultPath: path, + filters: [ + { name: 'CSV Files', extensions: ['csv'] }, + { name: 'All Files', extensions: ['*'] } + ], + properties: ['createDirectory'] + }) + if (!canceled) { + if (!filePath) throw new Error('saveDialog get empty filePath.') + + if (serial && serial.isOpen && ['general'].includes(menuContext)) { + serial.write(data); + await delayMs(500) + serial.write('Y\r\n') + + exportFileName = filePath; + startReadMeasuredData = false; + return 'succ' + } + return 'canceled' + } else { + return 'canceled' + } +}) + ipcMain.handle('load-from-file', async (event) => { logger.info('handle load-from-file call ...') diff --git a/src/views/General.vue b/src/views/General.vue index 437e2e6..9b1b633 100644 --- a/src/views/General.vue +++ b/src/views/General.vue @@ -2,7 +2,7 @@ { "en": { "text: connectAsConfigMode": "Enter configuration mode automatically on device's booted", - "text: clear data confirm": "This will clear all the storaged measurements in the flash. Once confirmed, the bootloader will launch the Application Firmware and storaged measurements will be wiped out.", + "text: clear data confirm": "This will clear all the storaged measurements in the flash. Once confirmed, storaged measurements will be wiped out.", "Maximum 32 chars allowed": "Maximum 32 non-whitespace chars", "end": "end" }, @@ -25,9 +25,10 @@ "Software Version": "软件版本", "Read": "读取", "Write": "写入", + "Export Data": "导出缓存数据", "Update Fw": "更新固件", - "Clear Data": "清空数据存储", - "text: clear data confirm": "这个操作将会清空存储在Flash中的测量数据,点击\"清空\"后,设备将退出配置模式,进入正常工作模式,并执行清空操作。", + "Clear Data": "清空缓存数据", + "text: clear data confirm": "这个操作将会清空存储在Flash中的测量数据,点击\"清空\"后,执行清空操作。", "Do it": "清空", "Connect": "连接", "Disconnect": "断开", @@ -166,6 +167,10 @@ @click.stop="writeFn()" :loading="writeLoading" :disabled="btnDisabled">{{$t('Write')}} + {{$t('Export Data')}} { + if (result === 'canceled') { + return; + } + }).catch((error) => { + console.log('save to file error:', error) + }).finally(() => { + }) + }, ClearDataFn() { this.dialog = true }, @@ -700,6 +720,10 @@ export default { //menu context ipcRenderer.on('menu-context', (event, arg) => { this.menuContext = arg + }), + + ipcRenderer.on('export-measured-data-end', (event, arg) => { + this.exportMeasuredLoading = arg }) }, beforeDestroy() { diff --git a/src/views/Home.vue b/src/views/Home.vue index 2e50db8..a3b6978 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -156,7 +156,7 @@
- +
diff --git a/vue.config.js b/vue.config.js index cae9682..bb712c0 100644 --- a/vue.config.js +++ b/vue.config.js @@ -12,7 +12,7 @@ module.exports = { filename: 'index.html', // when using title option, // template title tag needs to be <%= htmlWebpackPlugin.options.title %> - title: 'SenseCAP Sensor Hub Configuration Tool NG', + title: 'Sensor Hub Configuration Tool NG', // chunks to include on this page, by default includes // extracted common chunks and vendor chunks. chunks: ['index'] @@ -21,14 +21,14 @@ module.exports = { entry: 'src/main-general.js', template: 'public/index.html', filename: 'general.html', - title: 'SenseCAP Sensor Hub Configuration Tool NG - General', + title: 'Sensor Hub Configuration Tool NG - General', chunks: ['general'] }, sensor: { entry: 'src/main-sensor.js', template: 'public/index.html', filename: 'sensor.html', - title: 'SenseCAP Sensor Hub Configuration Tool NG - Sensor', + title: 'Sensor Hub Configuration Tool NG - Sensor', chunks: ['sensor'] }, }, @@ -57,8 +57,8 @@ module.exports = { builderOptions: { // options placed here will be merged with default configuration and passed to electron-builder 'appId': 'cc.seeed.sensecap.tools.hubng', - 'productName': 'SenseCAP Sensor Hub Configuration Tool NG', - 'copyright': 'Copyright ©2008-2020 Seeed Technology Co.,Ltd.', + 'productName': 'Sensor Hub Configuration Tool NG', + // 'copyright': 'Copyright ©2008-2020 Seeed Technology Co.,Ltd.', 'nsis': { 'installerIcon': 'build/icon.ico', 'installerHeader': 'build/icon.png', @@ -88,7 +88,7 @@ module.exports = { 'icon': 'build/icon.ico', }, 'dmg': { - 'title': 'SenseCAP Sensor Hub Configuration Tool NG', + 'title': 'Sensor Hub Configuration Tool NG', 'icon': 'build/icon.png', 'contents': [ {