8 _method_success_check(void *data, DBusMessage *msg, DBusError *error)
10 const char *name = data;
12 if ((!error) || (!dbus_error_is_set(error)))
14 printf("SUCCESS: method %s() finished successfully.\n", name);
18 printf("FAILURE: method %s() finished with error: %s %s\n",
19 name, error->name, error->message);
20 dbus_error_free(error);
24 _elements_print(E_Connman_Element **elements, unsigned int count)
27 for (i = 0; i < count; i++)
29 printf("--- element %d:\n", i);
30 e_connman_element_print(stdout, elements[i]);
33 printf("END: all elements count = %u\n", count);
37 _strings_print(const char **strings, unsigned int count)
40 for (i = 0; i < count; i++)
41 printf("--- strings %d: \"%s\"\n", i, strings[i]);
43 printf("END: all strings count = %u\n", count);
47 _on_element_add(void *data, int type, void *info)
49 E_Connman_Element *element = info;
50 printf(">>> %s\n", element->path);
55 _on_element_del(void *data, int type, void *info)
57 E_Connman_Element *element = info;
58 printf("<<< %s\n", element->path);
63 _on_element_updated(void *data, int type, void *info)
65 E_Connman_Element *element = info;
66 printf("!!! %s\n", element->path);
67 e_connman_element_print(stderr, element);
72 _on_cmd_quit(char *cmd, char *args)
74 fputs("Bye!\n", stderr);
75 ecore_main_loop_quit();
80 _on_cmd_sync(char *cmd, char *args)
82 e_connman_manager_sync_elements();
104 _on_cmd_get_all(char *cmd, char *args)
106 E_Connman_Element **elements;
117 ret = e_connman_elements_get_all_type(type, &count, &elements);
119 ret = e_connman_elements_get_all(&count, &elements);
122 fputs("ERROR: could not get elements\n", stderr);
125 printf("BEG: all elements type=%s count = %d\n", type, count);
126 _elements_print(elements, count);
132 static E_Connman_Element *
133 _element_from_args(char *args, char **next_args)
135 E_Connman_Element *element;
139 fputs("ERROR: missing element path\n", stderr);
144 *next_args = _tok(args);
145 element = e_connman_element_get(args);
147 fprintf(stderr, "ERROR: no element called \"%s\".\n", args);
153 _on_cmd_print(char *cmd, char *args)
156 E_Connman_Element *element = _element_from_args(args, &next_args);
158 e_connman_element_print(stdout, element);
163 _on_cmd_get_properties(char *cmd, char *args)
166 E_Connman_Element *element = _element_from_args(args, &next_args);
168 e_connman_element_properties_sync(element);
173 _on_cmd_property_set(char *cmd, char *args)
175 char *next_args, *name, *p;
176 E_Connman_Element *element = _element_from_args(args, &next_args);
188 fputs("ERROR: missing parameters name, type and value.\n", stderr);
196 fputs("ERROR: missing parameters type and value.\n", stderr);
203 fputs("ERROR: missing parameter value.\n", stderr);
210 case DBUS_TYPE_BOOLEAN:
211 vlong = !!atol(next_args);
212 value = (void *)vlong;
213 fprintf(stderr, "DBG: boolean is: %ld\n", vlong);
215 case DBUS_TYPE_UINT16:
216 vu16 = strtol(next_args, &p, 0);
219 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
223 fprintf(stderr, "DBG: u16 is: %hu\n", vu16);
225 case DBUS_TYPE_UINT32:
226 vu32 = strtol(next_args, &p, 0);
229 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
233 fprintf(stderr, "DBG: u16 is: %u\n", vu32);
235 case DBUS_TYPE_STRING:
236 case DBUS_TYPE_OBJECT_PATH:
237 p = next_args + strlen(next_args);
240 while (p > next_args && isspace(*p))
244 fprintf(stderr, "ERROR: invalid string \"%s\".\n", next_args);
248 fprintf(stderr, "DBG: string is: \"%s\"\n", next_args);
251 fprintf(stderr, "ERROR: don't know how to parse type '%c' (%d)\n",
256 fprintf(stderr, "set_property %s [%p] %s %c %p...\n",
257 args, element, name, type, value);
258 if (!e_connman_element_property_set(element, name, type, value))
260 fputs("ERROR: error setting property.\n", stderr);
267 /* Manager Commands */
270 _on_cmd_manager_get(char *cmd, char *args)
272 E_Connman_Element *element;
273 element = e_connman_manager_get();
274 e_connman_element_print(stderr, element);
279 _on_cmd_manager_get_profiles(char *cmd, char *args)
282 E_Connman_Element **profiles;
284 if (!e_connman_manager_profiles_get(&count, &profiles))
286 fputs("ERROR: can't get profiles\n", stderr);
289 printf("BEG: all manager profiles elements count = %d\n", count);
290 _elements_print(profiles, count);
295 _on_cmd_manager_get_devices(char *cmd, char *args)
298 E_Connman_Element **devices;
300 if (!e_connman_manager_devices_get(&count, &devices))
302 fputs("ERROR: can't get devices\n", stderr);
305 printf("BEG: all manager devices elements count = %d\n", count);
306 _elements_print(devices, count);
311 _on_cmd_manager_get_services(char *cmd, char *args)
314 E_Connman_Element **services;
316 if (!e_connman_manager_services_get(&count, &services))
318 fputs("ERROR: can't get services\n", stderr);
321 printf("BEG: all manager services elements count = %d\n", count);
322 _elements_print(services, count);
327 _on_cmd_manager_register_agent(char *cmd, char *args)
333 fputs("ERROR: missing the object path\n", stderr);
338 if (e_connman_manager_agent_register(path, NULL, NULL))
339 printf(":::Registering agent %s...\n", path);
341 fprintf(stderr, "ERROR: can't register agent %s\n", path);
347 _on_cmd_manager_unregister_agent(char *cmd, char *args)
353 fputs("ERROR: missing the object path\n", stderr);
358 if (e_connman_manager_agent_unregister(path, NULL, NULL))
359 printf(":::Unregistering agent %s...\n", path);
361 fprintf(stderr, "ERROR: can't unregister agent %s\n", path);
367 _on_cmd_manager_get_state(char *cmd, char *args)
370 if (e_connman_manager_state_get(&state))
371 printf(":::Manager state = \"%s\"\n", state);
373 fputs("ERROR: can't get manager state\n", stderr);
378 _on_cmd_manager_get_offline_mode(char *cmd, char *args)
381 if (e_connman_manager_offline_mode_get(&offline))
382 printf(":::Manager Offline Mode = %hhu\n", offline);
384 fputs("ERROR: can't get manager offline mode\n", stderr);
389 _on_cmd_manager_set_offline_mode(char *cmd, char *args)
394 fputs("ERROR: missing the offline mode value\n", stderr);
398 offline = !!atol(args);
399 if (e_connman_manager_offline_mode_set(offline, NULL, NULL))
400 printf(":::Manager Offline Mode set to %hhu\n", offline);
402 fputs("ERROR: can't set manager offline mode\n", stderr);
407 _on_cmd_manager_request_scan(char *cmd, char *args)
415 if (e_connman_manager_request_scan(args, NULL, NULL))
416 printf(":::Manager Request Scan for %s\n", args[0] ? args : "<all>");
418 fputs("ERROR: can't request scan on manager\n", stderr);
423 _on_cmd_manager_technology_enable(char *cmd, char *args)
427 fputs("ERROR: missing the technology type\n", stderr);
432 if (e_connman_manager_technology_enable(args, NULL, NULL))
433 printf(":::Manager Enable Technology %s\n", args);
435 fputs("ERROR: can't enable technology on manager\n", stderr);
440 _on_cmd_manager_technology_disable(char *cmd, char *args)
444 fputs("ERROR: missing the technology type\n", stderr);
449 if (e_connman_manager_technology_disable(args, NULL, NULL))
450 printf(":::Manager Disable Technology %s\n", args);
452 fputs("ERROR: can't disable technology on manager\n", stderr);
457 _on_cmd_manager_get_technologies_available(char *cmd, char *args)
459 const char **strings;
462 if (!e_connman_manager_technologies_available_get(&count, &strings))
463 fputs("ERROR: can't get available technologies\n", stderr);
466 printf("BEG: available technologies count = %u\n", count);
467 _strings_print(strings, count);
474 _on_cmd_manager_get_technologies_enabled(char *cmd, char *args)
476 const char **strings;
479 if (!e_connman_manager_technologies_enabled_get(&count, &strings))
480 fputs("ERROR: can't get enabled technologies\n", stderr);
483 printf("BEG: enabled technologies count = %u\n", count);
484 _strings_print(strings, count);
491 _on_cmd_manager_get_technologies_connected(char *cmd, char *args)
493 const char **strings;
496 if (!e_connman_manager_technologies_connected_get(&count, &strings))
497 fputs("ERROR: can't get connected technologies\n", stderr);
500 printf("BEG: connected technologies count = %u\n", count);
501 _strings_print(strings, count);
508 _on_cmd_manager_profile_remove(char *cmd, char *args)
510 E_Connman_Element *e;
514 fputs("ERROR: missing the profile path\n", stderr);
519 e = e_connman_profile_get(args);
520 if (e_connman_manager_profile_remove(e, NULL, NULL))
521 printf(":::Manager Remove Profile %s\n", args);
523 fputs("ERROR: can't remove profile from manager\n", stderr);
528 _on_cmd_manager_profile_get_active(char *cmd, char *args)
530 E_Connman_Element *e;
532 if (!e_connman_manager_profile_active_get(&e))
533 fputs("ERROR: can't active_get profile from manager\n", stderr);
535 e_connman_element_print(stderr, e);
540 _on_cmd_manager_profile_set_active(char *cmd, char *args)
542 E_Connman_Element *e;
546 fputs("ERROR: missing the profile path\n", stderr);
551 e = e_connman_profile_get(args);
552 if (e_connman_manager_profile_active_set(e, NULL, NULL))
553 printf(":::Manager Active Profile set to %s\n", args);
555 fputs("ERROR: can't set active profile\n", stderr);
559 /* Device Commands */
561 _on_cmd_device_propose_scan(char *cmd, char *args)
564 E_Connman_Element *e;
568 fputs("ERROR: missing the device path\n", stderr);
574 e = e_connman_device_get(path);
575 if (e_connman_device_propose_scan(e, NULL, NULL))
576 printf(":::Proposing scan %s...\n", path);
578 fputs("ERROR: can't propose scan\n", stderr);
583 _on_cmd_device_get_address(char *cmd, char *args)
585 const char *address, *path;
586 E_Connman_Element *e;
590 fputs("ERROR: missing the device path\n", stderr);
596 e = e_connman_device_get(path);
597 if (e_connman_device_address_get(e, &address))
598 printf(":::Device %s Address = \"%s\"\n", path, address);
600 fputs("ERROR: can't get device address\n", stderr);
605 _on_cmd_device_get_name(char *cmd, char *args)
607 const char *name, *path;
608 E_Connman_Element *e;
612 fputs("ERROR: missing the device path\n", stderr);
618 e = e_connman_device_get(path);
619 if (e_connman_device_name_get(e, &name))
620 printf(":::Device %s Name = \"%s\"\n", path, name);
622 fputs("ERROR: can't get device name\n", stderr);
627 _on_cmd_device_get_type(char *cmd, char *args)
629 const char *type, *path;
630 E_Connman_Element *e;
634 fputs("ERROR: missing the device path\n", stderr);
640 e = e_connman_device_get(path);
641 if (e_connman_device_type_get(e, &type))
642 printf(":::Device %s Type = \"%s\"\n", path, type);
644 fputs("ERROR: can't get device type\n", stderr);
649 _on_cmd_device_get_interface(char *cmd, char *args)
651 const char *interface, *path;
652 E_Connman_Element *e;
656 fputs("ERROR: missing the device path\n", stderr);
662 e = e_connman_device_get(path);
663 if (e_connman_device_interface_get(e, &interface))
664 printf(":::Device %s Interface = \"%s\"\n", path, interface);
666 fputs("ERROR: can't get device interface\n", stderr);
671 _on_cmd_device_get_powered(char *cmd, char *args)
675 E_Connman_Element *e;
679 fputs("ERROR: missing the device path\n", stderr);
685 e = e_connman_device_get(path);
686 if (e_connman_device_powered_get(e, &powered))
687 printf(":::Device %s Powered = %hhu\n", path, powered);
689 fputs("ERROR: can't get device powered\n", stderr);
694 _on_cmd_device_set_powered(char *cmd, char *args)
696 char *device_path, *next_args;
698 E_Connman_Element *e;
702 fputs("ERROR: missing the device path\n", stderr);
706 next_args = _tok(args);
709 fputs("ERROR: missing the powered value\n", stderr);
712 powered = !!atol(next_args);
714 e = e_connman_device_get(device_path);
715 if (e_connman_device_powered_set(e, powered, NULL, NULL))
716 printf(":::Device %s powered set to %hhu\n", device_path, powered);
718 fputs("ERROR: can't set device powered\n", stderr);
723 _on_cmd_device_get_scan_interval(char *cmd, char *args)
726 unsigned short scan_interval;
727 E_Connman_Element *e;
731 fputs("ERROR: missing the device path\n", stderr);
737 e = e_connman_device_get(path);
738 if (e_connman_device_scan_interval_get(e, &scan_interval))
739 printf(":::Device %s ScanInterval = %hu\n", path, scan_interval);
741 fputs("ERROR: can't get device scan interval\n", stderr);
746 _on_cmd_device_set_scan_interval(char *cmd, char *args)
748 char *device_path, *next_args, *p;
749 unsigned short scan_interval;
750 E_Connman_Element *e;
754 fputs("ERROR: missing the device path\n", stderr);
758 next_args = _tok(args);
761 fputs("ERROR: missing the scan interval value\n", stderr);
764 scan_interval = strtol(next_args, &p, 0);
767 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
771 e = e_connman_device_get(device_path);
772 if (e_connman_device_scan_interval_set(e, scan_interval, NULL, NULL))
773 printf(":::Device %s scan interval set to %hu\n", device_path, scan_interval);
775 fputs("ERROR: can't set device scan interval\n", stderr);
780 _on_cmd_device_get_scanning(char *cmd, char *args)
784 E_Connman_Element *e;
788 fputs("ERROR: missing the device path\n", stderr);
794 e = e_connman_device_get(path);
795 if (e_connman_device_scanning_get(e, &scanning))
796 printf(":::Device %s Scanning = %hhu\n", path, scanning);
798 fputs("ERROR: can't get device scanning\n", stderr);
803 _on_cmd_device_get_networks(char *cmd, char *args)
805 E_Connman_Element **networks;
808 E_Connman_Element *e;
812 fputs("ERROR: missing the device path\n", stderr);
818 e = e_connman_device_get(path);
819 if (!e_connman_device_networks_get(e, &count, &networks))
821 fputs("ERROR: can't get networks\n", stderr);
825 printf("BEG: all device network elements count = %d\n", count);
826 _elements_print(networks, count);
830 /* Profile Commands */
833 _on_cmd_profile_get_name(char *cmd, char *args)
835 const char *name, *path;
836 E_Connman_Element *e;
840 fputs("ERROR: missing the profile path\n", stderr);
846 e = e_connman_profile_get(path);
847 if (e_connman_profile_name_get(e, &name))
848 printf(":::Profile %s Name = \"%s\"\n", path, name);
850 fputs("ERROR: can't get profile name\n", stderr);
855 _on_cmd_profile_set_name(char *cmd, char *args)
857 char *path, *next_args;
858 E_Connman_Element *e;
862 fputs("ERROR: missing the profile path\n", stderr);
866 next_args = _tok(args);
869 fputs("ERROR: missing the offline mode value\n", stderr);
874 e = e_connman_profile_get(path);
875 if (e_connman_profile_name_set(e, next_args, NULL, NULL))
876 printf(":::Profile %s Name set to %s\n", path, next_args);
878 fputs("ERROR: can't set profile name\n", stderr);
883 _on_cmd_profile_get_offline_mode(char *cmd, char *args)
887 E_Connman_Element *e;
891 fputs("ERROR: missing the profile path\n", stderr);
897 e = e_connman_profile_get(path);
898 if (e_connman_profile_offline_mode_get(e, &offline))
899 printf(":::Profile %s Offline Mode = %hhu\n", path, offline);
901 fputs("ERROR: can't get profile offline mode\n", stderr);
906 _on_cmd_profile_set_offline_mode(char *cmd, char *args)
908 char *path, *next_args;
910 E_Connman_Element *e;
914 fputs("ERROR: missing the profile path\n", stderr);
918 next_args = _tok(args);
921 fputs("ERROR: missing the offline mode value\n", stderr);
925 offline = !!atol(next_args);
927 e = e_connman_profile_get(path);
928 if (e_connman_profile_offline_mode_set(e, offline, NULL, NULL))
929 printf(":::Profile %s Offline Mode set to %hhu\n", path, offline);
931 fputs("ERROR: can't set profile offline mode\n", stderr);
936 _on_cmd_profile_get_services(char *cmd, char *args)
938 E_Connman_Element **services;
939 E_Connman_Element *e;
945 fputs("ERROR: missing the profile path\n", stderr);
951 e = e_connman_profile_get(path);
952 if (!e_connman_profile_services_get(e, &count, &services))
954 fputs("ERROR: can't get services\n", stderr);
957 printf("BEG: all profile services count = %d\n", count);
958 _elements_print(services, count);
963 /* Network Commands */
966 _on_cmd_network_get_address(char *cmd, char *args)
968 const char *address, *path;
969 E_Connman_Element *e;
973 fputs("ERROR: missing the network path\n", stderr);
979 e = e_connman_network_get(path);
980 if (e_connman_network_address_get(e, &address))
981 printf(":::Network %s Address = \"%s\"\n", path, address);
983 fputs("ERROR: can't get network address\n", stderr);
988 _on_cmd_network_get_name(char *cmd, char *args)
990 const char *name, *path;
991 E_Connman_Element *e;
995 fputs("ERROR: missing the network path\n", stderr);
1001 e = e_connman_network_get(path);
1002 if (e_connman_network_name_get(e, &name))
1003 printf(":::Network %s Name = \"%s\"\n", path, name);
1005 fputs("ERROR: can't get network name\n", stderr);
1010 _on_cmd_network_get_connected(char *cmd, char *args)
1014 E_Connman_Element *e;
1018 fputs("ERROR: missing the network path\n", stderr);
1024 e = e_connman_network_get(path);
1025 if (e_connman_network_connected_get(e, &connected))
1026 printf(":::Network %s Connected = %hhu\n", path, connected);
1028 fputs("ERROR: can't get network connected\n", stderr);
1033 _on_cmd_network_get_strength(char *cmd, char *args)
1036 unsigned char strength;
1037 E_Connman_Element *e;
1041 fputs("ERROR: missing the network path\n", stderr);
1047 e = e_connman_network_get(path);
1048 if (e_connman_network_strength_get(e, &strength))
1049 printf(":::Network %s Strength = %#02hhx (%d)\n", path, strength, strength);
1051 fputs("ERROR: can't get network strength\n", stderr);
1056 _on_cmd_network_get_frequency(char *cmd, char *args)
1059 unsigned short frequency;
1060 E_Connman_Element *e;
1064 fputs("ERROR: missing the network path\n", stderr);
1070 e = e_connman_network_get(path);
1071 if (e_connman_network_frequency_get(e, &frequency))
1072 printf(":::Network %s Frequency = %#04hx (%d)\n", path, frequency, frequency);
1074 fputs("ERROR: can't get network frequency\n", stderr);
1079 _on_cmd_network_get_device(char *cmd, char *args)
1081 E_Connman_Element *e, *device;
1086 fputs("ERROR: missing the network path\n", stderr);
1092 e = e_connman_network_get(path);
1093 if (!e_connman_network_device_get(e, &device))
1094 fputs("ERROR: can't get network device\n", stderr);
1096 e_connman_element_print(stderr, device);
1101 _on_cmd_network_get_wifi_ssid(char *cmd, char *args)
1103 unsigned char *bytes;
1105 unsigned int i, count;
1106 E_Connman_Element *e;
1110 fputs("ERROR: missing the network path\n", stderr);
1116 e = e_connman_network_get(path);
1117 if (e_connman_network_wifi_ssid_get(e, &count, &bytes))
1119 printf(":::Network %s Wifi SSID = ", path);
1120 for (i = 0; i < count; i++)
1121 printf("%#02hhx (\"%c\"), ", bytes[i], bytes[i]);
1125 fputs("ERROR: can't get network wifi ssid\n", stderr);
1130 _on_cmd_network_get_wifi_mode(char *cmd, char *args)
1132 const char *wifi_mode, *path;
1133 E_Connman_Element *e;
1137 fputs("ERROR: missing the network path\n", stderr);
1143 e = e_connman_network_get(path);
1144 if (e_connman_network_wifi_mode_get(e, &wifi_mode))
1145 printf(":::Network %s Wifi Mode = \"%s\"\n", path, wifi_mode);
1147 fputs("ERROR: can't get network wifi mode\n", stderr);
1152 _on_cmd_network_get_wifi_security(char *cmd, char *args)
1154 const char *wifi_security, *path;
1155 E_Connman_Element *e;
1159 fputs("ERROR: missing the network path\n", stderr);
1165 e = e_connman_network_get(path);
1166 if (e_connman_network_wifi_security_get(e, &wifi_security))
1167 printf(":::Network %s Wifi Security = \"%s\"\n", path, wifi_security);
1169 fputs("ERROR: can't get network wifi security\n", stderr);
1174 _on_cmd_network_get_wifi_passphrase(char *cmd, char *args)
1176 const char *wifi_passphrase, *path;
1177 E_Connman_Element *e;
1181 fputs("ERROR: missing the network path\n", stderr);
1187 e = e_connman_network_get(path);
1188 if (e_connman_network_wifi_passphrase_get(e, &wifi_passphrase))
1189 printf(":::Network %s Wifi Passphrase = \"%s\"\n", path, wifi_passphrase);
1191 fputs("ERROR: can't get network wifi passphrase\n", stderr);
1196 _on_cmd_network_get_wifi_channel(char *cmd, char *args)
1199 E_Connman_Element *e;
1200 unsigned short wifi_channel;
1204 fputs("ERROR: missing the network path\n", stderr);
1210 e = e_connman_network_get(path);
1211 if (e_connman_network_wifi_channel_get(e, &wifi_channel))
1212 printf(":::Network %s Wifi Channel = %#02hx (%d)\n", path, wifi_channel, wifi_channel);
1214 fputs("ERROR: can't get network wifi channel\n", stderr);
1219 _on_cmd_network_get_wifi_eap(char *cmd, char *args)
1221 const char *wifi_eap, *path;
1222 E_Connman_Element *e;
1226 fputs("ERROR: missing the network path\n", stderr);
1232 e = e_connman_network_get(path);
1233 if (e_connman_network_wifi_eap_get(e, &wifi_eap))
1234 printf(":::Network %s Wifi EAP = \"%s\"\n", path, wifi_eap);
1236 fputs("ERROR: can't get network wifi eap\n", stderr);
1240 /* Services Commands */
1242 _on_cmd_service_connect(char *cmd, char *args)
1245 E_Connman_Element *e;
1249 fputs("ERROR: missing the service path\n", stderr);
1255 e = e_connman_service_get(path);
1256 if (e_connman_service_connect(e, NULL, NULL))
1257 printf(":::Connecting to Service %s...\n", path);
1259 fputs("ERROR: can't connect to service\n", stderr);
1264 _on_cmd_service_disconnect(char *cmd, char *args)
1267 E_Connman_Element *e;
1271 fputs("ERROR: missing the service path\n", stderr);
1277 e = e_connman_service_get(path);
1278 if (e_connman_service_disconnect(e, NULL, NULL))
1279 printf(":::Disconnecting Service %s...\n", path);
1281 fputs("ERROR: can't disconnect service\n", stderr);
1286 _on_cmd_service_remove(char *cmd, char *args)
1289 E_Connman_Element *e;
1293 fputs("ERROR: missing the service path\n", stderr);
1299 e = e_connman_service_get(path);
1300 if (e_connman_service_remove(e, NULL, NULL))
1301 printf(":::Removing Service %s...\n", path);
1303 fputs("ERROR: can't remove service\n", stderr);
1308 _on_cmd_service_move_before(char *cmd, char *args)
1310 char *path, *service_path;
1311 E_Connman_Element *e;
1315 fputs("ERROR: missing the service path\n", stderr);
1318 service_path = args;
1323 fputs("ERROR: missing the object service\n", stderr);
1328 e = e_connman_service_get(service_path);
1329 if (e_connman_service_move_before(e, path, NULL, NULL))
1330 printf(":::Moving before %s...\n", path);
1332 fputs("ERROR: can't move before\n", stderr);
1337 _on_cmd_service_move_after(char *cmd, char *args)
1339 char *path, *service_path;
1340 E_Connman_Element *e;
1344 fputs("ERROR: missing the service path\n", stderr);
1347 service_path = args;
1352 fputs("ERROR: missing the object service\n", stderr);
1357 e = e_connman_service_get(service_path);
1358 if (e_connman_service_move_after(e, path, NULL, NULL))
1359 printf(":::Moving after %s...\n", path);
1361 fputs("ERROR: can't move after\n", stderr);
1366 _on_cmd_service_get_state(char *cmd, char *args)
1368 const char *state, *path;
1369 E_Connman_Element *e;
1373 fputs("ERROR: missing the service path\n", stderr);
1379 e = e_connman_service_get(path);
1380 if (e_connman_service_state_get(e, &state))
1381 printf(":::Service %s State = \"%s\"\n", path, state);
1383 fputs("ERROR: can't get service state\n", stderr);
1388 _on_cmd_service_get_error(char *cmd, char *args)
1390 const char *error, *path;
1391 E_Connman_Element *e;
1395 fputs("ERROR: missing the service path\n", stderr);
1401 e = e_connman_service_get(path);
1402 if (e_connman_service_error_get(e, &error))
1403 printf(":::Service %s Error = \"%s\"\n", path, error);
1405 fputs("ERROR: can't get service error\n", stderr);
1410 _on_cmd_service_get_name(char *cmd, char *args)
1412 const char *name, *path;
1413 E_Connman_Element *e;
1417 fputs("ERROR: missing the service path\n", stderr);
1423 e = e_connman_service_get(path);
1424 if (e_connman_service_name_get(e, &name))
1425 printf(":::Service %s Name = \"%s\"\n", path, name);
1427 fputs("ERROR: can't get service name\n", stderr);
1432 _on_cmd_service_get_type(char *cmd, char *args)
1434 const char *type, *path;
1435 E_Connman_Element *e;
1439 fputs("ERROR: missing the service path\n", stderr);
1445 e = e_connman_service_get(path);
1446 if (e_connman_service_type_get(e, &type))
1447 printf(":::Service %s Type = \"%s\"\n", path, type);
1449 fputs("ERROR: can't get service type\n", stderr);
1454 _on_cmd_service_get_mode(char *cmd, char *args)
1456 const char *mode, *path;
1457 E_Connman_Element *e;
1461 fputs("ERROR: missing the service path\n", stderr);
1467 e = e_connman_service_get(path);
1468 if (e_connman_service_mode_get(e, &mode))
1469 printf(":::Service %s Mode = \"%s\"\n", path, mode);
1471 fputs("ERROR: can't get service mode\n", stderr);
1476 _on_cmd_service_get_security(char *cmd, char *args)
1478 const char *security, *path;
1479 E_Connman_Element *e;
1483 fputs("ERROR: missing the service path\n", stderr);
1489 e = e_connman_service_get(path);
1490 if (e_connman_service_security_get(e, &security))
1491 printf(":::Service %s Security = \"%s\"\n", path, security);
1493 fputs("ERROR: can't get service security\n", stderr);
1498 _on_cmd_service_get_passphrase(char *cmd, char *args)
1500 const char *passphrase, *path;
1501 E_Connman_Element *e;
1505 fputs("ERROR: missing the service path\n", stderr);
1511 e = e_connman_service_get(path);
1512 if (e_connman_service_passphrase_get(e, &passphrase))
1513 printf(":::Service %s Passphrase = \"%s\"\n", path, passphrase);
1515 fputs("ERROR: can't get service passphrase\n", stderr);
1520 _on_cmd_service_set_passphrase(char *cmd, char *args)
1522 char *passphrase, *path;
1523 E_Connman_Element *e;
1527 fputs("ERROR: missing the service path\n", stderr);
1531 passphrase = _tok(args);
1535 fputs("ERROR: missing the passphrase value\n", stderr);
1540 e = e_connman_service_get(path);
1541 if (e_connman_service_passphrase_set(e, passphrase, NULL, NULL))
1542 printf(":::Service %s passphrase set to \"%s\"\n", path, passphrase);
1544 fputs("ERROR: can't set service passphrase\n", stderr);
1549 _on_cmd_service_get_passphrase_required(char *cmd, char *args)
1553 E_Connman_Element *e;
1557 fputs("ERROR: missing the service path\n", stderr);
1563 e = e_connman_service_get(path);
1564 if (e_connman_service_passphrase_required_get(e, &passphrase))
1565 printf(":::Service %s Passphrase Required = %hhu\n", path, passphrase);
1567 fputs("ERROR: can't get service passphrase required\n", stderr);
1572 _on_cmd_service_get_strength(char *cmd, char *args)
1575 unsigned char strength;
1576 E_Connman_Element *e;
1580 fputs("ERROR: missing the service path\n", stderr);
1586 e = e_connman_service_get(path);
1587 if (e_connman_service_strength_get(e, &strength))
1588 printf(":::Service %s Strength = %#02hhx (%d)\n", path, strength, strength);
1590 fputs("ERROR: can't get service strength\n", stderr);
1595 _on_cmd_service_get_favorite(char *cmd, char *args)
1599 E_Connman_Element *e;
1603 fputs("ERROR: missing the service path\n", stderr);
1609 e = e_connman_service_get(path);
1610 if (e_connman_service_favorite_get(e, &favorite))
1611 printf(":::Service %s Favorite = %hhu\n", path, favorite);
1613 fputs("ERROR: can't get service favorite\n", stderr);
1618 _on_cmd_service_get_immutable(char *cmd, char *args)
1622 E_Connman_Element *e;
1626 fputs("ERROR: missing the service path\n", stderr);
1632 e = e_connman_service_get(path);
1633 if (e_connman_service_immutable_get(e, &immutable))
1634 printf(":::Service %s Immutable = %hhu\n", path, immutable);
1636 fputs("ERROR: can't get service immutable\n", stderr);
1641 _on_cmd_service_get_auto_connect(char *cmd, char *args)
1645 E_Connman_Element *e;
1649 fputs("ERROR: missing the service path\n", stderr);
1655 e = e_connman_service_get(path);
1656 if (e_connman_service_auto_connect_get(e, &auto_connect))
1657 printf(":::Service %s Auto Connect = %hhu\n", path, auto_connect);
1659 fputs("ERROR: can't get service auto connect\n", stderr);
1664 _on_cmd_service_set_auto_connect(char *cmd, char *args)
1666 char *path, *next_args;
1668 E_Connman_Element *e;
1672 fputs("ERROR: missing the service path\n", stderr);
1676 next_args = _tok(args);
1680 fputs("ERROR: missing the auto connect value\n", stderr);
1684 auto_connect = !!atol(next_args);
1686 e = e_connman_service_get(path);
1687 if (e_connman_service_auto_connect_set(e, auto_connect, NULL, NULL))
1688 printf(":::Service %s auto connect set to %d\n", path, auto_connect);
1690 fputs("ERROR: can't set service auto connect\n", stderr);
1695 _on_cmd_service_get_setup_required(char *cmd, char *args)
1698 bool setup_required;
1699 E_Connman_Element *e;
1703 fputs("ERROR: missing the service path\n", stderr);
1709 e = e_connman_service_get(path);
1710 if (e_connman_service_setup_required_get(e, &setup_required))
1711 printf(":::Service %s Setup Required = %hhu\n", path, setup_required);
1713 fputs("ERROR: can't get service setup required\n", stderr);
1718 _on_cmd_service_get_apn(char *cmd, char *args)
1720 const char *apn, *path;
1721 E_Connman_Element *e;
1725 fputs("ERROR: missing the service path\n", stderr);
1731 e = e_connman_service_get(path);
1732 if (e_connman_service_apn_get(e, &apn))
1733 printf(":::Service %s APN = \"%s\"\n", path, apn);
1735 fputs("ERROR: can't get service APN\n", stderr);
1740 _on_cmd_service_set_apn(char *cmd, char *args)
1743 E_Connman_Element *e;
1747 fputs("ERROR: missing the service path\n", stderr);
1755 fputs("ERROR: missing the apn value\n", stderr);
1760 e = e_connman_service_get(path);
1761 if (e_connman_service_apn_set(e, apn, NULL, NULL))
1762 printf(":::Service %s APN set to \"%s\"\n", path, apn);
1764 fputs("ERROR: can't set service APN\n", stderr);
1769 _on_cmd_service_get_mcc(char *cmd, char *args)
1771 const char *mcc, *path;
1772 E_Connman_Element *e;
1776 fputs("ERROR: missing the service path\n", stderr);
1782 e = e_connman_service_get(path);
1783 if (e_connman_service_mcc_get(e, &mcc))
1784 printf(":::Service %s MCC = \"%s\"\n", path, mcc);
1786 fputs("ERROR: can't get service MCC\n", stderr);
1791 _on_cmd_service_get_mnc(char *cmd, char *args)
1793 const char *mnc, *path;
1794 E_Connman_Element *e;
1798 fputs("ERROR: missing the service path\n", stderr);
1804 e = e_connman_service_get(path);
1805 if (e_connman_service_mnc_get(e, &mnc))
1806 printf(":::Service %s MNC = \"%s\"\n", path, mnc);
1808 fputs("ERROR: can't get service MNC\n", stderr);
1813 _on_cmd_service_get_roaming(char *cmd, char *args)
1817 E_Connman_Element *e;
1821 fputs("ERROR: missing the service path\n", stderr);
1827 e = e_connman_service_get(path);
1828 if (e_connman_service_roaming_get(e, &roaming))
1829 printf(":::Service %s Roaming = %hhu\n", path, roaming);
1831 fputs("ERROR: can't get service roaming\n", stderr);
1836 _on_cmd_service_get_ipv4_method(char *cmd, char *args)
1838 const char *ipv4_method, *path;
1839 E_Connman_Element *e;
1843 fputs("ERROR: missing the service path\n", stderr);
1849 e = e_connman_service_get(path);
1850 if (e_connman_service_ipv4_method_get(e, &ipv4_method))
1851 printf(":::Service %s IPv4 Method = \"%s\"\n", path, ipv4_method);
1853 fputs("ERROR: can't get service ipv4 method\n", stderr);
1858 _on_cmd_service_get_ipv4_address(char *cmd, char *args)
1860 const char *ipv4_address, *path;
1861 E_Connman_Element *e;
1865 fputs("ERROR: missing the service path\n", stderr);
1871 e = e_connman_service_get(path);
1872 if (e_connman_service_ipv4_address_get(e, &ipv4_address))
1873 printf(":::Service %s IPv4 Address = \"%s\"\n", path, ipv4_address);
1875 fputs("ERROR: can't get service ipv4 address\n", stderr);
1880 _on_cmd_service_get_ipv4_gateway(char *cmd, char *args)
1882 const char *ipv4_gateway, *path;
1883 E_Connman_Element *e;
1887 fputs("ERROR: missing the service path\n", stderr);
1893 e = e_connman_service_get(path);
1894 if (e_connman_service_ipv4_gateway_get(e, &ipv4_gateway))
1895 printf(":::Service %s IPv4 Gateway = \"%s\"\n", path, ipv4_gateway);
1897 fputs("ERROR: can't get service ipv4 gateway\n", stderr);
1902 _on_cmd_service_get_ipv4_netmask(char *cmd, char *args)
1904 const char *ipv4_netmask, *path;
1905 E_Connman_Element *e;
1909 fputs("ERROR: missing the service path\n", stderr);
1915 e = e_connman_service_get(path);
1916 if (e_connman_service_ipv4_netmask_get(e, &ipv4_netmask))
1917 printf(":::Service %s IPv4 Netmask = \"%s\"\n", path, ipv4_netmask);
1919 fputs("ERROR: can't get service ipv4 netmask\n", stderr);
1924 _on_cmd_service_get_ipv4_configuration_method(char *cmd, char *args)
1926 const char *ipv4_method, *path;
1927 E_Connman_Element *e;
1931 fputs("ERROR: missing the service path\n", stderr);
1937 e = e_connman_service_get(path);
1938 if (e_connman_service_ipv4_configuration_method_get(e, &ipv4_method))
1939 printf(":::Service %s IPv4 Configuration Method = \"%s\"\n",
1942 fputs("ERROR: can't get service ipv4_configuration method\n", stderr);
1947 _on_cmd_service_get_ipv4_configuration_address(char *cmd, char *args)
1949 const char *ipv4_address, *path;
1950 E_Connman_Element *e;
1954 fputs("ERROR: missing the service path\n", stderr);
1960 e = e_connman_service_get(path);
1961 if (e_connman_service_ipv4_configuration_address_get(e, &ipv4_address))
1962 printf(":::Service %s IPv4 Configuration Address = \"%s\"\n",
1963 path, ipv4_address);
1965 fputs("ERROR: can't get service ipv4_configuration address\n", stderr);
1970 _on_cmd_service_get_ipv4_configuration_gateway(char *cmd, char *args)
1972 const char *ipv4_gateway, *path;
1973 E_Connman_Element *e;
1977 fputs("ERROR: missing the service path\n", stderr);
1983 e = e_connman_service_get(path);
1984 if (e_connman_service_ipv4_configuration_gateway_get(e, &ipv4_gateway))
1985 printf(":::Service %s IPv4 Configuration Gateway = \"%s\"\n",
1986 path, ipv4_gateway);
1988 fputs("ERROR: can't get service ipv4_configuration gateway\n", stderr);
1993 _on_cmd_service_get_ipv4_configuration_netmask(char *cmd, char *args)
1995 const char *ipv4_netmask, *path;
1996 E_Connman_Element *e;
2000 fputs("ERROR: missing the service path\n", stderr);
2006 e = e_connman_service_get(path);
2007 if (e_connman_service_ipv4_configuration_netmask_get(e, &ipv4_netmask))
2008 printf(":::Service %s IPv4 Configuration Netmask = \"%s\"\n",
2009 path, ipv4_netmask);
2011 fputs("ERROR: can't get service ipv4 configuration netmask\n", stderr);
2016 _on_cmd_service_ipv4_configure_dhcp(char *cmd, char *args)
2019 E_Connman_Element *e;
2023 fputs("ERROR: missing the service path\n", stderr);
2029 e = e_connman_service_get(path);
2030 if (e_connman_service_ipv4_configure_dhcp
2031 (e, _method_success_check, "service_ipv4_configure_dhcp"))
2032 printf(":::Service %s IPv4 Configuration set to DHCP\n", path);
2034 fputs("ERROR: can't set service ipv4_configuration dhcp\n", stderr);
2039 _on_cmd_service_ipv4_configure_manual(char *cmd, char *args)
2041 char *path, *next_args, *address, *netmask = NULL;
2042 E_Connman_Element *e;
2046 fputs("ERROR: missing the service path\n", stderr);
2050 next_args = _tok(args);
2053 fputs("ERROR: missing the service address\n", stderr);
2057 address = next_args;
2058 next_args = _tok(next_args);
2061 netmask = next_args;
2065 e = e_connman_service_get(path);
2066 if (e_connman_service_ipv4_configure_manual
2067 (e, address, netmask,
2068 _method_success_check, "service_ipv4_configure_manual"))
2069 printf(":::Service %s IPv4 Configuration set to Manual (%s/%s)\n",
2070 path, address, netmask);
2072 fputs("ERROR: can't set service ipv4_configuration manual\n", stderr);
2077 _on_cmd_service_get_ethernet_method(char *cmd, char *args)
2079 const char *ethernet_method, *path;
2080 E_Connman_Element *e;
2084 fputs("ERROR: missing the service path\n", stderr);
2090 e = e_connman_service_get(path);
2091 if (e_connman_service_ethernet_method_get(e, ðernet_method))
2092 printf(":::Service %s Ethernet Method = \"%s\"\n", path, ethernet_method);
2094 fputs("ERROR: can't get service ethernet method\n", stderr);
2099 _on_cmd_service_get_ethernet_address(char *cmd, char *args)
2101 const char *ethernet_address, *path;
2102 E_Connman_Element *e;
2106 fputs("ERROR: missing the service path\n", stderr);
2112 e = e_connman_service_get(path);
2113 if (e_connman_service_ethernet_address_get(e, ðernet_address))
2114 printf(":::Service %s Ethernet Address = \"%s\"\n",
2115 path, ethernet_address);
2117 fputs("ERROR: can't get service ethernet address\n", stderr);
2122 _on_cmd_service_get_ethernet_mtu(char *cmd, char *args)
2125 E_Connman_Element *e;
2126 unsigned short ethernet_mtu;
2130 fputs("ERROR: missing the service path\n", stderr);
2136 e = e_connman_service_get(path);
2137 if (e_connman_service_ethernet_mtu_get(e, ðernet_mtu))
2138 printf(":::Service %s Ethernet MTU = %hu\n", path, ethernet_mtu);
2140 fputs("ERROR: can't get service ethernet mtu\n", stderr);
2145 _on_cmd_service_get_ethernet_netmask(char *cmd, char *args)
2147 const char *ethernet_netmask, *path;
2148 E_Connman_Element *e;
2152 fputs("ERROR: missing the service path\n", stderr);
2158 e = e_connman_service_get(path);
2159 if (e_connman_service_ethernet_netmask_get(e, ðernet_netmask))
2160 printf(":::Service %s Ethernet Netmask = \"%s\"\n",
2161 path, ethernet_netmask);
2163 fputs("ERROR: can't get service ethernet netmask\n", stderr);
2169 _on_input(void *data, Ecore_Fd_Handler *fd_handler)
2175 int (*cb)(char *cmd, char *args);
2177 {"quit", _on_cmd_quit},
2178 {"sync", _on_cmd_sync},
2179 {"get_all", _on_cmd_get_all},
2180 {"print", _on_cmd_print},
2181 {"get_properties", _on_cmd_get_properties},
2182 {"set_property", _on_cmd_property_set},
2183 {"manager_get", _on_cmd_manager_get},
2184 {"manager_get_profiles", _on_cmd_manager_get_profiles},
2185 {"manager_get_devices", _on_cmd_manager_get_devices},
2186 {"manager_get_services", _on_cmd_manager_get_services},
2187 {"manager_register_agent", _on_cmd_manager_register_agent},
2188 {"manager_unregister_agent", _on_cmd_manager_unregister_agent},
2189 {"manager_get_state", _on_cmd_manager_get_state},
2190 {"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
2191 {"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
2192 {"manager_request_scan", _on_cmd_manager_request_scan},
2193 {"manager_technology_enable", _on_cmd_manager_technology_enable},
2194 {"manager_technology_disable", _on_cmd_manager_technology_disable},
2195 {"manager_get_technologies_available", _on_cmd_manager_get_technologies_available},
2196 {"manager_get_technologies_enabled", _on_cmd_manager_get_technologies_enabled},
2197 {"manager_get_technologies_connected", _on_cmd_manager_get_technologies_connected},
2198 {"manager_profile_remove", _on_cmd_manager_profile_remove},
2199 {"manager_profile_get_active", _on_cmd_manager_profile_get_active},
2200 {"manager_profile_set_active", _on_cmd_manager_profile_set_active},
2201 {"device_propose_scan", _on_cmd_device_propose_scan},
2202 {"device_get_address", _on_cmd_device_get_address},
2203 {"device_get_name", _on_cmd_device_get_name},
2204 {"device_get_type", _on_cmd_device_get_type},
2205 {"device_get_interface", _on_cmd_device_get_interface},
2206 {"device_get_powered", _on_cmd_device_get_powered},
2207 {"device_set_powered", _on_cmd_device_set_powered},
2208 {"device_get_scan_interval", _on_cmd_device_get_scan_interval},
2209 {"device_set_scan_interval", _on_cmd_device_set_scan_interval},
2210 {"device_get_scanning", _on_cmd_device_get_scanning},
2211 {"device_get_networks", _on_cmd_device_get_networks},
2212 {"profile_get_name", _on_cmd_profile_get_name},
2213 {"profile_set_name", _on_cmd_profile_set_name},
2214 {"profile_get_offline_mode", _on_cmd_profile_get_offline_mode},
2215 {"profile_set_offline_mode", _on_cmd_profile_set_offline_mode},
2216 {"profile_get_services", _on_cmd_profile_get_services},
2217 {"network_get_address", _on_cmd_network_get_address},
2218 {"network_get_name", _on_cmd_network_get_name},
2219 {"network_get_connected", _on_cmd_network_get_connected},
2220 {"network_get_strength", _on_cmd_network_get_strength},
2221 {"network_get_frequency", _on_cmd_network_get_frequency},
2222 {"network_get_device", _on_cmd_network_get_device},
2223 {"network_get_wifi_ssid", _on_cmd_network_get_wifi_ssid},
2224 {"network_get_wifi_mode", _on_cmd_network_get_wifi_mode},
2225 {"network_get_wifi_security", _on_cmd_network_get_wifi_security},
2226 {"network_get_wifi_passphrase", _on_cmd_network_get_wifi_passphrase},
2227 {"network_get_wifi_channel", _on_cmd_network_get_wifi_channel},
2228 {"network_get_wifi_eap", _on_cmd_network_get_wifi_eap},
2229 {"service_connect", _on_cmd_service_connect},
2230 {"service_disconnect", _on_cmd_service_disconnect},
2231 {"service_remove", _on_cmd_service_remove},
2232 {"service_move_before", _on_cmd_service_move_before},
2233 {"service_move_after", _on_cmd_service_move_after},
2234 {"service_get_state", _on_cmd_service_get_state},
2235 {"service_get_error", _on_cmd_service_get_error},
2236 {"service_get_name", _on_cmd_service_get_name},
2237 {"service_get_type", _on_cmd_service_get_type},
2238 {"service_get_mode", _on_cmd_service_get_mode},
2239 {"service_get_security", _on_cmd_service_get_security},
2240 {"service_get_passphrase", _on_cmd_service_get_passphrase},
2241 {"service_set_passphrase", _on_cmd_service_set_passphrase},
2242 {"service_get_passphrase_required", _on_cmd_service_get_passphrase_required},
2243 {"service_get_strength", _on_cmd_service_get_strength},
2244 {"service_get_favorite", _on_cmd_service_get_favorite},
2245 {"service_get_immutable", _on_cmd_service_get_immutable},
2246 {"service_get_auto_connect", _on_cmd_service_get_auto_connect},
2247 {"service_set_auto_connect", _on_cmd_service_set_auto_connect},
2248 {"service_get_setup_required", _on_cmd_service_get_setup_required},
2249 {"service_get_apn", _on_cmd_service_get_apn},
2250 {"service_set_apn", _on_cmd_service_set_apn},
2251 {"service_get_mcc", _on_cmd_service_get_mcc},
2252 {"service_get_mnc", _on_cmd_service_get_mnc},
2253 {"service_get_roaming", _on_cmd_service_get_roaming},
2254 {"service_get_ipv4_method", _on_cmd_service_get_ipv4_method},
2255 {"service_get_ipv4_address", _on_cmd_service_get_ipv4_address},
2256 {"service_get_ipv4_gateway", _on_cmd_service_get_ipv4_gateway},
2257 {"service_get_ipv4_netmask", _on_cmd_service_get_ipv4_netmask},
2258 {"service_get_ipv4_configuration_method", _on_cmd_service_get_ipv4_configuration_method},
2259 {"service_get_ipv4_configuration_address", _on_cmd_service_get_ipv4_configuration_address},
2260 {"service_get_ipv4_configuration_gateway", _on_cmd_service_get_ipv4_configuration_gateway},
2261 {"service_get_ipv4_configuration_netmask", _on_cmd_service_get_ipv4_configuration_netmask},
2262 {"service_ipv4_configure_dhcp", _on_cmd_service_ipv4_configure_dhcp},
2263 {"service_ipv4_configure_manual", _on_cmd_service_ipv4_configure_manual},
2264 {"service_get_ethernet_method", _on_cmd_service_get_ethernet_method},
2265 {"service_get_ethernet_address", _on_cmd_service_get_ethernet_address},
2266 {"service_get_ethernet_mtu", _on_cmd_service_get_ethernet_mtu},
2267 {"service_get_ethernet_netmask", _on_cmd_service_get_ethernet_netmask},
2272 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
2274 fputs("ERROR: reading from stdin, exit\n", stderr);
2278 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
2280 fputs("ERROR: nothing to read?\n", stderr);
2284 if (!fgets(buf, sizeof(buf), stdin))
2286 fprintf(stderr, "ERROR: could not read command: %s\n", strerror(errno));
2287 ecore_main_loop_quit();
2292 while (isspace(*cmd))
2295 args = strchr(cmd, ' ');
2303 while (isspace(*args))
2306 p = args + strlen(args) - 1;
2314 p = cmd + strlen(cmd) - 1;
2319 if (strcmp(cmd, "help") == 0)
2323 printf("Commands with '%s' in the name:\n", args);
2324 for (itr = maps; itr->cmd != NULL; itr++)
2325 if (strstr(itr->cmd, args))
2326 printf("\t%s\n", itr->cmd);
2330 fputs("Commands:\n", stdout);
2331 for (itr = maps; itr->cmd != NULL; itr++)
2332 printf("\t%s\n", itr->cmd);
2334 fputc('\n', stdout);
2338 for (itr = maps; itr->cmd != NULL; itr++)
2339 if (strcmp(itr->cmd, cmd) == 0)
2340 return itr->cb(cmd, args);
2342 printf("unknown command \"%s\", args=%s\n", cmd, args);
2347 main(int argc, char *argv[])
2349 E_DBus_Connection *c;
2355 c = e_dbus_bus_get(DBUS_BUS_SYSTEM);
2357 printf("ERROR: can't connect to system session\n");
2361 e_connman_system_init(c);
2362 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_ADD, _on_element_add, NULL);
2363 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_DEL, _on_element_del, NULL);
2364 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_UPDATED,
2365 _on_element_updated, NULL);
2367 ecore_main_fd_handler_add
2368 (0, ECORE_FD_READ | ECORE_FD_ERROR, _on_input, NULL, NULL, NULL);
2370 ecore_main_loop_begin();
2372 e_connman_system_shutdown();
2374 e_dbus_connection_close(c);
2379 fputs("DBG: clean exit.\n", stderr);