Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-10

DBus Bindings

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

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.

Should I create the binding class as a separate Thread that checks the bus? Any other ideas?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Florian Klaempfl
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 13 lines
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.

Maybe queuing them and leave it to the user program to poll is enough?

Should I create the binding class as a separate Thread that checks the bus? Any other ideas?

Is there any relation to the async unit?

Reply by email

Michael Van Canneyt
to Felipe Monteiro de Carvalho: I am writing bindings for DBus (interprocess communication) library, but I'm a little…
Felipe Monteiro de Carvalho wrote 13 lines
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.

Reply by email

Marco van de Voort
to Florian Klaempfl: Maybe queuing them and leave it to the user program to poll is enough? Is there any…
Show quoted text 15 lines
> 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. Maybe queuing them and leave it to the user program to poll is enough? > > Should I create the binding class as a separate Thread that checks the > bus? > Any other ideas? Is there any relation to the async unit?

Florian, afaik Sebastian already had DBus stuff. He demonstrated it in Muenchen?

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort
Marco van de Voort wrote
Florian, afaik Sebastian already had DBus stuff. He demonstrated it in Muenchen?

Arg, duplicated work?

Well ... he should have written somewhere that he did it.

Anyway dbus is very new, and the API changed a lot in it's short life. It's only getting to 1.0 now, so it's not that bad. My bindings will also have to be updated to 1.0. Currently they are for 0.62

Felipe Monteiro de Carvalho

Reply by email