DSerial

Main class for performing serial port operations

Constructors

this
this(string deviceName, uint baudRate, DataBits dataBits, Parity parity, StopBits stopBits)

Constructor. Creates object with default settings of 9600,8N1. Default is blocking read/write operations

Destructor

~this
~this()
Undocumented in source.

Members

Functions

close
void close()

Closes the serial port

open
void open()

Opens the serial port with current settings. Throws an exception if the port can't be opened

read
ulong read(ubyte data)

convenience function. reads a single byte

read
ulong read(ubyte[] data)

convenience function. Reads up to data.length bytes

read
ulong read(ubyte* data, ulong length)

Reads data into the bytes array. Blocks until at least one char has been read.

setBlockingMode
void setBlockingMode(BlockingMode mode)

set blocking mode for operations

setOptions
void setOptions(uint baudRate, DataBits dataBits, Parity parity, StopBits stopBits)

Set the options of the port. Is applied immediately if the port is already open

setTimeout
void setTimeout(uint millis)

Sets read timeout in millis. On linux only increments of 100ms are available. Timeout maximum is 255000 = 25.5secs

write
long write(ubyte[] bytes)

Write bytes to the serial port returns bytes written, Only supports blocking and nonblocking writes. Timed writes are unsupported.

Meta