On Mon, Sep 19, 2022 at 7:51 AM Christo Crause <christo.cra...@gmail.com>
wrote:

>
>
> On Mon, 19 Sep 2022, 03:18 James Richters via fpc-pascal, <
> fpc-pascal@lists.freepascal.org> wrote:
>
>> I can't seem to find any documentation or SerRead or SerReadTimeout..
>> searching for either along with Freepascal doesn't get me any results.
>> If it exists somewhere and I am just missing it, can someone tell me where
>> it is?
>>
>> Anyway, what I'm trying to figure out is when the timeout timer starts...
>>
>
> FPC uses the OS provided functionality to interact with the serial port.
> On Windows the timeout seems to start when the read request is made (
> https://learn.microsoft.com/en-us/previous-versions/ff547486(v=vs.85)).
> On POSIX (at least Linux) it depends on the specific set of flags specified
> , scroll down to the discussion on canonical/noncanonical mode for the
> details (https://linux.die.net/man/3/termios).
>

A bit more information after peeking into the source code: on win32 the
timeout information can be read or set using Get/SetCommTimeouts. The
COMMTIMEOUTS structure (
https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-commtimeouts)
contains a read interval timeout and total timeouts for read & write
operations. SerReadTimeout sets the ReadTotalTimeoutConstant value, so
basically the total timeout duration.

On Linux SerReadTimeout uses a fpSelect on the handle with the specified
timeout, so in principle it is the same behaviour as on Windows, i.e. a
total timeout.

While both OSs provide some functionality to specify inter character
timeouts, FPC does not directly expose this functionality in the Serial
unit.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to