Reference Source Test
public class | source

Uart

Extends:

src/drivers/motion/MotionDriverSimulator.js~EventEmitter → Uart

Driver enables uart communication with electronic boards

Constructor Summary

Public Constructor
public

constructor(name: *)

Method Summary

Public Methods
public

send(buffer: *, callback: *, type: *)

Send data to Uart

Private Methods
private

_onPacketReceived(packet: Buffer, type: String)

Method will be called only if protocol is not null and protocol generated packet.

Public Constructors

public constructor(name: *) source

Params:

NameTypeAttributeDescription
name *

{String} - Unique name of driver

config.device *

{String} - Linux dev which will be used for serial communication

config.baudRate *

{Number} - Bits per second

config.protocol *

{String} - Name of protocol that will be used under the hood, check list of available protocols in misc/protocols

Public Methods

public send(buffer: *, callback: *, type: *) source

Send data to Uart

Params:

NameTypeAttributeDescription
buffer *

{Buffer} - Buffer of data which will be sent to uart

callback *

{Function} - Callback function which will be called after data is sent

type *

{Number} - Type of packet, will be ignored if protocol doesn't support

Private Methods

private _onPacketReceived(packet: Buffer, type: String) source

Method will be called only if protocol is not null and protocol generated packet.

Params:

NameTypeAttributeDescription
packet Buffer

Parsed packet

type String

Single character that represents type of packet