On Fri, 13 Oct 2006, Felipe Monteiro de Carvalho wrote:
> Hello, > > I am writing bindings for DBus (interprocess communication) library, > but I'm a little lost about how to create them. The procedural > low-level code is already working. > > Basically I can have one software that constantly scans the bus in a > loop in search of messages, and another that sends messages. And it > works. > > Now, I would like to write a class to make the use of dbus easier. I > would like to emit a signal when a message arrives, but I don't know > how to deal with the need to periodical checking if a message arrive. I would make the component in 2 levels: - Basic component just has the 'scanbus' procedure. This polls the bus, and triggers the appropriate events when messages have arrived. (call it TDBus or so) - Descendent component (For Lazarus) creates an internal timer. On each timer tick, it calls scanbus. An 'Active' property together with 'Interval' control the timer. (call it TTimedDBus, descends from TDBus) - Other descendent component hooks in the LCL message loop and continuously scans the dbus when the application is idle (much like the actions). (call it TIdleDBus, descends from TDBus) I don't think threading is needed. Anyway, just a proposal... Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal