[Lazarus] Cross-compiling for Raspberry Pi2
Martin Schreiber
mse00000 at gmail.com
Wed Sep 23 07:37:55 CEST 2015
On Wednesday 23 September 2015 06:33:02 Bo Berglund wrote:
> On Tue, 22 Sep 2015 10:00:12 +0200, Michael Schnell
>
> <mschnell at lumino.de> wrote:
> >On 09/21/2015 04:42 PM, Bo Berglund wrote:
> >> Unfortunately since the existing code is built on non-blocking serial
> >> communications and events to handle the data reception ...
> >
> >You can convert a blocking socket (or serial port receive) to be a
> >non-blocking Event-triggering (i.e. Delphi-Paradigm based) code by
> >encapsulating the blocking API in a thread and fire an event to the main
> >threads by TThread.Synchronize, TThread.Queue or
> >Application.QueueAsyncCall. Now you can do the complex work in the main
> >Thread event.
>
> That is what I figured I could do with the TInetSocket I found in some
> response here. I have verified it ships with FPC so I don't have to do
> any install or such to get it too.
>
> But since I did not find any documentation "for Dummies" on
> TInetSocket I am not at all sure what I should do to add a therad to
> manage it via an event handler.
The MSEgui socket components (and the pipe reader and RS232 components too
BTW) implement the model Michael describes. They have the event
properties "oninputavailable" and "onsocketbroken". If you like to build
something like this yourself based on "TInetSocket" the code is here:
https://gitlab.com/mseide-msegui/mseide-msegui/tree/master/lib/common/ifi
(msesockets.pas)
https://gitlab.com/mseide-msegui/mseide-msegui/tree/master/lib/common/serialcomm
(msesercomm.pas)
https://gitlab.com/mseide-msegui/mseide-msegui/tree/master/lib/common/kernel
(msepipestream.pas).
Martin
More information about the Lazarus
mailing list