You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-27 06:23:53 +01:00
TX ID, UI fixes
This commit is contained in:
@@ -7,6 +7,7 @@ const os = require('os');
|
||||
const win32 = (os.platform() == "win32");
|
||||
const unicode_type = (win32 ? 'int16_t' : 'int32_t');
|
||||
const lib = koffi.load(path.join(__dirname, "librdsparser." + (win32 ? "dll" : "so")));
|
||||
const { fetchTx } = require('./tx_search.js');
|
||||
|
||||
koffi.proto('void callback_pi(void *rds, void *user_data)');
|
||||
koffi.proto('void callback_pty(void *rds, void *user_data)');
|
||||
@@ -206,6 +207,15 @@ var dataToSend = {
|
||||
ims: 0,
|
||||
eq: 0,
|
||||
ant: 0,
|
||||
txInfo: {
|
||||
station: '',
|
||||
pol: '',
|
||||
erp: '',
|
||||
city: '',
|
||||
itu: '',
|
||||
distance: '',
|
||||
azimuth: ''
|
||||
},
|
||||
country_name: '',
|
||||
country_iso: 'UN',
|
||||
users: '',
|
||||
@@ -215,6 +225,7 @@ var legacyRdsPiBuffer = null;
|
||||
const initialData = { ...dataToSend };
|
||||
const resetToDefault = dataToSend => Object.assign(dataToSend, initialData);
|
||||
|
||||
|
||||
function handleData(ws, receivedData) {
|
||||
// Retrieve the last update time for this client
|
||||
let lastUpdateTime = clientUpdateIntervals.get(ws) || 0;
|
||||
@@ -329,6 +340,20 @@ function handleData(ws, receivedData) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get the received TX info
|
||||
const currentTx = fetchTx(dataToSend.freq, dataToSend.pi, dataToSend.ps);
|
||||
if(currentTx.station !== undefined) {
|
||||
dataToSend.txInfo = {
|
||||
station: currentTx.station,
|
||||
pol: currentTx.pol,
|
||||
erp: currentTx.erp,
|
||||
city: currentTx.city,
|
||||
itu: currentTx.itu,
|
||||
distance: currentTx.distance,
|
||||
azimuth: currentTx.azimuth
|
||||
}
|
||||
}
|
||||
|
||||
// Send the updated data to the client
|
||||
const dataToSendJSON = JSON.stringify(dataToSend);
|
||||
if (currentTime - lastUpdateTime >= updateInterval) {
|
||||
|
||||
Reference in New Issue
Block a user