[Lazarus] SdpoSerial Tx and Rx buffers?
Bo Berglund
bo.berglund at gmail.com
Mon Feb 14 20:32:37 CET 2011
On Mon, 14 Feb 2011 13:00:36 -0500, waldo kitty
<wkitty42 at windstream.net> wrote:
>On 2/14/2011 11:32, Bo Berglund wrote:
>> 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 know if this makes any difference but i'm trudging thru the synapse
>library attempting to work with its mime coding stuff... in my travels thru the
>documentation i note that synapse is synchronous instead of asynchronous (see:
>http://www.ararat.cz/synapse/doku.php/about )... the third and fourth paragraphs
>are important...
>
>since the synapse library has synaser as one of its sub(?)libraries, i assume
>that we're talking about the same library...
>
>the reason i mention the above is because i'm not sure how it might affect what
>you are attempting to do and if buffers are really needed... it has been a while
>since i did any comm coding which, at that time, was done directly to the com
>port or via a FOSSIL driver (which greatly alleviated and abstracted much)...
>
>i hope this helps in some small way...
Gosh, I did not know this....
For TCP/IP work I always use Indy, which is now also available and
maintained for freepascal.
But in the serial comm projects I am used to components that are
non-blocking, which means that a send method returns immediately even
before all data have been sent. Then the data are handled by a thread
maintained by the component internals (or Windows perhaps).
The net effect is that the main application is not blocked and
non-responsive while the transfer takes place.
In my case I am using SdpoSerial because it is included with
FPC/Lazarus. I am sending a data block that potentially can be 1
Mbytes in size over a channel operating at 38400 baud or slower.
Theoretically this means a transfer time of 273 seconds (4.5 min) or
more. My application must meanwhile give some feedback to the user
that the transfer is happening and also how it is proceeding.
So I need to know in the case of SdpoSerial that it is possible
without data loss to write a string of 1 Mbytes size.
I also need to know how I can examine the progress of the transfer so
I can control a progress bar or similar on screen while the transfer
is running.
While the transfer runs my program sits and waits for an ACK coming
back from the other end after it has checked the checksum. That is a
loop with Application.Processmessages, Sleep and a timeout...
In a blocking design this wait loop would of course not have been
needed becaus ethe Write would not return until all data have been
written to the output.
Bo Berglund
More information about the Lazarus
mailing list