Skip to content

Protocols & transports

All protocols within the application (see Protocol Layer) must implement IoProtocol trait. This page lists the protocols currently available.

Methods of a ProtocolDescription
get_ioReturns the IoData associated with the protocol.doc
get_protocol_nameReturns the procol name (RemoteIo, RaspiIo, etc.)doc
openOpens the communication using the underlying protocol.doc
closeGracefully shuts down the communication.doc
is_connectedChecks if the communication is opened using the underlying protocol.doc
set_pin_modeSets the mode of the specified pin.doc
digital_writeWrites level to the digital pin.doc
analog_writeWrites level to the analog pin.doc
report_analogSets the analog reporting state of the specified analog pin.doc
report_digitalSets the digital reporting state of the specified digital pin.doc
sampling_intervalSet the sampling interval (in ms).doc
servo_configConfigures the servo pwm range.doc
i2c_configSets a delay in microseconds between I2C devices write/read operations.doc
i2c_readReads size bytes from I2C device at the specified address.doc
i2c_writeWrites data to the I2C device at the specified address.doc

RemoteIo

RemoteIo is the default protocol for a board created with no special configuration.

rust
let board = Board::run();
let board = Board::default ().open();

Its purpose is to control a board remotely connected to the backend that run the software. The remote connection is established via the transport layer which RemoteIo must use. All transports within the application (see Transport Layer) must implement IoTransport trait.

Serial

RemoteIo+Serial

The Serial transport layer lets you control a remote board connected via a serial cable to your backend. That is the simplest solution you could image: an Arduino board for instance, cable-connected to your computer.

rust
let board = Board::from(Serial::default ()); // RemoteIo + serial with default port.
let board = Board::new(RemoteIo::new("COM3")); // custom port
let board = Board::new(RemoteIo::from(Serial::new("COM3"))); // custom transport

Ethernet (coming soon)

(coming soon)

RaspiIo (coming soon)

RaspiIo

(coming soon)
The purpose of RaspiIo is to control the input output pins of a RaspberryPi collocated to where your software would run. Meaning in that case: everything from your Backend Layer to your Hardware Layer is squashed into a single RaspberryPi

rust
let board = Board::new(RaspiIo::default ());

Released under the MIT License.