function BCCCheck(Command: string): string;
var
Sum: Integer;
iWork, i, j: Integer;
sFinal, sTemp: string;
begin
try
i := length(Command) div 2;
Sum := 0;
for j := 1 to i do
begin
iWork := StrToInt('$' + Command[2 * j - 1] + Command[2 * j]);
Sum := Sum + iWork;
end;
sTemp := IntToHex(Sum, 2);
if Length(sTemp) > 2 then
begin
sTemp := RightStr(sTemp, 2);
end;
sFinal := '';
for i := 0 to Length(sTemp) - 1 do
begin
sFinal := sFinal + IntToHex( ord(sTemp[i + 1]), 2);
end;
Result := sFinal;
except
Result := '';
end;
end;
var
Sum: Integer;
iWork, i, j: Integer;
sFinal, sTemp: string;
begin
try
i := length(Command) div 2;
Sum := 0;
for j := 1 to i do
begin
iWork := StrToInt('$' + Command[2 * j - 1] + Command[2 * j]);
Sum := Sum + iWork;
end;
sTemp := IntToHex(Sum, 2);
if Length(sTemp) > 2 then
begin
sTemp := RightStr(sTemp, 2);
end;
sFinal := '';
for i := 0 to Length(sTemp) - 1 do
begin
sFinal := sFinal + IntToHex( ord(sTemp[i + 1]), 2);
end;
Result := sFinal;
except
Result := '';
end;
end;