Description

Serial port interface by D

Package Information

Version0.5.0 (2016-Jun-03)
Repository https://github.com/nykytenko/onyx-serial
LicenseMIT
CopyrightCopyright © 2014-2015
AuthorsOleg Nykytenko
Registered byOleg Nykytenko
Dependencies

onyx-config

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

onyx-serial

onyx-serial: the simple serial port library by D.

Key features:

  • Open/close serial port.
  • Write/read to/from serial port.
  • Setup speed - standard value from 50 to 4,000,000.
  • parity - none, odd, even.
  • Setup read timeout in mS.
  • Check is port open.
  • Work on posix OS (Linux, OSX, FreeBSD).

Examples:

	import onyx.serial;

	/* Create ports */
	auto port1 = OxSerialPort("dev/ttyS1", Speed.B9600, Parity.none, 1000);
	auto port2 = OxSerialPort("dev/ttyS2", Speed.B9600, Parity.none, 1000);


	port1.open;
	port2.open;

	ubyte[] data = [0x22, 0x33, 0xCC];

	port1.write(data);

	ubyte[] buf = port2.read(3);

	assert (buf == data);

	port1.close();
	port2.close();

	string[] s1 =
		["[port]",
		 "name = /dev/ttyr06",
		 "speed = 57600",
		 "parity = none",
		 "time_out = 1500"];

	auto bundle = new immutable Bundle(s1);

	auto port3 = OxSerialPort(bundle);


	auto bundle = new immutable Bundle("./config/port4.conf");

	auto port4 = OxSerialPort(bundle);

Available versions

0.5.0 0.4.0 0.3.6 0.3.5 0.3.4 0.3.3 0.3.2 0.3.1 0.3.0 0.2.1 0.2.0-d.3 0.2.0-d.2 0.2.0-d.1 0.1.3 0.1.2 0.1.1 0.1.0-beta.4 0.1.0-beta.3 0.1.0-beta.2 0.1.0-beta.1 0.0.1-beta.1 0.0.1-alpha.2 0.0.1-alpha.1 ~master ~develop