Nemo QML Plugin D-Bus
API DocumentationDBusAdaptor QML Type
Provides a service on D-Bus More...
Import Statement: | import Nemo.DBus 2.0 |
Properties
Methods
- void emitSignal(string name, variant arguments)
Detailed Description
The DBusAdaptor object can be used to provide a D-Bus service on the system or session bus. A service can be called from other applications on the system as long as the service is active.
DBusAdaptor is intended to provide a means of exposing simple objects over D-Bus. Property values and method arguments are automatically converted between QML/JS and D-Bus. There is limited control over this process. For more complex use cases it is recommended to use C++ and the Qt DBus module.
Exposing an object on D-Bus
The following code demonstrates how to expose an object on the session bus. The com.example.service
service name will be registered and an object at /com/example/service
will be registered supporting the com.example.service
interface in addition to the common interfaces org.freedesktop.DBus.Properties
, org.freedesktop.DBus.Introspectable
and org.freedesktop.DBus.Peer
.
All properties and methods of the DBusAdaptor will be accessible via D-Bus. Only those properties and methods declared in the xml will be discoverable via D-Bus introspection.
import QtQuick 2.0 import Nemo.DBus 2.0 Item { DBusAdaptor { id: dbus property bool needUpdate: true service: 'com.example.service' iface: 'com.example.service' path: '/com/example/service' xml: ' <interface name="com.example.service">\n' + ' <method name="update" />\n' + ' <property name="needUpdate" type="b" access="readwrite" />\n' + ' </interface>\n' function update() { console.log("Update called") } } }
Property Documentation
This property holds whether to use the session or system D-Bus.
- DBus.SessionBus - The D-Bus session bus
- DBus.SystemBus - The D-Bus system bus
This property holds the registered service name. Typically this is in reversed domain-name.
This property holds the D-Bus introspection metadata snippet for this object/interface.
Method Documentation
Emit a signal with the given name and arguments. If arguments is undefined (the default if not specified), then the signal will be emitted without arguments.