6af9ac868a95b8b7c806e562399c7aeda97cc2f4
[apps/core/preloaded/settings.git] / setting-network / include / setting-network.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #ifndef __SETTING_NETWORK_H__
22 #define __SETTING_NETWORK_H__
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <glib.h>
27 #include <Elementary.h>
28 #include <Ecore_IMF.h>
29 #include <string.h>
30
31 #include <glib-object.h>
32
33 //#include <NetPMIntf_ext.h>
34 //#include <NetCMIntf_ext.h>
35 #include <network-pm-config.h>
36 #include <network-cm-intf.h>
37 #include <network-pm-intf.h>
38
39
40 #include <setting-common-draw-widget.h>
41 #include <setting-common-view.h>
42 #include <setting-debug.h>
43
44 #include <TapiUtility.h>
45 #include <ITapiNetwork.h>
46 #include <ITapiSim.h>
47
48 #include <TelErr.h>
49
50 #include <Ecore_IMF.h>
51
52 #define SUPPORT_CON_RESET
53 #define NET_CON_RESET_DBUS_PARA  "--system --print-reply --dest=com.tcore.ps / com.tcore.ps.master.ResetProfile"
54
55 #ifdef SUPPORT_MDM
56 #include <mdm.h>
57 #define MDM_POLICY_DATA_ROAMING_RESTRICTED_STR  "Security policy restricts use of Data roaming"
58 #endif
59
60 #define Data_packet_Desc "Data packet through 3G network will be consumed, if you use data download or upload without Wi-Fi connection."
61 #define SETTING_NETWORK_DATA_ROMING_DESC "Connect to data services when roaming"
62 #define SETTING_NETWORK_DATA_ROMING_OFF_DESC "When data roaming is disabled, the application that uses the data connection may not work"
63
64 #define SETTING_NETWORK_USE_PACKET_DATA_OFF_DESC "Data packet through 3G network will be consumed, if you use data download or upload without Wi-Fi connection. Continue?"
65 #define SETTING_NETWORK_USE_PACKET_DATA_ON_DESC "Use data services when roaming. Roaming will charge extra data fee"
66
67 #define CONNECTION_DSC "Connections"
68 #define KeyStr_Reset_Def "Reset to default"
69 #define KeyStr_Edit "Edit"
70 #define KeyStr_Saved "IDS_ST_BODY_SAVED"
71 #define keyStr_Searched "Searched"
72 #define keyStr_Failed_Searched "Searching network failed"
73 #define keyStr_Failed_Select_Network "Select network failed"
74 #define keyStr_Failed_Get_PreferNetwork "Get preferred network failed"
75
76 #define Insert_Access_Name_desc "Please input access name !"
77 #define Insert_User_Name_Desc "Please input User name !"
78 #define Invok_API_Failed_Desc "Failed to invoke API"
79
80 #define SETTING_ADD_PROFILE_INDEX -1
81 #define Invoking_TAPI_Timeout  8
82 #define COUNTRY_CODE_LEN        3
83 #define NETWORK_CODE_LEN        3
84 #define PRE_NETWORK_NAME_MAX 256
85
86 #define SETTING_NETWORK_POP_RESPONSE_ACTION_CANCEL  10  /*  the popupresponse action ID */
87 #define SETTING_NETWORK_SUBS_ID_NET_LEN 7
88
89 typedef enum {
90         SETTING_NETWORK_PREFERRED_NETWORK_NONE,
91         SETTING_NETWORK_PREFERRED_NETWORK_NEW,
92         SETTING_NETWORK_PREFERRED_NETWORK_EDIT,
93         SETTING_NETWORK_PREFERRED_NETWORK_LIST,
94         SETTING_NETWORK_PREFERRED_NETWORK_DELETE,
95
96 } setting_network_preferred_network_operation_type_t;
97
98 typedef struct _SettingNetworkUG SettingNetworkUG;
99
100 struct gl_network_data {
101         int index;
102         char name[PRE_NETWORK_NAME_MAX];
103 };
104
105 /**
106  * Setting Network UG context
107  * all UG function has void* as an agument. this is casted back to SettingNetworkUG
108  * and the functions access app context.
109  */
110 struct _SettingNetworkUG {
111         ui_gadget_h ug;
112         TapiHandle *handle;
113
114         /* add more variables here (move your appdata to here) */
115         Evas *evas;
116         Evas_Object *win_main_layout;
117         Evas_Object *win_get;
118         Evas_Object *popup;
119         Evas_Object *navi_bar;
120
121         //connection,
122         Elm_Object_Item *navi_it;
123         Evas_Object *controlbar;
124         Evas_Object *conformant;
125         Evas_Object *back_btn;
126         Evas_Object *l_button;
127         Evas_Object *r_button;
128         Evas_Object *m_button;
129
130         bool has_form_changed;
131         Evas_Object *genlist_sel_network;
132
133         Evas_Object *network_ug_pop;
134         Evas_Object *controllbar;
135
136         char *view_type_string;
137 #ifdef SUPPORT_MDM
138         mdm_result_t mdm_server_state;
139         mdm_status_t roaming_policy_status;
140         policy_receiver_handle mdm_handle;
141 #endif
142
143         Evas_Object *ly_main;
144         unsigned int subs_id_net[SETTING_NETWORK_SUBS_ID_NET_LEN];
145
146         //net_event_callbacks net_evt_cbs;
147
148         Setting_GenGroupItem_Data* data_auto_network_item;
149         Setting_GenGroupItem_Data* data_search_network_item;
150         bool b_searching_network;
151         bool b_set_auto_network;
152         bool b_set_manul_network;
153
154         Setting_GenGroupItem_Data *data_sel_net;
155         Setting_GenGroupItem_Data *data_net_mode;
156         Setting_GenGroupItem_Data *data_use_packet;
157         Setting_GenGroupItem_Data *data_roaming;
158
159         Evas_Object *chk_sel;
160         Evas_Object *chk_mode;
161         Evas_Object *pop_gsm;
162         Evas_Object *chk_3gcon;
163
164         int sel_net;            /* like vconf key */
165         int sel_act;            /* like vconf key */
166         char *sel_network;
167         int net_mode;           /* like vconf key */
168
169         TelNetworkPlmnList_t plmn_info;
170
171         int is_show_user;
172         //net_service_type_t con_type;
173         char *con_name;
174         net_profile_info_t *prof_list;
175         int prof_count;
176         int prof_sel_idx;
177
178         Evas_Object *chk_type;
179
180         const char *ed_acs_name_desc;
181         const char *ed_auth_type_desc;
182         const char *ed_user_name_desc;
183         const char *ed_pwd_desc;
184         const char *ed_pxy_addr_desc;
185         const char *ed_pxy_port_desc;
186         const char *ed_hm_url_desc;
187         int chkType;
188         Elm_Object_Item *item_above_user_name;
189         Elm_Object_Item *item_above_proxy_add;
190         Setting_GenGroupItem_Data *data_user_name;
191         Setting_GenGroupItem_Data *data_pwd;
192         Setting_GenGroupItem_Data *data_acs_name;
193         Setting_GenGroupItem_Data *data_pxy_addr;
194         Setting_GenGroupItem_Data *data_pxy_port;
195         Setting_GenGroupItem_Data *data_hm_url;
196         Setting_GenGroupItem_Data *data_auth_type;
197         Setting_GenGroupItem_Data *data_type_nor;
198         Setting_GenGroupItem_Data *data_type_sec;
199         Setting_GenGroupItem_Data *data_type_none;
200
201         Evas_Object *scl_edit;
202
203         /* Preferred network common */
204         TelNetworkPreferredPlmnList_t pref_list;
205         int sel_pref_idx;
206         setting_network_preferred_network_operation_type_t op_type;
207
208         Ecore_Idler *add_view_timer;
209         char search_text[MAX_SEARCH_STR_LEN + 1];
210         Evas_Object *nw_search_bar;
211
212         Evas_Object *scl_pref;
213         Evas_Object *chk_new_type;
214         Setting_GenGroupItem_Data *data_edit_mcc;
215         Setting_GenGroupItem_Data *data_edit_mnc;
216         Setting_GenGroupItem_Data *data_new_mcc;
217         Setting_GenGroupItem_Data *data_new_mnc;
218         Evas_Object *chk_edit_type;
219         Evas_Object *scl_pref_del;
220         Evas_Object *gl_sel_all;
221
222         Evas_Object *popup_label;
223         int deleted_number;
224         Eina_List *checked_data_list;
225         Eina_List *item_check_list;
226
227         /* Preferred network network list for genlist */
228         Evas_Object *gl_network;
229         Elm_Genlist_Item_Class itc;
230         struct gl_network_data *cur_sel_mem;
231         int cur_sel_index;
232
233         Setting_GenGroupItem_Data *data_cl_select_all;
234         Evas_Object *sub_clear_layout;
235         Evas_Object *selInfoPop;
236         Evas_Object *selInfoPop_layout;
237 };
238
239
240 extern setting_view setting_view_network_main;
241 extern setting_view setting_view_network_select_network;
242 extern setting_view setting_view_network_main_help;
243 extern setting_view setting_view_network_con;
244 extern setting_view setting_view_network_connection_create;
245 extern setting_view setting_view_network_3gcon;
246
247 extern setting_view setting_view_network_preferred_network;
248 extern setting_view setting_view_network_preferred_network_new;
249 extern setting_view setting_view_network_preferred_network_list;
250 extern setting_view setting_view_network_preferred_network_edit;
251 extern setting_view setting_view_network_preferred_network_delete;
252
253 const char *setting_network_get_act_str(TelNetworkSystemType_t type);
254 void setting_network_update_sel_network(void *data);
255
256 void setting_tapi_get_preferred_plmn_cb(TapiHandle *handle, int result, void *data, void *user_data);
257 void setting_tapi_set_preferred_plmn_cb(TapiHandle *handle, int result, void *data, void *user_data);
258
259 void setting_tapi_cancel_manual_search_cb(TapiHandle *handle, int result, void *data, void *user_data);
260 void setting_tapi_search_network_cb(TapiHandle *handle, int result, void *data, void *user_data);
261
262 void setting_tapi_get_serving_network_cb(TapiHandle *handle, int result, void *data, void *user_data);
263 void setting_tapi_get_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data);
264 void setting_tapi_set_plmn_mode_cb(TapiHandle *handle, int result, void *data, void *user_data);
265
266 void setting_tapi_get_band_cb(TapiHandle *handle, int result, void *data, void *user_data);
267 void setting_tapi_set_band_cb(TapiHandle *handle, int result, void *data, void *user_data);
268
269 void setting_network_select_network_chk_changed(void *data, Evas_Object *obj, void *event_info);
270 void setting_network_Gendial_select_plmn_cb(void *data, Evas_Object *obj, void *event_info);
271 void setting_network_popup_delete(void *data);
272
273 #endif                          /* __SETTING_NETWORK_H__ */