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
339 (path, _method_success_check, "manager_register_agent"))
340 printf(":::Registering agent %s...\n", path);
342 fprintf(stderr, "ERROR: can't register agent %s\n", path);
348 _on_cmd_manager_unregister_agent(char *cmd, char *args)
354 fputs("ERROR: missing the object path\n", stderr);
359 if (e_connman_manager_agent_unregister
360 (path, _method_success_check, "manager_unregister_agent"))
361 printf(":::Unregistering agent %s...\n", path);
363 fprintf(stderr, "ERROR: can't unregister agent %s\n", path);
369 _on_cmd_manager_get_state(char *cmd, char *args)
372 if (e_connman_manager_state_get(&state))
373 printf(":::Manager state = \"%s\"\n", state);
375 fputs("ERROR: can't get manager state\n", stderr);
380 _on_cmd_manager_get_offline_mode(char *cmd, char *args)
383 if (e_connman_manager_offline_mode_get(&offline))
384 printf(":::Manager Offline Mode = %hhu\n", offline);
386 fputs("ERROR: can't get manager offline mode\n", stderr);
391 _on_cmd_manager_set_offline_mode(char *cmd, char *args)
396 fputs("ERROR: missing the offline mode value\n", stderr);
400 offline = !!atol(args);
401 if (e_connman_manager_offline_mode_set
402 (offline, _method_success_check, "manager_set_offline_mode"))
404 printf(":::Manager Offline Mode set to %hhu\n", offline);
406 fputs("ERROR: can't set manager offline mode\n", stderr);
411 _on_cmd_manager_request_scan(char *cmd, char *args)
419 if (e_connman_manager_request_scan
420 (args, _method_success_check, "manager_request_scan"))
421 printf(":::Manager Request Scan for %s\n", args[0] ? args : "<all>");
423 fputs("ERROR: can't request scan on manager\n", stderr);
428 _on_cmd_manager_technology_enable(char *cmd, char *args)
432 fputs("ERROR: missing the technology type\n", stderr);
437 if (e_connman_manager_technology_enable
438 (args, _method_success_check, "manager_technology_enable"))
439 printf(":::Manager Enable Technology %s\n", args);
441 fputs("ERROR: can't enable technology on manager\n", stderr);
446 _on_cmd_manager_technology_disable(char *cmd, char *args)
450 fputs("ERROR: missing the technology type\n", stderr);
455 if (e_connman_manager_technology_disable
456 (args, _method_success_check, "manager_technology_disable"))
457 printf(":::Manager Disable Technology %s\n", args);
459 fputs("ERROR: can't disable technology on manager\n", stderr);
464 _on_cmd_manager_get_technologies_available(char *cmd, char *args)
466 const char **strings;
469 if (!e_connman_manager_technologies_available_get(&count, &strings))
470 fputs("ERROR: can't get available technologies\n", stderr);
473 printf("BEG: available technologies count = %u\n", count);
474 _strings_print(strings, count);
481 _on_cmd_manager_get_technologies_enabled(char *cmd, char *args)
483 const char **strings;
486 if (!e_connman_manager_technologies_enabled_get(&count, &strings))
487 fputs("ERROR: can't get enabled technologies\n", stderr);
490 printf("BEG: enabled technologies count = %u\n", count);
491 _strings_print(strings, count);
498 _on_cmd_manager_get_technologies_connected(char *cmd, char *args)
500 const char **strings;
503 if (!e_connman_manager_technologies_connected_get(&count, &strings))
504 fputs("ERROR: can't get connected technologies\n", stderr);
507 printf("BEG: connected technologies count = %u\n", count);
508 _strings_print(strings, count);
515 _on_cmd_manager_profile_remove(char *cmd, char *args)
517 E_Connman_Element *e;
521 fputs("ERROR: missing the profile path\n", stderr);
526 e = e_connman_profile_get(args);
527 if (e_connman_manager_profile_remove
528 (e, _method_success_check, "manager_profile_remove"))
529 printf(":::Manager Remove Profile %s\n", args);
531 fputs("ERROR: can't remove profile from manager\n", stderr);
536 _on_cmd_manager_profile_get_active(char *cmd, char *args)
538 E_Connman_Element *e;
540 if (!e_connman_manager_profile_active_get(&e))
541 fputs("ERROR: can't active_get profile from manager\n", stderr);
543 e_connman_element_print(stderr, e);
548 _on_cmd_manager_profile_set_active(char *cmd, char *args)
550 E_Connman_Element *e;
554 fputs("ERROR: missing the profile path\n", stderr);
559 e = e_connman_profile_get(args);
560 if (e_connman_manager_profile_active_set
561 (e, _method_success_check, "manager_profile_set_active"))
562 printf(":::Manager Active Profile set to %s\n", args);
564 fputs("ERROR: can't set active profile\n", stderr);
568 /* Device Commands */
570 _on_cmd_device_propose_scan(char *cmd, char *args)
573 E_Connman_Element *e;
577 fputs("ERROR: missing the device path\n", stderr);
583 e = e_connman_device_get(path);
584 if (e_connman_device_propose_scan
585 (e, _method_success_check, "device_propose_scan"))
586 printf(":::Proposing scan %s...\n", path);
588 fputs("ERROR: can't propose scan\n", stderr);
593 _on_cmd_device_get_address(char *cmd, char *args)
595 const char *address, *path;
596 E_Connman_Element *e;
600 fputs("ERROR: missing the device path\n", stderr);
606 e = e_connman_device_get(path);
607 if (e_connman_device_address_get(e, &address))
608 printf(":::Device %s Address = \"%s\"\n", path, address);
610 fputs("ERROR: can't get device address\n", stderr);
615 _on_cmd_device_get_name(char *cmd, char *args)
617 const char *name, *path;
618 E_Connman_Element *e;
622 fputs("ERROR: missing the device path\n", stderr);
628 e = e_connman_device_get(path);
629 if (e_connman_device_name_get(e, &name))
630 printf(":::Device %s Name = \"%s\"\n", path, name);
632 fputs("ERROR: can't get device name\n", stderr);
637 _on_cmd_device_get_type(char *cmd, char *args)
639 const char *type, *path;
640 E_Connman_Element *e;
644 fputs("ERROR: missing the device path\n", stderr);
650 e = e_connman_device_get(path);
651 if (e_connman_device_type_get(e, &type))
652 printf(":::Device %s Type = \"%s\"\n", path, type);
654 fputs("ERROR: can't get device type\n", stderr);
659 _on_cmd_device_get_interface(char *cmd, char *args)
661 const char *interface, *path;
662 E_Connman_Element *e;
666 fputs("ERROR: missing the device path\n", stderr);
672 e = e_connman_device_get(path);
673 if (e_connman_device_interface_get(e, &interface))
674 printf(":::Device %s Interface = \"%s\"\n", path, interface);
676 fputs("ERROR: can't get device interface\n", stderr);
681 _on_cmd_device_get_powered(char *cmd, char *args)
685 E_Connman_Element *e;
689 fputs("ERROR: missing the device path\n", stderr);
695 e = e_connman_device_get(path);
696 if (e_connman_device_powered_get(e, &powered))
697 printf(":::Device %s Powered = %hhu\n", path, powered);
699 fputs("ERROR: can't get device powered\n", stderr);
704 _on_cmd_device_set_powered(char *cmd, char *args)
706 char *device_path, *next_args;
708 E_Connman_Element *e;
712 fputs("ERROR: missing the device path\n", stderr);
716 next_args = _tok(args);
719 fputs("ERROR: missing the powered value\n", stderr);
722 powered = !!atol(next_args);
724 e = e_connman_device_get(device_path);
725 if (e_connman_device_powered_set
726 (e, powered, _method_success_check, "device_set_powered"))
727 printf(":::Device %s powered set to %hhu\n", device_path, powered);
729 fputs("ERROR: can't set device powered\n", stderr);
734 _on_cmd_device_get_scan_interval(char *cmd, char *args)
737 unsigned short scan_interval;
738 E_Connman_Element *e;
742 fputs("ERROR: missing the device path\n", stderr);
748 e = e_connman_device_get(path);
749 if (e_connman_device_scan_interval_get(e, &scan_interval))
750 printf(":::Device %s ScanInterval = %hu\n", path, scan_interval);
752 fputs("ERROR: can't get device scan interval\n", stderr);
757 _on_cmd_device_set_scan_interval(char *cmd, char *args)
759 char *device_path, *next_args, *p;
760 unsigned short scan_interval;
761 E_Connman_Element *e;
765 fputs("ERROR: missing the device path\n", stderr);
769 next_args = _tok(args);
772 fputs("ERROR: missing the scan interval value\n", stderr);
775 scan_interval = strtol(next_args, &p, 0);
778 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
782 e = e_connman_device_get(device_path);
783 if (e_connman_device_scan_interval_set
784 (e, scan_interval, _method_success_check, "device_set_scan_interval"))
785 printf(":::Device %s scan interval set to %hu\n", device_path, scan_interval);
787 fputs("ERROR: can't set device scan interval\n", stderr);
792 _on_cmd_device_get_scanning(char *cmd, char *args)
796 E_Connman_Element *e;
800 fputs("ERROR: missing the device path\n", stderr);
806 e = e_connman_device_get(path);
807 if (e_connman_device_scanning_get(e, &scanning))
808 printf(":::Device %s Scanning = %hhu\n", path, scanning);
810 fputs("ERROR: can't get device scanning\n", stderr);
815 _on_cmd_device_get_networks(char *cmd, char *args)
817 E_Connman_Element **networks;
820 E_Connman_Element *e;
824 fputs("ERROR: missing the device path\n", stderr);
830 e = e_connman_device_get(path);
831 if (!e_connman_device_networks_get(e, &count, &networks))
833 fputs("ERROR: can't get networks\n", stderr);
837 printf("BEG: all device network elements count = %d\n", count);
838 _elements_print(networks, count);
842 /* Profile Commands */
845 _on_cmd_profile_get_name(char *cmd, char *args)
847 const char *name, *path;
848 E_Connman_Element *e;
852 fputs("ERROR: missing the profile path\n", stderr);
858 e = e_connman_profile_get(path);
859 if (e_connman_profile_name_get(e, &name))
860 printf(":::Profile %s Name = \"%s\"\n", path, name);
862 fputs("ERROR: can't get profile name\n", stderr);
867 _on_cmd_profile_set_name(char *cmd, char *args)
869 char *path, *next_args;
870 E_Connman_Element *e;
874 fputs("ERROR: missing the profile path\n", stderr);
878 next_args = _tok(args);
881 fputs("ERROR: missing the offline mode value\n", stderr);
886 e = e_connman_profile_get(path);
887 if (e_connman_profile_name_set
888 (e, next_args, _method_success_check, "profile_set_name"))
889 printf(":::Profile %s Name set to %s\n", path, next_args);
891 fputs("ERROR: can't set profile name\n", stderr);
896 _on_cmd_profile_get_offline_mode(char *cmd, char *args)
900 E_Connman_Element *e;
904 fputs("ERROR: missing the profile path\n", stderr);
910 e = e_connman_profile_get(path);
911 if (e_connman_profile_offline_mode_get(e, &offline))
912 printf(":::Profile %s Offline Mode = %hhu\n", path, offline);
914 fputs("ERROR: can't get profile offline mode\n", stderr);
919 _on_cmd_profile_set_offline_mode(char *cmd, char *args)
921 char *path, *next_args;
923 E_Connman_Element *e;
927 fputs("ERROR: missing the profile path\n", stderr);
931 next_args = _tok(args);
934 fputs("ERROR: missing the offline mode value\n", stderr);
938 offline = !!atol(next_args);
940 e = e_connman_profile_get(path);
941 if (e_connman_profile_offline_mode_set
942 (e, offline, _method_success_check, "profile_set_offline_mode"))
943 printf(":::Profile %s Offline Mode set to %hhu\n", path, offline);
945 fputs("ERROR: can't set profile offline mode\n", stderr);
950 _on_cmd_profile_get_services(char *cmd, char *args)
952 E_Connman_Element **services;
953 E_Connman_Element *e;
959 fputs("ERROR: missing the profile path\n", stderr);
965 e = e_connman_profile_get(path);
966 if (!e_connman_profile_services_get(e, &count, &services))
968 fputs("ERROR: can't get services\n", stderr);
971 printf("BEG: all profile services count = %d\n", count);
972 _elements_print(services, count);
977 /* Network Commands */
980 _on_cmd_network_get_address(char *cmd, char *args)
982 const char *address, *path;
983 E_Connman_Element *e;
987 fputs("ERROR: missing the network path\n", stderr);
993 e = e_connman_network_get(path);
994 if (e_connman_network_address_get(e, &address))
995 printf(":::Network %s Address = \"%s\"\n", path, address);
997 fputs("ERROR: can't get network address\n", stderr);
1002 _on_cmd_network_get_name(char *cmd, char *args)
1004 const char *name, *path;
1005 E_Connman_Element *e;
1009 fputs("ERROR: missing the network path\n", stderr);
1015 e = e_connman_network_get(path);
1016 if (e_connman_network_name_get(e, &name))
1017 printf(":::Network %s Name = \"%s\"\n", path, name);
1019 fputs("ERROR: can't get network name\n", stderr);
1024 _on_cmd_network_get_connected(char *cmd, char *args)
1028 E_Connman_Element *e;
1032 fputs("ERROR: missing the network path\n", stderr);
1038 e = e_connman_network_get(path);
1039 if (e_connman_network_connected_get(e, &connected))
1040 printf(":::Network %s Connected = %hhu\n", path, connected);
1042 fputs("ERROR: can't get network connected\n", stderr);
1047 _on_cmd_network_get_strength(char *cmd, char *args)
1050 unsigned char strength;
1051 E_Connman_Element *e;
1055 fputs("ERROR: missing the network path\n", stderr);
1061 e = e_connman_network_get(path);
1062 if (e_connman_network_strength_get(e, &strength))
1063 printf(":::Network %s Strength = %#02hhx (%d)\n", path, strength, strength);
1065 fputs("ERROR: can't get network strength\n", stderr);
1070 _on_cmd_network_get_frequency(char *cmd, char *args)
1073 unsigned short frequency;
1074 E_Connman_Element *e;
1078 fputs("ERROR: missing the network path\n", stderr);
1084 e = e_connman_network_get(path);
1085 if (e_connman_network_frequency_get(e, &frequency))
1086 printf(":::Network %s Frequency = %#04hx (%d)\n", path, frequency, frequency);
1088 fputs("ERROR: can't get network frequency\n", stderr);
1093 _on_cmd_network_get_device(char *cmd, char *args)
1095 E_Connman_Element *e, *device;
1100 fputs("ERROR: missing the network path\n", stderr);
1106 e = e_connman_network_get(path);
1107 if (!e_connman_network_device_get(e, &device))
1108 fputs("ERROR: can't get network device\n", stderr);
1110 e_connman_element_print(stderr, device);
1115 _on_cmd_network_get_wifi_ssid(char *cmd, char *args)
1117 unsigned char *bytes;
1119 unsigned int i, count;
1120 E_Connman_Element *e;
1124 fputs("ERROR: missing the network path\n", stderr);
1130 e = e_connman_network_get(path);
1131 if (e_connman_network_wifi_ssid_get(e, &count, &bytes))
1133 printf(":::Network %s Wifi SSID = ", path);
1134 for (i = 0; i < count; i++)
1135 printf("%#02hhx (\"%c\"), ", bytes[i], bytes[i]);
1139 fputs("ERROR: can't get network wifi ssid\n", stderr);
1144 _on_cmd_network_get_wifi_mode(char *cmd, char *args)
1146 const char *wifi_mode, *path;
1147 E_Connman_Element *e;
1151 fputs("ERROR: missing the network path\n", stderr);
1157 e = e_connman_network_get(path);
1158 if (e_connman_network_wifi_mode_get(e, &wifi_mode))
1159 printf(":::Network %s Wifi Mode = \"%s\"\n", path, wifi_mode);
1161 fputs("ERROR: can't get network wifi mode\n", stderr);
1166 _on_cmd_network_get_wifi_security(char *cmd, char *args)
1168 const char *wifi_security, *path;
1169 E_Connman_Element *e;
1173 fputs("ERROR: missing the network path\n", stderr);
1179 e = e_connman_network_get(path);
1180 if (e_connman_network_wifi_security_get(e, &wifi_security))
1181 printf(":::Network %s Wifi Security = \"%s\"\n", path, wifi_security);
1183 fputs("ERROR: can't get network wifi security\n", stderr);
1188 _on_cmd_network_get_wifi_passphrase(char *cmd, char *args)
1190 const char *wifi_passphrase, *path;
1191 E_Connman_Element *e;
1195 fputs("ERROR: missing the network path\n", stderr);
1201 e = e_connman_network_get(path);
1202 if (e_connman_network_wifi_passphrase_get(e, &wifi_passphrase))
1203 printf(":::Network %s Wifi Passphrase = \"%s\"\n", path, wifi_passphrase);
1205 fputs("ERROR: can't get network wifi passphrase\n", stderr);
1210 _on_cmd_network_get_wifi_channel(char *cmd, char *args)
1213 E_Connman_Element *e;
1214 unsigned short wifi_channel;
1218 fputs("ERROR: missing the network path\n", stderr);
1224 e = e_connman_network_get(path);
1225 if (e_connman_network_wifi_channel_get(e, &wifi_channel))
1226 printf(":::Network %s Wifi Channel = %#02hx (%d)\n", path, wifi_channel, wifi_channel);
1228 fputs("ERROR: can't get network wifi channel\n", stderr);
1233 _on_cmd_network_get_wifi_eap(char *cmd, char *args)
1235 const char *wifi_eap, *path;
1236 E_Connman_Element *e;
1240 fputs("ERROR: missing the network path\n", stderr);
1246 e = e_connman_network_get(path);
1247 if (e_connman_network_wifi_eap_get(e, &wifi_eap))
1248 printf(":::Network %s Wifi EAP = \"%s\"\n", path, wifi_eap);
1250 fputs("ERROR: can't get network wifi eap\n", stderr);
1254 /* Services Commands */
1256 _on_cmd_service_connect(char *cmd, char *args)
1259 E_Connman_Element *e;
1263 fputs("ERROR: missing the service path\n", stderr);
1269 e = e_connman_service_get(path);
1270 if (e_connman_service_connect
1271 (e, _method_success_check, "service_connect"))
1272 printf(":::Connecting to Service %s...\n", path);
1274 fputs("ERROR: can't connect to service\n", stderr);
1279 _on_cmd_service_disconnect(char *cmd, char *args)
1282 E_Connman_Element *e;
1286 fputs("ERROR: missing the service path\n", stderr);
1292 e = e_connman_service_get(path);
1293 if (e_connman_service_disconnect
1294 (e, _method_success_check, "service_disconnect"))
1295 printf(":::Disconnecting Service %s...\n", path);
1297 fputs("ERROR: can't disconnect service\n", stderr);
1302 _on_cmd_service_remove(char *cmd, char *args)
1305 E_Connman_Element *e;
1309 fputs("ERROR: missing the service path\n", stderr);
1315 e = e_connman_service_get(path);
1316 if (e_connman_service_remove
1317 (e, _method_success_check, "service_remove"))
1318 printf(":::Removing Service %s...\n", path);
1320 fputs("ERROR: can't remove service\n", stderr);
1325 _on_cmd_service_move_before(char *cmd, char *args)
1327 char *path, *service_path;
1328 E_Connman_Element *e;
1332 fputs("ERROR: missing the service path\n", stderr);
1335 service_path = args;
1340 fputs("ERROR: missing the object service\n", stderr);
1345 e = e_connman_service_get(service_path);
1346 if (e_connman_service_move_before
1347 (e, path, _method_success_check, "service_move_before"))
1348 printf(":::Moving before %s...\n", path);
1350 fputs("ERROR: can't move before\n", stderr);
1355 _on_cmd_service_move_after(char *cmd, char *args)
1357 char *path, *service_path;
1358 E_Connman_Element *e;
1362 fputs("ERROR: missing the service path\n", stderr);
1365 service_path = args;
1370 fputs("ERROR: missing the object service\n", stderr);
1375 e = e_connman_service_get(service_path);
1376 if (e_connman_service_move_after
1377 (e, path, _method_success_check, "service_move_after"))
1378 printf(":::Moving after %s...\n", path);
1380 fputs("ERROR: can't move after\n", stderr);
1385 _on_cmd_service_get_state(char *cmd, char *args)
1387 const char *state, *path;
1388 E_Connman_Element *e;
1392 fputs("ERROR: missing the service path\n", stderr);
1398 e = e_connman_service_get(path);
1399 if (e_connman_service_state_get(e, &state))
1400 printf(":::Service %s State = \"%s\"\n", path, state);
1402 fputs("ERROR: can't get service state\n", stderr);
1407 _on_cmd_service_get_error(char *cmd, char *args)
1409 const char *error, *path;
1410 E_Connman_Element *e;
1414 fputs("ERROR: missing the service path\n", stderr);
1420 e = e_connman_service_get(path);
1421 if (e_connman_service_error_get(e, &error))
1422 printf(":::Service %s Error = \"%s\"\n", path, error);
1424 fputs("ERROR: can't get service error\n", stderr);
1429 _on_cmd_service_get_name(char *cmd, char *args)
1431 const char *name, *path;
1432 E_Connman_Element *e;
1436 fputs("ERROR: missing the service path\n", stderr);
1442 e = e_connman_service_get(path);
1443 if (e_connman_service_name_get(e, &name))
1444 printf(":::Service %s Name = \"%s\"\n", path, name);
1446 fputs("ERROR: can't get service name\n", stderr);
1451 _on_cmd_service_get_type(char *cmd, char *args)
1453 const char *type, *path;
1454 E_Connman_Element *e;
1458 fputs("ERROR: missing the service path\n", stderr);
1464 e = e_connman_service_get(path);
1465 if (e_connman_service_type_get(e, &type))
1466 printf(":::Service %s Type = \"%s\"\n", path, type);
1468 fputs("ERROR: can't get service type\n", stderr);
1473 _on_cmd_service_get_mode(char *cmd, char *args)
1475 const char *mode, *path;
1476 E_Connman_Element *e;
1480 fputs("ERROR: missing the service path\n", stderr);
1486 e = e_connman_service_get(path);
1487 if (e_connman_service_mode_get(e, &mode))
1488 printf(":::Service %s Mode = \"%s\"\n", path, mode);
1490 fputs("ERROR: can't get service mode\n", stderr);
1495 _on_cmd_service_get_security(char *cmd, char *args)
1497 const char *security, *path;
1498 E_Connman_Element *e;
1502 fputs("ERROR: missing the service path\n", stderr);
1508 e = e_connman_service_get(path);
1509 if (e_connman_service_security_get(e, &security))
1510 printf(":::Service %s Security = \"%s\"\n", path, security);
1512 fputs("ERROR: can't get service security\n", stderr);
1517 _on_cmd_service_get_passphrase(char *cmd, char *args)
1519 const char *passphrase, *path;
1520 E_Connman_Element *e;
1524 fputs("ERROR: missing the service path\n", stderr);
1530 e = e_connman_service_get(path);
1531 if (e_connman_service_passphrase_get(e, &passphrase))
1532 printf(":::Service %s Passphrase = \"%s\"\n", path, passphrase);
1534 fputs("ERROR: can't get service passphrase\n", stderr);
1539 _on_cmd_service_set_passphrase(char *cmd, char *args)
1541 char *passphrase, *path;
1542 E_Connman_Element *e;
1546 fputs("ERROR: missing the service path\n", stderr);
1550 passphrase = _tok(args);
1554 fputs("ERROR: missing the passphrase value\n", stderr);
1559 e = e_connman_service_get(path);
1560 if (e_connman_service_passphrase_set
1561 (e, passphrase, _method_success_check, "service_set_passphrase"))
1562 printf(":::Service %s passphrase set to \"%s\"\n", path, passphrase);
1564 fputs("ERROR: can't set service passphrase\n", stderr);
1569 _on_cmd_service_get_passphrase_required(char *cmd, char *args)
1573 E_Connman_Element *e;
1577 fputs("ERROR: missing the service path\n", stderr);
1583 e = e_connman_service_get(path);
1584 if (e_connman_service_passphrase_required_get(e, &passphrase))
1585 printf(":::Service %s Passphrase Required = %hhu\n", path, passphrase);
1587 fputs("ERROR: can't get service passphrase required\n", stderr);
1592 _on_cmd_service_get_strength(char *cmd, char *args)
1595 unsigned char strength;
1596 E_Connman_Element *e;
1600 fputs("ERROR: missing the service path\n", stderr);
1606 e = e_connman_service_get(path);
1607 if (e_connman_service_strength_get(e, &strength))
1608 printf(":::Service %s Strength = %#02hhx (%d)\n", path, strength, strength);
1610 fputs("ERROR: can't get service strength\n", stderr);
1615 _on_cmd_service_get_favorite(char *cmd, char *args)
1619 E_Connman_Element *e;
1623 fputs("ERROR: missing the service path\n", stderr);
1629 e = e_connman_service_get(path);
1630 if (e_connman_service_favorite_get(e, &favorite))
1631 printf(":::Service %s Favorite = %hhu\n", path, favorite);
1633 fputs("ERROR: can't get service favorite\n", stderr);
1638 _on_cmd_service_get_immutable(char *cmd, char *args)
1642 E_Connman_Element *e;
1646 fputs("ERROR: missing the service path\n", stderr);
1652 e = e_connman_service_get(path);
1653 if (e_connman_service_immutable_get(e, &immutable))
1654 printf(":::Service %s Immutable = %hhu\n", path, immutable);
1656 fputs("ERROR: can't get service immutable\n", stderr);
1661 _on_cmd_service_get_auto_connect(char *cmd, char *args)
1665 E_Connman_Element *e;
1669 fputs("ERROR: missing the service path\n", stderr);
1675 e = e_connman_service_get(path);
1676 if (e_connman_service_auto_connect_get(e, &auto_connect))
1677 printf(":::Service %s Auto Connect = %hhu\n", path, auto_connect);
1679 fputs("ERROR: can't get service auto connect\n", stderr);
1684 _on_cmd_service_set_auto_connect(char *cmd, char *args)
1686 char *path, *next_args;
1688 E_Connman_Element *e;
1692 fputs("ERROR: missing the service path\n", stderr);
1696 next_args = _tok(args);
1700 fputs("ERROR: missing the auto connect value\n", stderr);
1704 auto_connect = !!atol(next_args);
1706 e = e_connman_service_get(path);
1707 if (e_connman_service_auto_connect_set
1708 (e, auto_connect, _method_success_check, "service_set_auto_connect"))
1709 printf(":::Service %s auto connect set to %d\n", path, auto_connect);
1711 fputs("ERROR: can't set service auto connect\n", stderr);
1716 _on_cmd_service_get_setup_required(char *cmd, char *args)
1719 bool setup_required;
1720 E_Connman_Element *e;
1724 fputs("ERROR: missing the service path\n", stderr);
1730 e = e_connman_service_get(path);
1731 if (e_connman_service_setup_required_get(e, &setup_required))
1732 printf(":::Service %s Setup Required = %hhu\n", path, setup_required);
1734 fputs("ERROR: can't get service setup required\n", stderr);
1739 _on_cmd_service_get_apn(char *cmd, char *args)
1741 const char *apn, *path;
1742 E_Connman_Element *e;
1746 fputs("ERROR: missing the service path\n", stderr);
1752 e = e_connman_service_get(path);
1753 if (e_connman_service_apn_get(e, &apn))
1754 printf(":::Service %s APN = \"%s\"\n", path, apn);
1756 fputs("ERROR: can't get service APN\n", stderr);
1761 _on_cmd_service_set_apn(char *cmd, char *args)
1764 E_Connman_Element *e;
1768 fputs("ERROR: missing the service path\n", stderr);
1776 fputs("ERROR: missing the apn value\n", stderr);
1781 e = e_connman_service_get(path);
1782 if (e_connman_service_apn_set
1783 (e, apn, _method_success_check, "service_set_apn"))
1784 printf(":::Service %s APN set to \"%s\"\n", path, apn);
1786 fputs("ERROR: can't set service APN\n", stderr);
1791 _on_cmd_service_get_mcc(char *cmd, char *args)
1793 const char *mcc, *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_mcc_get(e, &mcc))
1806 printf(":::Service %s MCC = \"%s\"\n", path, mcc);
1808 fputs("ERROR: can't get service MCC\n", stderr);
1813 _on_cmd_service_get_mnc(char *cmd, char *args)
1815 const char *mnc, *path;
1816 E_Connman_Element *e;
1820 fputs("ERROR: missing the service path\n", stderr);
1826 e = e_connman_service_get(path);
1827 if (e_connman_service_mnc_get(e, &mnc))
1828 printf(":::Service %s MNC = \"%s\"\n", path, mnc);
1830 fputs("ERROR: can't get service MNC\n", stderr);
1835 _on_cmd_service_get_roaming(char *cmd, char *args)
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_roaming_get(e, &roaming))
1851 printf(":::Service %s Roaming = %hhu\n", path, roaming);
1853 fputs("ERROR: can't get service roaming\n", stderr);
1858 _on_cmd_service_get_ipv4_method(char *cmd, char *args)
1860 const char *ipv4_method, *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_method_get(e, &ipv4_method))
1873 printf(":::Service %s IPv4 Method = \"%s\"\n", path, ipv4_method);
1875 fputs("ERROR: can't get service ipv4 method\n", stderr);
1880 _on_cmd_service_get_ipv4_address(char *cmd, char *args)
1882 const char *ipv4_address, *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_address_get(e, &ipv4_address))
1895 printf(":::Service %s IPv4 Address = \"%s\"\n", path, ipv4_address);
1897 fputs("ERROR: can't get service ipv4 address\n", stderr);
1902 _on_cmd_service_get_ipv4_gateway(char *cmd, char *args)
1904 const char *ipv4_gateway, *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_gateway_get(e, &ipv4_gateway))
1917 printf(":::Service %s IPv4 Gateway = \"%s\"\n", path, ipv4_gateway);
1919 fputs("ERROR: can't get service ipv4 gateway\n", stderr);
1924 _on_cmd_service_get_ipv4_netmask(char *cmd, char *args)
1926 const char *ipv4_netmask, *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_netmask_get(e, &ipv4_netmask))
1939 printf(":::Service %s IPv4 Netmask = \"%s\"\n", path, ipv4_netmask);
1941 fputs("ERROR: can't get service ipv4 netmask\n", stderr);
1946 _on_cmd_service_get_ipv4_configuration_method(char *cmd, char *args)
1948 const char *ipv4_method, *path;
1949 E_Connman_Element *e;
1953 fputs("ERROR: missing the service path\n", stderr);
1959 e = e_connman_service_get(path);
1960 if (e_connman_service_ipv4_configuration_method_get(e, &ipv4_method))
1961 printf(":::Service %s IPv4 Configuration Method = \"%s\"\n",
1964 fputs("ERROR: can't get service ipv4_configuration method\n", stderr);
1969 _on_cmd_service_get_ipv4_configuration_address(char *cmd, char *args)
1971 const char *ipv4_address, *path;
1972 E_Connman_Element *e;
1976 fputs("ERROR: missing the service path\n", stderr);
1982 e = e_connman_service_get(path);
1983 if (e_connman_service_ipv4_configuration_address_get(e, &ipv4_address))
1984 printf(":::Service %s IPv4 Configuration Address = \"%s\"\n",
1985 path, ipv4_address);
1987 fputs("ERROR: can't get service ipv4_configuration address\n", stderr);
1992 _on_cmd_service_get_ipv4_configuration_gateway(char *cmd, char *args)
1994 const char *ipv4_gateway, *path;
1995 E_Connman_Element *e;
1999 fputs("ERROR: missing the service path\n", stderr);
2005 e = e_connman_service_get(path);
2006 if (e_connman_service_ipv4_configuration_gateway_get(e, &ipv4_gateway))
2007 printf(":::Service %s IPv4 Configuration Gateway = \"%s\"\n",
2008 path, ipv4_gateway);
2010 fputs("ERROR: can't get service ipv4_configuration gateway\n", stderr);
2015 _on_cmd_service_get_ipv4_configuration_netmask(char *cmd, char *args)
2017 const char *ipv4_netmask, *path;
2018 E_Connman_Element *e;
2022 fputs("ERROR: missing the service path\n", stderr);
2028 e = e_connman_service_get(path);
2029 if (e_connman_service_ipv4_configuration_netmask_get(e, &ipv4_netmask))
2030 printf(":::Service %s IPv4 Configuration Netmask = \"%s\"\n",
2031 path, ipv4_netmask);
2033 fputs("ERROR: can't get service ipv4 configuration netmask\n", stderr);
2038 _on_cmd_service_ipv4_configure_dhcp(char *cmd, char *args)
2041 E_Connman_Element *e;
2045 fputs("ERROR: missing the service path\n", stderr);
2051 e = e_connman_service_get(path);
2052 if (e_connman_service_ipv4_configure_dhcp
2053 (e, _method_success_check, "service_ipv4_configure_dhcp"))
2054 printf(":::Service %s IPv4 Configuration set to DHCP\n", path);
2056 fputs("ERROR: can't set service ipv4_configuration dhcp\n", stderr);
2061 _on_cmd_service_ipv4_configure_manual(char *cmd, char *args)
2063 char *path, *next_args, *address, *netmask = NULL;
2064 E_Connman_Element *e;
2068 fputs("ERROR: missing the service path\n", stderr);
2072 next_args = _tok(args);
2075 fputs("ERROR: missing the service address\n", stderr);
2079 address = next_args;
2080 next_args = _tok(next_args);
2083 netmask = next_args;
2087 e = e_connman_service_get(path);
2088 if (e_connman_service_ipv4_configure_manual
2089 (e, address, netmask,
2090 _method_success_check, "service_ipv4_configure_manual"))
2091 printf(":::Service %s IPv4 Configuration set to Manual (%s/%s)\n",
2092 path, address, netmask);
2094 fputs("ERROR: can't set service ipv4_configuration manual\n", stderr);
2099 _on_cmd_service_get_ethernet_method(char *cmd, char *args)
2101 const char *ethernet_method, *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_method_get(e, ðernet_method))
2114 printf(":::Service %s Ethernet Method = \"%s\"\n", path, ethernet_method);
2116 fputs("ERROR: can't get service ethernet method\n", stderr);
2121 _on_cmd_service_get_ethernet_address(char *cmd, char *args)
2123 const char *ethernet_address, *path;
2124 E_Connman_Element *e;
2128 fputs("ERROR: missing the service path\n", stderr);
2134 e = e_connman_service_get(path);
2135 if (e_connman_service_ethernet_address_get(e, ðernet_address))
2136 printf(":::Service %s Ethernet Address = \"%s\"\n",
2137 path, ethernet_address);
2139 fputs("ERROR: can't get service ethernet address\n", stderr);
2144 _on_cmd_service_get_ethernet_mtu(char *cmd, char *args)
2147 E_Connman_Element *e;
2148 unsigned short ethernet_mtu;
2152 fputs("ERROR: missing the service path\n", stderr);
2158 e = e_connman_service_get(path);
2159 if (e_connman_service_ethernet_mtu_get(e, ðernet_mtu))
2160 printf(":::Service %s Ethernet MTU = %hu\n", path, ethernet_mtu);
2162 fputs("ERROR: can't get service ethernet mtu\n", stderr);
2167 _on_cmd_service_get_ethernet_netmask(char *cmd, char *args)
2169 const char *ethernet_netmask, *path;
2170 E_Connman_Element *e;
2174 fputs("ERROR: missing the service path\n", stderr);
2180 e = e_connman_service_get(path);
2181 if (e_connman_service_ethernet_netmask_get(e, ðernet_netmask))
2182 printf(":::Service %s Ethernet Netmask = \"%s\"\n",
2183 path, ethernet_netmask);
2185 fputs("ERROR: can't get service ethernet netmask\n", stderr);
2191 _on_input(void *data, Ecore_Fd_Handler *fd_handler)
2197 int (*cb)(char *cmd, char *args);
2199 {"quit", _on_cmd_quit},
2200 {"sync", _on_cmd_sync},
2201 {"get_all", _on_cmd_get_all},
2202 {"print", _on_cmd_print},
2203 {"get_properties", _on_cmd_get_properties},
2204 {"set_property", _on_cmd_property_set},
2205 {"manager_get", _on_cmd_manager_get},
2206 {"manager_get_profiles", _on_cmd_manager_get_profiles},
2207 {"manager_get_devices", _on_cmd_manager_get_devices},
2208 {"manager_get_services", _on_cmd_manager_get_services},
2209 {"manager_register_agent", _on_cmd_manager_register_agent},
2210 {"manager_unregister_agent", _on_cmd_manager_unregister_agent},
2211 {"manager_get_state", _on_cmd_manager_get_state},
2212 {"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
2213 {"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
2214 {"manager_request_scan", _on_cmd_manager_request_scan},
2215 {"manager_technology_enable", _on_cmd_manager_technology_enable},
2216 {"manager_technology_disable", _on_cmd_manager_technology_disable},
2217 {"manager_get_technologies_available", _on_cmd_manager_get_technologies_available},
2218 {"manager_get_technologies_enabled", _on_cmd_manager_get_technologies_enabled},
2219 {"manager_get_technologies_connected", _on_cmd_manager_get_technologies_connected},
2220 {"manager_profile_remove", _on_cmd_manager_profile_remove},
2221 {"manager_profile_get_active", _on_cmd_manager_profile_get_active},
2222 {"manager_profile_set_active", _on_cmd_manager_profile_set_active},
2223 {"device_propose_scan", _on_cmd_device_propose_scan},
2224 {"device_get_address", _on_cmd_device_get_address},
2225 {"device_get_name", _on_cmd_device_get_name},
2226 {"device_get_type", _on_cmd_device_get_type},
2227 {"device_get_interface", _on_cmd_device_get_interface},
2228 {"device_get_powered", _on_cmd_device_get_powered},
2229 {"device_set_powered", _on_cmd_device_set_powered},
2230 {"device_get_scan_interval", _on_cmd_device_get_scan_interval},
2231 {"device_set_scan_interval", _on_cmd_device_set_scan_interval},
2232 {"device_get_scanning", _on_cmd_device_get_scanning},
2233 {"device_get_networks", _on_cmd_device_get_networks},
2234 {"profile_get_name", _on_cmd_profile_get_name},
2235 {"profile_set_name", _on_cmd_profile_set_name},
2236 {"profile_get_offline_mode", _on_cmd_profile_get_offline_mode},
2237 {"profile_set_offline_mode", _on_cmd_profile_set_offline_mode},
2238 {"profile_get_services", _on_cmd_profile_get_services},
2239 {"network_get_address", _on_cmd_network_get_address},
2240 {"network_get_name", _on_cmd_network_get_name},
2241 {"network_get_connected", _on_cmd_network_get_connected},
2242 {"network_get_strength", _on_cmd_network_get_strength},
2243 {"network_get_frequency", _on_cmd_network_get_frequency},
2244 {"network_get_device", _on_cmd_network_get_device},
2245 {"network_get_wifi_ssid", _on_cmd_network_get_wifi_ssid},
2246 {"network_get_wifi_mode", _on_cmd_network_get_wifi_mode},
2247 {"network_get_wifi_security", _on_cmd_network_get_wifi_security},
2248 {"network_get_wifi_passphrase", _on_cmd_network_get_wifi_passphrase},
2249 {"network_get_wifi_channel", _on_cmd_network_get_wifi_channel},
2250 {"network_get_wifi_eap", _on_cmd_network_get_wifi_eap},
2251 {"service_connect", _on_cmd_service_connect},
2252 {"service_disconnect", _on_cmd_service_disconnect},
2253 {"service_remove", _on_cmd_service_remove},
2254 {"service_move_before", _on_cmd_service_move_before},
2255 {"service_move_after", _on_cmd_service_move_after},
2256 {"service_get_state", _on_cmd_service_get_state},
2257 {"service_get_error", _on_cmd_service_get_error},
2258 {"service_get_name", _on_cmd_service_get_name},
2259 {"service_get_type", _on_cmd_service_get_type},
2260 {"service_get_mode", _on_cmd_service_get_mode},
2261 {"service_get_security", _on_cmd_service_get_security},
2262 {"service_get_passphrase", _on_cmd_service_get_passphrase},
2263 {"service_set_passphrase", _on_cmd_service_set_passphrase},
2264 {"service_get_passphrase_required", _on_cmd_service_get_passphrase_required},
2265 {"service_get_strength", _on_cmd_service_get_strength},
2266 {"service_get_favorite", _on_cmd_service_get_favorite},
2267 {"service_get_immutable", _on_cmd_service_get_immutable},
2268 {"service_get_auto_connect", _on_cmd_service_get_auto_connect},
2269 {"service_set_auto_connect", _on_cmd_service_set_auto_connect},
2270 {"service_get_setup_required", _on_cmd_service_get_setup_required},
2271 {"service_get_apn", _on_cmd_service_get_apn},
2272 {"service_set_apn", _on_cmd_service_set_apn},
2273 {"service_get_mcc", _on_cmd_service_get_mcc},
2274 {"service_get_mnc", _on_cmd_service_get_mnc},
2275 {"service_get_roaming", _on_cmd_service_get_roaming},
2276 {"service_get_ipv4_method", _on_cmd_service_get_ipv4_method},
2277 {"service_get_ipv4_address", _on_cmd_service_get_ipv4_address},
2278 {"service_get_ipv4_gateway", _on_cmd_service_get_ipv4_gateway},
2279 {"service_get_ipv4_netmask", _on_cmd_service_get_ipv4_netmask},
2280 {"service_get_ipv4_configuration_method", _on_cmd_service_get_ipv4_configuration_method},
2281 {"service_get_ipv4_configuration_address", _on_cmd_service_get_ipv4_configuration_address},
2282 {"service_get_ipv4_configuration_gateway", _on_cmd_service_get_ipv4_configuration_gateway},
2283 {"service_get_ipv4_configuration_netmask", _on_cmd_service_get_ipv4_configuration_netmask},
2284 {"service_ipv4_configure_dhcp", _on_cmd_service_ipv4_configure_dhcp},
2285 {"service_ipv4_configure_manual", _on_cmd_service_ipv4_configure_manual},
2286 {"service_get_ethernet_method", _on_cmd_service_get_ethernet_method},
2287 {"service_get_ethernet_address", _on_cmd_service_get_ethernet_address},
2288 {"service_get_ethernet_mtu", _on_cmd_service_get_ethernet_mtu},
2289 {"service_get_ethernet_netmask", _on_cmd_service_get_ethernet_netmask},
2294 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
2296 fputs("ERROR: reading from stdin, exit\n", stderr);
2300 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
2302 fputs("ERROR: nothing to read?\n", stderr);
2306 if (!fgets(buf, sizeof(buf), stdin))
2308 fprintf(stderr, "ERROR: could not read command: %s\n", strerror(errno));
2309 ecore_main_loop_quit();
2314 while (isspace(*cmd))
2317 args = strchr(cmd, ' ');
2325 while (isspace(*args))
2328 p = args + strlen(args) - 1;
2336 p = cmd + strlen(cmd) - 1;
2341 if (strcmp(cmd, "help") == 0)
2345 printf("Commands with '%s' in the name:\n", args);
2346 for (itr = maps; itr->cmd != NULL; itr++)
2347 if (strstr(itr->cmd, args))
2348 printf("\t%s\n", itr->cmd);
2352 fputs("Commands:\n", stdout);
2353 for (itr = maps; itr->cmd != NULL; itr++)
2354 printf("\t%s\n", itr->cmd);
2356 fputc('\n', stdout);
2360 for (itr = maps; itr->cmd != NULL; itr++)
2361 if (strcmp(itr->cmd, cmd) == 0)
2362 return itr->cb(cmd, args);
2364 printf("unknown command \"%s\", args=%s\n", cmd, args);
2369 main(int argc, char *argv[])
2371 E_DBus_Connection *c;
2377 c = e_dbus_bus_get(DBUS_BUS_SYSTEM);
2379 printf("ERROR: can't connect to system session\n");
2383 e_connman_system_init(c);
2384 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_ADD, _on_element_add, NULL);
2385 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_DEL, _on_element_del, NULL);
2386 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_UPDATED,
2387 _on_element_updated, NULL);
2389 ecore_main_fd_handler_add
2390 (0, ECORE_FD_READ | ECORE_FD_ERROR, _on_input, NULL, NULL, NULL);
2392 ecore_main_loop_begin();
2394 e_connman_system_shutdown();
2396 e_dbus_connection_close(c);
2401 fputs("DBG: clean exit.\n", stderr);