Giter Club home page Giter Club logo

gdbus-server's Introduction

D-Bus Server Example

This is a D-Bus server example written with GTK GLib C & Gio.

This is a simple demo for beginners. Please refer to D-Bus API Design Guidelines for production.

Build & Execute

$ meson setup builddir
$ cd builddir
$ meson compile
$ ./gdbus-server

Introspect the Bus' Object

Introspect the bus name io.starnight.dbus_test.TestServer's object /io/starnight/dbus_test/TestObject with dbus-send command:

$ dbus-send --session --print-reply \
            --type=method_call \
            --dest=io.starnight.dbus_test.TestServer \
            /io/starnight/dbus_test/TestObject \
            org.freedesktop.DBus.Introspectable.Introspect
method return time=1711180494.668633 sender=:1.188 -> destination=:1.189 serial=3 reply_serial=2
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
                      "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- GDBus 2.78.4 -->
<node>
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="out"/>
    </method>
    <method name="GetAll">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="a{sv}" name="properties" direction="out"/>
    </method>
    <method name="Set">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="in"/>
    </method>
    <signal name="PropertiesChanged">
      <arg type="s" name="interface_name"/>
      <arg type="a{sv}" name="changed_properties"/>
      <arg type="as" name="invalidated_properties"/>
    </signal>
  </interface>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg type="s" name="xml_data" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Peer">
    <method name="Ping"/>
    <method name="GetMachineId">
      <arg type="s" name="machine_uuid" direction="out"/>
    </method>
  </interface>
  <interface name="io.starnight.dbus_test.TestInterface">
    <method name="Login">
      <arg type="s" name="greeting" direction="in">
      </arg>
      <arg type="s" name="response" direction="out">
      </arg>
    </method>
    <method name="SendMsg">
      <arg type="s" name="msg" direction="in">
      </arg>
    </method>
    <signal name="MsgNotification">
      <arg type="s" name="sender">
      </arg>
      <arg type="s" name="msg">
      </arg>
    </signal>
    <property type="s" name="Title" access="readwrite">
    </property>
  </interface>
</node>
"

Reference

gdbus-server's People

Contributors

starnight avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.