dserial 0.0.3

A (linux) serial port implementation that supports blocking IO


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

dserial

A serial port library (for Linux) that supports non blocking IO

Example usage

Default (blocking usage)

import dserial;

DSerial serialPort = new DSerial("/dev/ttyUSB0",115200);
serialPort.open();
// writing
ubyte[] msgBuf = messageToBytes(msg);
return serialPort.write(msgBuf);

Non blocking usage

import dserial;

// Non blocking usage
DSerial serialPort = new DSerial("/dev/ttyS0");
serialPort.setBlockingMode(DSerial.BlockingMode.TimedImmediately);
serialPort.setTimeout(200); // 200 millis
serialPort.open();
ubyte c;
// reading (will return after 200ms if nothing available)
// read returns number of chars read and modifies c
while (serialPort.read(c) == 1) {
  // do work with c
}
Authors:
  • Jaap Geurts
Dependencies:
none
Versions:
0.0.3 2023-Sep-17
0.0.2 2023-Sep-17
0.0.1 2022-Sep-27
~master 2023-Sep-18
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 18 downloads total

Score:
0.5
Short URL:
dserial.dub.pm