Is there any method for LazSerial to
flush the indata buffer?
I want to get rid of the content of the buffer if it contains something before I start over with a new transaction.
AsyncPro has a method FlushInBuffer and the other Windows only serial component also has one named ZapRxQueue
Is something like that available for LazSerial too?
Or do I have to do:
procedure FlushRxData;
var
tmp: string;
begin
if FComm.DataAvailable then
tmp := FComm.ReadData();
end;
And is there any way to
monitor the outdata buffer so that the code can know when all data have been transferred?
In the existing code using Async Pro I have this to monitor the progress of the slow transmission:
repeat
{send data in chunks of 512 bytes}
sBuf := Copy(Cmd, 1, 512);
Delete(Cmd,1,512);
FComm.PutString(sBuf);
while FComm.OutBuffUsed > 16 do //Wait until most data sent
begin
Application.ProcessMessages;
Sleep(1);
end;
SetProgress(p - Length(Cmd), -1);
until Cmd = '';
I looked in the LazSerial unit and could not find anything similar to OutBufferUsed...
The other serial component also has a similar function named TxWaiting.
Any suggestions as to how I can deal with this?