Table of Contents

Class HarpMessage

Namespace
Bonsai.Harp
Assembly
Bonsai.Harp.dll

Represents a single message of the Harp protocol.

public class HarpMessage
Inheritance
HarpMessage
Inherited Members

Constructors

HarpMessage(bool, params byte[])

Initializes a new instance of the HarpMessage class from the full binary representation of the Harp message, and optionally updates the value of the checksum byte.

HarpMessage(params byte[])

Initializes a new instance of the HarpMessage class from the full binary representation of the Harp message.

Properties

Address

Gets the address of the register to which the Harp message refers to.

Checksum

Gets the checksum byte used for error detection in the Harp protocol.

Error

Gets a value indicating whether this message is an error report from the device.

IsTimestamped

Specifies whether the message payload contains time information.

IsValid

Specifies whether the message bytes represent a conformant Harp message, including payload checksum validation.

MessageBytes

Gets the full binary representation of the Harp message.

MessageType

Gets the type of the Harp message.

PayloadType

Gets the type of data available in the message payload.

Port

If the device is a hub of Harp messages, specifies the origin or destination of the Harp message. Otherwise, if the message refers to the device itself, returns the default value 0xFF.

Methods

CopyTo<TArray>(TArray[])

Copies the message payload into an array of non-pointer value types. The size in bytes of the array should be equal to or higher than the total size of the payload.

CopyTo<TArray>(TArray[], out double)

Copies the message payload into an array of non-pointer value types and gets the message timestamp. The size in bytes of the array should be equal to or higher than the total size of the payload.

CopyTo<TArray>(TArray[], int)

Copies the message payload into an array of non-pointer value types, starting at the specified index. The size in bytes of the array should be equal to or higher than the total size of the payload.

CopyTo<TArray>(TArray[], int, out double)

Copies the message payload into an array of non-pointer value types, starting at the specified index, and gets the message timestamp. The size in bytes of the array should be equal to or higher than the total size of the payload.

FromByte(int, MessageType, byte)

Returns a HarpMessage with the specified address, message type, and a single value 8-bit unsigned integer payload.

FromByte(int, MessageType, params byte[])

Returns a HarpMessage with the specified address, message type, and an array payload of 8-bit unsigned integers.

FromByte(int, double, MessageType, byte)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 8-bit unsigned integer payload.

FromByte(int, double, MessageType, params byte[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 8-bit unsigned integers.

FromByte(int, int, MessageType, byte)

Returns a HarpMessage with the specified address, message type, port, and a single value 8-bit unsigned integer payload.

FromByte(int, int, MessageType, params byte[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 8-bit unsigned integers.

FromByte(int, int, double, MessageType, byte)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 8-bit unsigned integer payload.

FromByte(int, int, double, MessageType, params byte[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 8-bit unsigned integers.

FromInt16(int, MessageType, short)

Returns a HarpMessage with the specified address, message type, and a single value 16-bit signed integer payload.

FromInt16(int, MessageType, params short[])

Returns a HarpMessage with the specified address, message type, and an array payload of 16-bit signed integers.

FromInt16(int, double, MessageType, short)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 16-bit signed integer payload.

FromInt16(int, double, MessageType, params short[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 16-bit signed integers.

FromInt16(int, int, MessageType, short)

Returns a HarpMessage with the specified address, message type, port, and a single value 16-bit signed integer payload.

FromInt16(int, int, MessageType, params short[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 16-bit signed integers.

FromInt16(int, int, double, MessageType, short)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 16-bit signed integer payload.

FromInt16(int, int, double, MessageType, params short[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 16-bit signed integers.

FromInt32(int, MessageType, int)

Returns a HarpMessage with the specified address, message type, and a single value 32-bit signed integer payload.

FromInt32(int, MessageType, params int[])

Returns a HarpMessage with the specified address, message type, and an array payload of 32-bit signed integers.

FromInt32(int, double, MessageType, int)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 32-bit signed integer payload.

FromInt32(int, double, MessageType, params int[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 32-bit signed integers.

FromInt32(int, int, MessageType, int)

Returns a HarpMessage with the specified address, message type, port, and a single value 32-bit signed integer payload.

FromInt32(int, int, MessageType, params int[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 32-bit signed integers.

FromInt32(int, int, double, MessageType, int)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 32-bit signed integer payload.

FromInt32(int, int, double, MessageType, params int[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 32-bit signed integers.

FromInt64(int, MessageType, long)

Returns a HarpMessage with the specified address, message type, and a single value 64-bit signed integer payload.

FromInt64(int, MessageType, params long[])

Returns a HarpMessage with the specified address, message type, and an array payload of 64-bit signed integers.

FromInt64(int, double, MessageType, long)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 64-bit signed integer payload.

FromInt64(int, double, MessageType, params long[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 64-bit signed integers.

FromInt64(int, int, MessageType, long)

Returns a HarpMessage with the specified address, message type, port, and a single value 64-bit signed integer payload.

FromInt64(int, int, MessageType, params long[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 64-bit signed integers.

FromInt64(int, int, double, MessageType, long)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 64-bit signed integer payload.

FromInt64(int, int, double, MessageType, params long[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 64-bit signed integers.

FromPayload(int, MessageType, PayloadType, ArraySegment<byte>)

Returns a HarpMessage with the specified address, message type, and payload data stored in the specified array segment.

FromPayload(int, MessageType, PayloadType, params byte[])

Returns a HarpMessage with the specified address, message type, and payload.

FromPayload(int, double, MessageType, PayloadType, ArraySegment<byte>)

Returns a HarpMessage with the specified address, message type, timestamp, and payload data stored in the specified array segment.

FromPayload(int, double, MessageType, PayloadType, params byte[])

Returns a HarpMessage with the specified address, message type, timestamp, and payload.

FromPayload(int, int, MessageType, PayloadType, ArraySegment<byte>)

Returns a HarpMessage with the specified address, message type, port, and payload data stored in the specified array segment.

FromPayload(int, int, MessageType, PayloadType, params byte[])

Returns a HarpMessage with the specified address, message type, port, and payload.

FromPayload(int, int, double, MessageType, PayloadType, ArraySegment<byte>)

Returns a HarpMessage with the specified address, message type, port, timestamp, and payload data stored in the specified array segment.

FromPayload(int, int, double, MessageType, PayloadType, params byte[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and payload.

FromSByte(int, MessageType, sbyte)

Returns a HarpMessage with the specified address, message type, and a single value 8-bit signed integer payload.

FromSByte(int, MessageType, params sbyte[])

Returns a HarpMessage with the specified address, message type, and an array payload of 8-bit signed integers.

FromSByte(int, double, MessageType, sbyte)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 8-bit signed integer payload.

FromSByte(int, double, MessageType, params sbyte[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 8-bit signed integers.

FromSByte(int, int, MessageType, sbyte)

Returns a HarpMessage with the specified address, message type, port, and a single value 8-bit signed integer payload.

FromSByte(int, int, MessageType, params sbyte[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 8-bit signed integers.

FromSByte(int, int, double, MessageType, sbyte)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 8-bit signed integer payload.

FromSByte(int, int, double, MessageType, params sbyte[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 8-bit signed integers.

FromSingle(int, MessageType, params float[])

Returns a HarpMessage with the specified address, message type, and an array payload of single-precision floating point numbers.

FromSingle(int, double, MessageType, params float[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of single-precision floating point numbers.

FromSingle(int, int, MessageType, params float[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of single-precision floating point numbers.

FromSingle(int, int, double, MessageType, params float[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of single-precision floating point numbers.

FromUInt16(int, MessageType, ushort)

Returns a HarpMessage with the specified address, message type, and a single value 16-bit unsigned integer payload.

FromUInt16(int, MessageType, params ushort[])

Returns a HarpMessage with the specified address, message type, and an array payload of 16-bit unsigned integers.

FromUInt16(int, double, MessageType, ushort)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 16-bit unsigned integer payload.

FromUInt16(int, double, MessageType, params ushort[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 16-bit unsigned integers.

FromUInt16(int, int, MessageType, ushort)

Returns a HarpMessage with the specified address, message type, port, and a single value 16-bit unsigned integer payload.

FromUInt16(int, int, MessageType, params ushort[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 16-bit unsigned integers.

FromUInt16(int, int, double, MessageType, ushort)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 16-bit unsigned integer payload.

FromUInt16(int, int, double, MessageType, params ushort[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 16-bit unsigned integers.

FromUInt32(int, MessageType, uint)

Returns a HarpMessage with the specified address, message type, and a single value 32-bit unsigned integer payload.

FromUInt32(int, MessageType, params uint[])

Returns a HarpMessage with the specified address, message type, and an array payload of 32-bit unsigned integers.

FromUInt32(int, double, MessageType, uint)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 32-bit unsigned integer payload.

FromUInt32(int, double, MessageType, params uint[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 32-bit unsigned integers.

FromUInt32(int, int, MessageType, uint)

Returns a HarpMessage with the specified address, message type, port, and a single value 32-bit unsigned integer payload.

FromUInt32(int, int, MessageType, params uint[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 32-bit unsigned integers.

FromUInt32(int, int, double, MessageType, uint)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 32-bit unsigned integer payload.

FromUInt32(int, int, double, MessageType, params uint[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 32-bit unsigned integers.

FromUInt64(int, MessageType, ulong)

Returns a HarpMessage with the specified address, message type, and a single value 64-bit unsigned integer payload.

FromUInt64(int, MessageType, params ulong[])

Returns a HarpMessage with the specified address, message type, and an array payload of 64-bit unsigned integers.

FromUInt64(int, double, MessageType, ulong)

Returns a HarpMessage with the specified address, message type, timestamp, and a single value 64-bit unsigned integer payload.

FromUInt64(int, double, MessageType, params ulong[])

Returns a HarpMessage with the specified address, message type, timestamp, and an array payload of 64-bit unsigned integers.

FromUInt64(int, int, MessageType, ulong)

Returns a HarpMessage with the specified address, message type, port, and a single value 64-bit unsigned integer payload.

FromUInt64(int, int, MessageType, params ulong[])

Returns a HarpMessage with the specified address, message type, port, and an array payload of 64-bit unsigned integers.

FromUInt64(int, int, double, MessageType, ulong)

Returns a HarpMessage with the specified address, message type, port, timestamp, and a single value 64-bit unsigned integer payload.

FromUInt64(int, int, double, MessageType, params ulong[])

Returns a HarpMessage with the specified address, message type, port, timestamp, and an array payload of 64-bit unsigned integers.

GetPayload()

Gets the array segment containing the raw message payload. This method returns a view into the original array without copying any data.

GetPayloadArray<TArray>()

Returns the message payload as an array of non-pointer value types. The size of the type should be a multiple of the total size of the payload.

GetPayloadByte()

Returns the message payload as a single 8-bit unsigned integer.

GetPayloadByte(int)

Returns the element at the specified index of the 8-bit unsigned integer array payload.

GetPayloadInt16()

Returns the message payload as a single 16-bit signed integer.

GetPayloadInt16(int)

Returns the element at the specified index of the 16-bit signed integer array payload.

GetPayloadInt32()

Returns the message payload as a single 32-bit signed integer.

GetPayloadInt32(int)

Returns the element at the specified index of the 32-bit signed integer array payload.

GetPayloadInt64()

Returns the message payload as a single 64-bit signed integer.

GetPayloadInt64(int)

Returns the element at the specified index of the 64-bit signed integer array payload.

GetPayloadSByte()

Returns the message payload as a single 8-bit signed integer.

GetPayloadSByte(int)

Returns the element at the specified index of the 8-bit signed integer array payload.

GetPayloadSingle()

Returns the message payload as a single-precision floating point number.

GetPayloadSingle(int)

Returns the element at the specified index of the single-precision floating point array payload.

GetPayloadUInt16()

Returns the message payload as a single 16-bit unsigned integer.

GetPayloadUInt16(int)

Returns the element at the specified index of the 16-bit unsigned integer array payload.

GetPayloadUInt32()

Returns the message payload as a single 32-bit unsigned integer.

GetPayloadUInt32(int)

Returns the element at the specified index of the 32-bit unsigned integer array payload.

GetPayloadUInt64()

Returns the message payload as a single 64-bit unsigned integer.

GetPayloadUInt64(int)

Returns the element at the specified index of the 64-bit unsigned integer array payload.

GetTimestamp()

Gets the timestamp of the message payload, in seconds.

GetTimestampedPayload()

Gets the array segment containing the raw message payload and the timestamp. This method returns a view into the original array without copying any data.

GetTimestampedPayloadArray<TArray>()

Returns the message payload as an array of non-pointer value types and gets the message timestamp. The size of the type should be a multiple of the total size of the payload.

GetTimestampedPayloadByte()

Returns the message payload as a single 8-bit unsigned integer and gets the message timestamp.

GetTimestampedPayloadByte(int)

Returns the element at the specified index of the 8-bit unsigned integer array payload and gets the message timestamp.

GetTimestampedPayloadInt16()

Returns the message payload as a single 16-bit signed integer and gets the message timestamp.

GetTimestampedPayloadInt16(int)

Returns the element at the specified index of the 16-bit signed integer array payload and gets the message timestamp.

GetTimestampedPayloadInt32()

Returns the message payload as a single 32-bit signed integer and gets the message timestamp.

GetTimestampedPayloadInt32(int)

Returns the element at the specified index of the 32-bit signed integer array payload and gets the message timestamp.

GetTimestampedPayloadInt64()

Returns the message payload as a single 64-bit signed integer and gets the message timestamp.

GetTimestampedPayloadInt64(int)

Returns the element at the specified index of the 64-bit signed integer array payload and gets the message timestamp.

GetTimestampedPayloadSByte()

Returns the message payload as a single 8-bit signed integer and gets the message timestamp.

GetTimestampedPayloadSByte(int)

Returns the element at the specified index of the 8-bit signed integer array payload and gets the message timestamp.

GetTimestampedPayloadSingle()

Returns the message payload as a single-precision floating point number and gets the message timestamp.

GetTimestampedPayloadSingle(int)

Returns the element at the specified index of the single-precision floating point array payload and gets the message timestamp.

GetTimestampedPayloadUInt16()

Returns the message payload as a single 16-bit unsigned integer and gets the message timestamp.

GetTimestampedPayloadUInt16(int)

Returns the element at the specified index of the 16-bit unsigned integer array payload and gets the message timestamp.

GetTimestampedPayloadUInt32()

Returns the message payload as a single 32-bit unsigned integer and gets the message timestamp.

GetTimestampedPayloadUInt32(int)

Returns the element at the specified index of the 32-bit unsigned integer array payload and gets the message timestamp.

GetTimestampedPayloadUInt64()

Returns the message payload as a single 64-bit unsigned integer and gets the message timestamp.

GetTimestampedPayloadUInt64(int)

Returns the element at the specified index of the 64-bit unsigned integer array payload and gets the message timestamp.

IsMatch(int)

Indicates whether the Harp message matches the specified address.

IsMatch(int, MessageType)

Indicates whether the Harp message matches the specified address and message type.

IsMatch(int, MessageType, PayloadType)

Indicates whether the Harp message matches the specified address, message type, and payload type.

IsMatch(int, PayloadType)

Indicates whether the Harp message matches the specified address and payload type.

ToString()

Returns a string that represents the Harp message metadata, payload length and timestamp.

TryGetTimestamp(out double)

Gets the timestamp of the message payload, in seconds. A return value indicates whether the message has a timestamped payload.