From ca8c24c058ca94fd4311558f48d2c31beaa81997 Mon Sep 17 00:00:00 2001
From: qubiaobiao <3294694717@qq.com>
Date: Wed, 18 Mar 2026 16:39:48 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=9B=E5=A4=A7=E5=8D=AB=E6=98=9F=E8=BF=90?=
=?UTF-8?q?=E8=A1=8C=E7=8A=B6=E6=80=81=E7=9B=91=E6=8E=A7=E7=B3=BB=E7=BB=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.js | 2 +-
oneShow.html | 56 ++
oneShowAll.html | 56 ++
oneShowSwitch.html | 56 ++
satellite-data-monitor-platform.html | 43 +
satellite-info-monitor-platform.html | 43 +
satellite-signal-monitor-platform.html | 43 +
satellite-state-monitor-platform.html | 43 +
src/main/KeyWord.js | 4 +-
src/main/api/NMEAHandler.js | 68 +-
src/main/app.ts | 189 +++--
src/main/config.js | 10 +-
src/main/load-serialport.js | 68 +-
src/main/preload.js | 18 +-
src/render/api/util.js | 60 +-
src/render/components/CenterCmp.vue | 111 +--
src/render/components/Clock.vue | 14 +-
src/render/components/Compass.vue | 14 +-
.../components/DigitalFlopContainer.vue | 42 +-
src/render/components/Layout/BorderBox3.vue | 2 +-
.../components/Layout/ShowAllHeader.vue | 24 +
src/render/components/Map.vue | 8 +-
src/render/components/NMEAAnimation.vue | 12 +-
src/render/components/PlanisphereView.vue | 29 +-
src/render/components/Ring.vue | 15 +-
src/render/components/SNRView.vue | 7 +-
src/render/components/ScrollBoardTable.vue | 106 ++-
src/render/components/WaterLevel.vue | 12 +-
src/render/oneShow.ts | 6 +
src/render/oneShowAll.ts | 6 +
src/render/oneShowSwitch.ts | 6 +
src/render/page/DataMonitorPage.vue | 19 +-
src/render/page/InfoMonitorPage.vue | 101 +--
src/render/page/SignalMonitorPage.vue | 138 ++--
src/render/page/StateMonitorPage.vue | 87 +-
src/render/page/oneShow.vue | 759 ++++++++++++++++++
src/render/page/oneShowAll.vue | 403 ++++++++++
src/render/page/oneShowSwitch.vue | 438 ++++++++++
src/render/satellite-data-monitor-platform.ts | 8 +-
src/render/satellite-info-monitor-platform.ts | 8 +-
.../satellite-signal-monitor-platform.ts | 8 +-
.../satellite-state-monitor-platform.ts | 8 +-
vite.config.ts | 3 +
43 files changed, 2609 insertions(+), 544 deletions(-)
create mode 100644 oneShow.html
create mode 100644 oneShowAll.html
create mode 100644 oneShowSwitch.html
create mode 100644 src/render/components/Layout/ShowAllHeader.vue
create mode 100644 src/render/oneShow.ts
create mode 100644 src/render/oneShowAll.ts
create mode 100644 src/render/oneShowSwitch.ts
create mode 100644 src/render/page/oneShow.vue
create mode 100644 src/render/page/oneShowAll.vue
create mode 100644 src/render/page/oneShowSwitch.vue
diff --git a/index.js b/index.js
index b729629..0a77219 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,4 @@
require('ts-node').register({
project:'./tsconfig.electron.json'
});
-require('./src/main/app.ts')
\ No newline at end of file
+require('./src/main/app.ts');
\ No newline at end of file
diff --git a/oneShow.html b/oneShow.html
new file mode 100644
index 0000000..0794eb0
--- /dev/null
+++ b/oneShow.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+ 卫星数据监控平台
+
+
+
+
+
+
diff --git a/oneShowAll.html b/oneShowAll.html
new file mode 100644
index 0000000..d276767
--- /dev/null
+++ b/oneShowAll.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+ 卫星数据监控平台
+
+
+
+
+
+
diff --git a/oneShowSwitch.html b/oneShowSwitch.html
new file mode 100644
index 0000000..c714bb1
--- /dev/null
+++ b/oneShowSwitch.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+ 卫星数据监控平台
+
+
+
+
+
+
diff --git a/satellite-data-monitor-platform.html b/satellite-data-monitor-platform.html
index 2dc44f5..5696065 100644
--- a/satellite-data-monitor-platform.html
+++ b/satellite-data-monitor-platform.html
@@ -4,6 +4,49 @@
+
卫星数据监控平台
diff --git a/satellite-info-monitor-platform.html b/satellite-info-monitor-platform.html
index 79d8ec3..d461005 100644
--- a/satellite-info-monitor-platform.html
+++ b/satellite-info-monitor-platform.html
@@ -4,6 +4,49 @@
+
卫星信息监控平台
diff --git a/satellite-signal-monitor-platform.html b/satellite-signal-monitor-platform.html
index a9c5da2..1d675e1 100644
--- a/satellite-signal-monitor-platform.html
+++ b/satellite-signal-monitor-platform.html
@@ -4,6 +4,49 @@
+
卫星信号监控平台
diff --git a/satellite-state-monitor-platform.html b/satellite-state-monitor-platform.html
index 3908ece..e21f825 100644
--- a/satellite-state-monitor-platform.html
+++ b/satellite-state-monitor-platform.html
@@ -4,6 +4,49 @@
+
卫星状态监控平台
diff --git a/src/main/KeyWord.js b/src/main/KeyWord.js
index 2f9c563..8417da3 100644
--- a/src/main/KeyWord.js
+++ b/src/main/KeyWord.js
@@ -1,3 +1,3 @@
// 加密关键字
-const keyword = 'GNSS'
-export { keyword }
\ No newline at end of file
+const keyword = 'BD';
+export { keyword };
\ No newline at end of file
diff --git a/src/main/api/NMEAHandler.js b/src/main/api/NMEAHandler.js
index a4a59a5..c27d7c2 100644
--- a/src/main/api/NMEAHandler.js
+++ b/src/main/api/NMEAHandler.js
@@ -1,48 +1,50 @@
-import nmea from 'nmea'
+import nmea from 'nmea';
-let events = {}
+let events = {};
const on = (eventName, callback) => {
if (!(eventName in events)) {
- events[eventName] = []
+ events[eventName] = [];
}
- events[eventName].push(callback)
-}
+ events[eventName].push(callback);
+};
const emit = (eventName, ...args) => {
if (!(eventName in events)) {
- return
+ return;
}
- const cbs = events[eventName]
+ const cbs = events[eventName];
cbs.forEach(cb => {
- cb.call(this, ...args)
+ cb.call(this, ...args);
});
-}
+};
const includes = (arr1, arr2) => {
return arr2.every(val => arr1.includes(val));
-}
+};
const handle = (value) => {
- if (value.length <= 0) return
+ if (value.length <= 0) return;
- emit('received', value)
+ emit('received', value);
- const strArr = value.split('\r\n')
+ const strArr = value.split('\r\n');
for (let i = 0; i < strArr.length; i++) {
const element = strArr[i];
- doHandle(element)
+ doHandle(element);
}
-
+
nmeaObj.GSA.forEach(element => {
let nmeaCache = {
GB:{talker_id:'GB',satellites:[]},
GP:{talker_id:'GP',satellites:[]},
GL:{talker_id:'GL',satellites:[]},
GA:{talker_id:'GA',satellites:[]},
- GQ:{talker_id:'GQ',satellites:[]}
+ GQ:{talker_id:'GQ',satellites:[]},
+ GI:{talker_id:'GI',satellites:[]},
+ GN:{talker_id:'GN',satellites:[]}
};
nmeaObj.GSV.forEach(item => {
if(item.talker_id == nmeaCache[item.talker_id].talker_id){
@@ -60,16 +62,16 @@ const handle = (value) => {
nmeaCache = null;
});
- emit('handled', nmeaObj)
- nmeaObj = resetNMEAObj()
-}
+ emit('handled', nmeaObj);
+ nmeaObj = resetNMEAObj();
+};
const doHandle = (value) => {
if (!verify(value)) {
- return
+ return;
}
- const result = nmea.parse(value)
+ const result = nmea.parse(value);
switch (result.sentence) {
case 'RMC':
nmeaObj.RMC = result
@@ -84,22 +86,22 @@ const doHandle = (value) => {
nmeaObj.GSV.push(result)
break;
}
-}
+};
const verify = (value) => {
if (!value) {
- return false
+ return false;
}
- const dollar_index = value.indexOf('$')
- const star_index = value.indexOf('*')
+ const dollar_index = value.indexOf('$');
+ const star_index = value.indexOf('*');
if (value.indexOf('$') !== 0 || star_index <= dollar_index) {
- return false
+ return false;
}
- const [sentence, checksum, ] = value.split('*')
- return nmea.Helpers.verifyChecksum(sentence, checksum)
-}
+ const [sentence, checksum, ] = value.split('*');
+ return nmea.Helpers.verifyChecksum(sentence, checksum);
+};
const resetNMEAObj = () => {
return {
@@ -107,9 +109,9 @@ const resetNMEAObj = () => {
'GGA': null,
'GSA': [],
'GSV': []
- }
-}
+ };
+};
-let nmeaObj = resetNMEAObj()
+let nmeaObj = resetNMEAObj();
-module.exports = { on, handle }
\ No newline at end of file
+module.exports = { on, handle };
\ No newline at end of file
diff --git a/src/main/app.ts b/src/main/app.ts
index c745e9f..fca80d8 100644
--- a/src/main/app.ts
+++ b/src/main/app.ts
@@ -1,80 +1,80 @@
-import { ipcMain, app, screen, globalShortcut, BrowserWindow, dialog, crashReporter } from 'electron'
+import { ipcMain, app, screen, globalShortcut, BrowserWindow, dialog, crashReporter } from 'electron';
import { join } from "path";
-const config = require('./config')
-import './load-serialport'
-import { keyword } from './KeyWord'
+const config = require('./config');
+import './load-serialport';
+import { keyword } from './KeyWord';
-const child_process = require('child_process')
-const crypto = require('crypto')
-const fs = require('fs')
+const child_process = require('child_process');
+const crypto = require('crypto');
+const fs = require('fs');
function queryPass(passPath: string, passValue: string) {
return new Promise(function (resolve, reject) {
try {
child_process.exec(`reg query ${passPath} /v ${passValue}`, (error: Error, stdout: string, stderr: string) => {
if (error) {
- reject(error)
- return
+ reject(error);
+ return;
}
- resolve({stdout, stderr})
+ resolve({stdout, stderr});
});
} catch (error) {
- reject(error)
+ reject(error);
}
})
-}
+};
function queryKey(keyPath: string, keyValue: string) {
return new Promise(function (resolve, reject) {
try {
child_process.exec(`reg query ${keyPath} /v ${keyValue}`, (error: Error, stdout: string, stderr: string) => {
if (error) {
- reject(error)
- return
+ reject(error);
+ return;
}
- resolve({stdout, stderr})
+ resolve({stdout, stderr});
})
} catch (error) {
- reject(error)
+ reject(error);
}
})
-}
+};
function cryptMD5(GUID: string) {
- let md5 = crypto.createHash('md5')
- let ciphertext = md5.update(GUID).digest('hex')
- return ciphertext.slice(0,8)+'-'+ciphertext.slice(8,12)+'-'+ciphertext.slice(12,16)+'-'+ciphertext.slice(16,20)+'-'+ciphertext.slice(20,32)
-}
+ let md5 = crypto.createHash('md5');
+ let ciphertext = md5.update(GUID).digest('hex');
+ return ciphertext.slice(0,8)+'-'+ciphertext.slice(8,12)+'-'+ciphertext.slice(12,16)+'-'+ciphertext.slice(16,20)+'-'+ciphertext.slice(20,32);
+};
-const passPath = 'HKEY_CURRENT_USER\\SOFTWARE\\HwaSmart'
-const passValue = 'BDAuthorization'
-const keyPath = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography'
-const keyValue = 'MachineGuid'
+const passPath = 'HKEY_CURRENT_USER\\SOFTWARE\\HwaSmart';
+const passValue = 'BDAuthorization';
+const keyPath = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography';
+const keyValue = 'MachineGuid';
async function checkLaunchEnv() {
try {
- const passResult: any = await queryPass(passPath, passValue)
- const keyResult: any = await queryKey(keyPath, keyValue)
+ const passResult: any = await queryPass(passPath, passValue);
+ const keyResult: any = await queryKey(keyPath, keyValue);
if(cryptMD5(keyResult.stdout.slice(83,119) + keyword) == passResult.stdout.slice(72,108)){
- return true
+ return true;
}else{
- return false
+ return false;
}
// 成功
// 查询到 有这个app启动项
} catch (error) {
// 没有查询到该app启动项目
- return false
+ return false;
}
-}
+};
// 记录崩溃信息
function recordCrash() {
return new Promise(resolve => {
// 崩溃日志请求成功....
resolve();
- })
-}
+ });
+};
function abnormalLog(txtName: string, txtLog: string) {
fs.writeFile(txtName, txtLog, (ero:any) => {
@@ -83,7 +83,7 @@ function abnormalLog(txtName: string, txtLog: string) {
}
console.log(`创建成功!`);
});
-}
+};
var windows:Array = [];
@@ -98,24 +98,24 @@ function createWindow(page: string, display: any) {
preload: join(__dirname, 'preload.js'),
webgl: true
}
- })
+ });
ipcMain.on("APP_MOUNTED", (event) => {
- const { sender } = event
- if (page == 'satellite-data-monitor-platform') {
- let depth = config.get('depth')
- let secondary = config.get('secondary')
- sender.send('deep', [depth, secondary])
+ const { sender } = event;
+ if (page == 'satellite-data-monitor-platform' || page == 'oneShow' || page == 'oneShowAll' || page == 'oneShowSwitch') {
+ const depth = config.get('depth');
+ const secondary = config.get('secondary');
+ sender.send('deep', [depth, secondary]);
}
- })
+ });
ipcMain.on("webglcontextlost", (event) => {
abnormalLog(`./resources/webglcontextlost${new Date().getTime()}.txt`, `webglcontextlost: ${new Date()}`);
- })
+ });
ipcMain.on("refresh", (event) => {
abnormalLog(`./resources/refresh${new Date().getTime()}.txt`, `refresh: ${new Date()}`);
- })
+ });
// 监听到软件奔溃时执行
win.webContents.on('crashed', () => {
@@ -146,51 +146,76 @@ function createWindow(page: string, display: any) {
console.log('err', e);
abnormalLog(`./resources/crash${new Date().getTime()}.txt`, `crash: ${new Date()}, err: ${e}`);
});
- })
+ });
if (process.env.NODE_ENV === 'development') {
- win.loadURL(`http://localhost:3000/${page}.html`)
- win.webContents.openDevTools()
+ win.loadURL(`http://localhost:3000/${page}.html`);
+ // win.webContents.openDevTools();
} else {
- win.loadFile(`dist/render/${page}.html`)
- // win.webContents.openDevTools()
+ win.loadFile(`dist/render/${page}.html`);
+ // win.webContents.openDevTools();
}
windows.push(win);
return win;
-}
+};
const sleep = (timeout:number) => {
return new Promise((resolve?:any)=>{
setTimeout(()=>{
resolve();
- }, timeout)
- })
-}
+ }, timeout);
+ });
+};
async function launch() {
- const displays = screen.getAllDisplays()
+ const showMode = config.get('showMode');
+ const displays = screen.getAllDisplays();
if (displays.length !== 4) {
- createWindow('satellite-data-monitor-platform', displays[0])
- await sleep(100);
- createWindow('satellite-info-monitor-platform', displays[0])
- await sleep(200);
- createWindow('satellite-signal-monitor-platform', displays[0])
- await sleep(300);
- createWindow('satellite-state-monitor-platform', displays[0])
+ switch (showMode) {
+ case "oneShow":
+ createWindow('oneShow', displays[0]);
+ break;
+ case "oneShowSwitch":
+ createWindow('oneShowSwitch', displays[0]);
+ break;
+ case "oneShowAll":
+ createWindow('oneShowAll', displays[0]);
+ break;
+ case "twoShow":
+ if (displays.length == 2) {
+ createWindow('oneShowSwitch', displays[0]);
+ await sleep(200);
+ createWindow('oneShowAll', displays[1]);
+ } else {
+ createWindow('oneShowSwitch', displays[0]);
+ await sleep(200);
+ createWindow('oneShowAll', displays[0]);
+ }
+ break;
+ case "fourShow":
+ createWindow('satellite-data-monitor-platform', displays[0]);
+ await sleep(200);
+ createWindow('satellite-info-monitor-platform', displays[0]);
+ await sleep(400);
+ createWindow('satellite-signal-monitor-platform', displays[0]);
+ await sleep(600);
+ createWindow('satellite-state-monitor-platform', displays[0]);
+ break;
+ }
} else {
- createWindow('satellite-data-monitor-platform', displays[0])
+ createWindow('satellite-data-monitor-platform', displays[0]);
await sleep(200);
- createWindow('satellite-info-monitor-platform', displays[1])
+ createWindow('satellite-info-monitor-platform', displays[1]);
await sleep(400);
- createWindow('satellite-signal-monitor-platform', displays[2])
+ createWindow('satellite-signal-monitor-platform', displays[2]);
await sleep(600);
- createWindow('satellite-state-monitor-platform', displays[3])
+ createWindow('satellite-state-monitor-platform', displays[3]);
}
// 屏蔽 F11 进入/退出全屏功能
- globalShortcut.register('F11', () => { return })
-}
+ globalShortcut.register('F11', () => { return });
+};
ipcMain.on('CLOSE', (event) => {
const res = dialog.showMessageBox({
@@ -210,48 +235,48 @@ ipcMain.on('CLOSE', (event) => {
});
windows = [];
}else{
- console.log('not close software')
+ console.log('not close software');
}
})
-})
+});
async function main() {
// 异步代码
- const checkReault: any = await checkLaunchEnv()
- console.log('env right:', checkReault)
+ const checkReault: any = await checkLaunchEnv();
+ console.log('env right:', checkReault);
// 异步代码执行完毕后执行的代码
if (checkReault) {
- launch()
+ launch();
// 模拟软件崩溃
// setTimeout(() => {
// process.crash();
// }, 10000);
} else {
- dialog.showErrorBox('系统提示', '软件启动出错,请联系售后技术支持人员')
- process.exit(1)
+ dialog.showErrorBox('系统提示', '软件启动出错,请联系售后技术支持人员');
+ process.exit(1);
}
-}
+};
-crashReporter.start({uploadToServer: false})
+crashReporter.start({uploadToServer: false});
-app.commandLine.appendSwitch('ignore-gpu-blacklist')
+app.commandLine.appendSwitch('ignore-gpu-blacklist');
-app.disableDomainBlockingFor3DAPIs()
+app.disableDomainBlockingFor3DAPIs();
// 禁用GPU加速,此模式下何时刷新canvas不能通过判断webgl上下文丢失实现
// app.disableHardwareAcceleration()
-app.whenReady().then(main)
+app.whenReady().then(main);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
- app.quit()
+ app.quit();
}
-})
+});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
- launch()
+ launch();
}
-})
+});
diff --git a/src/main/config.js b/src/main/config.js
index f2b6642..9191fc1 100644
--- a/src/main/config.js
+++ b/src/main/config.js
@@ -1,8 +1,8 @@
-const Store = require('electron-store')
+const Store = require('electron-store');
-const store = new Store()
-const set = (key, val) => store.set(key, val)
+const store = new Store();
+const set = (key, val) => store.set(key, val);
-const get = (key) => store.get(key)
+const get = (key) => store.get(key);
-module.exports = { set, get }
+module.exports = { set, get };
diff --git a/src/main/load-serialport.js b/src/main/load-serialport.js
index 4d246da..07cac66 100644
--- a/src/main/load-serialport.js
+++ b/src/main/load-serialport.js
@@ -1,72 +1,72 @@
-const { ipcMain } = require('electron')
-const { SerialPort } = require("serialport")
-const { InterByteTimeoutParser } = require('@serialport/parser-inter-byte-timeout')
-const config = require('./config')
+const { ipcMain } = require('electron');
+const { SerialPort } = require("serialport");
+const { InterByteTimeoutParser } = require('@serialport/parser-inter-byte-timeout');
+const config = require('./config');
-const NMEAHandler = require('./api/NMEAHandler')
+const NMEAHandler = require('./api/NMEAHandler');
-const DEFAULT_BAUDRATE = 115200
+const DEFAULT_BAUDRATE = 115200;
const getSerialPortConstructorArguments = (ports) => {
- let serialport = config.get('serialport')
- const path = ( serialport && serialport.path ) ? serialport.path : ports[0].path
- const baudRate = ( serialport && serialport.baudRate ) ? serialport.baudRate : DEFAULT_BAUDRATE
- return { path, baudRate }
-}
+ let serialport = config.get('serialport');
+ const path = ( serialport && serialport.path ) ? serialport.path : ports[0].path;
+ const baudRate = ( serialport && serialport.baudRate ) ? serialport.baudRate : DEFAULT_BAUDRATE;
+ return { path, baudRate };
+};
-const senders = []
+const senders = [];
ipcMain.on("APP_MOUNTED", (event) => {
- const { sender } = event
- senders.push(sender)
+ const { sender } = event;
+ senders.push(sender);
sender.once('destroyed', () => {
- const index = senders.indexOf(sender)
- if (index >= 0) senders.splice(index, 1)
+ const index = senders.indexOf(sender);
+ if (index >= 0) senders.splice(index, 1);
})
})
const sendMsg = (channel, msg) => {
- if (senders.length <= 0) return
+ if (senders.length <= 0) return;
try {
senders.forEach((sender) => {
- sender.send(channel, msg)
+ sender.send(channel, msg);
})
} catch (error) {
- console.error(error)
+ console.error(error);
}
}
SerialPort.list().then((ports, err) => {
if (err) {
- console.log(err)
- return
+ console.log(err);
+ return;
}
// 过滤掉COM1口,很多电脑自带COM1接口
- ports = ports.filter((port) => port.path != 'COM1')
+ ports = ports.filter((port) => port.path != 'COM1');
if (ports.length == 0) {
- console.error('设备未连接')
- return
+ console.error('设备未连接');
+ return;
}
try {
- const { path, baudRate } = getSerialPortConstructorArguments(ports)
- console.log(path, baudRate, '=====================')
- const serialPort = new SerialPort({ path, baudRate })
+ const { path, baudRate } = getSerialPortConstructorArguments(ports);
+ console.log(path, baudRate, '=====================');
+ const serialPort = new SerialPort({ path, baudRate });
- const parser = serialPort.pipe(new InterByteTimeoutParser({interval: 30}))
+ const parser = serialPort.pipe(new InterByteTimeoutParser({interval: 30}));
NMEAHandler.on('received' , (nmeaStr) => {
- sendMsg('NMEA_RECEIVED', nmeaStr)
- })
+ sendMsg('NMEA_RECEIVED', nmeaStr);
+ });
NMEAHandler.on('handled' , (nmeaObj) => {
- sendMsg('nmea', JSON.stringify(nmeaObj))
- })
+ sendMsg('nmea', JSON.stringify(nmeaObj));
+ });
- parser.on('data', (data) => NMEAHandler.handle(data.toString()))
+ parser.on('data', (data) => NMEAHandler.handle(data.toString()));
} catch (error) {
console.error(error);
}
-})
+});
diff --git a/src/main/preload.js b/src/main/preload.js
index 2134ac6..80b790a 100644
--- a/src/main/preload.js
+++ b/src/main/preload.js
@@ -1,21 +1,21 @@
-const {ipcRenderer, contextBridge} = require('electron')
+const {ipcRenderer, contextBridge} = require('electron');
contextBridge.exposeInMainWorld('ipcRenderer', {
send: (channel, data) => {
// whitelist channels
- let validChannels = ['toMain']
+ let validChannels = ['toMain'];
if (validChannels.includes(channel)) {
- ipcRenderer.send(channel, data)
+ ipcRenderer.send(channel, data);
}
- ipcRenderer.send(channel, data)
+ ipcRenderer.send(channel, data);
},
receive: (channel, func) => {
- console.log(func())
- let validChannels = ['fromMain']
+ console.log(func());
+ let validChannels = ['fromMain'];
if (validChannels.includes(channel)) {
// Deliberately strip event as it includes `sender`
- ipcRenderer.on(channel, (event, ...args) => func(...args))
+ ipcRenderer.on(channel, (event, ...args) => func(...args));
}
- ipcRenderer.on(channel, (event, ...args) => func(...args))
+ ipcRenderer.on(channel, (event, ...args) => func(...args));
}
-})
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/src/render/api/util.js b/src/render/api/util.js
index 7b44839..fa635f8 100644
--- a/src/render/api/util.js
+++ b/src/render/api/util.js
@@ -1,65 +1,65 @@
export function filterNonNumber (array) {
- return array.filter(n => typeof n === 'number')
-}
+ return array.filter(n => typeof n === 'number');
+};
export function mulAdd (nums) {
- nums = filterNonNumber(nums)
+ nums = filterNonNumber(nums);
- return nums.reduce((all, num) => all + num, 0)
-}
+ return nums.reduce((all, num) => all + num, 0);
+};
export function getTwoPointDistance (pointOne, pointTwo) {
- const minusX = Math.abs(pointOne[0] - pointTwo[0])
+ const minusX = Math.abs(pointOne[0] - pointTwo[0]);
- const minusY = Math.abs(pointOne[1] - pointTwo[1])
+ const minusY = Math.abs(pointOne[1] - pointTwo[1]);
- return Math.sqrt(minusX * minusX + minusY * minusY)
-}
+ return Math.sqrt(minusX * minusX + minusY * minusY);
+};
export function getPolylineLength(points) {
const lineSegments = new Array(points.length - 1)
.fill(0)
- .map((foo, i) => [points[i], points[i + 1]])
+ .map((foo, i) => [points[i], points[i + 1]]);
- const lengths = lineSegments.map(item => getTwoPointDistance(...item))
+ const lengths = lineSegments.map(item => getTwoPointDistance(...item));
- return mulAdd(lengths)
-}
+ return mulAdd(lengths);
+};
export function get_in_positioning_id(GSAArr) {
- let in_positioning_id = []
+ let in_positioning_id = [];
GSAArr.forEach(({ satellites }) => {
- in_positioning_id.push(...satellites)
+ in_positioning_id.push(...satellites);
});
- return in_positioning_id
-}
+ return in_positioning_id;
+};
export function getNMEAObj(nmeaStr) {
- if (!nmeaStr) return
+ if (!nmeaStr) return;
- return JSON.parse(nmeaStr)
-}
+ return JSON.parse(nmeaStr);
+};
export function getGSV (nmeaStr) {
- const nmeaObj = getNMEAObj(nmeaStr)
- // console.log(nmeaObj, '================')
- if (!nmeaObj || !nmeaObj.GSV) return null
+ const nmeaObj = getNMEAObj(nmeaStr);
+ // console.log(nmeaObj, '================');
+ if (!nmeaObj || !nmeaObj.GSV) return null;
- const { GSV } = nmeaObj
+ const { GSV } = nmeaObj;
const bd = {
// GSVArr: GSV.filter((gsv) => gsv.talker_id === 'BD')
GSVArr: GSV.filter((gsv) => gsv.talker_id === 'GB')
- }
+ };
const gp = {
GSVArr: GSV.filter((gsv) => gsv.talker_id === 'GP')
- }
+ };
const gl = {
GSVArr: GSV.filter((gsv) => gsv.talker_id === 'GL')
- }
+ };
const ga = {
GSVArr: GSV.filter((gsv) => gsv.talker_id === 'GA')
- }
+ };
- return { bd, gp, gl, ga }
-}
+ return { bd, gp, gl, ga };
+};
diff --git a/src/render/components/CenterCmp.vue b/src/render/components/CenterCmp.vue
index 75eef78..ebb6ae9 100644
--- a/src/render/components/CenterCmp.vue
+++ b/src/render/components/CenterCmp.vue
@@ -1,14 +1,15 @@
-