[Lazarus] Serial communication??

Bo Berglund bo.berglund at gmail.com
Tue Sep 28 22:18:47 CEST 2010


> On Tue, Sep 28, 2010 at 9:08 PM, Bo Berglund 
> <bo.berglund at gmail.com> wrote:
> > 1) Is serial communication with events not possible in FPC on Linux?
> 
> Of course it is possible. You just have to write your own library to
> do it. One possibility would be adapting lNet, like Synaser adapts
> Synapse.

I had hoped there would be ready-made code for such common things as
using serial communications....
 
> > 2) How can one use blocking reads when there is no way to 
> know exactly when
> > data will arrive? Everything else will stop when waiting 
> for data, right?
> 
> By using a timeout. Timeout = 0 returns immediately, so you can use
> this to check periodicaly if data comes.

Where is the timeout? Here is the serial.SerRead function:

function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt):
LongInt;

AFAICS there is only a Count parameter specifying the number of bytes to
read.

--
Bo B





More information about the Lazarus mailing list