mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:47:08 +00:00
Make selection of headers to parse configurable
This commit is contained in:
@@ -17,8 +17,9 @@ function maybeSendError(error, payload = {}) {
|
||||
sendAlert(packet);
|
||||
}
|
||||
|
||||
function parseMessages (buffer) {
|
||||
const formats = [ headers.hydronav, headers.labo, headers.smartsource ];
|
||||
function parseMessages (buffer, formats = [ "hydronav", "labo", "smartsource" ]) {
|
||||
const formatHandlers = formats.map( name => headers[name]);
|
||||
// [ headers.hydronav, headers.labo, headers.smartsource ];
|
||||
|
||||
const navData = {
|
||||
tstamp: new Date(),
|
||||
@@ -32,8 +33,8 @@ function parseMessages (buffer) {
|
||||
payload: []
|
||||
};
|
||||
|
||||
for (const format of formats) {
|
||||
console.log(format.name);
|
||||
for (const format of formatHandlers) {
|
||||
// console.log(format.name);
|
||||
const pos = format.detect(buffer);
|
||||
if (pos !== false) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user