4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
12 #include <Ecore_Getopt.h>
14 static const char def_modem_hardware_api[] =
21 static const char def_modem_hfp_api[] =
24 static const char def_modem_type[] =
27 static const Ecore_Getopt options = {
31 "(C) 2012 Intel Corporation",
32 "GPL-2" /* TODO: check license with Intel */,
33 "Phone Dialer using oFono and EFL.",
35 {ECORE_GETOPT_STORE_STR('H', "theme", "path to theme EDJ file."),
36 ECORE_GETOPT_STORE_STR('m', "modem", "Modem object path in oFono."),
37 ECORE_GETOPT_STORE_STR('a', "api", "oFono modem APIs to use, comma "
38 "separated. Example: "
39 "SimManager,VoiceCallManager. See --list-api"),
40 ECORE_GETOPT_STORE_TRUE('A', "list-api", "list all oFono modem API."),
41 ECORE_GETOPT_STORE_DEF_STR('t', "type", "oFono modem type to use.",
43 ECORE_GETOPT_STORE_TRUE('T', "list-types",
44 "list all oFono modem types."),
45 ECORE_GETOPT_VERSION('V', "version"),
46 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
47 ECORE_GETOPT_LICENSE('L', "license"),
48 ECORE_GETOPT_HELP('h', "help"),
54 int _app_exit_code = EXIT_SUCCESS;
56 EAPI int elm_main(int argc, char **argv)
59 char *modem_path = NULL;
60 char *modem_api = NULL;
61 char *modem_type = NULL;
63 Eina_Bool list_api = EINA_FALSE;
64 Eina_Bool list_type = EINA_FALSE;
65 Eina_Bool quit_option = EINA_FALSE;
66 Ecore_Getopt_Value values[] = {
67 ECORE_GETOPT_VALUE_STR(theme),
68 ECORE_GETOPT_VALUE_STR(modem_path),
69 ECORE_GETOPT_VALUE_STR(modem_api),
70 ECORE_GETOPT_VALUE_BOOL(list_api),
71 ECORE_GETOPT_VALUE_STR(modem_type),
72 ECORE_GETOPT_VALUE_BOOL(list_type),
73 ECORE_GETOPT_VALUE_BOOL(quit_option),
74 ECORE_GETOPT_VALUE_BOOL(quit_option),
75 ECORE_GETOPT_VALUE_BOOL(quit_option),
76 ECORE_GETOPT_VALUE_BOOL(quit_option),
77 ECORE_GETOPT_VALUE_NONE
80 _log_domain = eina_log_domain_register("dialer", NULL);
83 EINA_LOG_CRIT("Could not create log domain 'dialer'.");
88 args = ecore_getopt_parse(&options, values, argc, argv);
91 ERR("Could not parse command line options.");
92 _app_exit_code = EXIT_FAILURE;
96 puts("Supported oFono API:");
97 ofono_modem_api_list(stdout, "\t", "\n");
101 puts("Supported oFono type:");
102 ofono_modem_type_list(stdout, "\t", "\n");
110 CRITICAL("Could not setup remote control via DBus.");
111 _app_exit_code = EXIT_FAILURE;
116 CRITICAL("Could not setup ofono");
117 _app_exit_code = EXIT_FAILURE;
122 INF("User-defined modem path: %s", modem_path);
123 ofono_modem_path_wanted_set(modem_path);
127 INF("User-defined modem API: %s", modem_api);
128 ofono_modem_api_require(modem_api);
132 api = def_modem_hardware_api;
133 else if (strstr(modem_type, "hfp"))
134 api = def_modem_hfp_api;
135 else if (strcmp(modem_type, "hardware"))
136 api = def_modem_hardware_api;
138 WRN("modem type not handled: %s", modem_type);
139 api = "VoiceCallManager";
142 INF("Using default modem API: %s", api);
143 ofono_modem_api_require(api);
147 INF("User-defined modem type: %s", modem_type);
148 ofono_modem_type_require(modem_type);
150 INF("Using default modem type: %s", def_modem_type);
151 ofono_modem_type_require(def_modem_type);
154 if (!gui_init(theme)) {
155 CRITICAL("Could not setup graphical user interface");
156 _app_exit_code = EXIT_FAILURE;
160 INF("Entering main loop");
162 INF("Quit main loop");
173 return _app_exit_code;