ofono parses start time.
[profile/ivi/lemolo.git] / dialer / ofono.h
1 #ifndef _EFL_OFONO_H__
2 #define _EFL_OFONO_H__
3
4 typedef enum
5 {
6         OFONO_API_SIM =         (1 <<  0),
7         OFONO_API_NETREG =      (1 <<  1),
8         OFONO_API_VOICE =       (1 <<  2),
9         OFONO_API_MSG =         (1 <<  3),
10         OFONO_API_MSG_WAITING = (1 <<  4),
11         OFONO_API_SMART_MSG =   (1 <<  5),
12         OFONO_API_STK =         (1 <<  6),
13         OFONO_API_CALL_FW =     (1 <<  7),
14         OFONO_API_CALL_VOL =    (1 <<  8),
15         OFONO_API_CALL_METER =  (1 <<  9),
16         OFONO_API_CALL_SET =    (1 << 10),
17         OFONO_API_CALL_BAR =    (1 << 11),
18         OFONO_API_SUPPL_SERV =  (1 << 12),
19         OFONO_API_TXT_TEL =     (1 << 13),
20         OFONO_API_CELL_BROAD =  (1 << 14),
21         OFONO_API_CONNMAN =     (1 << 15),
22         OFONO_API_PUSH_NOTIF =  (1 << 16),
23         OFONO_API_PHONEBOOK =   (1 << 17),
24         OFONO_API_ASN =         (1 << 18)
25 } OFono_API;
26
27 typedef enum
28 {
29         OFONO_ERROR_NONE = 0,
30         OFONO_ERROR_FAILED,
31         OFONO_ERROR_DOES_NOT_EXIST,
32         OFONO_ERROR_IN_PROGRESS,
33         OFONO_ERROR_IN_USE,
34         OFONO_ERROR_INVALID_ARGS,
35         OFONO_ERROR_INVALID_FORMAT,
36         OFONO_ERROR_ACCESS_DENIED,
37         OFONO_ERROR_ATTACH_IN_PROGRESS,
38         OFONO_ERROR_INCORRECT_PASSWORD,
39         OFONO_ERROR_NOT_ACTIVE,
40         OFONO_ERROR_NOT_ALLOWED,
41         OFONO_ERROR_NOT_ATTACHED,
42         OFONO_ERROR_NOT_AVAILABLE,
43         OFONO_ERROR_NOT_FOUND,
44         OFONO_ERROR_NOT_IMPLEMENTED,
45         OFONO_ERROR_NOT_RECOGNIZED,
46         OFONO_ERROR_NOT_REGISTERED,
47         OFONO_ERROR_NOT_SUPPORTED,
48         OFONO_ERROR_SIM_NOT_READY,
49         OFONO_ERROR_STK,
50         OFONO_ERROR_TIMEDOUT,
51         OFONO_ERROR_OFFLINE
52 } OFono_Error;
53
54 typedef enum
55 {
56         OFONO_CALL_STATE_DISCONNECTED = 0,
57         OFONO_CALL_STATE_ACTIVE,
58         OFONO_CALL_STATE_HELD,
59         OFONO_CALL_STATE_DIALING,
60         OFONO_CALL_STATE_ALERTING,
61         OFONO_CALL_STATE_INCOMING,
62         OFONO_CALL_STATE_WAITING
63 } OFono_Call_State;
64
65 typedef struct _OFono_Call OFono_Call;
66 typedef struct _OFono_Pending OFono_Pending;
67
68 typedef void (*OFono_Simple_Cb)(void *data, OFono_Error error);
69 typedef void (*OFono_String_Cb)(void *data, OFono_Error error, const char *str);
70 typedef void (*OFono_Call_Cb)(void *data, OFono_Error error, OFono_Call *call);
71
72
73 /* Voice Call: */
74 OFono_Pending *ofono_call_hangup(OFono_Call *c, OFono_Simple_Cb cb,
75                                         const void *data);
76 OFono_Pending *ofono_call_answer(OFono_Call *c, OFono_Simple_Cb cb,
77                                         const void *data);
78
79 OFono_Call_State ofono_call_state_get(const OFono_Call *c);
80 const char *ofono_call_name_get(const OFono_Call *c);
81 const char *ofono_call_line_id_get(const OFono_Call *c);
82 double ofono_call_start_time_get(const OFono_Call *c);
83
84 #define ofono_call_state_valid_check(c) \
85         (ofono_call_state_get(c) != OFONO_CALL_STATE_DISCONNECTED)
86
87 void ofono_call_added_cb_set(void (*cb)(void *data, OFono_Call *call),
88                                 const void *data);
89 void ofono_call_removed_cb_set(void (*cb)(void *data, OFono_Call *call),
90                                 const void *data);
91 void ofono_call_changed_cb_set(void (*cb)(void *data, OFono_Call *call),
92                                 const void *data);
93 void ofono_call_disconnected_cb_set(void (*cb)(void *data, OFono_Call *call, const char *reason),
94                                 const void *data);
95
96 OFono_Pending *ofono_tones_send(const char *tones, OFono_Simple_Cb cb,
97                                 const void *data);
98
99 OFono_Pending *ofono_multiparty_create(OFono_Simple_Cb cb, const void *data);
100
101 /* Modem: */
102 const char *ofono_modem_serial_get(void);
103
104 OFono_Pending *ofono_modem_change_pin(const char *what, const char *old, const char *new,
105                                 OFono_Simple_Cb cb, const void *data);
106 OFono_Pending *ofono_modem_reset_pin(const char *what, const char *puk, const char *new,
107                                 OFono_Simple_Cb cb, const void *data);
108
109 OFono_Pending *ofono_ss_initiate(const char *command, OFono_String_Cb cb, const void *data);
110
111 OFono_Pending *ofono_dial(const char *number, const char *hide_callerid,
112                                 OFono_Call_Cb cb, const void *data);
113
114 /* Call Volume: */
115
116 OFono_Pending *ofono_mute_set(Eina_Bool mute, OFono_Simple_Cb cb, const void *data);
117 Eina_Bool ofono_mute_get(void);
118
119 OFono_Pending *ofono_volume_speaker_set(unsigned char volume, OFono_Simple_Cb cb, const void *data);
120 unsigned char ofono_volume_speaker_get(void);
121
122
123 OFono_Pending *ofono_volume_microphone_set(unsigned char volume, OFono_Simple_Cb cb, const void *data);
124 unsigned char ofono_volume_microphone_get(void);
125
126 /* Setup: */
127 void ofono_modem_api_require(unsigned int api_mask);
128 void ofono_modem_path_wanted_set(const char *path);
129
130 /* TODO: unique listener or multiple? set x add */
131 void ofono_connected_cb_set(void (*cb)(void *data), const void *data);
132 void ofono_disconnected_cb_set(void (*cb)(void *data), const void *data);
133 void ofono_changed_cb_set(void (*cb)(void *data), const void *data);
134
135 void ofono_pending_cancel(OFono_Pending *pending);
136
137 Eina_Bool ofono_init(void);
138 void ofono_shutdown(void);
139
140 #endif