procedure Tmain.TelComReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
PBuffer
char;
len,x,x1,i,j,k,mm,t:integer;
ASCStr:String;
BYTEStr:String;
str:array[0..140] of char;
temppos:array[0..200] of integer;
tp
char;
newdate:TdateTime;
substr1,substr2,substr3:string;
TempBuffer:array[0..200] of char;
begin
Timer4.Enabled:=False;
NoTele:=0;//ÊÕµ½»°µ¥±¨¾¯Öµ¹éÁã
Alerm:=0;
newdate:=date;
if formatdatetime('yymmdd',olddate)<>formatdatetime('yymmdd',newdate) then
Begin
closefile(outfile);
olddate:=newdate;
AssignFile(outfile, 'c:/zttele/'+formatdatetime('yyyymmdd',olddate)+'.txt');
Rewrite(outfile);
end;
// if BufferLength<10 then Exit;
for mm:=0 to 200 do
Begin
temppos[mm]:=0;
end;
j:=0;
k:=0;
temppos[0]:=0;
PBuffer:=Buffer;
writeln(outfile,PBuffer);
// PrintLine(PBuffer);
if (glHotelName='Ê®ÑßÃÀÀÖ´ó¾Æµê') then
begin
IF (PBuffer[0]<>'X') and (Has_second_line=false) then //'0'ÆäËû²»Êǵ绰
begin
Exit;
end;
if (PBuffer[0]='X') and (Has_second_line=false) then
begin
P_ASCStr:='';
Has_second_line:=true;
end;
end;
ASCStr:='';
BYTEStr:='';
// P_ASCStr:='';
PBuffer:=Buffer;
for i:=0 to BufferLength-1 do
begin
if (ORD(PBuffer
)>=32) AND (ORD(PBuffer)<=100) then
begin
ASCStr:=ASCStr+PBuffer;
BYTEStr:=BYTEStr+'#'+IntToStr(ORD(PBuffer));
end;
end;
if not Has_second_line then
begin
P_ASCStr:=ASCStr;
exit;
end
else
P_ASCStr:=P_ASCStr+ASCStr ;
is_e:=true;
if (PBuffer[0]='X') then exit;
// ASCStr:=ASCStr;
// P_ASCStr:='';
is_e:=false;
ASCStr:=P_ASCStr;
memo1.lines.clear;
memo2.lines.clear;
// writeln(outfile,ASCStr);
Memo1.Lines.Add(ASCStr);
Memo2.Lines.Add(BYTEStr);
{ Buffer1.Top:=0;
Buffer1.Bottom:=0;
Buffer1.TelePos:=0;
Buffer1.Buffer[0]:=#0; }
StrPcopy(Str,ASCStr);
len:=Strlen(str);
//ɾ³ý¶Ì»°µ¥
// if len<10 then exit;
Str[Len]:=#13;
Str[Len+1]:=#10;
Str[Len+2]:=#0;
Tp:=Str;
Buffer1.Write(Tp,strlen(Tp));
TeleSysParam.BufferCheck;
ASCStr:='';
BYTEStr:='';
Has_second_line:=false;
end;