EilDLL enhancements

This commit is contained in:
Jonny007-MKD 2014-06-12 07:23:50 +00:00
parent 13c03dd807
commit 23e0b8af56
8 changed files with 389 additions and 141 deletions

View file

@ -1,17 +1,17 @@
;CANoe Version |4|7|1|38817 ModbusNet
;CANoe Version |4|7|1|55217 ModbusNet
Version: 8.2.40 Build 40
32 PRO
10
APPDIR Vector.CANoe.Debugger.DLL
Vector.CANoe.Debugger, Version=8.2.40.0, Culture=neutral, PublicKeyToken=null
Vector.CANoe.Debugger.DebuggerComponent
1
1.0.0
APPDIR Vector.CANoe.SignalGenerators.DLL
Vector.CANoe.SignalGenerators, Version=8.2.40.0, Culture=neutral, PublicKeyToken=null
Vector.CANoe.SignalGenerators.ComponentWrapper
2
1
1.0.1
APPDIR Vector.CANoe.Debugger.DLL
Vector.CANoe.Debugger, Version=8.2.40.0, Culture=neutral, PublicKeyToken=null
Vector.CANoe.Debugger.DebuggerComponent
2
1.0.0
VGlobalConfiguration 1 Begin_Of_Object
17
VGlobalParameters 2 Begin_Of_Object
@ -67,6 +67,7 @@ DialogBegin
1
285 569 816 1103
SymbolExplorerDialogBegin
1
HistoryBegin
1 0
@ -741,9 +742,9 @@ Begin_Of_Multi_Line_String
Copyright (c) 2001-2006 Actipro Software LLC. All rights reserved.
http://www.ActiproSoftware.com/Products/DotNet/
--><ToolWindowLayout Version="1.0"><LayoutData><HostContainerControl><ToolWindowContainer Dock="Right" Size="645, 393" SelectedToolWindowGuid="859d3aae-7aff-47f2-8ca4-bb7d01f32282"><ToolWindow Key="{224229E5-10CA-425F-8B6F-C213CD04C44F}" Guid="859d3aae-7aff-47f2-8ca4-bb7d01f32282" DockedSize="641, 358" FloatingLocation="347, 323" FloatingSize="890, 483" HasOptions="False" ImageIndex="-1" Text="Simulationsaufbau" TitleBarText="Simulationsaufbau"><AutoHideStateInfo RootDock="Right" /><DockedInsideHostStateInfo RootDock="Right" IsAttached="False"><DockedBy Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" RootDock="Bottom" DockOperationType="TopOuter" IsTopMost="True" /><DockedBy Guid="7f29b491-3ada-4572-b140-b422651d6fed" RootDock="Top" DockOperationType="BottomOuter" IsTopMost="True" /></DockedInsideHostStateInfo><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer><ToolWindowContainer Dock="Left" Size="386, 393" SelectedToolWindowGuid="87323901-fe96-4011-a82f-
--><ToolWindowLayout Version="1.0"><LayoutData><HostContainerControl><ToolWindowContainer Dock="Right" Size="652, 393" SelectedToolWindowGuid="859d3aae-7aff-47f2-8ca4-bb7d01f32282"><ToolWindow Key="{224229E5-10CA-425F-8B6F-C213CD04C44F}" Guid="859d3aae-7aff-47f2-8ca4-bb7d01f32282" DockedSize="648, 358" FloatingLocation="347, 323" FloatingSize="890, 483" HasOptions="False" ImageIndex="-1" Text="Simulationsaufbau" TitleBarText="Simulationsaufbau"><AutoHideStateInfo RootDock="Right" /><DockedInsideHostStateInfo RootDock="Right" IsAttached="False"><DockedBy Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" RootDock="Bottom" DockOperationType="TopOuter" IsTopMost="True" /><DockedBy Guid="7f29b491-3ada-4572-b140-b422651d6fed" RootDock="Top" DockOperationType="BottomOuter" IsTopMost="True" /></DockedInsideHostStateInfo><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer><ToolWindowContainer Dock="Left" Size="510, 393" SelectedToolWindowGuid="87323901-fe96-4011-a82f-
kPersistNoLineBreak
0e1b8627507a"><ToolWindow Key="{E6849C53-63F6-4A32-9B1C-7018D50DDE09}" Guid="87323901-fe96-4011-a82f-0e1b8627507a" DockedSize="382, 161" FloatingLocation="6, 66" FloatingSize="677, 213" HasOptions="False" ImageIndex="-1" Text="Daten" TitleBarText="Daten"><AutoHideStateInfo RootDock="Left" /><DockedInsideHostStateInfo RootDock="Left" IsAttached="False"><DockedBy Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" RootDock="Bottom" DockOperationType="TopOuter" IsTopMost="True" /><DockedBy Guid="7f29b491-3ada-4572-b140-b422651d6fed" RootDock="Top" DockOperationType="BottomOuter" IsTopMost="True" /></DockedInsideHostStateInfo><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer><ToolWindowContainer Dock="Bottom" Size="1192, 285" SelectedToolWindowGuid="ac9be154-bd12-4ff9-b255-03e05277dbe2"><ToolWindow Key="{28077F35-C142-4ACC-B040-1BF0AB026C11}" Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" DockedSize="201, 281" FloatingLocation="111, 442" FloatingSize="1192, 514" Has
0e1b8627507a"><ToolWindow Key="{E6849C53-63F6-4A32-9B1C-7018D50DDE09}" Guid="87323901-fe96-4011-a82f-0e1b8627507a" DockedSize="506, 161" FloatingLocation="6, 66" FloatingSize="677, 213" HasOptions="False" ImageIndex="-1" Text="Daten" TitleBarText="Daten"><AutoHideStateInfo RootDock="Left" /><DockedInsideHostStateInfo RootDock="Left" IsAttached="False"><DockedBy Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" RootDock="Bottom" DockOperationType="TopOuter" IsTopMost="True" /><DockedBy Guid="7f29b491-3ada-4572-b140-b422651d6fed" RootDock="Top" DockOperationType="BottomOuter" IsTopMost="True" /></DockedInsideHostStateInfo><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer><ToolWindowContainer Dock="Bottom" Size="1192, 285" SelectedToolWindowGuid="ac9be154-bd12-4ff9-b255-03e05277dbe2"><ToolWindow Key="{28077F35-C142-4ACC-B040-1BF0AB026C11}" Guid="ac9be154-bd12-4ff9-b255-03e05277dbe2" DockedSize="201, 281" FloatingLocation="111, 442" FloatingSize="1192, 514" Has
kPersistNoLineBreak
Options="False" ImageIndex="-1" Text="Trace" TitleBarText="Trace"><AutoHideStateInfo RootDock="Bottom" /><DockedInsideHostStateInfo RootDock="Bottom" IsAttached="False" /><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer><ToolWindowContainer Dock="Top" Size="1192, 227" SelectedToolWindowGuid="7f29b491-3ada-4572-b140-b422651d6fed"><ToolWindow Key="{8F3DFCAC-9CCB-45C2-AF10-5DEC039B5956}" Guid="7f29b491-3ada-4572-b140-b422651d6fed" DockedSize="201, 223" FloatingLocation="6, 433" FloatingSize="300, 180" HasOptions="False" ImageIndex="-1" Text="Write" TitleBarText="Write"><AutoHideStateInfo RootDock="Top" /><DockedInsideHostStateInfo RootDock="Top" IsAttached="False" /><DockedOutsideHostStateInfo IsAttached="False" /></ToolWindow></ToolWindowContainer></HostContainerControl><AutoHide Dock="Left" /><AutoHide Dock="Right" /><AutoHide Dock="Top" /><AutoHide Dock="Bottom" /><TabbedDocuments Orientation="Horizontal" /><FloatingContainers /><Hidden><ToolWindow K
kPersistNoLineBreak
@ -925,7 +926,7 @@ VBusStatisticBox 14 Begin_Of_Object
VBoxRoot 15 Begin_Of_Object
1
1
1 0 0 1 -1 -1 -1 -1 0 89 662 431
1 0 0 1 -1 -1 -1 -1 780 375 999 611
Bus statistic
1
@ -953,7 +954,7 @@ END_OF_DOCK_INFO
0
0
1
1596 747
1188 901
END_OF_DESKTOP_DATA
END_OF_DESKTOP_DATA_COLLECTION
0
@ -1022,7 +1023,7 @@ VUniqueBox 16 Begin_Of_Object
VBoxRoot 17 Begin_Of_Object
1
1
1 1 1 1 0 218 -1 -1 196 115 786 460
1 1 0 1 -1 -1 -1 -1 1 375 779 615
Graphic
1
@ -1033,10 +1034,10 @@ MDI_DOCK_INFO_END
1 2 0 218 -1 -1 196 115 786 460
6 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0
END_OF_DOCK_INFO
0
1
1
2 3 -1 -1 -1 -1 243 246 837 595
1
0 1 -1 -1 -1 -1 157 147 751 496
0
1
95 389
@ -1050,7 +1051,7 @@ END_OF_DOCK_INFO
0
0
1
1596 747
1188 901
END_OF_DESKTOP_DATA
END_OF_DESKTOP_DATA_COLLECTION
0
@ -1195,7 +1196,7 @@ End_Of_Serialized_Data 15
End_Of_Object VPredefinedSignalObject 15
[MeasurementObject]
Eth 1::Rx Bus load
"%" 1 800080 -2.3237864 -1.8705227 -100. 100. 0.02 -5 0 0 36000000 1 1 0 0
"%" 1 800080 -2.3237864 -1.8705227 -100. 100. 0.1 -5 0 0 36000000 1 1 0 0
VPredefinedSignalObject 15 Begin_Of_Object
1
VHostSignal 16 Begin_Of_Object
@ -1246,7 +1247,7 @@ End_Of_Serialized_Data 15
End_Of_Object VPredefinedSignalObject 15
[MeasurementObject]
Eth 1::Tx Bus load
"%" 1 80 -2.3237864 -1.8705227 -100. 100. 0.02 -5 0 0 36000000 1 1 0 0
"%" 1 80 -2.3237864 -1.8705227 -100. 100. 0.1 -5 0 0 36000000 1 1 0 0
VPredefinedSignalObject 15 Begin_Of_Object
1
VHostSignal 16 Begin_Of_Object
@ -1297,7 +1298,7 @@ End_Of_Serialized_Data 15
End_Of_Object VPredefinedSignalObject 15
[MeasurementObject]
Eth 1::Rx Packet rate
"pkt/s" 1 800000 0. 10000. -100. 100. 500 -5 0 0 36000000 1 1 0 0
"pkt/s" 1 800000 0. 10000. -100. 100. 2000 -5 0 0 36000000 1 1 0 0
VPredefinedSignalObject 15 Begin_Of_Object
1
VHostSignal 16 Begin_Of_Object
@ -1348,9 +1349,9 @@ End_Of_Serialized_Data 15
End_Of_Object VPredefinedSignalObject 15
[MeasurementObject]
Eth 1::Tx Packet rate
"pkt/s" 1 808000 0. 10000. -100. 100. 500 -5 0 0 36000000 1 1 0 0
"pkt/s" 1 808000 0. 10000. -100. 100. 2000 -5 0 0 36000000 1 1 0 0
[GraphWindow:x_x_x_x_x_x_WindowBk_Grid_AxisBk_XAxisFr_YAxisFr_x_x_x_x_x_x]
0 26415.43074 26415.43074 200000 36000000 1 ffffff b2b2b2 ffffff 0 0 0 0 1 1 1 0
118499.99004 144915.42077999999 26415.43074 200000 36000000 1 ffffff b2b2b2 ffffff 0 0 0 0 1 1 1 0
0 30 5000
0
0 100
@ -1432,7 +1433,7 @@ Tahoma
0
0
0
913
222
0 10
1
2
@ -1625,10 +1626,7 @@ End_Of_Serialized_Data 14
16
0
17
1
14
ver=2: FT
End_Of_Serialized_Data 14
0
18
0
19
@ -3536,12 +3534,12 @@ Trace Window
End_Of_Object VLogExportPersister 15
End_Of_Serialized_Data 14
1
2
0
0
290
1
160
309
<VFileName V4 QL> 1 ""
End_Of_Object VTraceControlCfg 14
VNETTraceControlBox 14 Begin_Of_Object
@ -3553,7 +3551,7 @@ VUniqueBox 16 Begin_Of_Object
VBoxRoot 17 Begin_Of_Object
1
1
1 3 0 1 -1 -1 -1 -1 -15 105 1285 623
1 2 0 1 -1 -1 -1 -1 22 7 1322 571
1
@ -3565,14 +3563,14 @@ MDI_DOCK_INFO_END
6 1 0 0 0 0 0 0 1192 514 0 0 1 36756 1904 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 111 442 1 0 0 0 1 281 0 59422 1
END_OF_DOCK_INFO
1
3
2
0
0
1
1188 696
END_OF_DESKTOP_DATA
6
0 1 -1 -1 -1 -1 22 7 1450 571
0 1 -1 -1 -1 -1 22 7 1322 571
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0
END_OF_DOCK_INFO
1
@ -3580,7 +3578,7 @@ END_OF_DOCK_INFO
0
0
1
1596 747
1188 901
END_OF_DESKTOP_DATA
END_OF_DESKTOP_DATA_COLLECTION
0
@ -3889,7 +3887,7 @@ MDI_DOCK_INFO_END
1
6
0 1 -1 -1 -8 -30 -138 106 539 323
6 1 0 0 0 0 0 0 677 213 0 0 1 8084 1904 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 6 66 1 0 0 0 1 382 0 59420 1
6 1 0 0 0 0 0 0 677 213 0 0 1 8084 1904 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 6 66 1 0 0 0 1 506 0 59420 1
END_OF_DOCK_INFO
1
2
@ -3903,7 +3901,7 @@ END_OF_DESKTOP_DATA
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0
END_OF_DOCK_INFO
0
-1
2
0
0
0
@ -4572,7 +4570,7 @@ MDI_DOCK_INFO_END
1
6
0 1 -1 -1 -8 -30 0 0 890 487
6 1 0 0 0 0 0 0 890 483 0 0 1 20372 1904 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 347 323 1 0 0 0 1 641 0 59421 1
6 1 0 0 0 0 0 0 890 483 0 0 1 20372 1904 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 347 323 1 0 0 0 1 648 0 59421 1
END_OF_DOCK_INFO
1
0
@ -4631,7 +4629,7 @@ End_Of_Object VGrMnBox 3
VDOLocalInfoStruct 3 Begin_Of_Object
3
1
203
211
VDAOBus 4 Begin_Of_Object
1
1
@ -4899,7 +4897,7 @@ VBoxRoot 12 Begin_Of_Object
1
3
1 -1 0 1 -1 -1 -1 -1 35 -12 567 364
Debugger - Programm: Client_2 [Debugging ausgeschaltet]
Debugger - Client_2
1
MDI_DOCK_INFO_END
@ -5129,7 +5127,7 @@ VSimulinkModelViewerConfiguration 7 Begin_Of_Object
End_Of_Object VSimulinkModelViewerConfiguration 7
1
0
1716208489
327433878
0
NodeSignalPanelBustypeCount 0
End_Of_Object VSimulationNode 6
@ -5185,7 +5183,7 @@ END_OF_DESKTOP_DATA
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0
END_OF_DOCK_INFO
0
2
1
0
0
0
@ -5388,7 +5386,7 @@ NULL
End_Of_Object VDOLocalInfoStruct 3
0.000000
0 0
1 1 0 59420 1 176 1 2882400001 639 815 319 694 2882400002 0 0 0 0 0 0 1 2882400001 1280 1280 321 321 2882400002 0 0 0 0 0 0 3
1 1 0 59420 1 176 1 2882400001 632 808 319 694 2882400002 0 0 0 0 0 0 1 2882400001 1280 1280 321 321 2882400002 0 55 0 0 0 0 3
SS_BEGIN_COMMON_INFO
1
0
@ -5400,7 +5398,7 @@ Ether1
11
1
1
492214664 1 0 1 0 1 1 0 0 0 2000 1
487858576 1 0 1 0 1 1 0 105 35 2000 1
SS_BEGIN_COMMON_INFO
1
2
@ -5427,7 +5425,7 @@ VUniqueBox 3 Begin_Of_Object
VBoxRoot 4 Begin_Of_Object
1
3
0 2 0 1 -1 -1 -8 -30 162 249 890 645
0 3 0 1 -1 -1 -1 -1 117 403 779 746
Write
1
@ -5439,14 +5437,14 @@ MDI_DOCK_INFO_END
6 1 1010 180 0 0 300 180 300 180 0 61440 1 12180 1904 0 0 0 0 260 0 0 0 1 5 32767 1 59422 1 5 1011 185 4 6 433 1 10 0 0 1 223 0 59419 1
END_OF_DOCK_INFO
1
2
3
0
0
1
1188 901
END_OF_DESKTOP_DATA
6
0 1 -1 -1 -1 -1 22 272 684 615
0 1 -1 -1 -1 -1 117 403 779 746
6 0 1010 180 0 0 300 180 300 180 0 61440 1 12181 1904 0 0 0 0 260 1 0 0 -1 -1 32767 0 59422 0 0 0 0 0 0 0 1 10 0 0 1 229 0 59419 1
END_OF_DOCK_INFO
1
@ -5454,7 +5452,7 @@ END_OF_DOCK_INFO
0
0
1
1596 747
1188 901
END_OF_DESKTOP_DATA
END_OF_DESKTOP_DATA_COLLECTION
0
@ -5831,6 +5829,8 @@ FiltersEnd
1 1
END_OF_WORKSPACE_MEMBER_DATA
END_OF_WORKSPACE_MEMBER
1
@ -6428,7 +6428,7 @@ END_OF_DESKTOP_DATA
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 32767 0 0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0
END_OF_DOCK_INFO
0
-1
1
0
0
0

View file

@ -91,7 +91,7 @@ void EilConnectTo2()
if (gPacket == 0)
{
gSocketState = ERROR;
writeDbg(ConnError, "EthInitPacket: Could not create UDP packet: %d", EthGetLastError());
writeDbg(ConnError, "EthInitPacket: Could not create Modbus packet: %d", EthGetLastError());
OnModbusClientPanics(ConnectionError);
return;
}
@ -144,8 +144,8 @@ byte EilSnd(byte buffer[], word length)
bin_to_strhex(buffer, str);
writeDbg(ConnDebug, "EilSnd: %s (Länge: %d)", str, length);
EthResizeToken(gPacket, "udp", "data" , length*8);
EthSetTokenData(gPacket, "udp", "data" , length, buffer);
EthResizeToken(gPacket, "modbus", "data" , length*8);
EthSetTokenData(gPacket, "modbus", "data" , length, buffer);
EthCompletePacket(gPacket);
EthOutputPacket(gPacket);

View file

@ -57,6 +57,7 @@ void ModbusReadBits(word address, word count)
{
const byte length = __size_of(struct ModbusReqRead);
const byte funcCode = 0x01;
byte buffer[length];
struct ModbusReqRead mbr;
mbr.Address = address;
@ -69,7 +70,7 @@ void ModbusReadBits(word address, word count)
}
/// <ModbusReadBits>
void OnModbusReceiveBits(byte buffer[])
void OnModbusReceiveBits(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResReceiveBits mbres;
struct ModbusReqRead mbreq;
@ -78,7 +79,7 @@ void OnModbusReceiveBits(byte buffer[])
byte i, j;
memcpy_n2h(mbres, buffer);
memcpy_n2h(mbreq, gQueueAck[mbres.Header.TxID].Buffer);
memcpy_n2h(mbreq, gQueueAck[mbap.TxID].Buffer);
writeDbg(MbDebug, "Received %d bits from 0x%04X", mbreq.Count, mbreq.Address);
@ -123,13 +124,13 @@ void ModbusReadRegisters(word address, word count) // 16 bit
}
/// <ModbusReadRegisters>
void OnModbusReceiveRegisters(byte buffer[])
void OnModbusReceiveRegisters(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResReceiveRegisters mbres;
struct ModbusReqRead mbreq;
memcpy_n2h(mbres, buffer);
memcpy_n2h(mbreq, gQueueAck[mbres.Header.TxID].Buffer);
memcpy_n2h(mbreq, gQueueAck[mbap.TxID].Buffer);
writeDbg(MbDebug, "Received %d registers from 0x%04X", mbreq.Count, mbreq.Address);
@ -169,7 +170,7 @@ void ModbusWriteBit(word address, byte value)
}
/// <ModbusWriteBit>
void OnModbusConfirmBit(byte buffer[])
void OnModbusConfirmBit(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResConfirmSingle mbc;
@ -210,7 +211,7 @@ void ModbusWriteRegister(word address, int value)
}
/// <ModbusWriteRegister>
void OnModbusConfirmRegister(byte buffer[])
void OnModbusConfirmRegister(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResConfirmSingle mbc;
@ -300,7 +301,7 @@ void ModbusWriteBitsB(word address, word count, byte values[])
}
/// <ModbusWriteBits>
void OnModbusConfirmBits(byte buffer[])
void OnModbusConfirmBits(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResConfirmMultiple mbc;
@ -350,7 +351,7 @@ void ModbusWriteRegisters(word address, word count, word values[])
}
/// <ModbusWriteRegisters>
void OnModbusConfirmRegisters(byte buffer[])
void OnModbusConfirmRegisters(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResConfirmMultiple mbc;
@ -391,7 +392,7 @@ void ModbusWriteMasks(word address, word and, word or)
}
/// <ModbusWriteMasks>
void OnModbusConfirmMasks(byte buffer[])
void OnModbusConfirmMasks(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResConfirmMasks mbc;
@ -442,13 +443,13 @@ void ModbusReadWriteRegisters(word readAddress, word readCount, word writeAddres
}
/// <ModbusReadWriteRegisters>
void OnModbusReceiveConfirmRegisters(byte buffer[])
void OnModbusReceiveConfirmRegisters(struct ModbusApHeader mbap, byte buffer[])
{
struct ModbusResReceiveRegisters mbres;
struct ModbusReqRead mbreq;
memcpy_n2h(mbres, buffer);
memcpy_n2h(mbreq, gQueueAck[mbres.Header.TxID].Buffer);
memcpy_n2h(mbreq, gQueueAck[mbap.TxID].Buffer);
writeDbg(MbDebug, "Wrote some registers and received %d registers from 0x%04X", mbreq.Count, mbreq.Address);
@ -470,86 +471,44 @@ void OnModbusReceiveConfirmRegistersException(struct ModbusApHeader mbap, enum M
// ------------------------------------------------------------------------------------
// REGION: OnModbusReceive ------------------------------------------------------------
/// <-OnModbusReceive>
void OnModbusReceive(dword socket, long result, dword address, dword port, byte buffer[], dword size)
{
writeDbg(ConnDebug, "OnModbusReceive: Received %d bytes", size);
if (result == 0)
{
if (size == 0)
{
// Size of zero indicates that the socket was closed by the communication peer.
writeDbg(ConnWarning, "OnModbusReceive: Socket closed by peer");
ModbusDisconnect();
}
else
{
// Sucessfully received some bytes over the TCP/IP connection.
OnModbusReceive2(buffer, size);
}
}
else
{
gIpLastErr = ModbusGetLastConnectionError(gIpLastErrStr);
writeDbg(ConnError, "OnModbusReceive error (%d): %s", gIpLastErr, gIpLastErrStr);
ModbusDisconnect();
}
}
/// <-OnModbusReceive>
void OnModbusReceive2(byte buffer[], dword size)
void OnModbusReceive2(long packet)
{
struct ModbusApHeader mbap;
int offset;
char str[3*20];
byte buffer[gMaxPacketLength];
long size; // packet size in bits
//char str[3*20];
byte header[__size_of(struct ModbusApHeader)];
if (size < 8) // No complete Modbus Application Header
return;
size = EthGetThisData(0, gMaxPacketLength, buffer);
EthGetTokenData(packet, "modbus", "header", __size_of(struct ModbusApHeader), header); // TODO: EthGetTokenData does not handle endianness :( /////////////////////////////////////////////////
memcpy_n2h(mbap, header);
offset = 0;
do
{
writeDbg(ConnDebug, "OnModbusReceive2: Offset pre = %d", offset);
memcpy_n2h(mbap, buffer, offset);
OnModbusReceive2OnePacket(buffer, offset, mbap);
offset += __offset_of(struct ModbusApHeader, UnitID) + mbap.Length;
writeDbg(ConnDebug, "OnModbusReceive2: offset post = %d. %d <= %d?", offset, offset, size-8);
}
while(offset <= size-8); // We need at least 8 bytes for a new packet
writeDbg(ConnDebug, "OnModbusReceive2: yes. finished");
if (offset != size) // Can be removed.
{
bin_to_strhex(buffer, str);
writeDbg(ConnError, "OnModbusReceive2: Error while going through receive buffer. Our final offset is %d, but the size of the buffer is %d! Buffer: %s", offset, size, str);
OnModbusClientPanics(ParsingBuffer);
}
//bin_to_strhex(header, str);
//writeDbg(MbError, "Header: %s", str);
//writeDbg(MbError, "Header Length: 0x%X", mbap.Length);
OnModbusReceive2OnePacket(buffer, size, mbap);
}
/// <-OnModbusReceive>
void OnModbusReceive2OnePacket(byte buffer[], int offset, struct ModbusApHeader mbap)
void OnModbusReceive2OnePacket(byte buffer[], long size, struct ModbusApHeader mbap)
{
// Test transaction identifier?
// Test unit/device identifier?
word i; // counter
word length; // length of current packet
byte mbuffer[__size_of(struct ModbusResReceiveRegisters)]; // second buffer where we copy the message. This way the user won't overwrite other packages.
length = __offset_of(struct ModbusApHeader, UnitID) + mbap.Length;
// We cannot check this properly anymore. We have to trust the TCP/UDP stack and the sender... *sigh*
if (mbap.Length-2 != size)
{
writeDbg(ConnError, "OnModbusReceive2OnePAcket: Packet payload length (%d) is different from specified length (%d)!", size, mbap.Length-2);
return;
}
if (mbap.Protocol != 0) // Protocol is not Modbus (0x0000). Wayne.
{
writeDbg(ConnDebug, "OnModbusReceive2OnePacket: packet is no Modbus packet: Protocol = %d", mbap.Protocol);
return;
}
if (elCount(buffer) < offset + length) // packet larger than the (rest of the) buffer
{
writeDbg(ConnError, "OnModbusReceive2OnePacket: packet did not fit into Buffer: buffer length = %d, packet length = %d, offset = %d", elCount(buffer), __offset_of(struct ModbusApHeader, UnitID) + mbap.Length, offset);
// I REALLY don't want to assemble the two package fragments.
OnModbusClientPanics(ModbusPackageWasSplit);
return;
}
// MBAP Header is OK :) Go on
if (!gQueueSent.ContainsKey(mbap.TxID)) // We don't wait for this message!
@ -561,45 +520,41 @@ void OnModbusReceive2OnePacket(byte buffer[], int offset, struct ModbusApHeader
if (mbap.FuncCode > 0x80) // Oh no, we got a exception!
{
OnModbusReceive2Exceptions(buffer[offset+08], mbap);
OnModbusReceive2Exceptions(buffer[0], mbap);
gQueueAck.Remove(mbap.TxID); // Remove from acknowledge queue
return;
}
// Copy the message
memcpy_off(mbuffer, 0, buffer, offset, length);
// Let's give the PDU to the corresponding function
switch (mbap.FuncCode)
{
case 0x01:
case 0x02:
OnModbusReceiveBits(mbuffer);
OnModbusReceiveBits(mbap, buffer);
break;
case 0x03:
case 0x04:
OnModbusReceiveRegisters(mbuffer);
OnModbusReceiveRegisters(mbap, buffer);
break;
case 0x05:
OnModbusConfirmBit(mbuffer);
OnModbusConfirmBit(mbap, buffer);
break;
case 0x06:
OnModbusConfirmRegister(mbuffer);
OnModbusConfirmRegister(mbap, buffer);
break;
case 0x0F:
OnModbusConfirmBits(mbuffer);
OnModbusConfirmBits(mbap, buffer);
break;
case 0x10:
OnModbusConfirmRegisters(mbuffer);
OnModbusConfirmRegisters(mbap, buffer);
break;
case 0x16:
OnModbusConfirmMasks(mbuffer);
OnModbusConfirmMasks(mbap, buffer);
break;
case 0x17:
OnModbusReceiveConfirmRegisters(mbuffer);
OnModbusReceiveConfirmRegisters(mbap, buffer);
break;
default:
writeDbg(MbError, "OnModbusReceive2OnePacket: We received funcCode 0x%X!?", mbap.FuncCode);
@ -744,6 +699,8 @@ on timer gtRobin
if (gQueueSent.Size() > 4) // Wago 750-881 cannot handle more than 5 messages at a time :(
continue;
EthSetTokenInt(gPacket, "modbus", "TxId", TxID);
EthSetTokenInt(gPacket, "modbus", "FuncCode", gQueuePending[TxID].FuncCode);
// if packet was sent or the socket is not currently being opened
if (ModbusSnd(gQueuePending[TxID].Buffer, gQueuePending[TxID].Length) == 0 || gSocketState != NULL)
{

View file

@ -38,8 +38,6 @@ long ModbusGetLastConnectionError(char string[])
void OnEthReceivePacket(long channel, long dir, long packet)
{
byte buffer[gMaxPacketLength];
long size;
if (dir == TX)
return;
@ -58,7 +56,6 @@ void OnEthReceivePacket(long channel, long dir, long packet)
if (EthGetTokenInt(packet, "ipv4", "protocol") == 0x11 && EthGetTokenInt(packet, "ipv4", "source") == gRemoteIP) // if this is a UDP package from our server
{
size = EthGetThisData(0, gMaxPacketLength, buffer);
OnModbusReceive(0, 0, EthGetTokenInt(packet, "ipv4", "source"), gRemoteIP, buffer, size);
OnModbusReceive2(packet);
}
}

View file

@ -38,9 +38,9 @@ BU_: Client_2
BO_ 3 ReadRegisters: 8 Vector__XXX
BO_ 16908289 Client_2_RecBits: 1 Vector__XXX
SG_ DI2 : 1|1@1- (1,0) [0|0] "" Client_2
SG_ DI1 : 0|1@1- (1,0) [0|0] "" Client_2
BO_ 16908289 Client_2_RecBits: 2 Vector__XXX
SG_ DI2 : 9|1@1+ (1,0) [0|0] "" Client_2
SG_ DI1 : 8|1@1+ (1,0) [0|0] "" Client_2
BO_ 16908417 Client_2_Ex81: 1 Vector__XXX
SG_ ExCode : 0|8@1+ (1,0) [0|4] "" Client_2

View file

@ -34,7 +34,7 @@
<namespace name="Modbus" comment="">
<variable anlyzLocal="2" readOnly="false" valueSequence="false" unit="ms" name="RequestTimeout" comment="The maximum duration for a Modbus-UDP/-TCP request in milliseconds. After timeout a retransmission may be started (see MaxRetransmissionCount). Use `ping` to get the maximum latency to a device, double it and add 2-3 ms for processing." bitcount="32" isSigned="true" encoding="65001" type="int" startValue="7" minValue="1" minValuePhys="1" maxValue="1000" maxValuePhys="1000" />
<variable anlyzLocal="2" readOnly="false" valueSequence="false" unit="" name="Port" comment="" bitcount="32" isSigned="true" encoding="65001" type="int" startValue="502" minValue="1" minValuePhys="1" maxValue="65535" maxValuePhys="65535" />
<variable anlyzLocal="2" readOnly="false" valueSequence="false" unit="times" name="MaxTransmissionCount" comment="How often a retransmission of a request will be sent until it gets discarded and an error is thrown." bitcount="32" isSigned="true" encoding="65001" type="int" startValue="2" minValue="1" minValuePhys="1" maxValue="10" maxValuePhys="10" />
<variable anlyzLocal="2" readOnly="false" valueSequence="false" unit="times" name="MaxTransmissionCount" comment="How often a retransmission of a request will be sent until it gets discarded and an error is thrown." bitcount="32" isSigned="true" encoding="65001" type="int" startValue="1" minValue="1" minValuePhys="1" maxValue="10" maxValuePhys="10" />
</namespace>
<namespace name="TcpIp" comment="">
<variable anlyzLocal="2" readOnly="false" valueSequence="false" unit="" name="AdapterIndex" comment="Index of network interface to use" bitcount="32" isSigned="true" encoding="65001" type="int" startValue="2" minValue="1" minValuePhys="1" maxValue="20" maxValuePhys="20" />

View file

@ -1,6 +1,27 @@
Registered Modbus for UDP
Initializing Defining fields MyProtocolId = 4896.
InitProtocol.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 00 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 00 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 00 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 00 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 01 00 00 00 06 ff 01 00 00 00 02
@ -22,3 +43,276 @@ ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 02 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 02 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 02 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 02 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 03 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 03 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 03 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 03 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 04 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 04 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 04 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 04 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 05 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 05 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 05 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 05 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 06 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 06 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 06 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 06 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 07 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 07 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 07 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 07 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 08 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 08 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 08 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 08 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 09 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 09 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 09 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 09 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0a 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0a 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0a 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0a 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0b 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0b 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0b 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0b 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0c 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0c 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0c 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0c 00 00 00 04 ff 01 01 01
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0d 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0d 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0d 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0d 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
CompleteProtocol: Modbus->bitLength = 32, --> Length = 6.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0e 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0e 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 12
Data = 00 0e 00 00 00 06 ff 01 00 00 00 02
--> byteOffset = 50, byteLength = 4
--> ContentId = 1020001.
ParsePacket topProtocolToken->tokenId = 352 byteOffset = 42, byteLength = 10
Data = 00 0e 00 00 00 04 ff 01 01 00
--> byteOffset = 50, byteLength = 2
--> ContentId = 1020001.