代码:
function TFmPointPara.UnReadParam(ReceBuf : array of byte):integer ;
var
ParamStr : string;
TerminatalInfo : string;
Pos, DataLength : integer;
i, j : integer;
TmpByte : byte;
P : ^TTerminalPara;
begin
result := -1;
ParamStr := '';
for pos:=0 to 1023 do
begin
if ReceBuf[pos]=$66 then
break;
end;
DataLength := HexToInt(IntToHex(ReceBuf[4],0)+IntToHex(ReceBuf[3],0));
tmpbyte :=0;
for i:=0 to (DataLength+5-1) do tmpbyte := tmpbyte + ReceBuf;
if tmpByte <> Recebuf[DataLength+5] then
begin
PostMessageStr(Fm_Client.StatusBar1,'ÊÕµ½Òì³£Êý¾Ý£¡');
// WriteOperate(list,6,'ÊÕµ½Òì³£Êý¾Ý£¡');
exit;
end;
//½â°ü
if ReceBuf[pos+1] = $88 then
begin
for i := 3 downto 0 do
begin
TerminatalInfo := TerminatalInfo + IntToStr(ReceBuf[5+i]);
end;
DataLength := DataLength - 4;//4ΪÖն˱àºÅµÄ³¤¶È
end;