A class for representing replies from devices using the binary protocol.
More...
A class for representing replies from devices using the binary protocol.
Create an empty reply object.
int
s need to be set to something by default. This is typically 0. In Zaber's binary protocol, 0 is the "reset" command. To avoid accidental resetting a device or giving the impression a device has reset, the CommandNumber is set by default instead to 54, the more-harmless "get status" command.
Parses a byte array and creates a matching BinaryReply.
ZaberPort automatically calls this constructor to parse a reply received from the port before returning the Reply from Receive(). For this reason, it is rare that a user would need to use this constructor directly, or any BinaryReply constructor for that matter.
- Parameters
-
reply | The byte array to be parsed into a BinaryReply object. |
BinaryReply |
( |
byte |
deviceAddress, |
|
|
byte |
commandNumber, |
|
|
int |
data |
|
) |
| |
|
inline |
Create a new BinaryReply from a set of parameters.
This constructor is mostly useful for testing purposes, or to more easily compare a reply with an expected response.
- Parameters
-
deviceAddress | The number of the device this reply "came from". |
commandNumber | The number of the command that caused the "device" to respond. |
data | The data to be sent along with the command. |
override bool Equals |
( |
object |
obj | ) |
|
|
inlineinherited |
Tests the equality of any object against this reply.
- Parameters
-
obj | The object to be compared. |
- Returns
- True if the object and this reply are equal, false if they are inequal.
override bool Equals |
( |
Reply |
reply | ) |
|
|
inlinevirtual |
Checks to see if this reply is equal to another Reply.
- Parameters
-
reply | The reply to compare this one to. |
- Returns
- True if the replies are equal, false if inequal.
Implements Reply.
Reports whether this BinaryReply is equal to another BinaryReply.
- Parameters
-
reply | The reply to be compared to this one. |
- Returns
- True if the replies are equal, false if inequal.
override int GetHashCode |
( |
| ) |
|
|
inlinevirtual |
Returns a hash code based off the reply's attributes.
The hash code returned by this function depends on all of the attributes of the object, including the mutable ones. This means that when using this class in a HashMap or similar structure, it should be considered immutable, or else it will be lost upon being changed.
- Returns
- The calculated hash code.
Implements Reply.
override string ToString |
( |
| ) |
|
|
inlinevirtual |
Returns a human-readable representation of this reply.
- Returns
- A string representing the reply.
Implements Reply.
The number of the command which caused the device to reply.
Data returned with the reply.
The address of the device from which the reply came.
The documentation for this class was generated from the following file: