A Simple example of how to create a DBUS service.

sathishkumar sivagurunathan sathish1000 at gmail.com
Tue Oct 22 09:11:49 PDT 2013


Thanks Leonel for the answer,

As mentioned, I followed the exact procedure.

As a first step, I created an app that needs to be called, compiled it and
the moved the executable file ComMain.out to the exec folder.

The ComMain.out was made executable using chmod +x ComMain.out.

I created the service file and moved it usr/share/dbus-1.0/services folder.

The service files is listed below.. The file is named as
org.pulseaudio.genivi.RoutingSender.service.

# DBus service activation config
[D-BUS Service]
Name=org.pulseaudio.genivi.RoutingSender
Exec=/usr/bin/genivi/ComMain.out

Then using the dbus send command, I invoke the dbus

dbus-send --dest='org.pulseaudio.genivi'        \
            /org/pulseaudio/genivi/RoutingSender              \
            org.pulseaudio.genivi.RoutingSender   \
            int32:47

But I am not able to receive the desired result..

1) I am not able see the bus name when I invoke a "QDBUS" command on the
terminal..
2) I have tried to create a file in my program. When my program is invoked,
no file is generated in the folder..

I tried to restart the system to check incase the dbus daemon is not
picking my service.

Am I doing something wrong. Is there any way to check what I am doing wrong
??

Thanks,
Sathish..



On 18 October 2013 22:39, Leonel Florin Selles <
leonel.florin at cfg.jovenclub.cu> wrote:

> **
>
> well man, a service in dbus until I know, is the ability that dbus have to
> open closed applications when some one try to invoke some method on some
> one of his interfaces.
>
> For example, I have an app that public the interface "com.example.Hello"
> that have the method "SayHello", and that app is a dbus service, so, when
> this app is close, and some other app try to call the "SayHello" method,
> the dbus will open that app and then invoke the method.
> To public an app as a dbus service the only thing you need to do is create
> a file with the "well know name" of your app in the dbus, for example
>
> com.example.Hello.service
>
> and insert this line within the file
>
> [D-BUS Service]
> Name="well know name of your app"
> Exec="address in the file system to the binary of your app"
>
> example
>
>
> [D-BUS Service]
> Name=com.example.Hello
> Exec=/usr/bin/myapp
>
> and copy this file to /usr/share/dbus-1/services/
>
>
>
> El 2013-10-18 11:06, sathishkumar sivagurunathan escribió:
>
> Hello,
>
> I have been trying to create a DBUS service for my program so that an
> application can contact it through DBUS.
>
> I have gone through this tutorial
> http://kkaempf.blogspot.in/2009/03/d-bus-service-on-demand.html.
>
> But as I go through this process and run qdbus command in linux, the
> service I had created is not listed on terminal.
>
> So if somebody can list the procedure to create a DBUS service, it would
> be helpful.
>
> Thanks,
> Sathish
>
> --
> Este mensaje ha sido analizado por *MailScanner*<http://www.mailscanner.info/>
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.
>
> _______________________________________________
> dbus mailing listdbus at lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/dbus
>
>
> --
>
>
> --
> Este mensaje ha sido analizado por *MailScanner*<http://www.mailscanner.info/>
> en busca de virus y otros contenidos peligrosos,
> y se considera que está limpio.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20131022/193ad403/attachment.html>


More information about the dbus mailing list