sms: Use __ofono_atom_find
[platform/upstream/ofono.git] / src / stkagent.h
1 /*
2  *
3  *  oFono - Open Source Telephony
4  *
5  *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 struct stk_agent;
23
24 enum stk_agent_result {
25         STK_AGENT_RESULT_OK,
26         STK_AGENT_RESULT_BACK,
27         STK_AGENT_RESULT_TERMINATE,
28         STK_AGENT_RESULT_TIMEOUT,
29         STK_AGENT_RESULT_BUSY,
30 };
31
32 struct stk_menu_item {
33         char *text;
34         uint8_t icon_id;
35         uint8_t item_id;
36 };
37
38 struct stk_menu {
39         char *title;
40         struct stk_icon_id icon;
41         struct stk_menu_item *items;
42         int default_item;
43         gboolean soft_key;
44         gboolean has_help;
45 };
46
47 typedef void (*stk_agent_display_text_cb)(enum stk_agent_result result,
48                                                 void *user_data);
49
50 typedef void (*stk_agent_selection_cb)(enum stk_agent_result result,
51                                         uint8_t id, void *user_data);
52
53 typedef void (*stk_agent_confirmation_cb)(enum stk_agent_result result,
54                                                 ofono_bool_t confirm,
55                                                 void *user_data);
56
57 typedef void (*stk_agent_string_cb)(enum stk_agent_result result,
58                                         char *string, void *user_data);
59
60 typedef void (*stk_agent_tone_cb)(enum stk_agent_result result,
61                                                 void *user_data);
62
63 typedef void (*stk_agent_display_action_cb)(enum stk_agent_result result,
64                                                 void *user_data);
65
66 struct stk_agent *stk_agent_new(const char *path, const char *sender,
67                                         ofono_bool_t remove_on_terminate);
68
69 void stk_agent_free(struct stk_agent *agent);
70
71 void stk_agent_set_removed_notify(struct stk_agent *agent,
72                                         ofono_destroy_func removed_cb,
73                                         void *user_data);
74
75 ofono_bool_t stk_agent_matches(struct stk_agent *agent,
76                                 const char *path, const char *sender);
77
78 void stk_agent_request_cancel(struct stk_agent *agent);
79
80 int stk_agent_request_selection(struct stk_agent *agent,
81                                 const struct stk_menu *menu,
82                                 stk_agent_selection_cb cb,
83                                 void *user_data, ofono_destroy_func destroy,
84                                 int timeout);
85
86 int stk_agent_display_text(struct stk_agent *agent, const char *text,
87                                 const struct stk_icon_id *icon,
88                                 ofono_bool_t urgent,
89                                 stk_agent_display_text_cb cb,
90                                 void *user_data, ofono_destroy_func destroy,
91                                 int timeout);
92
93 int stk_agent_request_confirmation(struct stk_agent *agent, const char *text,
94                                         const struct stk_icon_id *icon,
95                                         stk_agent_confirmation_cb cb,
96                                         void *user_data,
97                                         ofono_destroy_func destroy,
98                                         int timeout);
99
100 int stk_agent_request_digit(struct stk_agent *agent, const char *text,
101                                 const struct stk_icon_id *icon,
102                                 stk_agent_string_cb cb, void *user_data,
103                                 ofono_destroy_func destroy, int timeout);
104
105 int stk_agent_request_key(struct stk_agent *agent, const char *text,
106                                 const struct stk_icon_id *icon,
107                                 ofono_bool_t unicode_charset,
108                                 stk_agent_string_cb cb, void *user_data,
109                                 ofono_destroy_func destroy, int timeout);
110
111 int stk_agent_request_digits(struct stk_agent *agent, const char *text,
112                                 const struct stk_icon_id *icon,
113                                 const char *default_text, int min, int max,
114                                 ofono_bool_t hidden, stk_agent_string_cb cb,
115                                 void *user_data, ofono_destroy_func destroy,
116                                 int timeout);
117
118 int stk_agent_request_input(struct stk_agent *agent, const char *text,
119                                 const struct stk_icon_id *icon,
120                                 const char *default_text,
121                                 ofono_bool_t unicode_charset, int min, int max,
122                                 ofono_bool_t hidden, stk_agent_string_cb cb,
123                                 void *user_data, ofono_destroy_func destroy,
124                                 int timeout);
125
126 int stk_agent_confirm_call(struct stk_agent *agent, const char *text,
127                                 const struct stk_icon_id *icon,
128                                 stk_agent_confirmation_cb cb, void *user_data,
129                                 ofono_destroy_func destroy, int timeout);
130
131 int stk_agent_play_tone(struct stk_agent *agent, const char *text,
132                         const struct stk_icon_id *icon, ofono_bool_t vibrate,
133                         const char *tone, stk_agent_tone_cb cb, void *user_data,
134                         ofono_destroy_func destroy, int timeout);
135
136 int stk_agent_loop_tone(struct stk_agent *agent, const char *text,
137                         const struct stk_icon_id *icon, ofono_bool_t vibrate,
138                         const char *tone, stk_agent_tone_cb cb, void *user_data,
139                         ofono_destroy_func destroy, int timeout);
140
141 void append_menu_items_variant(DBusMessageIter *iter,
142                                 const struct stk_menu_item *items);
143
144 int stk_agent_display_action_info(struct stk_agent *agent, const char *text,
145                                         const struct stk_icon_id *icon);
146
147 int stk_agent_confirm_launch_browser(struct stk_agent *agent, const char *text,
148                                         unsigned char icon_id, const char *url,
149                                         stk_agent_confirmation_cb cb,
150                                         void *user_data,
151                                         ofono_destroy_func destroy,
152                                         int timeout);
153
154 int stk_agent_display_action(struct stk_agent *agent, const char *text,
155                                         const struct stk_icon_id *icon,
156                                         stk_agent_display_action_cb cb,
157                                         void *user_data,
158                                         ofono_destroy_func destroy);
159
160 int stk_agent_confirm_open_channel(struct stk_agent *agent, const char *text,
161                                         const struct stk_icon_id *icon,
162                                         stk_agent_confirmation_cb cb,
163                                         void *user_data,
164                                         ofono_destroy_func destroy,
165                                         int timeout);