[Lazarus] [LAZARUS] Any Free/Cheap Async Serial Port Component

Michael Schnell mschnell at lumino.de
Thu Apr 3 11:14:20 CEST 2014


On 04/02/2014 10:53 PM, Roberto P. wrote:
> I'd like to point out that CPortLaz is multithreaded

Does it work similar to AsyncPro ?

In fact, IMHO, it would be desirable to have a component that 
_internally_ uses TThread to handle blocking ports (either using just a 
byte-FIDO - this is what AsyncPro does - and/or allowing the user to 
implement a protocol within the Thread's "Execute" ), and when some 
information from the port is received (at least one byte or when the 
protocol handler issues a "ready"), does an Event (aka queued callback) 
to the main thread.

The main thread call of course needs to be "scheduled" using means such 
as TThread.Queue or Application.QueueAsyncCall. (As at the time when 
AsyncPro was released, Delphi did not provide either, AsyncPro uses 
Windows Messages by directly accessing the Windows API, which happily is 
not necessary with Lazarus).

Unfortunately Thread -> Mainthread signaling is only easily provided in 
Lazarus in the GUI based Widget Types. (NoGUI still needs an appropriate 
enhancement.) But of course the user (or even a ComPort Unit) could 
provide a usable Main Loop implementation.

-Michael




More information about the Lazarus mailing list