summaryrefslogtreecommitdiff
path: root/src/examples/edbus/connman-list-services.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2013-04-23 11:40:05 -0300
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2013-04-23 12:36:29 -0300
commit4e3804041f8e865e007b2a6a0d45a05f39500c3b (patch)
treea493b9c8f8a610d2667651f3ba81819ed16fbe8c /src/examples/edbus/connman-list-services.c
parent4cf68bf728b5a858ce1c0efac25ded1a49ba8d9d (diff)
Rename edbus->eldbus
git grep -l edbus2 | while read f; do sed -i 's/edbus2/eldbus/g' "$f"; done find . -name '*edbus2*' -exec rename edbus2 eldbus {} \; git grep -l "EDBUS" | while read f; do sed -i 's/EDBUS/ELDBUS/g' "$f"; done git grep -l "EDBus" | while read f; do sed -i 's/EDBus/Eldbus/g' "$f"; done git grep -l "edbus (v2)" | while read f; do sed -i 's/edbus (v2)/eldbus/g' "$f"; done git grep -l "Edbus" | while read f; do sed -i 's/Edbus/Eldbus/g' "$f"; done git grep -l "edbus" | while read f; do sed -i 's/edbus/eldbus/g' "$f"; done find . -name '*edbus*' -exec rename edbus eldbus {} \; find . -name '*EDBus*' -exec rename EDBus Eldbus {} \;
Diffstat (limited to 'src/examples/edbus/connman-list-services.c')
-rw-r--r--src/examples/edbus/connman-list-services.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/src/examples/edbus/connman-list-services.c b/src/examples/edbus/connman-list-services.c
deleted file mode 100644
index 7bd81c2e5f..0000000000
--- a/src/examples/edbus/connman-list-services.c
+++ /dev/null
@@ -1,110 +0,0 @@
1//Compile with:
2// gcc -o connman-list-services connman-list-services.c `pkg-config --cflags --libs edbus2 ecore`
3
4#include "EDBus.h"
5#include <Ecore.h>
6
7static void
8on_services_get(void *data EINA_UNUSED, const EDBus_Message *msg, EDBus_Pending *pending EINA_UNUSED)
9{
10 EDBus_Message_Iter *array, *entry;
11 const char *errname, *errmsg;
12
13 if (edbus_message_error_get(msg, &errname, &errmsg))
14 {
15 fprintf(stderr, "Error: %s %s\n", errname, errmsg);
16 return;
17 }
18
19 if (!edbus_message_arguments_get(msg, "a(oa{sv})", &array))
20 {
21 fprintf(stderr, "Error: could not get array\n");
22 return;
23 }
24
25 while (edbus_message_iter_get_and_next(array, 'r', &entry))
26 {
27 EDBus_Message_Iter *properties, *dict_entry;
28 const char *path;
29
30 if (!edbus_message_iter_arguments_get(entry, "oa{sv}", &path, &properties))
31 {
32 fprintf(stderr, "Error: could not get entry contents\n");
33 return;
34 }
35
36 printf("service: %s\n", path);
37
38 while (edbus_message_iter_get_and_next(properties, 'e', &dict_entry))
39 {
40 EDBus_Message_Iter *variant;
41 const char *key;
42
43 if (!edbus_message_iter_arguments_get(dict_entry, "sv", &key,
44 &variant))
45 {
46 fprintf(stderr,
47 "Error: could not get property contents\n");
48 return;
49 }
50
51 printf("\t%s: type %s\n", key,
52 edbus_message_iter_signature_get(variant));
53
54 /* TODO: get the value from variant */
55 }
56 }
57}
58
59int
60main(void)
61{
62 EDBus_Connection *conn;
63 EDBus_Object *obj;
64 EDBus_Proxy *manager;
65 EDBus_Pending *pending;
66
67 ecore_init();
68 edbus_init();
69
70 conn = edbus_connection_get(EDBUS_CONNECTION_TYPE_SYSTEM);
71 if (!conn)
72 {
73 fprintf(stderr, "Error: could not get system bus\n");
74 return EXIT_FAILURE;
75 }
76
77 obj = edbus_object_get(conn, "net.connman", "/");
78 if (!obj)
79 {
80 fprintf(stderr, "Error: could not get object\n");
81 return EXIT_FAILURE;
82 }
83
84 manager = edbus_proxy_get(obj, "net.connman.Manager");
85 if (!manager)
86 {
87 fprintf(stderr, "Error: could not get proxy\n");
88 return EXIT_FAILURE;
89 }
90
91 pending = edbus_proxy_call(manager, "GetServices", on_services_get, NULL,
92 -1, "");
93
94 if (!pending)
95 {
96 fprintf(stderr, "Error: could not call\n");
97 return EXIT_FAILURE;
98 }
99
100 ecore_main_loop_begin();
101
102 edbus_proxy_unref(manager);
103 edbus_object_unref(obj);
104 edbus_connection_unref(conn);
105
106 edbus_shutdown();
107 ecore_shutdown();
108 return 0;
109}
110