Skip to content

Commit

Permalink
Merge pull request #3 from Seeed-Solution/feat-nova2
Browse files Browse the repository at this point in the history
Feat nova2
  • Loading branch information
Wvirgil123 authored Aug 1, 2023
2 parents 37ea63f + 7f16303 commit 462e1bb
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 12 deletions.
Binary file modified build/icon.icns
Binary file not shown.
Binary file modified build/icon.ico
Binary file not shown.
Binary file modified build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Binary file modified src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/sensecap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/sensecap_logo_1024pt.png
Binary file not shown.
Binary file added src/assets/sensecap_logo_1024pt.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 67 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -547,6 +551,7 @@ function parseLine(line) {
serial.write('c')
}
}
startReadMeasuredData = false;
return
}

Expand Down Expand Up @@ -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)
})
Expand Down Expand Up @@ -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 ...')

Expand Down
30 changes: 27 additions & 3 deletions src/views/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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": "断开",
Expand Down Expand Up @@ -166,6 +167,10 @@
@click.stop="writeFn()"
:loading="writeLoading"
:disabled="btnDisabled">{{$t('Write')}}</v-btn>
<v-btn rounded color="secondary" width="150" class="mr-5"
@click.stop="exportMeasuredFileFn()"
:loading="exportMeasuredLoading"
:disabled="btnDisabled">{{$t('Export Data')}}</v-btn>
<v-btn rounded color="secondary" width="150" class="mr-1"
@click.stop="ClearDataFn()"
:loading="clearCacheLoading"
Expand Down Expand Up @@ -246,6 +251,7 @@ export default {
writeLoading: false,
updateFwLoading: false,
clearCacheLoading: false,
exportMeasuredLoading: false,
//
serialOpened: false,
showHiddenCfg: false,
Expand Down Expand Up @@ -447,6 +453,20 @@ export default {
this.writeLoading = false
})
},
exportMeasuredFileFn() {
if( this.exportMeasuredLoading ) {
return
}
ipcRenderer.invoke('read-measured-data', "x").then((result) => {
if (result === 'canceled') {
return;
}
}).catch((error) => {
console.log('save to file error:', error)
}).finally(() => {
})
},
ClearDataFn() {
this.dialog = true
},
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
</v-col>
<v-col class="d-flex justify-center">
<div>
<v-img src="../assets/sensecap.png" width="100px" @click.stop="logoClicked()"></v-img>
<v-img src="../assets/sensecap.png" width="32px" @click.stop="logoClicked()"></v-img>
</div>
</v-col>
<v-col cols="auto" class="d-flex flex-column align-center justify-center caption grey--text">
Expand Down
12 changes: 6 additions & 6 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
filename: 'index.html',
// when using title option,
// template title tag needs to be <title><%= htmlWebpackPlugin.options.title %></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']
Expand All @@ -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']
},
},
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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': [
{
Expand Down

0 comments on commit 462e1bb

Please sign in to comment.