4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
13 #include <Ecore_Getopt.h>
15 static const char def_modem_hardware_api[] =
22 static const char def_modem_hfp_api[] =
25 static const char def_modem_type[] =
28 static const char def_rc_service[] = "org.tizen.dialer";
31 static const Ecore_Getopt options = {
35 "(C) 2012 Intel Corporation",
36 "GPL-2" /* TODO: check license with Intel */,
37 "Phone Dialer using oFono and EFL.",
39 {ECORE_GETOPT_STORE_STR('H', "theme", "path to theme EDJ file."),
40 ECORE_GETOPT_STORE_STR('m', "modem", "Modem object path in oFono."),
41 ECORE_GETOPT_STORE_STR('a', "api", "oFono modem APIs to use, comma "
42 "separated. Example: "
43 "SimManager,VoiceCallManager. See --list-api"),
44 ECORE_GETOPT_STORE_TRUE('A', "list-api", "list all oFono modem API."),
45 ECORE_GETOPT_STORE_DEF_STR('t', "type", "oFono modem type to use.",
47 ECORE_GETOPT_STORE_TRUE('T', "list-types",
48 "list all oFono modem types."),
49 ECORE_GETOPT_STORE_STR('R', "rc-dbus-name",
50 "The DBus name to use for the remote control."),
51 ECORE_GETOPT_VERSION('V', "version"),
52 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
53 ECORE_GETOPT_LICENSE('L', "license"),
54 ECORE_GETOPT_HELP('h', "help"),
60 int _app_exit_code = EXIT_SUCCESS;
62 EAPI int elm_main(int argc, char **argv)
65 char *modem_path = NULL;
66 char *modem_api = NULL;
67 char *modem_type = NULL;
69 char *rc_service = NULL;
70 Eina_Bool list_api = EINA_FALSE;
71 Eina_Bool list_type = EINA_FALSE;
72 Eina_Bool quit_option = EINA_FALSE;
73 Ecore_Getopt_Value values[] = {
74 ECORE_GETOPT_VALUE_STR(theme),
75 ECORE_GETOPT_VALUE_STR(modem_path),
76 ECORE_GETOPT_VALUE_STR(modem_api),
77 ECORE_GETOPT_VALUE_BOOL(list_api),
78 ECORE_GETOPT_VALUE_STR(modem_type),
79 ECORE_GETOPT_VALUE_BOOL(list_type),
80 ECORE_GETOPT_VALUE_STR(rc_service),
81 ECORE_GETOPT_VALUE_BOOL(quit_option),
82 ECORE_GETOPT_VALUE_BOOL(quit_option),
83 ECORE_GETOPT_VALUE_BOOL(quit_option),
84 ECORE_GETOPT_VALUE_BOOL(quit_option),
85 ECORE_GETOPT_VALUE_NONE
88 _log_domain = eina_log_domain_register("dialer", NULL);
91 EINA_LOG_CRIT("Could not create log domain 'dialer'.");
96 args = ecore_getopt_parse(&options, values, argc, argv);
99 ERR("Could not parse command line options.");
100 _app_exit_code = EXIT_FAILURE;
104 puts("Supported oFono API:");
105 ofono_modem_api_list(stdout, "\t", "\n");
109 puts("Supported oFono type:");
110 ofono_modem_type_list(stdout, "\t", "\n");
118 INF("User-defined DBus remote control service name: %s",
121 INF("Using default DBus remote control service name: %s",
125 if (!rc_init(rc_service ? rc_service : def_rc_service)) {
126 CRITICAL("Could not setup remote control via DBus.");
127 _app_exit_code = EXIT_FAILURE;
132 CRITICAL("Could not setup ofono");
133 _app_exit_code = EXIT_FAILURE;
138 INF("User-defined modem path: %s", modem_path);
139 ofono_modem_path_wanted_set(modem_path);
143 INF("User-defined modem API: %s", modem_api);
144 ofono_modem_api_require(modem_api);
148 api = def_modem_hardware_api;
149 else if (strstr(modem_type, "hfp"))
150 api = def_modem_hfp_api;
151 else if (strcmp(modem_type, "hardware"))
152 api = def_modem_hardware_api;
154 WRN("modem type not handled: %s", modem_type);
155 api = "VoiceCallManager";
158 INF("Using default modem API: %s", api);
159 ofono_modem_api_require(api);
163 INF("User-defined modem type: %s", modem_type);
164 ofono_modem_type_require(modem_type);
166 INF("Using default modem type: %s", def_modem_type);
167 ofono_modem_type_require(def_modem_type);
170 if (!util_init(theme)) {
171 CRITICAL("Could not setup graphical user interface");
172 _app_exit_code = EXIT_FAILURE;
177 CRITICAL("Could not setup graphical user interface");
178 _app_exit_code = EXIT_FAILURE;
182 INF("Entering main loop");
184 INF("Quit main loop");
197 return _app_exit_code;