702de61fed8c238c5458e9d68c7047e3dc46f910
[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 #include <net_connection.h>
33
34
35 #include <setting-common-draw-widget.h>
36 #include <setting-common-view.h>
37 #include <setting-debug.h>
38
39 #include <TapiUtility.h>
40 #include <ITapiNetwork.h>
41 #include <ITapiSim.h>
42
43 #include <TelErr.h>
44
45 #include <Ecore_IMF.h>
46
47 #define Keystr_NetBrand_Auto "GSM/WCDMA(auto connect)"
48 #define Keystr_NetBrand_Auto_WCDMA_GSM "WCDMA/GSM (auto connect)"
49 #define Keystr_NetBrand_WCDMA "WCDMA only"
50 #define Keystr_NetBrand_LTE_WCDMA "LTE/WCDMA"
51 #define Keystr_NetBrand_GSM "GSM only"
52
53 #define SUPPORT_CON_RESET
54 #define NET_CON_RESET_DBUS_PARA  "--system --print-reply --dest=com.tcore.ps / com.tcore.ps.master.ResetProfile"
55
56
57 #define Data_packet_Desc "Data packet through 3G network will be consumed, if you use data download or upload without Wi-Fi connection."
58 #define SETTING_NETWORK_DATA_ROMING_DESC "IDS_COM_BODY_CONNECT_TO_DATA_SERVICES_WHEN_ROAMING"
59 #define SETTING_NETWORK_DATA_ROMING_OFF_DESC "When data roaming is disabled, the application that uses the data connection may not work"
60
61 #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?"
62 #define SETTING_NETWORK_USE_PACKET_DATA_ON_DESC "Use data services when roaming. Roaming will charge extra data fee"
63
64 #define CONNECTION_DSC "IDS_ST_BODY_CONNECTIONS"
65 #define KeyStr_Reset_Def "IDS_ST_BODY_RESET_TO_DEFAULT"
66 #define KeyStr_Edit "IDS_ST_BODY_EDIT"
67 #define KeyStr_Saved "IDS_ST_BODY_SAVED"
68 #define keyStr_Searched "Searched"
69 #define keyStr_Failed_Searched "Searching network failed"
70 #define keyStr_Failed_Select_Network "Select network failed"
71 #define keyStr_Failed_Get_PreferNetwork "Get preferred network failed"
72
73 #define Insert_Access_Name_desc "Please input access name !"
74 #define Insert_User_Name_Desc "Please input User name !"
75 #define Invok_API_Failed_Desc "Failed to invoke API"
76
77 //in the feture
78 #define NotifyStr_PDP_OFF "PDP will be disabled to find network nearby"
79 #define Keystr_UNKNOWN_NETWORK "Untitled network"
80
81 #define SETTING_ADD_PROFILE_INDEX -1
82 #define Invoking_TAPI_Timeout  8
83 #define COUNTRY_CODE_LEN        3
84 #define NETWORK_CODE_LEN        3
85 #define PRE_NETWORK_NAME_MAX 256
86
87 #define SETTING_NETWORK_POP_RESPONSE_ACTION_CANCEL  10  /*  the popupresponse action ID */
88 #define SETTING_NETWORK_SUBS_ID_NET_LEN 7
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 enum {
99         NET_RESTORE_NONE = 0, //do need restore
100         NET_RESTORE_PDP, //restore the vconf of pdp()
101         NET_RESTORE_PDP_ROAM,//restore the vconf of roaming()
102 } net_restore_t;//restore type
103
104
105 typedef struct _SettingNetworkUG SettingNetworkUG;
106
107 struct gl_network_data {
108         int index;
109         char name[PRE_NETWORK_NAME_MAX];
110 };
111
112 #define MAX_PROFILE_NUM 100
113 /**
114  * Setting Network UG context
115  * all UG function has void* as an agument. this is casted back to SettingNetworkUG
116  * and the functions access app context.
117  */
118 struct _SettingNetworkUG {
119         ui_gadget_h ug;
120         TapiHandle *handle;
121         connection_h connection;
122         connection_profile_h sel_profile_h;
123         net_restore_t net_restore;
124
125         /* add more variables here (move your appdata to here) */
126         Evas *evas;
127         Evas_Object *win_main_layout;
128         Evas_Object *win_get;
129         Evas_Object *popup;
130         Evas_Object *navi_bar;
131
132         //connection,
133         Elm_Object_Item *navi_it;
134         Evas_Object *bottom_btn;
135         //Evas_Object *conformant;
136         Evas_Object *back_btn;
137         Evas_Object *l_button;
138         Evas_Object *r_button;
139         //Evas_Object *m_button;
140
141         bool has_form_changed;
142         Evas_Object *genlist_sel_network;
143
144         Evas_Object *network_ug_pop;
145         Evas_Object *controllbar;
146
147         char *view_type_string;
148
149         Evas_Object *ly_main;
150         unsigned int subs_id_net[SETTING_NETWORK_SUBS_ID_NET_LEN];
151
152         Setting_GenGroupItem_Data* data_auto_network_item;
153         Setting_GenGroupItem_Data* data_search_network_item;
154         bool b_searching_network;
155         bool b_set_auto_network;
156         bool b_set_manul_network;
157
158         Setting_GenGroupItem_Data *data_sel_net;
159         Setting_GenGroupItem_Data *data_net_mode;
160         Setting_GenGroupItem_Data *data_use_packet;
161         Setting_GenGroupItem_Data *data_roaming;
162
163         Evas_Object *chk_sel;
164         Evas_Object *chk_mode;
165         Evas_Object *pop_gsm;
166         Evas_Object *chk_3gcon;
167
168         int sel_net;            /* like vconf key */
169         int sel_act;            /* like vconf key */
170         char *sel_network;
171         int net_mode;           /* like vconf key */
172
173         TelNetworkPlmnList_t plmn_info;
174
175         int is_show_user;
176         char *con_name;
177
178         Evas_Object *chk_type;
179
180         char *ed_acs_name_desc;
181         char *ed_auth_type_desc;
182         char *ed_user_name_desc;
183         char *ed_pwd_desc;
184         char *ed_pxy_addr_desc;
185         char *ed_pxy_port_desc;
186         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__ */