1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
To developers.
Interacting with Skype over DBus/GLib.
Setting up the "Notify" method call so we can receive messages from the Skype.
Step 0) Define a XML file that descripes the method signatures.
Ref:http://lists.freedesktop.org/archives/dbus/2010-December/013910.html
http://dbus.freedesktop.org/doc/dbus-tutorial.html#glib-server
Create a XML definition file.
Study: xml/skype-service-object.xml.
<?xml version="1.0" encoding="UTF-8" ?>
<node>
<interface name="com.Skype.API.Client">
<method name="Notify">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="skype_service_notify_callback"/>
<arg type="s" name="message" direction="in"/>
</method>
</interface>
</node>
To notify its clients, Skype will call the skype_service_notify_callback(...) method and it sends
one "in" argument of type "s" string. It takes no "out" arguments.
----
Step 1) Then use the dbus-binding-tool to generate a header file from the XML. Run
$ dbus-binding-tool --prefix=server_object --mode=glib-server skype-service-object.xml > skype-service-object-glue.h
Include the generated header file (skype-service-object-glue.h) to our project.
Study:
src/skype-service-object-glue.h.
----
Step 2) Create a new GObject where you implement the skype_service_notify_callback(...) method.
Ref:http://library.gnome.org/devel/gobject/stable/
http://live.gnome.org/DBusGlibBindings
Study:
src/skype-service.h and
src/skype-service.c.
----
Step 3) Create a service object and setup the method callbacks.
See the skype_setup_notify_methods() function in src/dbus-skype.c.
----
Step 4) Module to interact with the Skype over DBus.
Study:
src/dbus-skype.c
|