Set the Service name of an own service

hannehomuth hannehomuth1 at gmx.de
Wed Jul 9 07:14:06 PDT 2008


Hello Everyone,

now that I used Dbus as a "Client" I wanna, or better to say have to, write
my own Dbus Service.
I use java and i've created a little app which creates my own Object which
implements the DBusInterface and the Introspectable Interface. Hier some
code.

package picolcddbusdaemon;

import org.freedesktop.DBus.Introspectable;
import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusInterfaceName;

/**
 *
 * @author jhomuth
 */
@DBusInterfaceName("de.sourcepark.PicoLcd")
public class PicoLCDRemoteObject implements DBusInterface, Introspectable {

    
    public String Introspect() {
        String introspectString;
        introspectString = "<node>" +
                           "<interface name =
\"org.freedektop.Dbus.Introspectable\">" +
                           "<method name = \"Introspect\">" +
                           "<arg name = \"data\" direction = \"out\" type =
\"s\"/>" +
                           "</method>" +
                           "</interface>"+
                           "<interface name =
\"de.sourcepark.Dbus.PicoLcd\">" +
                           "<method name = \"sayHello\">" +
                           "</method>" +
                           "</interface>" +
                           "</node>";
        return introspectString;
    }

    public boolean isRemote() {
        return true;
    }
    
    public void sayHello()
    {
        System.out.println("Hello");
    }

}

In the main method (not seen here) I opened a Connection and exported my
Object to the Dbus. And it worked. When I open the D-Feet Dbus Debugger (a
little tool to check whats going on on the dbus) I see my Object with the
object path and all methods, but the name of my service is something like
:1.15 or :1.10 or something else. It raises the more I start my app. This is
the unique name I think. But how kann I set a name like (my.own.Dbusservice
or org.freedesktop.Notifications)?
I've already declared a .service file to /usr/share/dbus-1/services which
looks like this.

[D-BUS Service]
Name=de.sourcepark.PicoLcd
Exec=/home/jhomuth/NetBeansProjects/PicoLCDDbusDaemon/dist/PicoLCDDbusDaemon.jar

I'm not sure if the Exec Path is set right but I think that does not matter
yet.

Do you know how to set the service name ?
In Code?
By an Interface?
I don't know!

Thx for suggestions and sorry about my bad english



-- 
View this message in context: http://www.nabble.com/Set-the-Service-name-of-an-own-service-tp18362590p18362590.html
Sent from the Free Desktop - dbus mailing list archive at Nabble.com.



More information about the dbus mailing list