Skip to main content

Class SerialMessageProcessor

A serial message processor class to accept data, parse and raise notifications when complete messages are received

Assembly: Meadow.Contracts.dll
View Source
public class SerialMessageProcessor

Derived:
Meadow.Hardware.SerialMessagePort

Properties

ReceiveBufferSize

The buffer size, in bytes

View Source
public virtual int ReceiveBufferSize { get; protected set; }

NullDataValue

Optional null data value Value will be removed from data before being added to the buffer

View Source
public byte? NullDataValue { get; set; }

Fields

messageMode

The current message mode used by the SerialMessageProcessor.

View Source
protected SerialMessageProcessor.SerialMessageMode messageMode

messageDelimiterTokens

The tokens used as delimiters to identify the end of a message.

View Source
protected byte[] messageDelimiterTokens

messageLength

The expected length of each message.

View Source
protected int messageLength

preserveDelimiter

Indicates whether the delimiter should be preserved in the received message.

View Source
protected bool preserveDelimiter

readBuffer

The read buffer used by the SerialMessageProcessor to store received data.

View Source
protected CircularBuffer<byte> readBuffer

msgParseLock

The lock object used for thread synchronization during message parsing.

View Source
protected object msgParseLock

Methods

Process(byte[])

View Source
public void Process(byte[] data)
Parameters
TypeNameDescription
System.Byte[]datareturns true if end of stream (suffix delimiter found at end, or prefix found without new prefix)

RaiseMessageReceivedAndNotify(SerialMessageData)

Raise message received notification to subscribers

View Source
protected void RaiseMessageReceivedAndNotify(SerialMessageData messageData)
Parameters
TypeName
Meadow.Hardware.SerialMessageDatamessageData

Events

MessageReceived

Raised when a message, as defined in the constructor, arrives.

View Source
public event EventHandler<SerialMessageData> MessageReceived
Event Type

System.EventHandler<Meadow.Hardware.SerialMessageData>