I want to include a CAN hardware interface into NR.
How can I handle the events of the module?
JavaScript Events
The module emits the following events:
open when the serial port is successfully opened
error if an error occurs
data when an incoming CAN bus frame is received
write when an outgoing CAN bus frame is sent to the device (the event is emitted before the frame is actually sent on the bus)
close when the port is closed
um, ok, fine your company uses canbus interfaces. Great.
Perhaps my question was unclear. Let me ask a different way...
Is it not possible to use one of the existing pre-packaged canbus nodes that are already designed and working for Node-RED and dont require you to use a non packaged npm module?
Assuming for 1 second you are loading this lib in a function node, you handle events in a node-red function exactly the same as you would in any nodejs application
example
can.on('some-event', function(data) {
// do something with data e.g. send it out to next node
node.send(topic: 'some-event', {payload: data})
})