12 _method_success_check(void *data, __UNUSED__ DBusMessage *msg, DBusError *error)
14 const char *name = data;
16 if ((!error) || (!dbus_error_is_set(error)))
18 printf("SUCCESS: method %s() finished successfully.\n", name);
22 printf("FAILURE: method %s() finished with error: %s %s\n",
23 name, error->name, error->message);
24 dbus_error_free(error);
28 _elements_print(E_Connman_Element **elements, unsigned int count)
31 for (i = 0; i < count; i++)
33 printf("--- element %d:\n", i);
34 e_connman_element_print(stdout, elements[i]);
37 printf("END: all elements count = %u\n", count);
41 _strings_print(const char **strings, unsigned int count)
44 for (i = 0; i < count; i++)
45 printf("--- strings %d: \"%s\"\n", i, strings[i]);
47 printf("END: all strings count = %u\n", count);
51 _on_element_add(__UNUSED__ void *data, __UNUSED__ int type, void *info)
53 E_Connman_Element *element = info;
54 printf(">>> %s\n", element->path);
55 return ECORE_CALLBACK_PASS_ON;
59 _on_element_del(__UNUSED__ void *data, __UNUSED__ int type, void *info)
61 E_Connman_Element *element = info;
62 printf("<<< %s\n", element->path);
63 return ECORE_CALLBACK_PASS_ON;
67 _on_element_updated(__UNUSED__ void *data, __UNUSED__ int type, void *info)
69 E_Connman_Element *element = info;
70 printf("!!! %s\n", element->path);
71 e_connman_element_print(stderr, element);
72 return ECORE_CALLBACK_PASS_ON;
76 _on_cmd_quit(__UNUSED__ char *cmd, __UNUSED__ char *args)
78 fputs("Bye!\n", stderr);
79 ecore_main_loop_quit();
80 return ECORE_CALLBACK_CANCEL;
84 _on_cmd_sync(__UNUSED__ char *cmd, __UNUSED__ char *args)
86 e_connman_manager_sync_elements();
87 return ECORE_CALLBACK_RENEW;
108 _on_cmd_get_all(__UNUSED__ char *cmd, char *args)
110 E_Connman_Element **elements;
121 ret = e_connman_elements_get_all_type(type, &count, &elements);
123 ret = e_connman_elements_get_all(&count, &elements);
126 fputs("ERROR: could not get elements\n", stderr);
129 printf("BEG: all elements type=%s count = %d\n", type, count);
130 _elements_print(elements, count);
133 return ECORE_CALLBACK_RENEW;
136 static E_Connman_Element *
137 _element_from_args(char *args, char **next_args)
139 E_Connman_Element *element;
143 fputs("ERROR: missing element path\n", stderr);
148 *next_args = _tok(args);
149 element = e_connman_element_get(args);
151 fprintf(stderr, "ERROR: no element called \"%s\".\n", args);
157 _on_cmd_print(__UNUSED__ char *cmd, char *args)
160 E_Connman_Element *element = _element_from_args(args, &next_args);
162 e_connman_element_print(stdout, element);
163 return ECORE_CALLBACK_RENEW;
167 _on_cmd_get_properties(__UNUSED__ char *cmd, char *args)
170 E_Connman_Element *element = _element_from_args(args, &next_args);
172 e_connman_element_properties_sync(element);
173 return ECORE_CALLBACK_RENEW;
177 _on_cmd_property_set(__UNUSED__ char *cmd, char *args)
179 char *next_args, *name, *p;
180 E_Connman_Element *element = _element_from_args(args, &next_args);
188 return ECORE_CALLBACK_RENEW;
192 fputs("ERROR: missing parameters name, type and value.\n", stderr);
193 return ECORE_CALLBACK_RENEW;
200 fputs("ERROR: missing parameters type and value.\n", stderr);
201 return ECORE_CALLBACK_RENEW;
207 fputs("ERROR: missing parameter value.\n", stderr);
208 return ECORE_CALLBACK_RENEW;
214 case DBUS_TYPE_BOOLEAN:
215 vlong = !!atol(next_args);
217 fprintf(stderr, "DBG: boolean is: %ld\n", vlong);
219 case DBUS_TYPE_UINT16:
220 vu16 = strtol(next_args, &p, 0);
223 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
224 return ECORE_CALLBACK_RENEW;
227 fprintf(stderr, "DBG: u16 is: %hu\n", vu16);
229 case DBUS_TYPE_UINT32:
230 vu32 = strtol(next_args, &p, 0);
233 fprintf(stderr, "ERROR: invalid number \"%s\".\n", next_args);
234 return ECORE_CALLBACK_RENEW;
237 fprintf(stderr, "DBG: u16 is: %u\n", vu32);
239 case DBUS_TYPE_STRING:
240 case DBUS_TYPE_OBJECT_PATH:
241 p = next_args + strlen(next_args);
244 while (p > next_args && isspace(*p))
248 fprintf(stderr, "ERROR: invalid string \"%s\".\n", next_args);
252 fprintf(stderr, "DBG: string is: \"%s\"\n", next_args);
255 fprintf(stderr, "ERROR: don't know how to parse type '%c' (%d)\n",
257 return ECORE_CALLBACK_RENEW;
260 fprintf(stderr, "set_property %s [%p] %s %c %p...\n",
261 args, element, name, type, value);
262 if (!e_connman_element_property_set(element, name, type, value))
263 fputs("ERROR: error setting property.\n", stderr);
265 return ECORE_CALLBACK_RENEW;
269 /* Manager Commands */
272 _on_cmd_manager_get(__UNUSED__ char *cmd, __UNUSED__ char *args)
274 E_Connman_Element *element;
275 element = e_connman_manager_get();
276 e_connman_element_print(stderr, element);
277 return ECORE_CALLBACK_RENEW;
281 _on_cmd_manager_get_profiles(__UNUSED__ char *cmd, __UNUSED__ char *args)
284 E_Connman_Element **profiles;
286 if (!e_connman_manager_profiles_get(&count, &profiles))
288 fputs("ERROR: can't get profiles\n", stderr);
289 return ECORE_CALLBACK_RENEW;
291 printf("BEG: all manager profiles elements count = %d\n", count);
292 _elements_print(profiles, count);
293 return ECORE_CALLBACK_RENEW;
297 _on_cmd_manager_get_services(__UNUSED__ char *cmd, __UNUSED__ char *args)
300 E_Connman_Element **services;
302 if (!e_connman_manager_services_get(&count, &services))
304 fputs("ERROR: can't get services\n", stderr);
305 return ECORE_CALLBACK_RENEW;
307 printf("BEG: all manager services elements count = %d\n", count);
308 _elements_print(services, count);
309 return ECORE_CALLBACK_RENEW;
313 _on_cmd_manager_register_agent(__UNUSED__ char *cmd, char *args)
319 fputs("ERROR: missing the object path\n", stderr);
320 return ECORE_CALLBACK_RENEW;
324 if (e_connman_manager_agent_register
325 (path, _method_success_check, "manager_register_agent"))
326 printf(":::Registering agent %s...\n", path);
328 fprintf(stderr, "ERROR: can't register agent %s\n", path);
330 return ECORE_CALLBACK_RENEW;
334 _on_cmd_manager_unregister_agent(__UNUSED__ char *cmd, char *args)
340 fputs("ERROR: missing the object path\n", stderr);
341 return ECORE_CALLBACK_RENEW;
345 if (e_connman_manager_agent_unregister
346 (path, _method_success_check, "manager_unregister_agent"))
347 printf(":::Unregistering agent %s...\n", path);
349 fprintf(stderr, "ERROR: can't unregister agent %s\n", path);
351 return ECORE_CALLBACK_RENEW;
355 _on_cmd_manager_get_state(__UNUSED__ char *cmd, __UNUSED__ char *args)
358 if (e_connman_manager_state_get(&state))
359 printf(":::Manager state = \"%s\"\n", state);
361 fputs("ERROR: can't get manager state\n", stderr);
362 return ECORE_CALLBACK_RENEW;
366 _on_cmd_manager_get_offline_mode(__UNUSED__ char *cmd, __UNUSED__ char *args)
369 if (e_connman_manager_offline_mode_get(&offline))
370 printf(":::Manager Offline Mode = %hhu\n", offline);
372 fputs("ERROR: can't get manager offline mode\n", stderr);
373 return ECORE_CALLBACK_RENEW;
377 _on_cmd_manager_set_offline_mode(__UNUSED__ char *cmd, char *args)
382 fputs("ERROR: missing the offline mode value\n", stderr);
383 return ECORE_CALLBACK_RENEW;
386 offline = !!atol(args);
387 if (e_connman_manager_offline_mode_set
388 (offline, _method_success_check, "manager_set_offline_mode"))
390 printf(":::Manager Offline Mode set to %hhu\n", offline);
392 fputs("ERROR: can't set manager offline mode\n", stderr);
393 return ECORE_CALLBACK_RENEW;
397 _on_cmd_manager_request_scan(__UNUSED__ char *cmd, char *args)
405 if (e_connman_manager_request_scan
406 (args, _method_success_check, "manager_request_scan"))
407 printf(":::Manager Request Scan for %s\n", args[0] ? args : "<all>");
409 fputs("ERROR: can't request scan on manager\n", stderr);
410 return ECORE_CALLBACK_RENEW;
414 _on_cmd_manager_technology_enable(__UNUSED__ char *cmd, char *args)
418 fputs("ERROR: missing the technology type\n", stderr);
419 return ECORE_CALLBACK_RENEW;
423 if (e_connman_manager_technology_enable
424 (args, _method_success_check, "manager_technology_enable"))
425 printf(":::Manager Enable Technology %s\n", args);
427 fputs("ERROR: can't enable technology on manager\n", stderr);
428 return ECORE_CALLBACK_RENEW;
432 _on_cmd_manager_technology_disable(__UNUSED__ char *cmd, char *args)
436 fputs("ERROR: missing the technology type\n", stderr);
437 return ECORE_CALLBACK_RENEW;
441 if (e_connman_manager_technology_disable
442 (args, _method_success_check, "manager_technology_disable"))
443 printf(":::Manager Disable Technology %s\n", args);
445 fputs("ERROR: can't disable technology on manager\n", stderr);
446 return ECORE_CALLBACK_RENEW;
450 _on_cmd_manager_get_technologies_available(__UNUSED__ char *cmd, __UNUSED__ char *args)
452 const char **strings;
455 if (!e_connman_manager_technologies_available_get(&count, &strings))
456 fputs("ERROR: can't get available technologies\n", stderr);
459 printf("BEG: available technologies count = %u\n", count);
460 _strings_print(strings, count);
463 return ECORE_CALLBACK_RENEW;
467 _on_cmd_manager_get_technologies_enabled(__UNUSED__ char *cmd, __UNUSED__ char *args)
469 const char **strings;
472 if (!e_connman_manager_technologies_enabled_get(&count, &strings))
473 fputs("ERROR: can't get enabled technologies\n", stderr);
476 printf("BEG: enabled technologies count = %u\n", count);
477 _strings_print(strings, count);
480 return ECORE_CALLBACK_RENEW;
484 _on_cmd_manager_get_technologies_connected(__UNUSED__ char *cmd, __UNUSED__ char *args)
486 const char **strings;
489 if (!e_connman_manager_technologies_connected_get(&count, &strings))
490 fputs("ERROR: can't get connected technologies\n", stderr);
493 printf("BEG: connected technologies count = %u\n", count);
494 _strings_print(strings, count);
497 return ECORE_CALLBACK_RENEW;
501 _on_cmd_manager_profile_remove(__UNUSED__ char *cmd, char *args)
503 E_Connman_Element *e;
507 fputs("ERROR: missing the profile path\n", stderr);
508 return ECORE_CALLBACK_RENEW;
512 e = e_connman_profile_get(args);
513 if (e_connman_manager_profile_remove
514 (e, _method_success_check, "manager_profile_remove"))
515 printf(":::Manager Remove Profile %s\n", args);
517 fputs("ERROR: can't remove profile from manager\n", stderr);
518 return ECORE_CALLBACK_RENEW;
522 _on_cmd_manager_profile_get_active(__UNUSED__ char *cmd, __UNUSED__ char *args)
524 E_Connman_Element *e;
526 if (!e_connman_manager_profile_active_get(&e))
527 fputs("ERROR: can't active_get profile from manager\n", stderr);
529 e_connman_element_print(stderr, e);
530 return ECORE_CALLBACK_RENEW;
534 _on_cmd_manager_profile_set_active(__UNUSED__ char *cmd, char *args)
536 E_Connman_Element *e;
540 fputs("ERROR: missing the profile path\n", stderr);
541 return ECORE_CALLBACK_RENEW;
545 e = e_connman_profile_get(args);
546 if (e_connman_manager_profile_active_set
547 (e, _method_success_check, "manager_profile_set_active"))
548 printf(":::Manager Active Profile set to %s\n", args);
550 fputs("ERROR: can't set active profile\n", stderr);
551 return ECORE_CALLBACK_RENEW;
554 /* Profile Commands */
557 _on_cmd_profile_get_name(__UNUSED__ char *cmd, char *args)
559 const char *name, *path;
560 E_Connman_Element *e;
564 fputs("ERROR: missing the profile path\n", stderr);
565 return ECORE_CALLBACK_RENEW;
570 e = e_connman_profile_get(path);
571 if (e_connman_profile_name_get(e, &name))
572 printf(":::Profile %s Name = \"%s\"\n", path, name);
574 fputs("ERROR: can't get profile name\n", stderr);
575 return ECORE_CALLBACK_RENEW;
579 _on_cmd_profile_set_name(__UNUSED__ char *cmd, char *args)
581 char *path, *next_args;
582 E_Connman_Element *e;
586 fputs("ERROR: missing the profile path\n", stderr);
587 return ECORE_CALLBACK_RENEW;
590 next_args = _tok(args);
593 fputs("ERROR: missing the offline mode value\n", stderr);
594 return ECORE_CALLBACK_RENEW;
598 e = e_connman_profile_get(path);
599 if (e_connman_profile_name_set
600 (e, next_args, _method_success_check, "profile_set_name"))
601 printf(":::Profile %s Name set to %s\n", path, next_args);
603 fputs("ERROR: can't set profile name\n", stderr);
604 return ECORE_CALLBACK_RENEW;
608 _on_cmd_profile_get_offline_mode(__UNUSED__ char *cmd, char *args)
612 E_Connman_Element *e;
616 fputs("ERROR: missing the profile path\n", stderr);
617 return ECORE_CALLBACK_RENEW;
622 e = e_connman_profile_get(path);
623 if (e_connman_profile_offline_mode_get(e, &offline))
624 printf(":::Profile %s Offline Mode = %hhu\n", path, offline);
626 fputs("ERROR: can't get profile offline mode\n", stderr);
627 return ECORE_CALLBACK_RENEW;
631 _on_cmd_profile_set_offline_mode(__UNUSED__ char *cmd, char *args)
633 char *path, *next_args;
635 E_Connman_Element *e;
639 fputs("ERROR: missing the profile path\n", stderr);
640 return ECORE_CALLBACK_RENEW;
643 next_args = _tok(args);
646 fputs("ERROR: missing the offline mode value\n", stderr);
647 return ECORE_CALLBACK_RENEW;
650 offline = !!atol(next_args);
652 e = e_connman_profile_get(path);
653 if (e_connman_profile_offline_mode_set
654 (e, offline, _method_success_check, "profile_set_offline_mode"))
655 printf(":::Profile %s Offline Mode set to %hhu\n", path, offline);
657 fputs("ERROR: can't set profile offline mode\n", stderr);
658 return ECORE_CALLBACK_RENEW;
662 _on_cmd_profile_get_services(__UNUSED__ char *cmd, char *args)
664 E_Connman_Element **services;
665 E_Connman_Element *e;
671 fputs("ERROR: missing the profile path\n", stderr);
672 return ECORE_CALLBACK_RENEW;
677 e = e_connman_profile_get(path);
678 if (!e_connman_profile_services_get(e, &count, &services))
680 fputs("ERROR: can't get services\n", stderr);
681 return ECORE_CALLBACK_RENEW;
683 printf("BEG: all profile services count = %d\n", count);
684 _elements_print(services, count);
685 return ECORE_CALLBACK_RENEW;
689 /* Services Commands */
691 _on_cmd_service_connect(__UNUSED__ char *cmd, char *args)
694 E_Connman_Element *e;
698 fputs("ERROR: missing the service path\n", stderr);
699 return ECORE_CALLBACK_RENEW;
704 e = e_connman_service_get(path);
705 if (e_connman_service_connect
706 (e, _method_success_check, "service_connect"))
707 printf(":::Connecting to Service %s...\n", path);
709 fputs("ERROR: can't connect to service\n", stderr);
710 return ECORE_CALLBACK_RENEW;
714 _on_cmd_service_disconnect(__UNUSED__ char *cmd, char *args)
717 E_Connman_Element *e;
721 fputs("ERROR: missing the service path\n", stderr);
722 return ECORE_CALLBACK_RENEW;
727 e = e_connman_service_get(path);
728 if (e_connman_service_disconnect
729 (e, _method_success_check, "service_disconnect"))
730 printf(":::Disconnecting Service %s...\n", path);
732 fputs("ERROR: can't disconnect service\n", stderr);
733 return ECORE_CALLBACK_RENEW;
737 _on_cmd_service_remove(__UNUSED__ char *cmd, char *args)
740 E_Connman_Element *e;
744 fputs("ERROR: missing the service path\n", stderr);
745 return ECORE_CALLBACK_RENEW;
750 e = e_connman_service_get(path);
751 if (e_connman_service_remove
752 (e, _method_success_check, "service_remove"))
753 printf(":::Removing Service %s...\n", path);
755 fputs("ERROR: can't remove service\n", stderr);
756 return ECORE_CALLBACK_RENEW;
760 _on_cmd_service_move_before(__UNUSED__ char *cmd, char *args)
762 char *path, *service_path;
763 E_Connman_Element *e;
767 fputs("ERROR: missing the service path\n", stderr);
768 return ECORE_CALLBACK_RENEW;
775 fputs("ERROR: missing the object service\n", stderr);
776 return ECORE_CALLBACK_RENEW;
780 e = e_connman_service_get(service_path);
781 if (e_connman_service_move_before
782 (e, path, _method_success_check, "service_move_before"))
783 printf(":::Moving before %s...\n", path);
785 fputs("ERROR: can't move before\n", stderr);
786 return ECORE_CALLBACK_RENEW;
790 _on_cmd_service_move_after(__UNUSED__ char *cmd, char *args)
792 char *path, *service_path;
793 E_Connman_Element *e;
797 fputs("ERROR: missing the service path\n", stderr);
798 return ECORE_CALLBACK_RENEW;
805 fputs("ERROR: missing the object service\n", stderr);
806 return ECORE_CALLBACK_RENEW;
810 e = e_connman_service_get(service_path);
811 if (e_connman_service_move_after
812 (e, path, _method_success_check, "service_move_after"))
813 printf(":::Moving after %s...\n", path);
815 fputs("ERROR: can't move after\n", stderr);
816 return ECORE_CALLBACK_RENEW;
820 _on_cmd_service_get_state(__UNUSED__ char *cmd, char *args)
822 const char *state, *path;
823 E_Connman_Element *e;
827 fputs("ERROR: missing the service path\n", stderr);
828 return ECORE_CALLBACK_RENEW;
833 e = e_connman_service_get(path);
834 if (e_connman_service_state_get(e, &state))
835 printf(":::Service %s State = \"%s\"\n", path, state);
837 fputs("ERROR: can't get service state\n", stderr);
838 return ECORE_CALLBACK_RENEW;
842 _on_cmd_service_get_error(__UNUSED__ char *cmd, char *args)
844 const char *error, *path;
845 E_Connman_Element *e;
849 fputs("ERROR: missing the service path\n", stderr);
850 return ECORE_CALLBACK_RENEW;
855 e = e_connman_service_get(path);
856 if (e_connman_service_error_get(e, &error))
857 printf(":::Service %s Error = \"%s\"\n", path, error);
859 fputs("ERROR: can't get service error\n", stderr);
860 return ECORE_CALLBACK_RENEW;
864 _on_cmd_service_get_name(__UNUSED__ char *cmd, char *args)
866 const char *name, *path;
867 E_Connman_Element *e;
871 fputs("ERROR: missing the service path\n", stderr);
872 return ECORE_CALLBACK_RENEW;
877 e = e_connman_service_get(path);
878 if (e_connman_service_name_get(e, &name))
879 printf(":::Service %s Name = \"%s\"\n", path, name);
881 fputs("ERROR: can't get service name\n", stderr);
882 return ECORE_CALLBACK_RENEW;
886 _on_cmd_service_get_type(__UNUSED__ char *cmd, char *args)
888 const char *type, *path;
889 E_Connman_Element *e;
893 fputs("ERROR: missing the service path\n", stderr);
894 return ECORE_CALLBACK_RENEW;
899 e = e_connman_service_get(path);
900 if (e_connman_service_type_get(e, &type))
901 printf(":::Service %s Type = \"%s\"\n", path, type);
903 fputs("ERROR: can't get service type\n", stderr);
904 return ECORE_CALLBACK_RENEW;
908 _on_cmd_service_get_mode(__UNUSED__ char *cmd, char *args)
910 const char *mode, *path;
911 E_Connman_Element *e;
915 fputs("ERROR: missing the service path\n", stderr);
916 return ECORE_CALLBACK_RENEW;
921 e = e_connman_service_get(path);
922 if (e_connman_service_mode_get(e, &mode))
923 printf(":::Service %s Mode = \"%s\"\n", path, mode);
925 fputs("ERROR: can't get service mode\n", stderr);
926 return ECORE_CALLBACK_RENEW;
930 _on_cmd_service_get_security(__UNUSED__ char *cmd, char *args)
932 const E_Connman_Array *security;
934 E_Connman_Element *e;
938 fputs("ERROR: missing the service path\n", stderr);
939 return ECORE_CALLBACK_RENEW;
944 e = e_connman_service_get(path);
945 if (e_connman_service_security_get(e, &security))
947 Eina_Array_Iterator iterator;
950 if (security->type != DBUS_TYPE_STRING)
952 fprintf(stderr, "ERROR: expected type '%c' but got '%c' for "
954 DBUS_TYPE_STRING, security->type);
955 return ECORE_CALLBACK_RENEW;
957 printf(":::Service %s Security = ", path);
958 EINA_ARRAY_ITER_NEXT(security->array, i, entry, iterator)
959 printf("\"%s\", ", entry);
963 fputs("ERROR: can't get service security\n", stderr);
964 return ECORE_CALLBACK_RENEW;
968 _on_cmd_service_get_passphrase(__UNUSED__ char *cmd, char *args)
970 const char *passphrase, *path;
971 E_Connman_Element *e;
975 fputs("ERROR: missing the service path\n", stderr);
976 return ECORE_CALLBACK_RENEW;
981 e = e_connman_service_get(path);
982 if (e_connman_service_passphrase_get(e, &passphrase))
983 printf(":::Service %s Passphrase = \"%s\"\n", path, passphrase);
985 fputs("ERROR: can't get service passphrase\n", stderr);
986 return ECORE_CALLBACK_RENEW;
990 _on_cmd_service_set_passphrase(__UNUSED__ char *cmd, char *args)
992 char *passphrase, *path;
993 E_Connman_Element *e;
997 fputs("ERROR: missing the service path\n", stderr);
998 return ECORE_CALLBACK_RENEW;
1001 passphrase = _tok(args);
1005 fputs("ERROR: missing the passphrase value\n", stderr);
1006 return ECORE_CALLBACK_RENEW;
1010 e = e_connman_service_get(path);
1011 if (e_connman_service_passphrase_set
1012 (e, passphrase, _method_success_check, "service_set_passphrase"))
1013 printf(":::Service %s passphrase set to \"%s\"\n", path, passphrase);
1015 fputs("ERROR: can't set service passphrase\n", stderr);
1016 return ECORE_CALLBACK_RENEW;
1020 _on_cmd_service_get_passphrase_required(__UNUSED__ char *cmd, char *args)
1023 Eina_Bool passphrase;
1024 E_Connman_Element *e;
1028 fputs("ERROR: missing the service path\n", stderr);
1029 return ECORE_CALLBACK_RENEW;
1034 e = e_connman_service_get(path);
1035 if (e_connman_service_passphrase_required_get(e, &passphrase))
1036 printf(":::Service %s Passphrase Required = %hhu\n", path, passphrase);
1038 fputs("ERROR: can't get service passphrase required\n", stderr);
1039 return ECORE_CALLBACK_RENEW;
1043 _on_cmd_service_get_strength(__UNUSED__ char *cmd, char *args)
1046 unsigned char strength;
1047 E_Connman_Element *e;
1051 fputs("ERROR: missing the service path\n", stderr);
1052 return ECORE_CALLBACK_RENEW;
1057 e = e_connman_service_get(path);
1058 if (e_connman_service_strength_get(e, &strength))
1059 printf(":::Service %s Strength = %#02hhx (%d)\n", path, strength, strength);
1061 fputs("ERROR: can't get service strength\n", stderr);
1062 return ECORE_CALLBACK_RENEW;
1066 _on_cmd_service_get_favorite(__UNUSED__ char *cmd, char *args)
1070 E_Connman_Element *e;
1074 fputs("ERROR: missing the service path\n", stderr);
1075 return ECORE_CALLBACK_RENEW;
1080 e = e_connman_service_get(path);
1081 if (e_connman_service_favorite_get(e, &favorite))
1082 printf(":::Service %s Favorite = %hhu\n", path, favorite);
1084 fputs("ERROR: can't get service favorite\n", stderr);
1085 return ECORE_CALLBACK_RENEW;
1089 _on_cmd_service_get_immutable(__UNUSED__ char *cmd, char *args)
1092 Eina_Bool immutable;
1093 E_Connman_Element *e;
1097 fputs("ERROR: missing the service path\n", stderr);
1098 return ECORE_CALLBACK_RENEW;
1103 e = e_connman_service_get(path);
1104 if (e_connman_service_immutable_get(e, &immutable))
1105 printf(":::Service %s Immutable = %hhu\n", path, immutable);
1107 fputs("ERROR: can't get service immutable\n", stderr);
1108 return ECORE_CALLBACK_RENEW;
1112 _on_cmd_service_get_auto_connect(__UNUSED__ char *cmd, char *args)
1115 Eina_Bool auto_connect;
1116 E_Connman_Element *e;
1120 fputs("ERROR: missing the service path\n", stderr);
1121 return ECORE_CALLBACK_RENEW;
1126 e = e_connman_service_get(path);
1127 if (e_connman_service_auto_connect_get(e, &auto_connect))
1128 printf(":::Service %s Auto Connect = %hhu\n", path, auto_connect);
1130 fputs("ERROR: can't get service auto connect\n", stderr);
1131 return ECORE_CALLBACK_RENEW;
1135 _on_cmd_service_set_auto_connect(__UNUSED__ char *cmd, char *args)
1137 char *path, *next_args;
1138 Eina_Bool auto_connect;
1139 E_Connman_Element *e;
1143 fputs("ERROR: missing the service path\n", stderr);
1144 return ECORE_CALLBACK_RENEW;
1147 next_args = _tok(args);
1151 fputs("ERROR: missing the auto connect value\n", stderr);
1152 return ECORE_CALLBACK_RENEW;
1155 auto_connect = !!atol(next_args);
1157 e = e_connman_service_get(path);
1158 if (e_connman_service_auto_connect_set
1159 (e, auto_connect, _method_success_check, "service_set_auto_connect"))
1160 printf(":::Service %s auto connect set to %d\n", path, auto_connect);
1162 fputs("ERROR: can't set service auto connect\n", stderr);
1163 return ECORE_CALLBACK_RENEW;
1167 _on_cmd_service_get_setup_required(__UNUSED__ char *cmd, char *args)
1170 Eina_Bool setup_required;
1171 E_Connman_Element *e;
1175 fputs("ERROR: missing the service path\n", stderr);
1176 return ECORE_CALLBACK_RENEW;
1181 e = e_connman_service_get(path);
1182 if (e_connman_service_setup_required_get(e, &setup_required))
1183 printf(":::Service %s Setup Required = %hhu\n", path, setup_required);
1185 fputs("ERROR: can't get service setup required\n", stderr);
1186 return ECORE_CALLBACK_RENEW;
1190 _on_cmd_service_get_apn(__UNUSED__ char *cmd, char *args)
1192 const char *apn, *path;
1193 E_Connman_Element *e;
1197 fputs("ERROR: missing the service path\n", stderr);
1198 return ECORE_CALLBACK_RENEW;
1203 e = e_connman_service_get(path);
1204 if (e_connman_service_apn_get(e, &apn))
1205 printf(":::Service %s APN = \"%s\"\n", path, apn);
1207 fputs("ERROR: can't get service APN\n", stderr);
1208 return ECORE_CALLBACK_RENEW;
1212 _on_cmd_service_set_apn(__UNUSED__ char *cmd, char *args)
1215 E_Connman_Element *e;
1219 fputs("ERROR: missing the service path\n", stderr);
1220 return ECORE_CALLBACK_RENEW;
1227 fputs("ERROR: missing the apn value\n", stderr);
1228 return ECORE_CALLBACK_RENEW;
1232 e = e_connman_service_get(path);
1233 if (e_connman_service_apn_set
1234 (e, apn, _method_success_check, "service_set_apn"))
1235 printf(":::Service %s APN set to \"%s\"\n", path, apn);
1237 fputs("ERROR: can't set service APN\n", stderr);
1238 return ECORE_CALLBACK_RENEW;
1242 _on_cmd_service_get_mcc(__UNUSED__ char *cmd, char *args)
1244 const char *mcc, *path;
1245 E_Connman_Element *e;
1249 fputs("ERROR: missing the service path\n", stderr);
1250 return ECORE_CALLBACK_RENEW;
1255 e = e_connman_service_get(path);
1256 if (e_connman_service_mcc_get(e, &mcc))
1257 printf(":::Service %s MCC = \"%s\"\n", path, mcc);
1259 fputs("ERROR: can't get service MCC\n", stderr);
1260 return ECORE_CALLBACK_RENEW;
1264 _on_cmd_service_get_mnc(__UNUSED__ char *cmd, char *args)
1266 const char *mnc, *path;
1267 E_Connman_Element *e;
1271 fputs("ERROR: missing the service path\n", stderr);
1272 return ECORE_CALLBACK_RENEW;
1277 e = e_connman_service_get(path);
1278 if (e_connman_service_mnc_get(e, &mnc))
1279 printf(":::Service %s MNC = \"%s\"\n", path, mnc);
1281 fputs("ERROR: can't get service MNC\n", stderr);
1282 return ECORE_CALLBACK_RENEW;
1286 _on_cmd_service_get_roaming(__UNUSED__ char *cmd, char *args)
1290 E_Connman_Element *e;
1294 fputs("ERROR: missing the service path\n", stderr);
1295 return ECORE_CALLBACK_RENEW;
1300 e = e_connman_service_get(path);
1301 if (e_connman_service_roaming_get(e, &roaming))
1302 printf(":::Service %s Roaming = %hhu\n", path, roaming);
1304 fputs("ERROR: can't get service roaming\n", stderr);
1305 return ECORE_CALLBACK_RENEW;
1309 _on_cmd_service_get_ipv4_method(__UNUSED__ char *cmd, char *args)
1311 const char *ipv4_method, *path;
1312 E_Connman_Element *e;
1316 fputs("ERROR: missing the service path\n", stderr);
1317 return ECORE_CALLBACK_RENEW;
1322 e = e_connman_service_get(path);
1323 if (e_connman_service_ipv4_method_get(e, &ipv4_method))
1324 printf(":::Service %s IPv4 Method = \"%s\"\n", path, ipv4_method);
1326 fputs("ERROR: can't get service ipv4 method\n", stderr);
1327 return ECORE_CALLBACK_RENEW;
1331 _on_cmd_service_get_ipv4_address(__UNUSED__ char *cmd, char *args)
1333 const char *ipv4_address, *path;
1334 E_Connman_Element *e;
1338 fputs("ERROR: missing the service path\n", stderr);
1339 return ECORE_CALLBACK_RENEW;
1344 e = e_connman_service_get(path);
1345 if (e_connman_service_ipv4_address_get(e, &ipv4_address))
1346 printf(":::Service %s IPv4 Address = \"%s\"\n", path, ipv4_address);
1348 fputs("ERROR: can't get service ipv4 address\n", stderr);
1349 return ECORE_CALLBACK_RENEW;
1353 _on_cmd_service_get_ipv4_gateway(__UNUSED__ char *cmd, char *args)
1355 const char *ipv4_gateway, *path;
1356 E_Connman_Element *e;
1360 fputs("ERROR: missing the service path\n", stderr);
1361 return ECORE_CALLBACK_RENEW;
1366 e = e_connman_service_get(path);
1367 if (e_connman_service_ipv4_gateway_get(e, &ipv4_gateway))
1368 printf(":::Service %s IPv4 Gateway = \"%s\"\n", path, ipv4_gateway);
1370 fputs("ERROR: can't get service ipv4 gateway\n", stderr);
1371 return ECORE_CALLBACK_RENEW;
1375 _on_cmd_service_get_ipv4_netmask(__UNUSED__ char *cmd, char *args)
1377 const char *ipv4_netmask, *path;
1378 E_Connman_Element *e;
1382 fputs("ERROR: missing the service path\n", stderr);
1383 return ECORE_CALLBACK_RENEW;
1388 e = e_connman_service_get(path);
1389 if (e_connman_service_ipv4_netmask_get(e, &ipv4_netmask))
1390 printf(":::Service %s IPv4 Netmask = \"%s\"\n", path, ipv4_netmask);
1392 fputs("ERROR: can't get service ipv4 netmask\n", stderr);
1393 return ECORE_CALLBACK_RENEW;
1397 _on_cmd_service_get_ipv4_configuration_method(__UNUSED__ char *cmd, char *args)
1399 const char *ipv4_method, *path;
1400 E_Connman_Element *e;
1404 fputs("ERROR: missing the service path\n", stderr);
1405 return ECORE_CALLBACK_RENEW;
1410 e = e_connman_service_get(path);
1411 if (e_connman_service_ipv4_configuration_method_get(e, &ipv4_method))
1412 printf(":::Service %s IPv4 Configuration Method = \"%s\"\n",
1415 fputs("ERROR: can't get service ipv4_configuration method\n", stderr);
1416 return ECORE_CALLBACK_RENEW;
1420 _on_cmd_service_get_ipv4_configuration_address(__UNUSED__ char *cmd, char *args)
1422 const char *ipv4_address, *path;
1423 E_Connman_Element *e;
1427 fputs("ERROR: missing the service path\n", stderr);
1428 return ECORE_CALLBACK_RENEW;
1433 e = e_connman_service_get(path);
1434 if (e_connman_service_ipv4_configuration_address_get(e, &ipv4_address))
1435 printf(":::Service %s IPv4 Configuration Address = \"%s\"\n",
1436 path, ipv4_address);
1438 fputs("ERROR: can't get service ipv4_configuration address\n", stderr);
1439 return ECORE_CALLBACK_RENEW;
1443 _on_cmd_service_get_ipv4_configuration_gateway(__UNUSED__ char *cmd, char *args)
1445 const char *ipv4_gateway, *path;
1446 E_Connman_Element *e;
1450 fputs("ERROR: missing the service path\n", stderr);
1451 return ECORE_CALLBACK_RENEW;
1456 e = e_connman_service_get(path);
1457 if (e_connman_service_ipv4_configuration_gateway_get(e, &ipv4_gateway))
1458 printf(":::Service %s IPv4 Configuration Gateway = \"%s\"\n",
1459 path, ipv4_gateway);
1461 fputs("ERROR: can't get service ipv4_configuration gateway\n", stderr);
1462 return ECORE_CALLBACK_RENEW;
1466 _on_cmd_service_get_ipv4_configuration_netmask(__UNUSED__ char *cmd, char *args)
1468 const char *ipv4_netmask, *path;
1469 E_Connman_Element *e;
1473 fputs("ERROR: missing the service path\n", stderr);
1474 return ECORE_CALLBACK_RENEW;
1479 e = e_connman_service_get(path);
1480 if (e_connman_service_ipv4_configuration_netmask_get(e, &ipv4_netmask))
1481 printf(":::Service %s IPv4 Configuration Netmask = \"%s\"\n",
1482 path, ipv4_netmask);
1484 fputs("ERROR: can't get service ipv4 configuration netmask\n", stderr);
1485 return ECORE_CALLBACK_RENEW;
1489 _on_cmd_service_ipv4_configure_dhcp(__UNUSED__ char *cmd, char *args)
1492 E_Connman_Element *e;
1496 fputs("ERROR: missing the service path\n", stderr);
1497 return ECORE_CALLBACK_RENEW;
1502 e = e_connman_service_get(path);
1503 if (e_connman_service_ipv4_configure_dhcp
1504 (e, _method_success_check, "service_ipv4_configure_dhcp"))
1505 printf(":::Service %s IPv4 Configuration set to DHCP\n", path);
1507 fputs("ERROR: can't set service ipv4_configuration dhcp\n", stderr);
1508 return ECORE_CALLBACK_RENEW;
1512 _on_cmd_service_ipv4_configure_manual(__UNUSED__ char *cmd, char *args)
1514 char *path, *next_args, *address, *netmask = NULL, *gateway = NULL;
1515 E_Connman_Element *e;
1519 fputs("ERROR: missing the service path\n", stderr);
1520 return ECORE_CALLBACK_RENEW;
1523 next_args = _tok(args);
1526 fputs("ERROR: missing the service address\n", stderr);
1527 return ECORE_CALLBACK_RENEW;
1530 address = next_args;
1531 next_args = _tok(next_args);
1533 netmask = next_args;
1535 next_args = _tok(next_args);
1538 gateway = next_args;
1542 e = e_connman_service_get(path);
1543 if (e_connman_service_ipv4_configure_manual
1544 (e, address, netmask, gateway,
1545 _method_success_check, "service_ipv4_configure_manual"))
1546 printf(":::Service %s IPv4 Configuration set to Manual (%s/%s) gw %s\n",
1547 path, address, netmask, gateway);
1549 fputs("ERROR: can't set service ipv4_configuration manual\n", stderr);
1550 return ECORE_CALLBACK_RENEW;
1554 _on_cmd_service_get_ethernet_method(__UNUSED__ char *cmd, char *args)
1556 const char *ethernet_method, *path;
1557 E_Connman_Element *e;
1561 fputs("ERROR: missing the service path\n", stderr);
1562 return ECORE_CALLBACK_RENEW;
1567 e = e_connman_service_get(path);
1568 if (e_connman_service_ethernet_method_get(e, ðernet_method))
1569 printf(":::Service %s Ethernet Method = \"%s\"\n", path, ethernet_method);
1571 fputs("ERROR: can't get service ethernet method\n", stderr);
1572 return ECORE_CALLBACK_RENEW;
1576 _on_cmd_service_get_ethernet_address(__UNUSED__ char *cmd, char *args)
1578 const char *ethernet_address, *path;
1579 E_Connman_Element *e;
1583 fputs("ERROR: missing the service path\n", stderr);
1584 return ECORE_CALLBACK_RENEW;
1589 e = e_connman_service_get(path);
1590 if (e_connman_service_ethernet_address_get(e, ðernet_address))
1591 printf(":::Service %s Ethernet Address = \"%s\"\n",
1592 path, ethernet_address);
1594 fputs("ERROR: can't get service ethernet address\n", stderr);
1595 return ECORE_CALLBACK_RENEW;
1599 _on_cmd_service_get_ethernet_mtu(__UNUSED__ char *cmd, char *args)
1602 E_Connman_Element *e;
1603 unsigned short ethernet_mtu;
1607 fputs("ERROR: missing the service path\n", stderr);
1608 return ECORE_CALLBACK_RENEW;
1613 e = e_connman_service_get(path);
1614 if (e_connman_service_ethernet_mtu_get(e, ðernet_mtu))
1615 printf(":::Service %s Ethernet MTU = %hu\n", path, ethernet_mtu);
1617 fputs("ERROR: can't get service ethernet mtu\n", stderr);
1618 return ECORE_CALLBACK_RENEW;
1622 _on_cmd_service_get_ethernet_netmask(__UNUSED__ char *cmd, char *args)
1624 const char *ethernet_netmask, *path;
1625 E_Connman_Element *e;
1629 fputs("ERROR: missing the service path\n", stderr);
1630 return ECORE_CALLBACK_RENEW;
1635 e = e_connman_service_get(path);
1636 if (e_connman_service_ethernet_netmask_get(e, ðernet_netmask))
1637 printf(":::Service %s Ethernet Netmask = \"%s\"\n",
1638 path, ethernet_netmask);
1640 fputs("ERROR: can't get service ethernet netmask\n", stderr);
1641 return ECORE_CALLBACK_RENEW;
1645 _on_cmd_technology_get_state(__UNUSED__ char *cmd, char *args)
1647 const char *state, *path;
1648 E_Connman_Element *e;
1652 fputs("ERROR: missing the technology path\n", stderr);
1653 return ECORE_CALLBACK_RENEW;
1658 e = e_connman_technology_get(path);
1659 if (e_connman_technology_state_get(e, &state))
1660 printf(":::Technology %s State = \"%s\"\n", path, state);
1662 fputs("ERROR: can't get technology state\n", stderr);
1663 return ECORE_CALLBACK_RENEW;
1667 _on_cmd_technology_get_type(__UNUSED__ char *cmd, char *args)
1669 const char *type, *path;
1670 E_Connman_Element *e;
1674 fputs("ERROR: missing the technology path\n", stderr);
1675 return ECORE_CALLBACK_RENEW;
1680 e = e_connman_technology_get(path);
1681 if (e_connman_technology_type_get(e, &type))
1682 printf(":::Technology %s Type = \"%s\"\n", path, type);
1684 fputs("ERROR: can't get technology type\n", stderr);
1685 return ECORE_CALLBACK_RENEW;
1689 _on_cmd_technology_get_name(__UNUSED__ char *cmd, char *args)
1691 const char *name, *path;
1692 E_Connman_Element *e;
1696 fputs("ERROR: missing the technology path\n", stderr);
1697 return ECORE_CALLBACK_RENEW;
1702 e = e_connman_technology_get(path);
1703 if (e_connman_technology_name_get(e, &name))
1704 printf(":::Technology %s Name = \"%s\"\n", path, name);
1706 fputs("ERROR: can't get technology name\n", stderr);
1707 return ECORE_CALLBACK_RENEW;
1711 _on_input(__UNUSED__ void *data, Ecore_Fd_Handler *fd_handler)
1717 Eina_Bool (*cb)(char *cmd, char *args);
1719 {"quit", _on_cmd_quit},
1720 {"sync", _on_cmd_sync},
1721 {"get_all", _on_cmd_get_all},
1722 {"print", _on_cmd_print},
1723 {"get_properties", _on_cmd_get_properties},
1724 {"set_property", _on_cmd_property_set},
1725 {"manager_get", _on_cmd_manager_get},
1726 {"manager_get_profiles", _on_cmd_manager_get_profiles},
1727 {"manager_get_services", _on_cmd_manager_get_services},
1728 {"manager_register_agent", _on_cmd_manager_register_agent},
1729 {"manager_unregister_agent", _on_cmd_manager_unregister_agent},
1730 {"manager_get_state", _on_cmd_manager_get_state},
1731 {"manager_get_offline_mode", _on_cmd_manager_get_offline_mode},
1732 {"manager_set_offline_mode", _on_cmd_manager_set_offline_mode},
1733 {"manager_request_scan", _on_cmd_manager_request_scan},
1734 {"manager_technology_enable", _on_cmd_manager_technology_enable},
1735 {"manager_technology_disable", _on_cmd_manager_technology_disable},
1736 {"manager_get_technologies_available", _on_cmd_manager_get_technologies_available},
1737 {"manager_get_technologies_enabled", _on_cmd_manager_get_technologies_enabled},
1738 {"manager_get_technologies_connected", _on_cmd_manager_get_technologies_connected},
1739 {"manager_profile_remove", _on_cmd_manager_profile_remove},
1740 {"manager_profile_get_active", _on_cmd_manager_profile_get_active},
1741 {"manager_profile_set_active", _on_cmd_manager_profile_set_active},
1742 {"profile_get_name", _on_cmd_profile_get_name},
1743 {"profile_set_name", _on_cmd_profile_set_name},
1744 {"profile_get_offline_mode", _on_cmd_profile_get_offline_mode},
1745 {"profile_set_offline_mode", _on_cmd_profile_set_offline_mode},
1746 {"profile_get_services", _on_cmd_profile_get_services},
1747 {"service_connect", _on_cmd_service_connect},
1748 {"service_disconnect", _on_cmd_service_disconnect},
1749 {"service_remove", _on_cmd_service_remove},
1750 {"service_move_before", _on_cmd_service_move_before},
1751 {"service_move_after", _on_cmd_service_move_after},
1752 {"service_get_state", _on_cmd_service_get_state},
1753 {"service_get_error", _on_cmd_service_get_error},
1754 {"service_get_name", _on_cmd_service_get_name},
1755 {"service_get_type", _on_cmd_service_get_type},
1756 {"service_get_mode", _on_cmd_service_get_mode},
1757 {"service_get_security", _on_cmd_service_get_security},
1758 {"service_get_passphrase", _on_cmd_service_get_passphrase},
1759 {"service_set_passphrase", _on_cmd_service_set_passphrase},
1760 {"service_get_passphrase_required", _on_cmd_service_get_passphrase_required},
1761 {"service_get_strength", _on_cmd_service_get_strength},
1762 {"service_get_favorite", _on_cmd_service_get_favorite},
1763 {"service_get_immutable", _on_cmd_service_get_immutable},
1764 {"service_get_auto_connect", _on_cmd_service_get_auto_connect},
1765 {"service_set_auto_connect", _on_cmd_service_set_auto_connect},
1766 {"service_get_setup_required", _on_cmd_service_get_setup_required},
1767 {"service_get_apn", _on_cmd_service_get_apn},
1768 {"service_set_apn", _on_cmd_service_set_apn},
1769 {"service_get_mcc", _on_cmd_service_get_mcc},
1770 {"service_get_mnc", _on_cmd_service_get_mnc},
1771 {"service_get_roaming", _on_cmd_service_get_roaming},
1772 {"service_get_ipv4_method", _on_cmd_service_get_ipv4_method},
1773 {"service_get_ipv4_address", _on_cmd_service_get_ipv4_address},
1774 {"service_get_ipv4_gateway", _on_cmd_service_get_ipv4_gateway},
1775 {"service_get_ipv4_netmask", _on_cmd_service_get_ipv4_netmask},
1776 {"service_get_ipv4_configuration_method", _on_cmd_service_get_ipv4_configuration_method},
1777 {"service_get_ipv4_configuration_address", _on_cmd_service_get_ipv4_configuration_address},
1778 {"service_get_ipv4_configuration_gateway", _on_cmd_service_get_ipv4_configuration_gateway},
1779 {"service_get_ipv4_configuration_netmask", _on_cmd_service_get_ipv4_configuration_netmask},
1780 {"service_ipv4_configure_dhcp", _on_cmd_service_ipv4_configure_dhcp},
1781 {"service_ipv4_configure_manual", _on_cmd_service_ipv4_configure_manual},
1782 {"service_get_ethernet_method", _on_cmd_service_get_ethernet_method},
1783 {"service_get_ethernet_address", _on_cmd_service_get_ethernet_address},
1784 {"service_get_ethernet_mtu", _on_cmd_service_get_ethernet_mtu},
1785 {"service_get_ethernet_netmask", _on_cmd_service_get_ethernet_netmask},
1786 {"technology_get_state", _on_cmd_technology_get_state},
1787 {"technology_get_type", _on_cmd_technology_get_type},
1788 {"technology_get_name", _on_cmd_technology_get_name},
1793 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
1795 fputs("ERROR: reading from stdin, exit\n", stderr);
1796 return ECORE_CALLBACK_CANCEL;
1799 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
1801 fputs("ERROR: nothing to read?\n", stderr);
1802 return ECORE_CALLBACK_CANCEL;
1805 if (!fgets(buf, sizeof(buf), stdin))
1807 fprintf(stderr, "ERROR: could not read command: %s\n", strerror(errno));
1808 ecore_main_loop_quit();
1809 return ECORE_CALLBACK_CANCEL;
1813 while (isspace(*cmd))
1816 args = strchr(cmd, ' ');
1824 while (isspace(*args))
1827 p = args + strlen(args) - 1;
1835 p = cmd + strlen(cmd) - 1;
1840 if (strcmp(cmd, "help") == 0)
1844 printf("Commands with '%s' in the name:\n", args);
1845 for (itr = maps; itr->cmd; itr++)
1846 if (strstr(itr->cmd, args))
1847 printf("\t%s\n", itr->cmd);
1851 fputs("Commands:\n", stdout);
1852 for (itr = maps; itr->cmd; itr++)
1853 printf("\t%s\n", itr->cmd);
1855 fputc('\n', stdout);
1856 return ECORE_CALLBACK_RENEW;
1859 for (itr = maps; itr->cmd; itr++)
1860 if (strcmp(itr->cmd, cmd) == 0)
1861 return itr->cb(cmd, args);
1863 printf("unknown command \"%s\", args=%s\n", cmd, args);
1864 return ECORE_CALLBACK_RENEW;
1868 main(__UNUSED__ int argc, __UNUSED__ char *argv[])
1870 E_DBus_Connection *c;
1876 c = e_dbus_bus_get(DBUS_BUS_SYSTEM);
1878 printf("ERROR: can't connect to system session\n");
1882 e_connman_system_init(c);
1883 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_ADD, _on_element_add, NULL);
1884 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_DEL, _on_element_del, NULL);
1885 ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_UPDATED,
1886 _on_element_updated, NULL);
1888 ecore_main_fd_handler_add
1889 (0, ECORE_FD_READ | ECORE_FD_ERROR, _on_input, NULL, NULL, NULL);
1891 ecore_main_loop_begin();
1893 e_connman_system_shutdown();
1895 e_dbus_connection_close(c);
1900 fputs("DBG: clean exit.\n", stderr);