5 #include <appcore-efl.h>
7 #include <Elementary.h>
12 #ifndef ELM_LIB_QUICKLAUNCH
18 #include "pulseaudio.h"
22 #include <Ecore_Getopt.h>
24 static const char def_modem_hardware_api[] =
31 static const char def_modem_hfp_api[] =
34 static const char def_modem_type[] =
37 static const char def_rc_service[] = "org.tizen.dialer";
40 static const Ecore_Getopt options = {
44 "(C) 2012 Intel Corporation",
45 "GPL-2" /* TODO: check license with Intel */,
46 "Phone Dialer using oFono and EFL.",
48 {ECORE_GETOPT_STORE_STR('H', "theme", "path to theme EDJ file."),
49 ECORE_GETOPT_STORE_STR('m', "modem", "Modem object path in oFono."),
50 ECORE_GETOPT_STORE_STR('a', "api", "oFono modem APIs to use, comma "
51 "separated. Example: "
52 "SimManager,VoiceCallManager. See --list-api"),
53 ECORE_GETOPT_STORE_TRUE('A', "list-api", "list all oFono modem API."),
54 ECORE_GETOPT_STORE_DEF_STR('t', "type", "oFono modem type to use.",
56 ECORE_GETOPT_STORE_TRUE('T', "list-types",
57 "list all oFono modem types."),
58 ECORE_GETOPT_STORE_STR('R', "rc-dbus-name",
59 "The DBus name to use for the remote control."),
60 ECORE_GETOPT_VERSION('V', "version"),
61 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
62 ECORE_GETOPT_LICENSE('L', "license"),
63 ECORE_GETOPT_HELP('h', "help"),
69 int _app_exit_code = EXIT_SUCCESS;
72 static int _create(void *data __UNUSED__)
77 static int _reset(bundle *b __UNUSED__, void *data __UNUSED__)
82 static int _resume(void *data __UNUSED__)
87 static int _pause(void *data __UNUSED__)
92 static int _terminate(void *data __UNUSED__)
98 EAPI int elm_main(int argc, char **argv)
101 char *modem_path = NULL;
102 char *modem_api = NULL;
103 char *modem_type = NULL;
105 char *rc_service = NULL;
106 Eina_Bool list_api = EINA_FALSE;
107 Eina_Bool list_type = EINA_FALSE;
108 Eina_Bool quit_option = EINA_FALSE;
109 Ecore_Getopt_Value values[] = {
110 ECORE_GETOPT_VALUE_STR(theme),
111 ECORE_GETOPT_VALUE_STR(modem_path),
112 ECORE_GETOPT_VALUE_STR(modem_api),
113 ECORE_GETOPT_VALUE_BOOL(list_api),
114 ECORE_GETOPT_VALUE_STR(modem_type),
115 ECORE_GETOPT_VALUE_BOOL(list_type),
116 ECORE_GETOPT_VALUE_STR(rc_service),
117 ECORE_GETOPT_VALUE_BOOL(quit_option),
118 ECORE_GETOPT_VALUE_BOOL(quit_option),
119 ECORE_GETOPT_VALUE_BOOL(quit_option),
120 ECORE_GETOPT_VALUE_BOOL(quit_option),
121 ECORE_GETOPT_VALUE_NONE
124 _log_domain = eina_log_domain_register("dialer", NULL);
127 EINA_LOG_CRIT("Could not create log domain 'dialer'.");
132 args = ecore_getopt_parse(&options, values, argc, argv);
135 ERR("Could not parse command line options.");
136 _app_exit_code = EXIT_FAILURE;
140 puts("Supported oFono API:");
141 ofono_modem_api_list(stdout, "\t", "\n");
145 puts("Supported oFono type:");
146 ofono_modem_type_list(stdout, "\t", "\n");
154 INF("User-defined DBus remote control service name: %s",
157 INF("Using default DBus remote control service name: %s",
161 if (!rc_init(rc_service ? rc_service : def_rc_service)) {
162 CRITICAL("Could not setup remote control via DBus.");
163 _app_exit_code = EXIT_FAILURE;
168 CRITICAL("Could not setup ofono");
169 _app_exit_code = EXIT_FAILURE;
174 INF("User-defined modem path: %s", modem_path);
175 ofono_modem_path_wanted_set(modem_path);
179 INF("User-defined modem API: %s", modem_api);
180 ofono_modem_api_require(modem_api);
184 api = def_modem_hfp_api;
185 else if (strstr(modem_type, "hfp"))
186 api = def_modem_hfp_api;
187 else if (strcmp(modem_type, "hardware"))
188 api = def_modem_hardware_api;
190 WRN("modem type not handled: %s", modem_type);
191 api = "VoiceCallManager";
194 INF("Using default modem API: %s", api);
195 ofono_modem_api_require(api);
199 INF("User-defined modem type: %s", modem_type);
200 ofono_modem_type_require(modem_type);
202 INF("Using default modem type: %s", def_modem_type);
203 ofono_modem_type_require(def_modem_type);
206 if (!util_init(theme)) {
207 CRITICAL("Could not setup graphical user interface");
208 _app_exit_code = EXIT_FAILURE;
214 CRITICAL("Could not setup automotive-message-broker");
215 _app_exit_code = EXIT_FAILURE;
221 CRITICAL("Could not setup pulseaudio");
222 _app_exit_code = EXIT_FAILURE;
227 CRITICAL("Could not setup graphical user interface");
228 _app_exit_code = EXIT_FAILURE;
232 INF("Entering main loop");
236 struct appcore_ops ops = {
241 .terminate = _terminate,
244 iReturn = appcore_efl_main("org.tizen.dialer", &argc, &argv, &ops);
248 INF("Quit main loop");
270 return _app_exit_code;