Calls related to interaction with serial ports.
- Source:
Methods
(static) closePort(port) → {Promise.<(null|Error)>}
Parameters:
Name |
Type |
Description |
port |
string
|
Name of port to close. |
- Source:
Returns:
-
Type
-
Promise.<(null|Error)>
(static) findPorts() → {Promise.<(Array.<string>|Error)>}
- Source:
Returns:
Communication (RS232, COM, TTY) ports available on connected system.
-
Type
-
Promise.<(Array.<string>|Error)>
(static) openPort(port, optionsopt) → {Promise.<(null|Error)>}
Parameters:
Name |
Type |
Attributes |
Description |
port |
string
|
|
Name of port to open. |
options |
Object
|
<optional>
|
Boundaries of serial port output.
Properties
Name |
Type |
Attributes |
Default |
Description |
start |
string
|
<optional>
|
0x0002
|
Character denoting start of serial response. Not used if width
|
end |
string
|
<optional>
|
0x000D
|
Character denoting end of serial response. Not used if width is provided. |
width |
number
|
<optional>
|
|
Used for fixed-width response serial communication. |
baudRate |
string
|
<optional>
|
9600
|
|
dataBits |
string
|
<optional>
|
8
|
|
stopBits |
string
|
<optional>
|
1
|
|
parity |
string
|
<optional>
|
'NONE'
|
Valid values [NONE| EVEN | ODD | MARK | SPACE] |
flowControl |
string
|
<optional>
|
'NONE'
|
Valid values [NONE | XONXOFF | XONXOFF_OUT | XONXOFF_IN | RTSCTS | RTSCTS_OUT | RTSCTS_IN] |
|
- Source:
Returns:
-
Type
-
Promise.<(null|Error)>
(static) sendData(port, data, propertiesopt) → {Promise.<(null|Error)>}
Send commands over a serial port.
Any responses from the device will be sent to serial callback functions.
Parameters:
Name |
Type |
Attributes |
Description |
port |
string
|
|
An open port to send data over. |
data |
string
|
|
The data to send to the serial device. |
properties |
Object
|
<optional>
|
DEPRECATED: Properties of data being sent over the serial port.
Properties
Name |
Type |
Attributes |
Default |
Description |
baudRate |
string
|
<optional>
|
9600
|
|
dataBits |
string
|
<optional>
|
8
|
|
stopBits |
string
|
<optional>
|
1
|
|
parity |
string
|
<optional>
|
'NONE'
|
Valid values [NONE| EVEN | ODD | MARK | SPACE] |
flowControl |
string
|
<optional>
|
'NONE'
|
Valid values [NONE | XONXOFF | XONXOFF_OUT | XONXOFF_IN | RTSCTS | RTSCTS_OUT | RTSCTS_IN] |
|
- Source:
- See:
-
Returns:
-
Type
-
Promise.<(null|Error)>
(static) setSerialCallbacks(calls)
List of functions called for any response from open serial ports.
Event data will contain {string} portName
for all types.
For RECEIVE types, {string} output
.
For ERROR types, {string} exception
.
Parameters:
Name |
Type |
Description |
calls |
function
|
Array.<function()>
|
Single or array of Function({string} portName, {string} output) calls. |
- Source: