1.0.2 • Published 5 months ago
bajo-serialport v1.0.2
bajo-serialport
Plugin name: bajoSerialport, alias: sp
Attention: I do NOT accept any pull request at the moment, thanks!
Serialport binding for Bajo. If Bajo Emitter is loaded, events & messages are also handled through Bajo Emitter processing system.
Installation
Goto your <bajo-base-dir>
and type:
$ npm install bajo-serialport
Now open your <bajo-data-dir>/config/.plugins
and put bajo-serialport
in it
. Order doesn't matter here, but you should put it below bajo-emitter
:
...
bajo-emitter
bajo-serialport
...
Configuration
Open/create <bajo-data-dir>/config/bajoSerialport.json
:
Key | Type | Required | Default | Description |
---|---|---|---|---|
connections | array | no | [] | Define one or more connections |
name | string | no | default | Connection name, must be unique among all your connections |
path | string | yes | Path name, e.g: /dev/tty-usbserial1 | |
baudRate | integer | no | 38400 | Baudrate |
parser | string/object | no | ReadlineParser | Serialport parser |
broadcast | boolean | no | false | Incoming messages are broadcastable by bajoEmitter |
Example:
{
"connections": [{
"name": "usb1",
"path": "/dev/tty-usbserial1",
"baudRate": 9600,
"broadcast": true
}]
}
Hook
bajoSerialport:onParserData (conn, message)
bajoSerialport:onPortClose (conn)
bajoSerialport:onPortError (conn, error)
bajoSerialport:onPortOpen (conn)