![Cyndar Electronic Technology XD-TOF-25 Скачать руководство пользователя страница 36](http://html1.mh-extra.com/html/cyndar-electronic-technology/xd-tof-25/xd-tof-25_operating-instructions-manual_2704637036.webp)
Sensing the world
·
Leading the change
35
//
myCompleteMessage.AppendFormat("{0}",Encoding.ASCII.GetString(runanwser, 0,
numberOfBytesRead));
//
if (myCompleteMessage[0]!=0x02
)
||(myCompleteMessage[myCompleteMessage.Length-1]!=0x03
)
{
//Check the header and trailer, if there is an error, the packet error operation
}
//
string result = myCompleteMessage.ToString();
string[] split = result.Split(new char[] { ' ' });//
TelegramCounter = split[7]; //
For example, communication timer (you can extract other information as needed)
ScanCounter = split[8]; //
For example scan counter (you can extract other information as needed)
int ii = 0
;
ii = int.Parse(split[25], System.Globalization.NumberStyles.AllowHexSpecifier);//Hexadecimal
to decimal, the 25th segment represents the number of measurement data
int j = 0;// Statistics of data
for (int i = 26; i < ii
+
26; i
++
)// Through this cycle, all the measured data are found.
Although he has different lengths, the format of the spaces remains unchanged, which is the
basis of the division.
{
split[i]=int.Parse(split[i], System.Globalization.NumberStyles.AllowHexSpecifier).ToString(); }
//split[i]
j++
;// J Statistics of measured data.
}
STEP17
:Continuously request data
Your application needs to send the following communication request to the radar server:
<STX>sEN{SPC}LMDscandata{SPC}1<ETX>
02
73 45 4E
20
4C 4D 44 73 63 61 6E 64 61 74 61
20
31
03
<STX>
02
sEN
73 45 4E
20
LMDscandata
4C 4D 44 73 63 61 6E 64 61 74
61
Read TCPIP communication receive buffer
Write all the information stack read by the network port to the receiving result variable
while (scandata[numberOfBytesRead—1] != 0x03);//Because the multi-segment PSH=1 is used for
segment transmission, it must detect the trailer (ETX, 03h) before it is considered that the
reception is complete. This part of the content is complete for the data packet Reception is
very important
You can continue to operate the acceptance information in myCompleteMessage to determine
further operations. The following continues to extract key instruction information, which
may contain ETX, STX, you need to further elaborate processing
Split the text into N string arrays with spaces.
For the i-25th data split
Header
Data
content
Space
(
SPC
)