PkUnknown Class |
Namespace: RRAutoLib.Loconet
<SerializableAttribute> Public Class PkUnknown Inherits Packet
The PkUnknown type exposes the following members.
Name | Description | |
---|---|---|
![]() | PkUnknown | Permits instantiation of user derived classes. |
![]() | PkUnknown(SerializationInfo, StreamingContext) | Used to inherit custom serialization from Packet because constructors are not inherited. |
Name | Description | |
---|---|---|
![]() | Bytes | Gets the bytes that makes up a Loconet packet message. (Inherited from Packet.) |
![]() | Description | User friendly description of the packet. (Overrides PacketDescription.) |
![]() | ID | Gets the unique identifier of the packet. (Inherited from Packet.) |
![]() | IsEchoe | Gets value indicating if the packet is an echoe. (Inherited from Packet.) |
![]() | NeedsPacketResponse | Gets value indicating if this packet expects a response packet. (Inherited from Packet.) |
![]() | OpCode | Gets the Loconet operation code associated with the packet. (Overrides PacketOpCode.) |
![]() | ParmsDesc | User friendly description of the most significant packet parameters. (Overrides PacketParmsDesc.) |
![]() | PostTxWait | Gets or sets the time in milliseconds to wait after sending this packet before performing the next step. (Inherited from Packet.) |
![]() | RxPacket | Gets the received response packet post transmit. (Inherited from Packet.) |
![]() | Tag | Gets or sets an arbitrary object that is associated with the packet. (Inherited from Packet.) |
![]() | TimeStamp | Gets an event time stamp of the packet's echo or arrival. (Inherited from Packet.) |
Name | Description | |
---|---|---|
![]() | BytesToString | Converts the Bytes into a readable string. (Inherited from Packet.) |
![]() ![]() | Clone | Creates a copy of the packet. (Inherited from Packet.) |
![]() | GetObjectData | (Inherited from Packet.) |
![]() | ValidPacketResponse | Gets value indicating if given packet is a valid response for this packet. (Inherited from Packet.) |
Name | Description | |
---|---|---|
![]() | _blnIsEchoe | Exposed through IsEchoe property. (Inherited from Packet.) |
![]() | _bytaBytes | Exposed through Bytes property. (Inherited from Packet.) |
![]() | _dblTimeStamp | Exposed through TimeStamp property. (Inherited from Packet.) |
![]() | _objRxPacket | Exposed through RxPacket property. (Inherited from Packet.) |
![]() | _objTag | Exposed through Tag property. (Inherited from Packet.) |
![]() | _sctID | Exposed through ID property. (Inherited from Packet.) |
![]() | _srtPostTxWait | Exposed through PostTxWait property. (Inherited from Packet.) |
Imports RRAutoLib.Loconet Public Class PkCustom Inherits PkUnknown Public Sub New() 'initialize an n byte packet; 'in this example it is a 4 byte OPS_LOCO_ADR _bytaBytes = New Byte(3) {&HBF, 0, 0, 0} End Sub Public Sub New(address As UShort) 'simplify class construction Me.New() Me.Address = address End Sub Public Property Address() As UShort Get 'decode parameter from packet bytes Dim bits = BitWise.CopyBits(_bytaBytes(3), 0, 7, 0, 0) 'least significant 7 bits Return BitWise.CopyBits(_bytaBytes(2), 0, 7, bits, 7) 'most significant 7 bits End Get Set(value As UShort) 'encode parameter to packet bytes BitWise.CopyBits(value, 0, 7, _bytaBytes(3), 0) 'least significant 7 bits BitWise.CopyBits(value, 7, 7, _bytaBytes(2), 0) 'most significant 7 bits End Set End Property Public Overrides ReadOnly Property NeedsPacketResponse() As Boolean Get 'indicates that this packet expects a response Return True End Get End Property Public Overrides Function ValidPacketResponse(responsePacket As RRAutoLib.Loconet.Packet) As Boolean 'indicates that this packet expects either a slot read or a long aknoledge as a response packet Return responsePacket.OpCode = OpCodes.SL_RD_DATA OrElse _ responsePacket.OpCode = OpCodes.LONG_ACK End Function Public Overrides ReadOnly Property Description() As String Get 'brief description of packet Return "My custom packet" End Get End Property Public Overrides ReadOnly Property ParmsDesc() As String Get 'description of decoded packet parameters Return $"Adr={Me.Address}" End Get End Property End Class