[Lazarus] SdpoSerial Tx and Rx buffers?
Bo Berglund
bo.berglund at gmail.com
Mon Feb 14 17:32:00 CET 2011
On Mon, 14 Feb 2011 11:29:06 +0100, Michael Schnell
<mschnell at lumino.de> wrote:
>On 02/13/2011 11:15 PM, Bo Berglund wrote:
>> In serial components I have used with Delphi before there was always a
>> property to set the buffer sizes (both Tx and Rx). But I cannot find a
>> way to do this with SdpoSerial.
>Does SdpoSerial use buffers at all ? With AsyncPro, Buffers necessary to
>convert the blocking System interface into the event driven AsyncPro
>user API by doing the blocking system calls in threads. With the
>receiver, the collected data needs to be buffered until the main thread
>is available to handle it, With the sender, the data generated by the
>main thread needs to be buffered until the system API unblocks the
>interface it blocked to prevent overrun of the system buffers.
>
>Without using threads the user just sees a blocking interface and no
>buffers are necessary.
AFAICT SdpoSerial is a wrapper for the Synaser blocking serial
component to make it more "user friendly" by providing receive events
when data arrive.
And my question is really about the existence of buffers and in that
case how to adjust them?
I don't want to mess with the component files myself, they are way too
intricate, I just want to use the serial comm functions.
But I need to know if there will be loss of data if I use a write
command with a very big string argument and the communications buffers
are not big enough to store this string. What will happen?
- Loss of data?
- Reverting to blocking operations (ouch!)?
Of course I can test it by actually sending a large chunk of data, but
then I might use test data that are just a tad too short to reveal a
buffer problem. Better to know how it will react.
And another important thing should I not need to set a buffer size:
How can I know when the data I submitted to SdpoSerial has actually
left the serial port on to the wire? A TxBuffer.DataCount property or
similar would come in handy here if it existed....
Bo Berglund
More information about the Lazarus
mailing list