[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SerialPort.Open [Polling]?


Le 05/06/2024 à 20:12, Claus Dietrich a écrit :
Am 04.06.24 um 12:22 schrieb Benoît Minisini:
Le 04/06/2024 à 03:49, T Lee Davidson a écrit :
https://gambaswiki.org/wiki/comp/gb.net/serialport/open describes the SerialPort.Open method. But, it does not explain what the optional Polling parameter is/does.

Looking at the source code, it appears to be the interval, in milliseconds with a default of 50ms, between polls of the serial port, I assume, to see if there is data available to be read. Is this correct?


According to the source code, polling is only used if you handle one of the 'XXXChange' event. Detecting data availability is always done, and not by polling.

Beware it does not work if you change the event observer of the SerialPort object after having created it.

Regards,

Hi Benoit

Your reply doesn't explain the purpose of the optional polling parameter and since the detection of data is always done, what are the detection-criteria (i.e. byte by byte)?

Best regards

Claus


The optional polling parameter is there in the case you want a polling interval different from the default (50 ms).

As I said, polling is not used for detecting data availability, but for detecting the 'XXXChange' events.

Regards,

--
Benoît Minisini.


References:
SerialPort.Open [Polling]?T Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: SerialPort.Open [Polling]?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: SerialPort.Open [Polling]?Claus Dietrich <claus.dietrich@xxxxxxxxxx>