upload tizen1.0 source
[framework/uifw/e17.git] / src / modules / ofono / e_mod_main.h
1 #ifndef E_MOD_MAIN_H
2 #define E_MOD_MAIN_H
3
4 #include "config.h"
5 #include <e.h>
6 #include <E_Ofono.h>
7 #include <eina_log.h>
8
9 #define MOD_CONF_VERSION 2
10
11 extern int _e_ofono_module_log_dom;
12 #define DBG(...)  EINA_LOG_DOM_DBG(_e_ofono_module_log_dom, __VA_ARGS__)
13 #define WRN(...)  EINA_LOG_DOM_WARN(_e_ofono_module_log_dom, __VA_ARGS__)
14 #define CRIT(...) EINA_LOG_DOM_CRIT(_e_ofono_module_log_dom, __VA_ARGS__)
15 #define ERR(...)  EINA_LOG_DOM_ERR(_e_ofono_module_log_dom, __VA_ARGS__)
16
17 typedef struct E_Ofono_Instance       E_Ofono_Instance;
18 typedef struct E_Ofono_Module_Context E_Ofono_Module_Context;
19
20 struct E_Ofono_Instance
21 {
22    E_Ofono_Module_Context *ctxt;
23    E_Gadcon_Client        *gcc;
24    E_Gadcon_Popup         *popup;
25    E_Menu                 *menu;
26
27    struct
28    {
29       Evas_Object *gadget;
30       Evas_Object *table;
31       Evas_Object *name;
32       Evas_Object *powered;
33       struct
34       {
35          Ecore_X_Window       win;
36          Ecore_Event_Handler *mouse_up;
37          Ecore_Event_Handler *key_down;
38       } input;
39    } ui;
40
41    E_Gadcon_Popup  *tip;
42    Evas_Object     *o_tip;
43
44    /* e_dbus ofono element pointers */
45    E_Ofono_Element *modem_element;
46    E_Ofono_Element *netreg_element;
47
48    /* modem data */
49    const char      *path;
50    const char      *name;
51    const char      *status;
52    const char      *op;
53    int              int_powered; /* used by popup */
54    Eina_Bool        powered;
55    uint8_t          strength;
56
57    Eina_Bool        powered_pending : 1;
58 };
59
60 struct E_Ofono_Module_Context
61 {
62    Eina_List *instances;
63
64    struct
65    {
66       Ecore_Event_Handler *manager_in;
67       Ecore_Event_Handler *manager_out;
68       Ecore_Event_Handler *element_add;
69       Ecore_Event_Handler *element_del;
70       Ecore_Event_Handler *element_updated;
71    } event;
72
73    struct
74    {
75       Ecore_Poller *manager_changed;
76    } poller;
77
78    Eina_Bool has_manager : 1;
79 };
80
81 EAPI extern E_Module_Api e_modapi;
82 EAPI void  *e_modapi_init(E_Module *m);
83 EAPI int    e_modapi_shutdown(E_Module *m);
84 EAPI int    e_modapi_save(E_Module *m);
85
86 const char *e_ofono_theme_path(void);
87
88 static inline void
89 _ofono_dbus_error_show(const char      *msg,
90                        const DBusError *error)
91 {
92    const char *name;
93
94    if ((!error) || (!dbus_error_is_set(error)))
95      return;
96
97    name = error->name;
98    if (strncmp(name, "org.ofono.Error.", sizeof("org.ofono.Error.") - 1) == 0)
99      name += sizeof("org.ofono.Error.") - 1;
100
101    e_util_dialog_show(_("Ofono Server Operation Failed"),
102                       _("Could not execute remote operation:<br>"
103                         "%s<br>"
104                         "Server Error <hilight>%s:</hilight> %s"),
105                       msg, name, error->message);
106 }
107
108 static inline void
109 _ofono_operation_error_show(const char *msg)
110 {
111    e_util_dialog_show(_("Ofono Operation Failed"),
112                       _("Could not execute local operation:<br>%s"),
113                       msg);
114 }
115
116 /**
117  * @addtogroup Optional_Devices
118  * @{
119  *
120  * @defgroup Module_OFono oFono (Telephony)
121  *
122  * oFono is the Linux Telephony stack and can be used to monitor
123  * network signal, send and receive SMS, connect to GPRS/Edge/3G/4G.
124  *
125  * @note The plugin is barebones and can just show devices, no SMS
126  *       management done yet.
127  *
128  * @see http://ofono.org/
129  * @}
130  */
131 #endif