Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

Nemo QML Plugin D-Bus

API Documentation
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Methods
  • Detailed Description
  • Exposing an object on D-Bus

DBusAdaptor QML Type

Provides a service on D-Bus More...

Import Statement: import Nemo.DBus 2.0
  • List of all members, including inherited members

Properties

  • bus : enum
  • iface : string
  • path : string
  • service : string
  • xml : string

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

bus : enum

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

iface : string

This property holds the interface that this object supports.


path : string

This property holds the object path that this object will be published at.


service : string

This property holds the registered service name. Typically this is in reversed domain-name.


xml : string

This property holds the D-Bus introspection metadata snippet for this object/interface.


Method Documentation

void emitSignal(string name, variant arguments)

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.


  • Legal
  • Contact Us
  • Jollyboys Ltd © 2024

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn