GXDN: Gurux Developer Network
ParsePacketFromDataEventHandler Delegate
NamespacesGurux.ClientParsePacketFromDataEventHandler
GXClient component calls this method, if the client application uses its own parsing method, instead of the one of GXCom.
Parameters
sender (GXClient)
The source of the event.
data (Object)
Received data.
packet (GXPacket)
Packet where data is parsed.
packetSize ( Int32 %)
Amount of bytes that the packet takes from the byte flow.
Remarks
This method is called only, if ParseReceivedPacket is set True.
Examples
CopyVBScript
'In this example we presume that data starts with char 01 and ends with 02 and all data is ASCII.
sub GXSClient1_ParsePacketFromData(object Data, object GXPacket, int PacketSize)
dim BOP_Pos, EOP_Pos, Pos
BOP_Pos = 0
EOP_Pos = 0
'Find BOP
for Pos = 0 to PacketSize -1
    if Data(Pos) = 01 then
        BOP_Pos = Pos
    end if
next
'Find EOP
for Pos to PacketSize -1
    if Data(Pos) = 02 then
        EOP_Pos = Pos
    end if
next
'Don't go further if packet is not found
if BOP_Pos = 0 or EOP_Pos = 0
       PacketSize = 0
       exit sub
end if
'Reset packet and append new data as byte array
GXPacket.AppendData, data, GX_VT_BYTE or GX_VT_ARRAY
PacketSize = EOP_Pos
end sub
See Also

Assembly: Gurux.Client (Module: Gurux.Client) Version: 5.0.0.1