Skip to main content

Interface ISerialMessageController

Contract for devices that expose ISerialMessagePort(s).

Assembly: Meadow.Contracts.dll
View Source
Declaration
public interface ISerialMessageController

Methods

CreateSerialMessagePort(SerialPortName, byte[], bool, int, int, Parity, StopBits, int)

Initializes a new instance of the ISerialMessagePort class that listens for serial messages defined byte[] message termination suffix.

View Source
Declaration
ISerialMessagePort CreateSerialMessagePort(SerialPortName portName, byte[] suffixDelimiter, bool preserveDelimiter, int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One, int readBufferSize = 512)
Returns

Meadow.Hardware.ISerialMessagePort

Parameters
TypeNameDescription
Meadow.Hardware.SerialPortNameportNameThe 'SerialPortName` of port to use.
System.Byte[]suffixDelimiterA byte[] of the delimiter(s) that
denote the end of the message.
System.BooleanpreserveDelimiterWhether or not to preserve the
delimiter tokens when passing the message to subscribers.
System.Int32baudRateSpeed, in bits per second, of the serial port.
System.Int32dataBitsNumber of data bits expected in the serial
message frame. Default is 8.
Meadow.Hardware.ParityparityParity enum describing what type of
cyclic-redundancy-check (CRC) bit, if any, should be expected in the
serial message frame. Default is `Parity.None`. |

| Meadow.Hardware.StopBits | stopBits | StopBits describing how many bits should be expected at the end of every character in the serial message frame. Default is StopBits.One. | | System.Int32 | readBufferSize | Size, in bytes, of the read buffer. Default is 512. |

CreateSerialMessagePort(SerialPortName, byte[], bool, int, int, int, Parity, StopBits, int)

Initializes a new instance of the ISerialMessagePort class that listens for serial messages defined by a byte[] prefix, and a fixed length.

View Source
Declaration
ISerialMessagePort CreateSerialMessagePort(SerialPortName portName, byte[] prefixDelimiter, bool preserveDelimiter, int messageLength, int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One, int readBufferSize = 512)
Returns

Meadow.Hardware.ISerialMessagePort

Parameters
TypeNameDescription
Meadow.Hardware.SerialPortNameportNameThe 'SerialPortName` of port to use.
System.Byte[]prefixDelimiterA byte[] of the delimiter(s) that
denote the beginning of the message.
System.BooleanpreserveDelimiterWhether or not to preserve the
delimiter tokens when passing the message to subscribers.
System.Int32messageLengthLength of the message, not including the
delimiter, to be parsed out of the incoming data.
System.Int32baudRateSpeed, in bits per second, of the serial port.
System.Int32dataBitsNumber of data bits expected in the serial
message frame. Default is 8.
Meadow.Hardware.ParityparityParity enum describing what type of
cyclic-redundancy-check (CRC) bit, if any, should be expected in the
serial message frame. Default is `Parity.None`. |

| Meadow.Hardware.StopBits | stopBits | StopBits describing how many bits should be expected at the end of every character in the serial message frame. Default is StopBits.One. | | System.Int32 | readBufferSize | Size, in bytes, of the read buffer. Default is 512. |