10 static E_DBus_Connection *econ = NULL;
13 print_prop(const Eina_Hash *hash, const void *key, void *data, __UNUSED__ void *fdata)
15 const Eina_List *strlist, *l;
17 E_Ukit_Property *p = data;
18 E_Ukit_Properties props;
21 props.properties = (Eina_Hash*)hash;
24 case E_UKIT_PROPERTY_TYPE_STRING:
25 printf("\t%s = [%s]\n", (char*)key, e_ukit_property_string_get(&props, key, &err));
27 case E_UKIT_PROPERTY_TYPE_INT:
28 printf("\t%s = [%d]\n", (char*)key, e_ukit_property_int_get(&props, key, &err));
30 case E_UKIT_PROPERTY_TYPE_UINT32:
31 printf("\t%s = [%llu]\n", (char*)key, (long long unsigned)e_ukit_property_uint32_get(&props, key, &err));
33 case E_UKIT_PROPERTY_TYPE_UINT64:
34 printf("\t%s = [%llu]\n", (char*)key, (long long unsigned)e_ukit_property_uint64_get(&props, key, &err));
36 case E_UKIT_PROPERTY_TYPE_INT64:
37 printf("\t%s = [%lld]\n", (char*)key, (long long int)e_ukit_property_int64_get(&props, key, &err));
39 case E_UKIT_PROPERTY_TYPE_BOOL:
40 printf("\t%s = [%d]\n", (char*)key, e_ukit_property_bool_get(&props, key, &err));
42 case E_UKIT_PROPERTY_TYPE_DOUBLE:
43 printf("\t%s = [%f]\n", (char*)key, e_ukit_property_double_get(&props, key, &err));
45 case E_UKIT_PROPERTY_TYPE_STRLIST:
46 printf("\t%s = [", (char*)key);
47 strlist = e_ukit_property_strlist_get(&props, key, &err);
48 EINA_LIST_FOREACH(strlist, l, y)
49 printf("%s%s", y, (l->next) ? " " : "");
58 hash_props(void *user_data, void *reply_data, DBusError *error)
60 printf("%s:\n", (char*)user_data);
61 E_Ukit_Get_All_Properties_Return *ret = reply_data;
63 if (!ret || dbus_error_is_set(error))
66 dbus_error_free(error);
70 eina_hash_foreach(ret->properties, print_prop, NULL);
76 test_mount(void *user_data, void *reply_data, DBusError *error)
78 E_Ukit_Get_Property_Return *ret = reply_data;
80 if (!ret || dbus_error_is_set(error))
83 dbus_error_free(error);
89 printf("[%s] is mounted!\n\tGrabbing more stats to fill your screen...\n", (char*)user_data);
90 e_udisks_get_all_properties(econ, user_data, hash_props, strdup(user_data));
92 else printf("[%s] is not mounted!\n", (char*)user_data);
97 print_devs(void *user_data, void *reply_data, DBusError *error)
99 E_Ukit_Get_All_Devices_Return *ret = reply_data;
103 if (!ret || !ret->strings || dbus_error_is_set(error))
106 dbus_error_free(error);
110 EINA_LIST_FOREACH(ret->strings, l, udi)
112 if (!strcmp((char*)user_data, "disks"))
113 e_udisks_get_property(econ, udi, "DeviceIsMounted", test_mount, strdup(udi));
115 e_upower_get_all_properties(econ, udi, hash_props, strdup(udi));
121 my_quit(__UNUSED__ void *data)
123 ecore_main_loop_quit();
124 return ECORE_CALLBACK_CANCEL;
134 econ = e_dbus_bus_get(DBUS_BUS_SYSTEM);
137 e_udisks_get_all_devices(econ, print_devs, strdup("disks"));
138 e_upower_get_all_devices(econ, print_devs, strdup("power"));
140 /*add a short timer to quit to try and ensure that all the tests run*/
141 ecore_timer_add(1, my_quit, NULL);
142 ecore_main_loop_begin();
144 if (econ) e_dbus_connection_close(econ);