Hi
I'm trying to create a Node app that will listen to the serial port. The idea is that I scan an RFID tag and I can read the value.
I have the following BrightSign:
Model: XT1144
Boot Version: 7.1.42
BrightSign OS Version: 8.5.33
I have a Nexmosphere XM-350 (with an XR-DR1 and XR-C10 attached) plugged into the serial port. I know this isn't a Nexmosphere forum, just giving as complete a picture as possible). This setup basically reads RFID tags.
I've followed this guide as closely as possible:
https://github.com/brightsign/bs-node-serialport
And here is my code:
const SerialPort = require('@serialport/stream')
const ByteLength = require('@serialport/parser-byte-length');
function main() {
const BrightSignBinding = require('./bs-binding');
SerialPort.Binding = BrightSignBinding;
let path = '/dev/ttyS0';
const options = {
path: path,
port: 0, // Port 0, 3.5mm Serial/RS232, Port 2, USB Serial
baudRate: 115200, // Update to reflect the expected baud rate
dataBits: 8,
stopBits: 1,
parity: "none",
autoOpen: false,
module_root: '/storage/sd' // Source for where serialport will look for the underlying module
}
let port = new SerialPort(path, options);
let parser = port.pipe(new ByteLength({length: 1}));
port.open(function (err) {
if (err) {
return console.log('Error opening port: ', err.message)
}
console.log(`connected to ${path}, isOpen: ${port.isOpen}`);
// Transmitter
port.write('abc', function(err) {
if (err) {
console.log(err);
return console.log('Error on write: ', err.message)
}
console.log('message written')
})
});
// Receiver
parser.on('data', function(data) {
console.log("Parsed data: " + data);
});
// Open errors will be emitted as an error event
port.on('error', function(err) {
console.log(err);
console.log('Error: ', err.message)
})
console.log(`After serialport creation`);
}
window.main = main;
In the log, I can see the following:
[ 31.964] [INFO] [source file:///sd:/index.html:7]: After serialport creation
[ 31.965] No inversion GPIO
[ 31.967] [INFO] [source file:///sd:/index.html:7]: connected to /dev/ttyS0, isOpen: true
[ 31.971] [INFO] [source file:///sd:/index.html:7]: message written
However when I scan an RFID, although an LED changes on the Nexmo kit (which I assume means a signal has been sent) I don't see any message in the BrightSign log.
Has anyone got experience with this sort of thing? I'm not sure how I can even test the serial port.