blob: de32957fd317f7a62056edbcbbe5a0aa5078ef2a (
plain)
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
|
#include <dbus/dbus.h>
#include <stdio.h>
#include "watch.h"
int
main (int argc,
char **argv)
{
DBusConnection *connection;
DBusResultCode result;
DBusMessage *message;
if (argc < 2)
{
fprintf (stderr, "Give the server address as an argument\n");
return 1;
}
connection = dbus_connection_open (argv[1], &result);
if (connection == NULL)
{
fprintf (stderr, "Failed to open connection to %s: %s\n",
argv[1], dbus_result_to_string (result));
return 1;
}
setup_connection (connection);
/* Send a message to get things going */
message = dbus_message_new ("org.freedesktop.DBus.Test", "org.freedesktop.DBus.Test");
if (!dbus_connection_send (connection,
message,
NULL))
fprintf (stderr, "No memory to send reply\n");
dbus_message_unref (message);
do_mainloop ();
dbus_connection_unref (connection);
return 0;
}
|