[fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?
Bo Berglund
bo.berglund at gmail.com
Wed Sep 2 13:51:56 CEST 2020
On Tue, 1 Sep 2020 20:31:57 +0200 (CEST), Michael Van Canneyt via
fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
>Yes, but you can only override a virtual constructor. The TThread
>constructor is not virtual.
I am doing the setup in a different way so I don't have to use Create.
My new FpSerialPort works fine now with the simple test application.
But now I have to plug it into the larger service app I am porting and
I have come across a piece of code where the alternative com port
classes used on Windows have a way to check how many bytes are in the
outgoing buffer ready to be transfered.
The existing code waits until there are less than 16 bytes left to
transfer before it fills the Tx buffer with another packet of 512
bytes.
In order to do this it checks the state of the Tx buffer:
Using LazSerial (Windows and Linux):
while FComm.SynSer.SendingData > 16 do (waiting for it to empty)
Using AsyncPro (Windows):
while FComm.OutBuffUsed > 16 do
Using an older but simpler serial comp on Windows:
while FComm.TxWaiting > 16 do
Is there anything comparable available via the serial unit?
I have not found anything so I guess it has to be an addition to get
it done....
The binary data to send can in worst case be 1 Mbytes in size even
though normally it varies between 1 and a few hundred bytes per
operation.
Any suggestions?
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list