Property | Type | Description | |
---|---|---|---|
buffer | byte[] | ||
propsSet | SetProperties |
Method | Description | |
---|---|---|
Check ( ) : bool |
Validate packet completely including checksum. Checks common and packet type specific characteristics.
|
|
Equals ( |
||
Equals ( object obj ) : bool | ||
Finish ( ) : void |
Finish the packet. (Checksum and inline length byte.) Also checks if all properties have been set.
|
|
FromBytes ( byte buffer ) : void |
Parses packet by taking packet bytes, does not use a copy! Assumes complete packet, does not validate. May want to call Check () afterwards. (Packet size is being calculated based on packet length byte.)
|
|
GetHashCode ( ) : int | ||
NewFromBytes ( byte bytes ) : |
Returns a specific Ssm2Packet type based on given content. Does not validate the packet, so manually call the Check method afterwards!
|
|
Ssm2Packet ( ) : System |
Creates a SSM2 packet. Afterwards you have to set all properties and call Finish() to complete the packet. (This constructor allocates maximum possible packet size of 260 bytes.)
|
|
Ssm2Packet ( byte buffer ) : System |
Takes given (empty) storage buffer and sets first byte. Afterwards you have to set all properties and call Construct() to finish the packet. This constructor is not meant for parsing an existing packet, use static method NewFromBytes instead or instance method FromBytes instead!
|
|
Ssm2Packet ( int capacity ) : System |
Creates a new packet with specified capacity. Afterwards you have to set all properties and call Construct() to finish the packet.
|
|
ToBytesCopy ( ) : byte[] |
Returns a copy of the actual packet bytes. May return empty array or less bytes if packet is incomplete. Guaranteed to not return null. Use method Check () before to assure validity.
|
Method | Description | |
---|---|---|
AssertAddress ( int address ) : void |
Throw ArgumentOutOfRangeException if outside valid range: 0 ≤ address ≤ 0xFFFFFF. (SSM2 addresses consist of 3 bytes allowing 16 MiB address space.)
|
|
GetAddress ( int index ) : int | ||
SetAddress ( int address, int index ) : void | ||
SetConstBytes ( ) : void |
Sets the const bytes except first packet byte. (Must be overriden by derived classes to set command and possible padding bytes.)
|
|
Ssm2Packet ( byte buffer, int capacityMin ) : System |
Assures minimum capacity of given buffer. Useful when specific minimum or fixed packet size is known. Also sets packet size to given capacity.
|
|
TakeBuffer ( byte buffer, int minLength ) : void |
Takes the buffer and checks for minimum length.
|
|
UpdateFlags ( SetProperties toSet ) : void |
Set flag to indicate that this part of the packet has been set. Also unsets checksum flag as it needs recalculation in method Finish().
|
Method | Description | |
---|---|---|
SetFirstByte ( ) : void |
protected static AssertAddress ( int address ) : void | ||
address | int |
/// A |
return | void |
public FromBytes ( byte buffer ) : void | ||
buffer | byte |
/// A |
return | void |
public static NewFromBytes ( byte bytes ) : |
||
bytes | byte |
/// A |
return |
protected SetAddress ( int address, int index ) : void | ||
address | int | |
index | int | |
return | void |
public Ssm2Packet ( byte buffer ) : System | ||
buffer | byte |
/// A |
return | System |
protected Ssm2Packet ( byte buffer, int capacityMin ) : System | ||
buffer | byte | |
capacityMin | int | |
return | System |
public Ssm2Packet ( int capacity ) : System | ||
capacity | int | /// Maximum packet size. /// |
return | System |
protected TakeBuffer ( byte buffer, int minLength ) : void | ||
buffer | byte | /// Buffer. /// |
minLength | int | /// Minimum buffer length. /// |
return | void |
protected UpdateFlags ( SetProperties toSet ) : void | ||
toSet | SetProperties | /// The flag to set. /// |
return | void |