comparison src/ui/bmi/mmiNetwork.c @ 3:67bfe9f274f6

src/ui: import of src/ui3 from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:33:10 +0000
parents
children c0052fe355d3
comparison
equal deleted inserted replaced
2:3a14ee9a9843 3:67bfe9f274f6
1 /*******************************************************************************
2
3 CONDAT (UK)
4
5 ********************************************************************************
6
7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner.
9
10 ********************************************************************************
11
12 $Project name: Basic MMI
13 $Project code: BMI (6349)
14 $Module: Network
15 $File: MmiNetwork.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 22/02/01
20
21 ********************************************************************************
22
23 Description:
24
25
26
27 ********************************************************************************
28
29 $Hist
30
31 Oct 09, 2007 OMAPS00148258 x0056422
32 Description: Memory leak problem
33 Solution: Modified the freed memory size to solve the memory leak problem
34
35 Aug 07, 2007 DR:OMAPS00137726 x0066814(Geetha)
36 Description:HPLMN Manual Selection at power on -unable to perform manual selection at power ON
37 Solution: In network_nm_cb(), added a new case E_NM_PLMN_LIST_BOOTUP, to list the PLMNs during bootup.
38 May 31, 2007 DR: OMAPS00133201 x0pleela
39 Description: MS keeps searching networks and doesn't list available PLMNs after performing
40 manual selection
41 Solution : Added new function nm_abort_network() to destroy the dialog saying "Searching for
42 Networks" when CME_ERR_AbortedByNetwork error is recieved from ACI
43
44 May 24, 2007 DR: OMAPS00132483 x0pleela
45 Description: MM: While playing an AAC, unplug USB freezes the audio
46 Solution: In network() function, setting or resetting the phonelock and auto phone lock status bits
47
48 May 09, 2007 DR: OMAPS00129014 x0pleela
49 Description: COMBO: unable to send SMS during midi playing
50 Solution: Added phone lock status code in network() function.
51 May 09, 2007 DR: OMAPS00129014
52 Description: COMBO: unable to send SMS during midi playing
53 Solution: Added phone lock status code in network() function.
54 Apr 13, 2007 DRT:OMAPS00122739 x0066814(Geetha)
55 Description: With Orange SIM card, once attached (at+cgatt=1), "5201" is displayed instead of "Orange"
56 Solution : In network function, under the NETWORK_FULL_SERVICE,
57 added a contion to check whether plmn_name is present.
58
59 Mar 30,2007 DRT: OMAPS00120157 x00061088(Prachi)
60 Description : MMI displays network forbidden
61 Solution: Added check for Manual selection when the user selects network
62 manually for network list .Now network() checking for for Manual selection
63 by checking data->network_list_status is NETWORK_LIST_DISPLAY_FIRST or not.
64
65 Feb 16, 2007 OMAPS00098351 x0066814(Geetha)
66 Description: NITZ support is not working
67 Solution: Added the FF_TIMEZONE flag.Time is calculated according to GMT, if the FF_TIMEZONE flag is enabled.
68 Added settingsNITZ function to write the menu option selected onto the Flash.
69
70 Feb 08,2007 DRT: OMAPS00115060 x00061088(Prachi)
71 Description : To check for Forbidden network (for denied services),it takes long time.
72 after including fix for issue OMAPS00110741.
73 Solution: To solve this issue ,condition for forbidden network(i.e. network_data.forbidden == TRUE)
74 is moved out of condition if (parameter != Null).
75
76
77
78 Jan 10, 2007 REF: OMAPS00110741 x0039928(sumanth)
79 Description: Sample resets after network deregistration during Robustness Test
80 Solution: A condition is added to check if the parameter passed to the network() is NULL.
81
82 Jan 05, 2007 OMAPS00084665 x0039928(sumanth)
83 Description: Boot time exceed UCSD estimations
84
85 Dec 13, 2006 DRT: OMAPS00105640 x0039928(Sumanth)
86 Description : SIMP: The board reboots when removing SIM card.
87 Solution : A condition is added in network() to check if SIM is active.
88
89 Oct 30,2006 ER:OMAPS00091029 x0039928(sumanth)
90 Bootup time measurement
91
92 Oct 05, 2006 ER: OMAPS00094496 x0061088(Prachi)
93 Description:Enhance RSSI to 3 parameters: Strength, quality, min-access-level
94 Solution: If there is NO NETWORK , Network() is calling globalSignalUpdate()
95 to show the Signal Strength.
96 Sep 18,2006 DRT: OMAPS0090268 x00061088(Prachi)
97 Description : To check for Forbidden network (for denied services),it takes long time.
98 Solution : Function network_nm_cb() has now be implemented to handle E_NM_FORBIDDEN_NETWORK,which sends event
99 NETWORK_FORBIDDEN_NETWORK to network(),by setting flags network_data.aborted =False
100 and network_data.forbidden = Ture.
101
102 Jun 23, 2006 DR: OMAPS00082374 x0pleela
103 Description: EONS Failures - unexpected output from the MMI: 2 carriers; on the top always T-Mobile
104 Solution: a) Removed the usage of global variable gEons_alloc_active
105 b) Added new check for CNIV request
106 c) Memset the data->plmn_name and data->network_name
107 d) Added check to display short name if long name len is 0. or display numeric name if short name len is 0
108
109 June 02, 2006 DR: OMAPS00078005 x0021334
110 Descripton: Test for NITZ (Network Identity and Timezone) support - No New time was displayed
111 Solution: New Time/Date received from network is sent to MFW by lower layer by invoking 'rAT_PercentCTZV'
112 function. This function has now been implemented to pass on the received values to MMI
113 for user confirmation and RTC updation.
114
115 May 26, 2006 ER: OMAPS00079607 x0012849 :Jagannatha M
116 Description: CPHS: To support AoC and information numbers.
117 Solution: Made the following changes
118 Added a function that returns the roaming status.
119
120 Feb 15, 2006 ER: OMAPS00065203 x0pleela
121 Description: Cingular Operator Name Prioritization implementation required
122 Solution: Incorporated review comments
123 - Included flag NEPTUNE_BOARD to retain old code for operator get name and
124 added new code for this ER also
125 - Removed the global variable gOper_sel_done and have introduced 2 functions which will
126 set and get the status of the operator selection
127
128 Feb 09, 2006 ER: OMAPS00065203 x0pleela
129 Description: Cingular Operator Name Prioritization implementation required
130 Solution: In function network(), check if EONS is allocated and activated. If not, get operator name from other sources
131 Removed CPHS check code as prioritized operator name is already updated to network_data
132
133 xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
134 Added a please wait screen so that the sim is updated with the new code before
135 populating the list again when deleting or when entering a newtwork code
136
137 Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
138 Description: Phone crashes on invoking Manual option in Network Selection Menu.
139 Solution: Memory free of network_data.pplmn is done when the editor exits instead of
140 list exit by option selection so that the pplmn data is available when the list is invoked once again.
141
142 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
143 Description: The homezone/cityzone tags were not being displayed properly.
144 Solution: Modified to save the tags properly in caches and also made the
145 appropriate modifications to update the same properly during mobility.
146
147 Sep 23, 2004 REF: CRR 24562 xvilliva
148 Bug: Enable/disable the manual network selection option depending
149 on ENS.
150 Fix: If the manual network selection is disabled we check if an
151 error is returned and flash an alert to the user.
152
153 Sep 8, 2004 REF: CRR 16062 xvilliva
154 Bug: If a PLMN is selected (by using the middle key) from the PLMN list
155 presented upon a manual search the D-Sample may freeze.
156 Fix: The "KEY_MNUSELECT" event is also monitered which was not
157 done earlier and was resulting in the PLMN list shown again.
158
159 Jul 21, 2004 REF: CRR 13348 xvilliva
160 Bug: After selecting HPLMN manually, the idle screen is not shown.
161 Fix: After the "Network Selected" alert is flashed, we destroy the
162 phonebook menu to return to the idle screen.
163
164
165 // Apr 14, 2004 REF: CRR 12641 xpradipg
166 // The network when selected using "Automatic" is not showing an alert after selection.
167 // A flag has been used to show the alert when ever network is selected using
168 // "Automatic" method. As the flag is present it will not flash this alert when the
169 // device is restarted.
170
171 25/10/00 Original Condat(UK) BMI version.
172
173 05/04/06 REF:OMAPS00061046 x0043641
174 BUG:Possible to cancel the searching with right soft key although the option is not available.
175 FIX: In the searching mode cancel option is provided.
176
177 08-03-2006 REF: OMAPS00061049 x0020906
178
179 Bug: The sample crashed many times while trying to camp onto a FPLMN. PCO stucked when tracing this TC,
180 therefore no PCO traces available; only L1 traces (TestHarness).
181
182 Fix: During manual selection from the indication will get the plmn list count and used the count for allocating
183 plmn_list pointer and then destorying the list and free the pointer allocation when particular network is selected
184 or when back softkey is pressed.
185
186
187 $End
188 // Issue Number : SPR#12654 on 07/04/04 by Pradeep/Vadiraj
189 *******************************************************************************/
190
191
192 /*******************************************************************************
193
194 Include Files
195
196 *******************************************************************************/
197
198 #define ENTITY_MFW
199
200 /* includes */
201 #include <string.h>
202 #include <stdio.h>
203 #include <stdlib.h>
204
205 #if defined (NEW_FRAME)
206
207 #include "typedefs.h"
208 #include "vsi.h"
209 #include "pei.h"
210 #include "custom.h"
211 #include "gsm.h"
212
213 #else
214
215 #include "STDDEFS.H"
216 #include "custom.h"
217 #include "gsm.h"
218 #include "vsi.h"
219
220 #endif
221 #include "mfw_sys.h"
222
223 #include "prim.h"
224
225 #include "mfw_mfw.h"
226 #include "mfw_win.h"
227 #include "mfw_kbd.h"
228 /* SPR#1428 - SH - New Editor changes */
229 #ifndef NEW_EDITOR
230 #include "mfw_edt.h"
231 #endif
232 #include "mfw_lng.h"
233 #include "mfw_icn.h"
234 #include "mfw_mnu.h"
235 #include "mfw_tim.h"
236 #include "mfw_sim.h"
237 #include "mfw_nm.h"
238 #include "mfw_cm.h"
239 #include "mfw_sat.h"
240 #include "mfw_phb.h"
241 #include "mfw_sms.h"
242
243 // June 02, 2006 DR: OMAPS00078005 x0021334
244 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the Flag
245 #ifdef FF_TIMEZONE
246 #include "mfw_td.h"
247 #endif
248
249 #include "dspl.h"
250
251 #include "ksd.h"
252 #include "psa.h"
253
254 #include "MmiDummy.h"
255 #include "MmiMmi.h"
256 #include "MmiMain.h"
257 #include "MmiStart.h"
258 #include "MmiPins.h"
259
260 #include "MmiDialogs.h"
261 #include "MmiLists.h"
262 /* SPR#1428 - SH - New Editor changes */
263 #ifdef NEW_EDITOR
264 #include "ATBCommon.h"
265 #include "ATBDisplay.h"
266 #include "ATBEditor.h"
267 #include "AUIEditor.h"
268 #else
269 #include "MmiEditor.h"
270 #endif
271
272 #include "MmiMenu.h"
273 #include "MmiIdle.h"
274 #include "mmiCall.h"
275 #include "MmiBookController.h"
276 #include "MmiNetwork.h"
277 #include "MmiSoftKeys.h"
278 #include "MmiSounds.h"
279 #include "MmiPcm.h"
280
281 #include "prim.h"
282 #ifndef PCM_2_FFS
283 #include "pcm.h"
284 #endif
285
286 #include "mfw_ffs.h"
287 #include "MmiCPHS.h"
288
289 #ifdef MMI_HOMEZONE_ENABLED
290 #include "MmiHomezone.h"
291 #endif
292
293 #include "MmiNetwork.h"
294
295 #include "cus_aci.h"
296
297 #include "mmiColours.h"
298
299 /* BEGIN ADD: Neptune Alignment */
300 #ifdef NEPTUNE_BOARD
301 #include "bmi_integ_misc.h"
302 #endif
303 /* END ADD: Neptune Alignment */
304 #ifdef NEPTUNE_BOARD
305 /* PLMN list count obtained from indication, stored in the global static variable*/
306 /*OMAPS00061049 - 08-03-2006 */
307 static int Plmn_list_count = 0;
308 #endif
309
310
311 /* Enum containing GMT */
312 typedef enum {
313 MMI_GMT_NT_1200 = -48, /* Read as GMT -12:00 hrs */
314 MMI_GMT_NT_1145 = -47, /* Read as GMT -11:45 hrs */
315 MMI_GMT_NT_1130 = -46,
316 MMI_GMT_NT_1115 = -45,
317 MMI_GMT_NT_1100 = -44,
318 MMI_GMT_NT_1045 = -43,
319 MMI_GMT_NT_1030 = -42,
320 MMI_GMT_NT_1015 = -41,
321 MMI_GMT_NT_1000 = -40,
322 MMI_GMT_NT_0945 = -39,
323 MMI_GMT_NT_0930 = -38,
324 MMI_GMT_NT_0915 = -37,
325 MMI_GMT_NT_0900 = -36,
326 MMI_GMT_NT_0845 = -35,
327 MMI_GMT_NT_0830 = -34,
328 MMI_GMT_NT_0815 = -33,
329 MMI_GMT_NT_0800 = -32,
330 MMI_GMT_NT_0745 = -31,
331 MMI_GMT_NT_0730 = -30,
332 MMI_GMT_NT_0715 = -29,
333 MMI_GMT_NT_0700 = -28,
334 MMI_GMT_NT_0645 = -27,
335 MMI_GMT_NT_0630 = -26,
336 MMI_GMT_NT_0615 = -25,
337 MMI_GMT_NT_0600 = -24,
338 MMI_GMT_NT_0545 = -23,
339 MMI_GMT_NT_0530 = -22,
340 MMI_GMT_NT_0515 = -21,
341 MMI_GMT_NT_0500 = -20,
342 MMI_GMT_NT_0445 = -19,
343 MMI_GMT_NT_0430 = -18,
344 MMI_GMT_NT_0415 = -17,
345 MMI_GMT_NT_0400 = -16,
346 MMI_GMT_NT_0345 = -15,
347 MMI_GMT_NT_0330 = -14,
348 MMI_GMT_NT_0315 = -13,
349 MMI_GMT_NT_0300 = -12,
350 MMI_GMT_NT_0245 = -11,
351 MMI_GMT_NT_0230 = -10,
352 MMI_GMT_NT_0215 = -9,
353 MMI_GMT_NT_0200 = -8,
354 MMI_GMT_NT_0145 = -7,
355 MMI_GMT_NT_0130 = -6,
356 MMI_GMT_NT_0115 = -5,
357 MMI_GMT_NT_0100 = -4,
358 MMI_GMT_NT_0045 = -3,
359 MMI_GMT_NT_0030 = -2,
360 MMI_GMT_NT_0015 = -1,
361
362 MMI_GMT_PT_0000 = 0, /* Read as GMT +0:00 */
363
364
365 MMI_GMT_PT_0015 = 1,
366 MMI_GMT_PT_0030 = 2,
367 MMI_GMT_PT_0045 = 3,
368 MMI_GMT_PT_0100 = 4,
369 MMI_GMT_PT_0115 = 5,
370 MMI_GMT_PT_0130 = 6,
371 MMI_GMT_PT_0145 = 7,
372 MMI_GMT_PT_0200 = 8,
373 MMI_GMT_PT_0215 = 9,
374 MMI_GMT_PT_0230 = 10,
375 MMI_GMT_PT_0245 = 11,
376 MMI_GMT_PT_0300 = 12,
377 MMI_GMT_PT_0315 = 13,
378 MMI_GMT_PT_0330 = 14,
379 MMI_GMT_PT_0345 = 15,
380 MMI_GMT_PT_0400 = 16,
381 MMI_GMT_PT_0415 = 17,
382 MMI_GMT_PT_0430 = 18,
383 MMI_GMT_PT_0445 = 19,
384 MMI_GMT_PT_0500 = 20,
385 MMI_GMT_PT_0515 = 21,
386 MMI_GMT_PT_0530 = 22,
387 MMI_GMT_PT_0545 = 23,
388 MMI_GMT_PT_0600 = 24,
389 MMI_GMT_PT_0615 = 25,
390 MMI_GMT_PT_0630 = 26,
391 MMI_GMT_PT_0645 = 27,
392 MMI_GMT_PT_0700 = 28,
393 MMI_GMT_PT_0715 = 29,
394 MMI_GMT_PT_0730 = 30,
395 MMI_GMT_PT_0745 = 31,
396 MMI_GMT_PT_0800 = 32,
397 MMI_GMT_PT_0815 = 33,
398 MMI_GMT_PT_0830 = 34,
399 MMI_GMT_PT_0845 = 35,
400 MMI_GMT_PT_0900 = 36,
401 MMI_GMT_PT_0915 = 37,
402 MMI_GMT_PT_0930 = 38,
403 MMI_GMT_PT_0945 = 39,
404 MMI_GMT_PT_1000 = 40,
405 MMI_GMT_PT_1015 = 41,
406 MMI_GMT_PT_1030 = 42,
407 MMI_GMT_PT_1045 = 43,
408 MMI_GMT_PT_1100 = 44,
409 MMI_GMT_PT_1115 = 45,
410 MMI_GMT_PT_1130 = 46,
411 MMI_GMT_PT_1145 = 47,
412 MMI_GMT_PT_1200 = 48, /* Read as GMT +12:00 */
413
414
415
416 MMI_TIME_ERROR = -100
417 } T_MMI_TZ;
418
419
420 int mmi_timezone_value(int mmi_rtc_timezone);
421
422 /*
423 * Data for top window
424 */
425 typedef struct
426 {
427 T_MMI_CONTROL mmi_control;
428 T_MFW_HND network_win; /* MFW win handler */
429 T_MFW_HND nm_handle; /* MFW network handler */
430 UBYTE aborted;
431 UBYTE forbidden;
432 UBYTE keep_plmn_list;
433 T_MFW_NETWORK_STRUCT *pplmn; /* pref. PLMN list */
434 T_MFW_PPLMN_MEM pplmn_mem;
435 UBYTE plmn_name[SIZE_PLMN_NAME]; /* textual network name */
436 UBYTE network_name[SIZE_NETWORK_NAME]; /* numeric network name */
437 USHORT status; /* current status */
438 UBYTE roaming_indicator; /* Roaming Indicator */
439 ListMenuData * network_list; /* PLMN available List */
440 UBYTE network_list_status;/* Network List Status */
441 UBYTE network_search_name[MAX_PLMN][6]; /* numeric network name */
442 T_MFW_HND network_search_win;
443 UBYTE Listposition;
444 } T_network;
445
446 T_network network_data;
447
448 typedef struct
449 {
450 T_MMI_CONTROL mmi_control;
451 T_MFW_HND win;
452 SHORT id;
453 T_MFW_HND parent;
454 T_MFW_HND kbd;
455 T_MFW_HND kbd_long;
456 T_MFW_HND menu;
457 T_MFW_HND dialog_win;
458 ListMenuData *network_list;
459 /*SPR 2635, replace pplmn data structure pointer with pointer to array of strings*/
460 char** pplmn_longnames;
461 CHAR buffer[6];
462 #ifdef NEW_EDITOR
463 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */
464 #else
465 T_EDITOR_DATA editor_info; /* storage for editor attributes */
466 #endif
467 } T_network_OPT;
468
469
470 typedef enum
471 {
472 E_INIT,
473 E_BACK,
474 E_RETURN,
475 E_ABORT,
476 E_EXIT
477 } e_lists_events;
478
479 // Apr 14, 2004 REF: CRR 12641 xpradipg
480 static BOOLEAN Auto_Network_Select=false;
481 extern T_MFW_HND gPhbkMenu;// Jul 21, 2004 REF: CRR 13348 xvilliva
482 // Sep 23, 2004 REF: CRR 24562 xvilliva
483 extern int g_ensErr;
484
485
486 /*
487 * Local prototypes
488 */
489 static int network_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
490 static int network_nm_cb (T_MFW_EVENT event, T_MFW_HND para);
491 static void network_remove_network_log (void);
492 static UBYTE network_log_enabled (void);
493 static void network_list_cb (T_MFW_HND win, ListMenuData * ListData);
494 static void network_pref_list_cb (T_MFW_HND win, ListMenuData * ListData);
495 static ListMenuData * network_create_list (T_network * data, T_MFW_PLMN_LIST * plmn_list);
496 static ListMenuData * network_create_pref_list (T_network * data);
497 static ListMenuData * network_create_mobile_list (T_network_OPT * data);
498 static void network_start_animation_plmn_selection (int plmn_value);
499 static void network_start_animation (void);
500 static void network_stop_animation (void);
501 static void network_selected (void);
502 static void network_forbidden_plmn (void);
503 static void network_no_plmns (void);
504 void network_animation_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
505 //Jul 21, 2004 REF: CRR 13348 xvilliva
506 //We use a seperate callback for "Network Selected".
507 void network_select_animation_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
508 T_MFW_HND network_MNU_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
509 static T_MFW_HND network_MNU_create(MfwHnd parent_window);
510 static void network_MNU_destroy(MfwHnd own_window);
511 void network_MNU_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
512 static int network_MNU_mnu_cb (MfwEvt e, MfwMnu *m);
513 static int network_MNU_win_cb (MfwEvt e, MfwWin *w);
514 static int network_MNU_kbd_cb (MfwEvt e, MfwKbd *k);
515 static int network_request_plnm_list (MfwMnu* m, MfwMnuItem* i);
516 void network_delete_pref_plnm (T_MFW_HND win , USHORT identifier, UBYTE reason);
517 void network_info_screen (T_MFW_HND win, USHORT MessageId, T_VOID_FUNC funt_ptr );// xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
518 static int network_delete(MfwMnu* m, MfwMnuItem* i);
519 T_MFW_HND network_EDT_start (MfwMnu* m, MfwMnuItem* i);
520 static T_MFW_HND network_EDT_create (T_MFW_HND parent);
521 static void network_EDT_destroy (T_MFW_HND window);
522 static void network_EDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
523 static void network_EDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event);
524 /* SPR#2354 - SH -Added two new callbacks */
525 static void network_request_plmn_list_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
526 void network_mobile_list_changed_cb(T_MFW_HND win , USHORT identifier, UBYTE reason);
527
528 //x0pleela 30 May, 2007 DR: OMAPS00133201
529 void nm_abort_network( void );
530
531 // June 02, 2006 DR: OMAPS00078005 x0021334
532 // Call back function of info dialog for getting user confirmation for time update
533 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
534 #ifdef FF_TIMEZONE
535 static int nw_time_update_callback(T_MFW_HND win, USHORT identifier, UBYTE reason);
536
537 // June 02, 2006 DR: OMAPS00078005 x0021334
538 // To update RTC with new time and date info.
539 static T_MFW_TIME newTime;
540 static T_MFW_DATE newDate;
541 #endif
542
543 /*
544 * Local Definitions
545 */
546 #define NETWORK_LIMITED_SERVICE 420
547 #define NETWORK_NO_NETWORK 421
548 #define NETWORK_PLMN_LIST 422
549 #define NETWORK_PREFERRED_LIST 423
550 #define NETWORK_PPLMN_MEM_LIST 424
551 /* SPR759 - SH - Cell reselection */
552 #define NETWORK_CELL_SELECT 425
553
554 #define NETWORK_LIST_DISPLAY 430
555 #define NETWORK_LIST_SELECT_PLMN 432
556
557 // June 02, 2006 DR: OMAPS00078005 x0021334
558 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
559 #ifdef FF_TIMEZONE
560 #define NETWORK_TIME_UPDATE 445
561 #endif
562 //Sep 18 2006 DRT :OMAPS0009268 x0061088
563 #define NETWORK_FORBIDDEN_NETWORK 446
564
565 #ifdef NEPTUNE_BOARD
566 /* List destory not done - added - OMAPS00061049 - 08-03-2006 */
567 #define NETWORK_LIST_DESTORY 440
568 #endif
569
570 /*
571 * Local Network List Status
572 */
573 #define NETWORK_LIST_DISPLAY_FIRST 1
574 #define NETWORK_LIST_SELECTED 2
575 #define NETWORK_LIST_REGISTRATION 3
576 #define NETWORK_PREF_LIST_SELECTED 4
577 #define NETWORK_MENU_ITEM 2
578
579 //nm 5.3.01 this number will be change
580 #define MAX_SHOW_OF_PLMN 99
581
582 static MfwMnuItem network_OPTItems [] =
583 {
584 {0,0,0,(char *)TxtSelectFromList, 0, (MenuFunc)network_request_plnm_list, item_flag_none},
585 {0,0,0,(char *)TxtEnterNetworkCode, 0, (MenuFunc)network_EDT_start, item_flag_none},
586 {0,0,0,(char *)TxtDelete, 0, (MenuFunc)network_delete, item_flag_none}
587 };
588
589 static MfwMnuAttr network_OPTAttrib =
590 {
591 &network_menuArea,
592 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
593 (U8)-1, /* use default font */
594 network_OPTItems, /* with these items */
595 sizeof(network_OPTItems)/sizeof(MfwMnuItem), /* number of items */
596 COLOUR_LIST_NETWORK, TxtNull, NULL, MNUATTRSPARE
597
598
599 };
600
601
602
603 static MfwMnuAttr network_menuAttrib =
604 {
605 &network_menuArea,
606 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
607 (U8)-1, /* use default font */
608 NULL, /* with these items */
609 0, /* number of items */
610 COLOUR_LIST_NETWORK, TxtNull, NULL, MNUATTRSPARE
611
612 };
613
614 //x0pleela 09 May, 2007 DR: OMAPS00129014
615 #ifdef FF_PHONE_LOCK
616 extern T_MFW_HND phlock_win_handle; /* to hold the win handle of phone unlock editor window */
617 GLOBAL UBYTE phlock_auto;
618 //x0pleela 29 May, 2007 DR: OMAPS00132483
619 EXTERN int mfw_get_Phlock_status(void);
620 EXTERN void mfw_set_Phlock_status( int phlock_status);
621 EXTERN int mfw_get_Auto_Phlock_status(void);
622 EXTERN void mfw_set_Auto_Phlock_status( int phlock_status);
623 #endif //F_PHONE_LOCK
624 /*******************************************************************************
625
626 $Function: networkInit
627
628 $Description:
629
630 $Returns:
631
632 $Arguments:
633
634 *******************************************************************************/
635 T_MFW_HND networkInit (T_MFW_HND parent_window)
636 {
637 return (network_create (parent_window));
638 }
639
640
641 /*******************************************************************************
642
643 $Function: networkExit
644
645 $Description: exit network handling (Backward Compatibility interface)
646
647 $Returns:
648
649 $Arguments:
650 *********************************************************************/
651
652
653 void networkExit (void)
654 {
655 network_destroy (network_data.network_win);
656 }
657
658 /*********************************************************************
659 *
660 * Network Dialog
661 *
662 * Window - Structure
663 *
664 * network --> network_list
665 * --> network_search_animation
666 *
667 *********************************************************************/
668
669 /*******************************************************************************
670
671 $Function: network_create
672
673 $Description: create network top window
674
675 $Returns:
676
677 $Arguments:
678
679 *******************************************************************************/
680 T_MFW_HND network_create (T_MFW_HND parent_window)
681 {
682 T_network * data = &network_data;
683 T_MFW_WIN * win;
684
685 TRACE_FUNCTION ("network_create()");
686
687 data->network_win = win_create (parent_window, 0, 0, (T_MFW_CB)network_win_cb);
688
689 if (data->network_win EQ 0)
690 return 0;
691
692 /*
693 * Create window handler
694 */
695 data->mmi_control.dialog = (T_DIALOG_FUNC)network;
696 data->mmi_control.data = data;
697 win = ((T_MFW_HDR *)data->network_win)->data;
698 win->user = (void *) data;
699
700 /*
701 * Initialise MFW
702 */
703 nm_init ();
704
705 /*
706 * Create any other handler
707 */
708 data->nm_handle = nm_create (data->network_win, E_NM_ALL_SERVICES, (T_MFW_CB)network_nm_cb);
709
710 memset (data->plmn_name, 0, SIZE_PLMN_NAME);
711 memset (data->network_name, 0, SIZE_NETWORK_NAME);
712
713 data->aborted = FALSE;
714 data->keep_plmn_list = FALSE;
715 data->forbidden = FALSE;
716
717 data->status = NETWORK_NO_SERVICE;
718 data->network_list = NULL;
719 data->network_search_win = 0;
720 data->Listposition = 0;
721
722
723
724 winShow(data->network_win);
725 /*
726 * return window handle
727 */
728 return data->network_win;
729 }
730
731 /*******************************************************************************
732
733 $Function: network_destroy
734
735 $Description: destroy network top window
736
737 $Returns:
738
739 $Arguments:
740
741 *******************************************************************************/
742 void network_destroy (T_MFW_HND own_window)
743 {
744 T_MFW_WIN * win;
745 T_network * data;
746
747 TRACE_FUNCTION ("network_destroy()");
748
749 if (own_window)
750 {
751 win = ((T_MFW_HDR *)own_window)->data;
752 data = (T_network *)win->user;
753
754 if (data)
755 {
756 /*
757 * Exit NM and delete NM handler
758 */
759 nm_exit ();
760 nm_delete (data->nm_handle);
761
762 /*
763 * Delete WIN handler
764 */
765 win_delete (data->network_win);
766 }
767 }
768 }
769
770 /*******************************************************************************
771
772 $Function: network
773
774 $Description: network top window dialog function
775
776 $Returns:
777
778 $Arguments:
779
780 *******************************************************************************/
781 void network (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
782 {
783
784 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
785 T_network * data = (T_network *)win_data->user;
786 T_MFW_NETWORK_STRUCT * plmn_ident;
787 UBYTE signal_value;
788
789 // June 02, 2006 DR: OMAPS00078005 x0021334
790 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
791 #ifdef FF_TIMEZONE
792 T_DISPLAY_DATA display_info ; // Structure for info_dialog
793 T_MFW_TIME_IND *network_time; // Time/date info from network
794 T_MFW_TIME *time_format; // To get the current time format set in MS
795 #endif
796
797
798 TRACE_FUNCTION(">>> network()");
799
800 //x0pleela 09 Mar, 2007 DR: OMAPS00129014
801 #ifdef FF_PHONE_LOCK
802 if( mfw_phlock_get_lock_status(MFW_PH_LOCK) == MFW_PH_LOCK_ENABLE )
803 {
804 TRACE_EVENT("idle_draw: MFW_PH_LOCK_ENABLE");
805
806 //x0pleela 23 May, 2007 DR: OMAPS00132483
807 //Set the phone lock status to TRUE
808 mfw_set_Phlock_status(TRUE);
809
810 if( !phlock_win_handle )
811 phLock_UnLock();
812 }
813 else //for Automatic Phone lock check
814 {
815 //x0pleela 23 May, 2007 DR: OMAPS00132483
816 //Set the phone lock status to FALSE
817 mfw_set_Phlock_status(FALSE);
818
819 if( mfw_phlock_get_autolock_status(MFW_AUTO_PH_LOCK) == MFW_PH_LOCK_ENABLE )
820 {
821 phlock_auto = TRUE;
822
823 //x0pleela 23 May, 2007 DR: OMAPS00132483
824 //Set the auto phone lock status to TRUE
825 mfw_set_Auto_Phlock_status(TRUE);
826 }
827 //x0pleela 23 May, 2007 DR: OMAPS00132483
828 //Set the auto phone lock status to FALSE
829 mfw_set_Auto_Phlock_status(FALSE);
830 }
831 #endif /* FF_PHONE_LOCK */
832
833 switch (event)
834 {
835 case NETWORK_NO_SERVICE:
836 case NETWORK_LIMITED_SERVICE:
837 TRACE_EVENT ("NETWORK NO/LIMITED SERVICE");
838 /*
839 * Set Status
840 */
841 data->status = NETWORK_NO_SERVICE;
842
843 // June 02, 2006 DR: OMAPS00078005 x0021334
844 // Set PCTZV mode on
845 //Dec 13,2006 DR:OMAPS00098351 x0066814-Added the FF_TIMEZONE flag
846 #ifdef FF_TIMEZONE
847 nm_get_network_time();
848 #endif
849
850 /*
851 * Check if network log is enabled
852 */
853 if (network_log_enabled ())
854 {
855 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
856 }
857 else
858 {
859 SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
860 if (data->network_list NEQ NULL)
861 {
862 switch (data->network_list_status)
863 {
864 case NETWORK_LIST_REGISTRATION:
865 TRACE_EVENT ("NETWORK_LIST_REGISTRATION");
866 /*
867 * Present list of available PLMNs again
868 *
869 * Start the available plmn search
870 */
871 nm_avail_plmn_list();
872 //Sep 23, 2004 REF: CRR 24562 xvilliva
873 //After retrieving the list we see if an error occured
874 //and flash an alert to the user accordingly.
875 if(g_ensErr == 1)
876 {
877 g_ensErr = 0;
878 info_screen(0, TxtNotAllowed, TxtNull, NULL);
879 }
880
881 /*
882 * remove network log if needed
883 */
884 network_remove_network_log ();
885
886 network_data.forbidden = TRUE;
887 break;
888
889 case NETWORK_LIST_SELECTED:
890 TRACE_EVENT ("NETWORK_LIST_SELECTED");
891 /*
892 * After registration start, MFW returns the current status
893 */
894 data->network_list_status= NETWORK_LIST_REGISTRATION;
895 data->keep_plmn_list = TRUE;
896 break;
897 }
898 }
899 }
900 //Oct 05, 2006 ER: OMAPS00094496 x0061088(Prachi)
901 signal_value = 0 ;
902 globalSignalUpdate(signal_value);
903 #ifdef MMI_HOMEZONE_ENABLED
904 /* sh - tell homezone there is no network */
905 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
906 //Modified to incorporate the third argument.
907 homezoneUpdate(0,0,0);
908 #endif
909 break;
910
911 case NETWORK_SEARCH_NETWORK:
912 TRACE_EVENT ("NETWORK SEARCH NETWORK");
913 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
914 break;
915
916 case NETWORK_FULL_SERVICE:
917 TRACE_EVENT("NETWORK_FULL_SERVICE");
918 /*
919 * Set Status
920 */
921 data->status = NETWORK_FULL_SERVICE;
922 #ifdef FF_CPHS_REL4
923 mfw_cphs_get_msp_info();
924 #endif
925
926 // June 02, 2006 DR: OMAPS00078005 x0021334
927 // Set PCTZV mode on
928 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
929 #ifdef FF_TIMEZONE
930 nm_get_network_time();
931 #endif
932 /*
933 * Copy Network Name in textual and numerical format
934 *
935 * NOTE: Service Provider Name is not used
936 * Operator Name from SIM needs CPHS support by MFW
937 */
938 plmn_ident = (T_MFW_NETWORK_STRUCT *)parameter;
939
940 //x0pleela 15 Feb, 2006 ER: OMAPs00065203
941 //Removed the global variable gOper_sel_done and have introduced 2 functions which will
942 //set and get the status of the operator selection
943
944 //x0pleela 9 Feb, 2006 ER:OMAPS00065203
945 //Check if EONS is allocated and activated. If not, and if operator name is not yet obtained from other sources
946 //get operator name from other sources
947 if( ( ( plmn_ident->opn_read_from EQ NM_CPHS ) AND ( plmn_ident->roaming_indicator) )
948 OR (plmn_ident->opn_read_from EQ NM_ROM) )
949 {
950 //get operator name from other sources CPHS or NITZ or ROM
951 nm_get_opername(plmn_ident);
952 }
953 memset(data->plmn_name, 0, SIZE_PLMN_NAME);
954 memset(data->network_name, 0, SIZE_NETWORK_NAME); /* x0039928 - Lint warning removal */
955 #ifdef NO_ASCIIZ
956 memcpy (data->plmn_name, &plmn_ident->network_long.data, SIZE_PLMN_NAME);
957 #else
958 memcpy (data->plmn_name, plmn_ident->network_long, SIZE_PLMN_NAME);
959 #endif
960 memcpy (data->network_name, plmn_ident->network_numeric, SIZE_NETWORK_NAME);
961
962 /*
963 * If network name is not known use numeric representation as default.
964 */
965
966 #ifdef NO_ASCIIZ
967 //Apr 13, 2007 DRT:OMAPS00122739 x0066814(Geetha)
968 if(!(strlen((char*)data->plmn_name)))
969 {
970
971 if( plmn_ident->network_short.len EQ 0 )
972 strcpy ((char *)data->plmn_name, (char *)data->network_name);
973 else
974 memcpy (data->plmn_name, &plmn_ident->network_short.data, SHORT_NAME); /* x0039928 -Lint warning removal */
975
976 }
977 #else
978 //Apr 13, 2007 DRT:OMAPS00122739 x0066814(Geetha)
979 if(!(strlen((char*)data->plmn_name)))
980 {
981
982 if (strlen ((char *)(plmn_ident->network_short)) EQ 0)
983 strcpy ((char *)data->plmn_name, (char *)data->network_name);
984 else
985 memcpy (data->plmn_name, &plmn_ident->network_short, SIZE_PLMN_NAME);
986
987 }
988 #endif
989 /*
990 * Store Roaming Indicator
991 */
992 data->roaming_indicator = plmn_ident->roaming_indicator;
993
994 network_stop_animation ();
995
996 /*
997 * Inform Idle screen
998 */
999 SEND_EVENT (idle_get_window(), NETWORK_FULL_SERVICE, 0, 0);
1000
1001 /*
1002 * If network list is available
1003 */
1004 if (data->network_list NEQ NULL)
1005 {
1006 switch (data->network_list_status)
1007 {
1008 case NETWORK_LIST_REGISTRATION:
1009 if(data->keep_plmn_list EQ FALSE)
1010 {
1011 TRACE_EVENT("NETWORK_LIST_REGISTRATION No 1");
1012
1013 #ifdef FF_2TO1_PS
1014 #ifndef NEPTUNE_BOARD
1015 FREE_MEMORY ((UBYTE *)data->network_list->List,
1016 MMREG_MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1017 #else
1018 /* Free the allocated memory for PLMN list window -
1019 OMAPS00061049 - 08-03-2006 */
1020 FREE_MEMORY ((UBYTE *)data->network_list->List,
1021 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1022 #endif
1023
1024 #else
1025
1026 #ifndef NEPTUNE_BOARD
1027 FREE_MEMORY ((UBYTE *)data->network_list->List,
1028 MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1029 #else
1030 /* Free the allocated memory for PLMN list window -
1031 OMAPS00061049 - 08-03-2006 */
1032 FREE_MEMORY ((UBYTE *)data->network_list->List,
1033 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1034 #endif
1035
1036 #endif
1037 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
1038 data->network_list = NULL;
1039 }
1040 data->keep_plmn_list = FALSE;
1041 break;
1042 case NETWORK_LIST_SELECTED:
1043 /*
1044 * After registration start, MFW returns the current status
1045 */
1046 TRACE_EVENT("NETWORK_LIST_SELECTED");
1047 data->network_list_status= NETWORK_LIST_REGISTRATION;
1048 /* Commented out and moved
1049 network_selected(); */
1050 break;
1051 }
1052 // API - Moved from previous position
1053 network_selected();
1054 }
1055
1056 // Apr 14, 2004 REF: CRR 12641 xpradipg
1057 if(Auto_Network_Select==true)
1058 {
1059 network_selected();
1060 Auto_Network_Select=false;
1061 }
1062
1063 break;
1064
1065 case NETWORK_NO_NETWORK:
1066 TRACE_EVENT ("NETWORK NO NETWORK");
1067 /*
1068 * No PLMN found after search for available PLMNs
1069 */
1070 network_stop_animation ();
1071 if (network_log_enabled ())
1072 {
1073 data->status = NETWORK_NO_SERVICE;
1074 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
1075 }
1076 else
1077 {
1078 /*
1079 * No Networks found.
1080 */
1081 data->status = NETWORK_NO_SERVICE;
1082 SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
1083 }
1084 #ifdef MMI_HOMEZONE_ENABLED
1085 /* sh - tell homezone there is no network */
1086 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1087 //Modified to incorporate the third argument.
1088 homezoneUpdate(0,0,0);
1089 #endif
1090 break;
1091 //sep 18 2006 OMPAS00090268 x0061088(Prachi)
1092 case NETWORK_FORBIDDEN_NETWORK:
1093 case NETWORK_PLMN_LIST:
1094 TRACE_EVENT ("NETWORK PLMN LIST");
1095 TRACE_EVENT (">>NETWORK PLMN LIST");
1096 /*
1097 * PLMN list found
1098 */
1099 if (network_data.aborted != TRUE)
1100 {
1101 if (network_log_enabled ())
1102 {
1103 data->status = NETWORK_NO_SERVICE;
1104 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
1105 }
1106 else
1107 {
1108 T_MFW_PLMN_LIST * plmn_list;
1109 /*
1110 * Networks founds.
1111 */
1112 data->status = NETWORK_NO_SERVICE;
1113 /*
1114 * If network list is available, destroy
1115 */
1116 if (data->network_list NEQ NULL)
1117 {
1118
1119 #ifdef FF_2TO1_PS
1120 #ifndef NEPTUNE_BOARD
1121 FREE_MEMORY ((UBYTE *)data->network_list->List,
1122 MMREG_MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1123 #else
1124 /* Free the allocated memory for PLMN list window -
1125 OMAPS00061049 - 08-03-2006 */
1126 FREE_MEMORY ((UBYTE *)data->network_list->List,
1127 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1128 #endif
1129
1130 #else
1131 #ifndef NEPTUNE_BOARD
1132 FREE_MEMORY ((UBYTE *)data->network_list->List,
1133 MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1134 #else
1135 /* Free the allocated memory for PLMN list window -
1136 OMAPS00061049 - 08-03-2006 */
1137 FREE_MEMORY ((UBYTE *)data->network_list->List,
1138 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1139 #endif
1140
1141 #endif
1142
1143 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
1144 data->network_list = NULL;
1145 }
1146
1147 /* Jan 10, 2007 REF: OMAPS00110741 x0039928(sumanth) */
1148 /* Soln : check if parameter passed is NULL */
1149 if(parameter != NULL)
1150 {
1151 /*
1152 * If list is empty, show info screen
1153 */
1154 plmn_list = (T_MFW_PLMN_LIST *)parameter;
1155
1156 #ifdef NEPTUNE_BOARD
1157 /* Count assigned to global static variable - OMAPS00061049 - 08-03-2006 */
1158 Plmn_list_count = plmn_list->count;
1159 #endif
1160 /* Dec 13, 2006 DRT: OMAPS00105640 x0039928(Sumanth)
1161 Fix: Condition added to check if sim is active */
1162 if(SIM_NOT_ACTIVE != sim_status_check())
1163 {
1164 if (plmn_list->count EQ 0)
1165 {
1166 network_stop_animation ();
1167 network_no_plmns ();
1168 }
1169 else
1170 {
1171 /*
1172 * Create and present list of available PLMNs
1173 *
1174 */
1175
1176 /* Pass the plmn_list which already hold the parameter data - OMAPS00061049 - 08-03-2006 */
1177 #ifndef NEPTUNE_BOARD
1178 data->network_list = network_create_list (data, parameter);
1179 #else
1180 data->network_list = network_create_list (data, plmn_list );
1181 #endif
1182 data->network_list_status = NETWORK_LIST_DISPLAY_FIRST;
1183 network_stop_animation ();
1184 listDisplayListMenu (win, data->network_list, (ListCbFunc)network_list_cb,0);
1185
1186 // change by Sasken ( Pradeep/Vadiraj) on Apr 07th 2004
1187 // Issue Number : SPR#12654 on 07/04/04 by Pradeep/Vadiraj
1188 // Bug : Pressing "search" button does not trigger anything
1189 // Solution: When the ME is already camped on to a network the NoNetwork event is not sent.
1190 // Commented the following line
1191 // SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
1192
1193
1194 }
1195 }
1196 }
1197 }
1198 //Mar 30,2007 DRT: OMAPS00120157 x00061088(Prachi)
1199 if(data->network_list_status == NETWORK_LIST_DISPLAY_FIRST)
1200 {
1201 // Feb 08,2007 DRT: OMAPS00115060 x00061088(Prachi)
1202 if (network_data.forbidden == TRUE)
1203 {
1204 network_forbidden_plmn();
1205 network_data.forbidden = FALSE;
1206 }
1207 }
1208
1209 }
1210 else
1211 {
1212 network_data.aborted = FALSE;
1213 }
1214 #ifdef MMI_HOMEZONE_ENABLED
1215 /* sh - tell homezone there is no network */
1216 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1217 //Modified to incorporate the third argument.
1218 homezoneUpdate(0,0,0);
1219 #endif
1220 break;
1221
1222 case NETWORK_LIST_SELECT_PLMN:
1223
1224 TRACE_EVENT ("NETWORK LIST_SELECT");
1225 TRACE_EVENT (">> NETWORK LIST_SELECT");
1226 /*
1227 * A network has been selected from the PLMN available list
1228 * Start manual registration and start Search animation.
1229 */
1230 network_start_animation_plmn_selection (value);
1231 data->network_list_status = NETWORK_LIST_SELECTED;
1232 nm_select_plmn ((U8 *)network_data.network_search_name[value]);
1233 //Sep 23, 2004 REF: CRR 24562 xvilliva
1234 //After retrieving the list we see if an error occured
1235 //and flash an alert to the user accordingly.
1236 if(g_ensErr == 1)
1237 {
1238 g_ensErr = 0;
1239 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1240 }
1241
1242 /* x0056422, OMAPS00148258 */
1243
1244 if (data->network_list NEQ NULL)
1245 {
1246 #ifdef FF_2TO1_PS
1247 #ifndef NEPTUNE_BOARD
1248 FREE_MEMORY ((UBYTE *)data->network_list->List,
1249 MMREG_MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1250 #else
1251 /* Free the allocated memory for PLMN list window -
1252 OMAPS00061049 - 08-03-2006 */
1253 FREE_MEMORY ((UBYTE *)data->network_list->List,
1254 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1255 #endif /* NEPTUNE_BOARD */
1256
1257 #else
1258 #ifndef NEPTUNE_BOARD
1259 FREE_MEMORY ((UBYTE *)data->network_list->List,
1260 MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
1261 #else
1262 /* Free the allocated memory for PLMN list window -
1263 OMAPS00061049 - 08-03-2006 */
1264 FREE_MEMORY ((UBYTE *)data->network_list->List,
1265 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1266 #endif /* NEPTUNE_BOARD */
1267
1268 #endif /* FF_2TO1_PS */
1269
1270 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
1271 data->network_list = NULL;
1272 }
1273 //Modify by hou peng 2007/09/19 end
1274
1275 /* x0056422 OMAPS00148258 */
1276
1277 break;
1278 case NETWORK_PPLMN_MEM_LIST:
1279 {
1280 T_MFW_PPLMN_MEM *pplmn_mem;
1281 UBYTE i;
1282
1283 TRACE_EVENT (">> NETWORK PPLMN MEM LIST");
1284 /* Save the number of PLMN records:
1285 * maxRcd = maximum preferred PLMN records on the SIM card
1286 * usedRcd = used preferred PLMN records on the SIM card
1287 */
1288 pplmn_mem = (T_MFW_PPLMN_MEM *)parameter;
1289
1290 network_data.pplmn_mem.maxRcd = pplmn_mem->maxRcd;
1291 network_data.pplmn_mem.usedRcd = pplmn_mem->usedRcd;
1292
1293 /*
1294 * Request preferred PLMN list from the SIM
1295 */
1296
1297
1298 network_data.pplmn = (T_MFW_NETWORK_STRUCT *)ALLOC_MEMORY ((pplmn_mem->maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
1299
1300 if (network_data.pplmn EQ 0)
1301 {
1302 return;
1303 }
1304
1305 if (pplmn_mem->usedRcd > 0)
1306 {
1307 // request MFW to fill up the pref. PLMN list
1308 nm_pref_plmn_list(network_data.pplmn, pplmn_mem->maxRcd, 1);
1309 }
1310 else
1311 {
1312 // doesnt make sense to request the MFW to fill up the list
1313 // when the "pplmn_mem->usedRcd" is 0
1314
1315 TRACE_EVENT(">> NETWORK PPLMN MEM LIST - ELSE Loop");
1316 for (i=0; i < (network_data.pplmn_mem.maxRcd); i++)
1317 {
1318 #ifdef NO_ASCIIZ
1319 network_data.pplmn[i].network_long.len = 0;
1320 network_data.pplmn[i].network_short.len = 0;
1321 #else
1322 memset(network_data.pplmn[i].network_long, '\0', LONG_NAME);
1323 memset(network_data.pplmn[i].network_short, '\0', SHORT_NAME);
1324 #endif
1325 memset(network_data.pplmn[i].network_numeric, '\0', NUMERIC_LENGTH);
1326 }
1327
1328 data->network_list = network_create_pref_list (data);
1329 listDisplayListMenu (win, data->network_list,(ListCbFunc)network_pref_list_cb,0);
1330 }
1331
1332 }
1333 break;
1334
1335 case NETWORK_PREFERRED_LIST:
1336 {
1337
1338 /* UBYTE i; */ /* Warning Correction */
1339
1340
1341 TRACE_EVENT (">>NETWORK PREFERRED LIST");
1342 /*
1343 * Create and present the preferred list of PLMNs
1344 *
1345 */
1346
1347 //nm network_stop_animation ();
1348
1349
1350 data->network_list = network_create_pref_list (data);
1351
1352 /* cq12719 Check if prefered list info resource has been created.16-03-04 MZ */
1353 if(data->network_list != NULL)
1354 listDisplayListMenu (win, data->network_list,(ListCbFunc)network_pref_list_cb,0);
1355 }
1356 break;
1357
1358 case NETWORK_CELL_SELECT:
1359 {
1360
1361 /* x0045876, 14-Aug-2006 (WR -"cell_data" was set but never used) */
1362 #ifdef MMI_HOMEZONE_ENABLED
1363 /* If Homezone is active, inform it of the new cell data */
1364 T_MFW_CELL_STRUCT *cell_data;
1365 #endif
1366
1367 TRACE_EVENT(">>NETWORK CELL SELECT");
1368
1369
1370 /* x0045876, 14-Aug-2006 (WR -"cell_data" was set but never used) */
1371 /* cell_data = (T_MFW_CELL_STRUCT *)parameter; */
1372
1373 #ifdef MMI_HOMEZONE_ENABLED
1374
1375 /* x0045876, 14-Aug-2006 (WR -"cell_data" was set but never used) */
1376 cell_data = (T_MFW_CELL_STRUCT *)parameter;
1377
1378 /* SPR759 - SH - send cell reselection info to homezone */
1379
1380 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1381 //Modified to incorporate the third argument.
1382 homezoneUpdate(cell_data->lid, cell_data->ci, 0);
1383 #endif
1384 break;
1385 #ifdef NEPTUNE_BOARD
1386 /* Destory the list when select softkey is pressed / back softkey is pressed */
1387 /* OMAPS00061049 - 08-03-2006 - BEGIN*/
1388 case NETWORK_LIST_DESTORY:
1389 TRACE_EVENT ("Inside NETWORK_LIST_DESTORY Event");
1390
1391 /* Destory the list window */
1392 listsDestroy(data->network_list->win);
1393
1394 TRACE_EVENT ("Destoryed list window successfully");
1395
1396 /*
1397 * If network list is available, destroy
1398 */
1399 if (data->network_list NEQ NULL)
1400 {
1401
1402 #ifdef FF_2TO1_PS
1403 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
1404 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1405 #else
1406 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
1407 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1408 #endif
1409
1410 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
1411 data->network_list = NULL;
1412 }
1413
1414 TRACE_EVENT ("List window memory freed");
1415 break;
1416 /* OMAPS00061049 - 08-03-2006 - END */
1417 #endif
1418
1419
1420 }
1421
1422 // June 02, 2006 DR: OMAPS00078005 x0021334
1423 // Descripton: Test for NITZ (Network Identity and Timezone) support - No New time was displayed
1424 // Solution: New Time/Date received from network is sent to MFW by lower layer by invoking 'rAT_PercentCTZV'
1425 // function. The same is received and handled in case NETWORK_TIME_UPDATE in MMI for user
1426 // confirmation and RTC updation.
1427
1428 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Begin
1429 #ifdef FF_TIMEZONE
1430 case NETWORK_TIME_UPDATE:
1431 {
1432 BOOL modify_date_negative = FALSE;
1433 BOOL modify_date_positive = FALSE;
1434 int actual_TD = 0;
1435 int absolute_value;
1436
1437 TRACE_EVENT ("Inside NETWORK_TIME_UPDATE Event");
1438
1439 if(FFS_flashData.nitz_option!=NitzOff)
1440 {
1441
1442 TRACE_FUNCTION("NITZ- not OFF");
1443
1444 // Copy time and date info received from network into 'time'
1445 network_time = (T_MFW_TIME_IND *)parameter;
1446 actual_TD = network_time->timezone;
1447 absolute_value = (10*(actual_TD & 0x7))+((actual_TD >> 4) & 0xf);
1448
1449 TRACE_EVENT_P1("actual_TD: %d", actual_TD);
1450 TRACE_EVENT_P1("Absolute value: %d", absolute_value);
1451 TRACE_FUNCTION("IN HEX");
1452 TRACE_EVENT_P1("actual_TD: %x", actual_TD);
1453 TRACE_EVENT_P1("Absolute value: %x", absolute_value);
1454 if((actual_TD & 0x08))
1455 {
1456 absolute_value = ~absolute_value+1;
1457 }
1458
1459 actual_TD = absolute_value;
1460
1461 if(actual_TD >0)
1462 {
1463
1464 network_time->hour = network_time->hour + actual_TD/4 ;
1465
1466 network_time->minute = network_time->minute + (actual_TD%4)*15;
1467 if(network_time->minute > 60)
1468 {
1469 network_time->minute = network_time->minute - 60 ;
1470 network_time->hour = network_time->hour +1;
1471 }
1472 if(network_time->minute == 60)
1473 {
1474 network_time->minute = 0;
1475 network_time->hour = network_time->hour +1;
1476 }
1477 if(network_time->hour >= 24)
1478 modify_date_positive = TRUE;
1479
1480
1481 }
1482 else if(actual_TD<0)
1483 {
1484
1485 if((network_time->minute - abs((actual_TD%4)*15)) < 0)
1486 {
1487 network_time->minute = 60 - (abs((actual_TD%4)*15) - network_time->minute );
1488
1489 network_time->hour = network_time->hour - 1;
1490 }
1491 else if((network_time->minute - abs((actual_TD%4)*15)) == 0)
1492 {
1493 network_time->minute = 0;
1494 network_time->hour = network_time->hour - 1;
1495
1496 }
1497 else
1498 network_time->minute = network_time->minute - abs((actual_TD%4)*15);
1499
1500 if((network_time->hour - abs(actual_TD/4 )) < 0)
1501 modify_date_negative = TRUE;
1502 else
1503 network_time->hour = network_time->hour - abs(actual_TD/4 );
1504
1505 }
1506
1507 //Assume the date is 1/07/2005 5 Am in the morning
1508 //After time zone calculation it needs to become 30/06/2005 and not 31 st June 2005 since there are only 30 days
1509 //in all the odd months before July and in all the even months after july(7th Month)
1510 //Similarly a problem arises if the year too needs to be adjusted after the timezone calculations.
1511
1512
1513 if(modify_date_negative)
1514 {
1515
1516 TRACE_EVENT("modify date negative");
1517 network_time->hour = 24 - abs(network_time->hour - abs(actual_TD/4 ));
1518
1519 network_time->day = network_time->day -1;
1520
1521 if(network_time->day == 0)
1522 {
1523 if(((network_time->month)%2 != 0) && network_time->month <= 7)
1524 {
1525 if( network_time->month == 1)
1526 {
1527 network_time->month = network_time->month -1;
1528 network_time->day = 31;
1529 }
1530 else{
1531 network_time->month = network_time->month -1;
1532 network_time->day = 30;
1533 }
1534 }
1535 else if(((network_time->month)%2 == 0) && network_time->month < 7)
1536 {
1537 network_time->month = network_time->month -1;
1538 network_time->day = 31;
1539 }
1540 if(((network_time->month)%2 == 0) && network_time->month > 7)
1541 {
1542 if( network_time->month == 8)
1543 {
1544 network_time->month = network_time->month -1;
1545 network_time->day = 31;
1546 }
1547 else
1548 {
1549 network_time->month = network_time->month -1;
1550 network_time->day = 30;
1551 }
1552
1553 }
1554 if(network_time->month == 2)
1555 {
1556 if(((network_time->year+2000)%4 == 0) && ((network_time->year+2000)%100 != 0))
1557 network_time->day = 29;
1558 else
1559 network_time->day = 28;
1560 }
1561 if(network_time->month <= 0)
1562 {
1563 network_time->year = network_time->year -1;
1564 network_time->month = 12;
1565 }
1566 }
1567 }
1568
1569 else if(modify_date_positive)
1570 {
1571 TRACE_EVENT("modify date positive");
1572 network_time->hour = network_time->hour -24;
1573
1574 network_time->day = network_time->day + 1;
1575
1576 if(network_time->month == 2)
1577 {
1578 if(network_time->day == 30)
1579 {
1580 network_time->day = 1;
1581 network_time->month = 3;
1582 }
1583 if(network_time ->day == 29)
1584 {
1585 if(((network_time->year+2000)%4 == 0) && ((network_time->year+2000)%100 != 0))
1586 {
1587 network_time->day = 29;
1588 }
1589 else
1590 {
1591 network_time->day = 1;
1592 network_time->month = 3;
1593 }
1594 }
1595 }
1596 else
1597 {
1598 if(network_time->day>=31)
1599 {
1600 if(network_time->day == 31)
1601 {
1602 if(((network_time->month)%2 != 0) && network_time->month <= 7)
1603 {
1604 network_time->day = 31;
1605 }
1606 else if(((network_time->month)%2 == 0) && network_time->month > 7)
1607 {
1608 network_time->day = 31;
1609 }
1610
1611 else
1612 {
1613 network_time->day = 1;
1614 network_time->month = network_time->month +1;
1615 }
1616 }
1617 else
1618 {
1619 network_time->day = 1;
1620 network_time->month = network_time->month +1;
1621 }
1622 }
1623 }
1624 if(network_time->month > 12)
1625 {
1626 network_time->year = network_time->year + 1;
1627 network_time->month = 1;
1628 }
1629 }
1630
1631 // Get the current time and format info set in the MS
1632 time_format = mfw_td_get_time();
1633
1634 // Copy this info in the structure that will be used to do RTC upation.
1635 // This ensures that the format set remains the same even after RTC updation.
1636 newTime = *time_format;
1637
1638 TRACE_EVENT("------------------------------------");
1639 TRACE_EVENT_P1("Current format set in MS : %d", time_format->format);
1640
1641 // The time info received from network is in 24Hrs format. Depeneding on the format
1642 // curently set in the MS, we need to do conversion and then update the RTC.
1643 if (time_format->format == RTC_TIME_FORMAT_12HOUR)
1644 {
1645 TRACE_EVENT("12 Hrs format");
1646
1647 if (network_time->hour == 0) // If hour info from network is 0, set hour as 12
1648 { // and the AM/PM flag off to indicate AM.
1649 newTime.PM_flag = 0;
1650 newTime.hour = 12;
1651 }
1652 else if (network_time->hour < 12) // If hour info from network is less than 12,
1653 { // set the hour info as it is and AM flag to off.
1654 newTime.PM_flag = 0;
1655 newTime.hour = network_time->hour;
1656 }
1657 else
1658 {
1659 newTime.PM_flag = 1; // If hour info from network is greater than 12,
1660 newTime.hour = network_time->hour - 12; // set hour = received hour - 12 and AM/PM
1661 } // flag to ON indicate PM.
1662
1663 newTime.minute = network_time->minute; // Set minute info
1664 newTime.second = network_time->second; // Set second info
1665
1666 // Set the date related info. Year information is decoded in the following way:
1667 // 0 - 2000 - default
1668 // 1 - 2001
1669 // 2 - 2002 etc.
1670 // Hence we need to add 2000 to the year value received from network to
1671 // display the actual year.
1672
1673 newDate.day = network_time->day; // Day of the month
1674 newDate.month = network_time->month; // Month
1675 newDate.year = network_time->year + 2000; // year
1676 }
1677 else
1678 {
1679 TRACE_EVENT("24 Hrs format");
1680 newTime.hour = network_time->hour; // In 24 Hrs format, set the received hour info as it is.
1681
1682 newTime.minute = network_time->minute; // Set minute info
1683 newTime.second = network_time->second; // Set second info
1684
1685 // Set the date related info. Year information is decoded in the following way:
1686 // 0 - 2000 - default
1687 // 1 - 2001
1688 // 2 - 2002 etc.
1689 // Hence we need to add 2000 to the year value received from network to
1690 // display the actual year.
1691
1692 newDate.day = network_time->day; // Day of the month
1693 newDate.month = network_time->month; // Month
1694 newDate.year = network_time->year + 2000; // year
1695 }
1696
1697 if(FFS_flashData.nitz_option==NitzAutomatic)
1698 {
1699 // Update RTC with new time info
1700 mfw_td_set_time(&newTime);
1701
1702 // Update RTC with new date info
1703 mfw_td_set_date(&newDate);
1704
1705 // Send IDLE_UPDATE event to force idle screen refresh
1706 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, 0);
1707
1708
1709 }
1710 else //if(FFS_flashData.nitz_option==NITZOn)
1711 {
1712 // Show a dialog to the user to get confirmation for Time/Date updation.
1713 dlg_initDisplayData_TextId( &display_info, TxtYes, TxtNo, TxtTimeUpdate, TxtTimeUpdateConfirm, COLOUR_STATUS);
1714 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)nw_time_update_callback, FOREVER, KEY_HUP | KEY_LEFT | KEY_RIGHT);
1715 info_dialog (NULL, &display_info);
1716 }
1717 }
1718 }
1719 break;
1720 #endif
1721
1722 }
1723 }
1724 //Dec 13,2006 DR:OMAPS00098351 x0066814 - End
1725 /*******************************************************************************
1726
1727 $Function: network_win_cb
1728
1729 $Description: network top window
1730
1731 $Returns:
1732
1733 $Arguments:
1734
1735 *******************************************************************************/
1736 static int network_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
1737 {
1738 /*
1739 * Top Window has no output
1740 */
1741 return 1;
1742 }
1743
1744
1745 /*******************************************************************************
1746
1747 $Function: network_nm_cb
1748
1749 $Description: network handler (mfw callback handler)
1750
1751 $Returns:
1752
1753 $Arguments:
1754
1755 *******************************************************************************/
1756 static int network_nm_cb (T_MFW_EVENT event, T_MFW_HND para)
1757 {
1758 TRACE_FUNCTION("network_nm_cb");
1759
1760 switch(event)
1761 {
1762 case E_NM_FULL_SERVICE:
1763 //x0pleela 9 Feb, 2006 ER:OMAPS00065203
1764 //Handling E_NM_OPN for operator name display
1765 case E_NM_OPN:
1766
1767 SEND_EVENT (network_data.network_win, NETWORK_FULL_SERVICE, 0, para);
1768 break;
1769 //Sep 18,2006 DRT: OMAPS00090268 x0061088(Prachi)
1770 //Description : To check for Forbidden network (for denied services),it takes long time.
1771 //Solution : Function network_nm_cb() has now be implemented to handle E_NM_FORBIDDEN_NETWORK,which sends event
1772 //NETWORK_FORBIDDEN_NETWORK to network(),by setting flags network_data.aborted =False
1773 //and network_data.forbidden = Ture
1774 case E_NM_FORBIDDEN_NETWORK:
1775 network_data.forbidden = TRUE;
1776 network_data.aborted = FALSE;
1777 /* Jan 10, 2007 REF: OMAPS00110741 x0039928(sumanth) */
1778 /* Fix : Pass NULL as parameter */
1779 SEND_EVENT (network_data.network_win, NETWORK_FORBIDDEN_NETWORK, 0, 0);
1780 break;
1781
1782 case E_NM_LIMITED_SERVICE:
1783 SEND_EVENT (network_data.network_win, NETWORK_LIMITED_SERVICE, 0, para);
1784 break;
1785
1786 case E_NM_NO_SERVICE:
1787 SEND_EVENT (network_data.network_win, NETWORK_NO_SERVICE, 0, para);
1788 break;
1789
1790 case E_NM_SEARCH_NETWORK:
1791 SEND_EVENT (network_data.network_win, NETWORK_SEARCH_NETWORK, 0, para);
1792 break;
1793
1794 case E_NM_NO_NETWORK:
1795 SEND_EVENT (network_data.network_win, NETWORK_NO_NETWORK, 0, para);
1796 break;
1797
1798 case E_NM_PLMN_LIST:
1799 SEND_EVENT (network_data.network_win, NETWORK_PLMN_LIST, 0, para);
1800 break;
1801
1802 case E_NM_DEREGISTRATION:
1803 TRACE_EVENT("MmiNetwork:E_NM_DEREGISTRATION");
1804 mainShutdown();
1805 break;
1806 case E_NM_PREF_PLMN_LIST:
1807 TRACE_EVENT("MmiNetwork:E_NM_PREF_PLMN_LIST");
1808 SEND_EVENT (network_data.network_win, NETWORK_PREFERRED_LIST, 0, para);
1809 break;
1810 case E_NM_PPLMN_MEM:
1811 TRACE_EVENT("MmiNetwork:E_NM_PPLMN_MEM");
1812 SEND_EVENT (network_data.network_win, NETWORK_PPLMN_MEM_LIST, 0, para);
1813 break;
1814 /* SH 29-04-02 - Cell reselection */
1815 case E_NM_CELL_SELECT:
1816 TRACE_EVENT("MmiNetwork:E_NM_CELL_SELECT");
1817 SEND_EVENT (network_data.network_win, NETWORK_CELL_SELECT, 0, para);
1818 break;
1819 /* SPR919 - SH - Band selection */
1820 case E_NM_BAND:
1821 TRACE_EVENT("MmiNetwork:E_NM_BAND");
1822 nm_registration (nm_get_mode (),0, 0);
1823 //Sep 23, 2004 REF: CRR 24562 xvilliva
1824 //After retrieving the list we see if an error occured
1825 //and flash an alert to the user accordingly.
1826 if(g_ensErr == 1)
1827 {
1828 g_ensErr = 0;
1829 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1830 }
1831 break;
1832
1833 //x0pleela 30 May, 2007 DR: OMAPS00133201
1834 case E_NM_ABORT_NETWORK:
1835 TRACE_EVENT("MmiNetwork:E_NM_ABORT_NETWORK");
1836 nm_abort_network();
1837 break;
1838 /*Aug 07, 2007 DR:OMAPS00137726 x0066814(Geetha)*/
1839 case E_NM_PLMN_LIST_BOOTUP:
1840 TRACE_EVENT("MmiNetwork:E_NM_PLMN_LIST_BOOTUP");
1841 /*Start the available plmn search*/
1842 nm_avail_plmn_list();
1843 /*After retrieving the list we see if an error occured
1844 and flash an alert to the user accordingly.*/
1845 if(g_ensErr == 1)
1846 {
1847 g_ensErr = 0;
1848 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1849 }
1850 /* remove network log if needed */
1851 network_remove_network_log ();
1852 network_start_animation ();
1853 network_data.aborted = FALSE;
1854
1855 break;
1856
1857 // June 02, 2006 DR: OMAPS00078005 x0021334
1858 // Send NETWORK_TIME_UPDATE event to update the new network time/date
1859 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
1860 #ifdef FF_TIMEZONE
1861 case E_MFW_TIME_IND:
1862 TRACE_EVENT("E_MFW_TIME_IND");
1863 SEND_EVENT (network_data.network_win, NETWORK_TIME_UPDATE, 0, para);
1864 break;
1865 #endif
1866 default:
1867 return 0;
1868 }
1869 return 1;
1870 }
1871
1872 /*******************************************************************************
1873
1874 $Function: nm_flag_log_off
1875
1876 $Description: Attribut function for menu entries.
1877 It defines whether the network log off function shall
1878 be displayed or not.
1879
1880 $Returns:
1881
1882 $Arguments:
1883
1884 *******************************************************************************/
1885 USHORT nm_flag_log_off (T_MFW_MNU * m, T_MFW_MNU_ATTR * ma, T_MFW_MNU_ITEM * mi)
1886 {
1887 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
1888 return 0;
1889
1890 return MNU_ITEM_HIDE;
1891 }
1892 /*******************************************************************************
1893
1894 $Function: nm_flag_log_off
1895
1896 $Description: Attribut function for menu entries.
1897 It defines whether the network log off function shall
1898 be displayed or not.
1899
1900 $Returns:
1901
1902 $Arguments:
1903
1904 *******************************************************************************/
1905 USHORT nm_flag_log_on (T_MFW_MNU * m, T_MFW_MNU_ATTR * ma, T_MFW_MNU_ITEM * mi)
1906 {
1907 if (FFS_flashData.network_name == NULL)
1908 {
1909 return MNU_ITEM_HIDE;
1910 }
1911 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_NOT_USED)
1912 return 0;
1913
1914 return MNU_ITEM_HIDE;
1915 }
1916
1917 /*******************************************************************************
1918
1919 $Function: network_set_mode_auto
1920
1921 $Description: Start a automatic registration
1922
1923 $Returns:
1924
1925 $Arguments:
1926
1927 *******************************************************************************/
1928 int network_set_mode_auto(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1929 {
1930 TRACE_FUNCTION ("network_set_mode_auto()");
1931
1932 /*
1933 * Save the automatic mode in PCM for next power on
1934 */
1935 nm_set_mode(NM_AUTOMATIC);
1936
1937 /*
1938 * Start the registration of full service
1939 */
1940 nm_registration (NM_AUTOMATIC,0, FALSE);
1941
1942 /*
1943 * remove network log if needed
1944 */
1945 network_remove_network_log ();
1946
1947 /*
1948 * Remove Main Menu
1949 */
1950 //JVJEmenuExit();
1951
1952 network_start_animation ();
1953 // Apr 14, 2004 REF: CRR 12641 xpradipg
1954 Auto_Network_Select=true;
1955 return 1;
1956 }
1957 /*******************************************************************************
1958
1959 $Function: network_set_mode_man
1960
1961 $Description: Start a manual registration
1962
1963 $Returns:
1964
1965 $Arguments:
1966
1967 *******************************************************************************/
1968 int network_set_mode_man(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1969 {
1970 TRACE_FUNCTION ("network_set_mode_man()");
1971
1972 /*
1973 * Save the automatic mode in PCM for next power on
1974 */
1975 nm_set_mode(NM_MANUAL);
1976
1977 /*
1978 * Start the available plmn search
1979 */
1980 nm_avail_plmn_list();
1981 //Sep 23, 2004 REF: CRR 24562 xvilliva
1982 //After retrieving the list we see if an error occured
1983 //and flash an alert to the user accordingly.
1984 if(g_ensErr == 1)
1985 {
1986 g_ensErr = 0;
1987 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1988 return 1;
1989 }
1990
1991 /*
1992 * remove network log if needed
1993 */
1994 network_remove_network_log ();
1995
1996 /*
1997 * Remove Main Menu
1998 */
1999 //nm menuExit();
2000
2001 network_start_animation ();
2002
2003 network_data.aborted = FALSE;
2004 return 1;
2005 }
2006
2007 /*
2008 +--------------------------------------------------------------------+
2009 | PROJECT : MMI (6366) MODULE : MmiNetwork |
2010 | STATE : code ROUTINE : network_pref_list |
2011 +--------------------------------------------------------------------+
2012
2013 PURPOSE : Show the preferred list
2014
2015 */
2016 int network_pref_list(T_MFW_MNU *m, T_MFW_MNU_ITEM *mi)
2017 {
2018 //TRACE_FUNCTION ("network_pref_list()");
2019
2020 /*
2021 * Request the maximum number of preferred PLMN records
2022 * on the SIM card
2023 */
2024 nm_pplmn_mem_req();
2025
2026
2027
2028 return 1;
2029 }
2030
2031
2032 /*******************************************************************************
2033
2034 $Function: network_remove_network_log
2035
2036 $Description: Reset network log if set.
2037
2038 $Returns:
2039
2040 $Arguments:
2041
2042 *******************************************************************************/
2043 static void network_remove_network_log (void)
2044 {
2045
2046 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
2047 {
2048 /*
2049 * Until now the network log has been used.
2050 * Now write to FFS
2051 */
2052 FFS_flashData.net_log_status = NM_LOG_AVAIL_NOT_USED;
2053 flash_write();
2054
2055 }
2056 }
2057
2058 /*******************************************************************************
2059
2060 $Function: network_log_off
2061
2062 $Description: Removes a network log and returns to automatic registration.
2063
2064 $Returns:
2065
2066 $Arguments:
2067
2068 *******************************************************************************/
2069 int network_log_off(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
2070 {
2071 TRACE_FUNCTION ("network_log_off()");
2072
2073 /*
2074 * Same behaviour as automatic registration
2075 */
2076 network_set_mode_auto (m,i);
2077
2078
2079 network_start_animation ();
2080
2081 return 1;
2082 }
2083
2084 /*******************************************************************************
2085
2086 $Function: network_log_on
2087
2088 $Description: Sets a network log.
2089
2090 $Returns:
2091
2092 $Arguments:
2093
2094 *******************************************************************************/
2095 int network_log_on(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
2096 {
2097
2098
2099 TRACE_FUNCTION ("network_log_on()");
2100
2101
2102 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_NOT_USED OR
2103 FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
2104 {
2105 /*
2106 * Until now the network log has been not used.
2107 * Now set the PCM.
2108 */
2109 FFS_flashData.net_log_status = NM_LOG_AVAIL_USED;
2110 memcpy (FFS_flashData.plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
2111 memcpy (FFS_flashData.network_name, network_data.network_name, SIZE_NETWORK_NAME);
2112
2113
2114 flash_write();
2115 /*
2116 * Save the manual mode in PCM for next power on
2117 */
2118 nm_set_mode(NM_MANUAL);
2119
2120 /*
2121 * Start the registration of the logged network
2122 */
2123 nm_select_plmn (network_data.network_name);
2124 //Sep 23, 2004 REF: CRR 24562 xvilliva
2125 //After retrieving the list we see if an error occured
2126 //and flash an alert to the user accordingly.
2127 if(g_ensErr == 1)
2128 {
2129 g_ensErr = 0;
2130 info_screen(0, TxtNotAllowed, TxtNull, NULL);
2131 }
2132 }
2133
2134
2135 network_start_animation ();
2136
2137 return 1;
2138 }
2139
2140 /*******************************************************************************
2141
2142 $Function: network_start_full_service
2143
2144 $Description: Starts a full service registration.
2145 a) manual selection
2146 b) automatic selection
2147 c) network log selection
2148
2149 $Returns:
2150
2151 $Arguments:
2152
2153 *******************************************************************************/
2154 void network_start_full_service(void)
2155 {
2156
2157 TRACE_FUNCTION ("network_start_full_service()");
2158
2159 network_data.status = NETWORK_SEARCH_NETWORK;
2160
2161 if(FFS_flashData.plmn_name == NULL) //if no network data
2162 { /*
2163 * Start normal Registration
2164 */
2165 //TISH modified for MSIM
2166 #if defined (_WIN32_)
2167 EXTERN UBYTE mmi_reg_mode;
2168
2169 if (mmi_reg_mode EQ 0)
2170 nm_registration (NM_AUTOMATIC,0, 0);
2171 else
2172 nm_registration (NM_MANUAL,0, 0);
2173 #else
2174 if (nm_get_mode() == NM_MANUAL)
2175 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
2176 nm_registration (nm_get_mode (),0, 0);
2177 #endif
2178 }
2179 else
2180 {
2181 switch (FFS_flashData.net_log_status)
2182 {
2183 case NM_LOG_AVAIL_USED:
2184 memcpy (network_data.plmn_name, FFS_flashData.plmn_name, SIZE_PLMN_NAME);
2185 memcpy (network_data.network_name, FFS_flashData.network_name, SIZE_NETWORK_NAME);
2186 nm_select_plmn (network_data.network_name);
2187 break;
2188 default:
2189 if (nm_get_mode() == NM_MANUAL)
2190 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
2191 nm_registration (nm_get_mode (),0, 0);
2192 break;
2193 }
2194 }
2195 //Sep 23, 2004 REF: CRR 24562 xvilliva
2196 //After retrieving the list we see if an error occured
2197 //and flash an alert to the user accordingly.
2198 if(g_ensErr == 1)
2199 {
2200 g_ensErr = 0;
2201 info_screen(0, TxtNotAllowed, TxtNull, NULL);
2202 }
2203 }
2204
2205 /*******************************************************************************
2206
2207 $Function: network_get_name
2208
2209 $Description: Returns the textual and numeric representation of the
2210 network name.
2211
2212 $Returns:
2213
2214 $Arguments:
2215
2216 *******************************************************************************/
2217 void network_get_name(T_CURRENT_NETWORK * nm)
2218 {
2219 #ifdef NO_ASCIIZ
2220 T_MFW_SP_NAME service_provider_name;
2221 #else
2222 U8 service_provider_name[LONG_NAME];
2223 #endif
2224 TRACE_FUNCTION ("network_get_name()");
2225
2226 //x0pleela 15 Feb, 2006 ER: OMAPS00065203
2227 //Included flag NEPTUNE_BOARD to retain old code for operator get name and
2228 //added new code for this ER also
2229
2230 #ifndef NEPTUNE_BOARD
2231
2232 //x0pleela 09 Feb, 2006 ER: OMAPS00065203
2233 //Removed the code as prioritized operator name is already updated to network_data
2234 // and CPHS check is not required
2235
2236 //x0pleela 09 Feb, 2006 ER: OMAPS00065203
2237 //Updating prioritized operator name
2238 memset( nm->plmn_name, 0, SIZE_PLMN_NAME );
2239 memset( nm->network_name, 0, SIZE_NETWORK_NAME );
2240 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
2241 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
2242
2243 memset( nm->service_provider_name, 0, SP_NAME );
2244 #else
2245 if (CphsPresent() )//if CPHS supported
2246 {
2247 T_MFW_CPHS_OP_NAME* operator_name;
2248 operator_name = CphsRequestOperatorName(); //get operator name
2249
2250 if (operator_name->longName.data[0] != NULL)//if name not blank
2251 {
2252 memcpy(nm->plmn_name, operator_name->longName.data, SIZE_PLMN_NAME);
2253 TRACE_EVENT("Reading PLMN from SIM");
2254 }
2255 else
2256 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
2257
2258 if (operator_name->shortName.data[0] != NULL)//if name not blank
2259 {
2260 memcpy(nm->network_name, operator_name->shortName.data, SIZE_NETWORK_NAME);
2261 }
2262 else
2263 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
2264 }
2265 else
2266 {
2267
2268 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
2269 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
2270
2271 }
2272 /* Marcus: Issue 1618: 24/01/2003: Start */
2273 /* Obtain the service provider name (from the SIM EF-SPN file) if any */
2274 nm->service_provider_name[0] = '\0';
2275 #endif
2276 #ifdef NO_ASCIIZ
2277 nm_get_spn(&service_provider_name);
2278 if ((service_provider_name.len != 0) &&
2279 (service_provider_name.data[0] != '\0'))
2280 {
2281 if (service_provider_name.len > sizeof(nm->service_provider_name)-1)
2282 service_provider_name.len = sizeof(nm->service_provider_name)-1;
2283
2284 memcpy(nm->service_provider_name,
2285 service_provider_name.data,
2286 service_provider_name.len);
2287
2288 nm->service_provider_name[service_provider_name.len] = '\0';
2289 }
2290 #else
2291 nm_get_spn(service_provider_name);
2292 if (strlen(service_provider_name))
2293 {
2294 strncpy(nm->service_provider_name,
2295 service_provider_name,
2296 sizeof(nm->service_provider_name)-1);
2297
2298 nm->service_provider_name[sizeof(nm->service_provider_name)-1] = '\0';
2299 }
2300 #endif
2301 /* Marcus: Issue 1618: 24/01/2003: End */
2302 nm->roaming_indicator = network_data.roaming_indicator;
2303 }
2304
2305 /*******************************************************************************
2306
2307 $Function: network_log_enabled
2308
2309 $Description: Checks whether a network log is active or not.
2310
2311 $Returns:
2312
2313 $Arguments:
2314
2315 *******************************************************************************/
2316 static UBYTE network_log_enabled (void)
2317 {
2318
2319 TRACE_FUNCTION ("network_log_enabled()");
2320
2321 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
2322 return TRUE;
2323
2324 return FALSE;
2325 }
2326
2327 /*******************************************************************************
2328
2329 $Function: ListMenuData
2330
2331 $Description: Creates a list of available PLMNs for selection.
2332
2333 $Returns:
2334
2335 $Arguments:
2336
2337 *******************************************************************************/
2338 static ListMenuData * network_create_list (T_network * data, T_MFW_PLMN_LIST * plmn_list)
2339 {
2340 UBYTE i;
2341
2342 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
2343
2344 if (list_menu_data EQ 0)
2345 return NULL;
2346
2347 /* Allocated memory only for availble number of plmn list count */
2348 /* OMAPS00061049 - 08-03-2006 */
2349 #ifndef NEPTUNE_BOARD
2350 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (MAX_PLMN * sizeof (T_MFW_MNU_ITEM));
2351 #else
2352 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (plmn_list->count * sizeof (T_MFW_MNU_ITEM));
2353 #endif
2354
2355 if (list_menu_data->List EQ 0)
2356 return NULL;
2357
2358 /*
2359 * Fill Menu List
2360 */
2361 #ifdef FF_2TO1_PS
2362 for (i=0;i<MMREG_MAX_PLMN_ID;i++)
2363 #else
2364 for (i=0;i<MAX_PLMN_ID;i++)
2365 #endif
2366 {
2367 #ifndef NEPTUNE_BOARD
2368 /* Taken this statement inside the condition */
2369 /* OMAPS00061049 - 08-03-2006 */
2370 mnuInitDataItem(&list_menu_data->List[i]);
2371 #endif
2372
2373 if (i < plmn_list->count)
2374 {
2375 #ifdef NEPTUNE_BOARD
2376 mnuInitDataItem(&list_menu_data->List[i]);
2377 #endif
2378
2379 /*
2380 * set network name
2381 */
2382 #ifdef NO_ASCIIZ
2383 if (plmn_list->plmn[i].network_long.len NEQ 0)
2384 {
2385 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_long.data;
2386 }
2387 #else
2388 if (strlen((char *)plmn_list->plmn[i].network_long) NEQ 0)
2389 {
2390 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_long;
2391 }
2392 #endif
2393 else
2394 {
2395 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_numeric;
2396 }
2397
2398 /*
2399 * Store numeric network name in any case
2400 */
2401 strncpy ((char *)data->network_search_name[i], (char *)plmn_list->plmn[i].network_numeric, 6);
2402
2403
2404 /*
2405 * NOTE : add forbidden indicator
2406 */
2407 list_menu_data->List[i].flagFunc = item_flag_none;
2408 }
2409 else
2410 {
2411 }
2412 }
2413
2414 /*
2415 * Fill common parameter for list handling
2416 */
2417
2418 list_menu_data->ListLength = plmn_list->count;
2419 list_menu_data->ListPosition = 1;
2420 list_menu_data->CursorPosition = 1;
2421 list_menu_data->SnapshotSize = plmn_list->count;
2422 list_menu_data->Font = 0;
2423 list_menu_data->LeftSoftKey = TxtSoftSelect;
2424 list_menu_data->RightSoftKey = TxtSoftBack;
2425 // Sep 8, 2004 REF: CRR 16062 xvilliva
2426 //Though all the key events are monitered, the listsKeyEvent()
2427 //responds to a few keys which includes KCD_MNUSELECT.
2428 list_menu_data->KeyEvents = KEY_ALL;
2429 list_menu_data->Reason = 0;
2430 list_menu_data->Strings = TRUE;
2431 list_menu_data->Attr = &network_menuAttrib;
2432 list_menu_data->autoDestroy = TRUE;
2433 list_menu_data->listCol = COLOUR_LIST_XX;
2434
2435
2436 return list_menu_data;
2437 }
2438
2439 /*******************************************************************************
2440
2441 $Function: network_create_pref_list
2442
2443 $Description: Creates a list of preferred PLMNs for selection.
2444
2445 $Returns:
2446
2447 $Arguments:
2448
2449 *******************************************************************************/
2450 static ListMenuData * network_create_pref_list (T_network * data)
2451 {
2452 UBYTE i;
2453
2454 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
2455
2456 if (list_menu_data EQ 0)
2457 {
2458 return NULL;
2459 }
2460
2461 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY ((data->pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
2462
2463 if (list_menu_data->List EQ 0)
2464 {
2465
2466 /* cq12719 If second memory alloc fails Free the memory allocated for list menu data. 16-03-04 MZ */
2467 if(NULL != list_menu_data)
2468 FREE_MEMORY ((void *)list_menu_data, sizeof (ListMenuData));
2469
2470 return NULL;
2471 }
2472
2473 TRACE_EVENT ("network_create_pref_list ()");
2474
2475
2476
2477 /*
2478 * Fill Menu List
2479 */
2480 for (i=0; i < (network_data.pplmn_mem.maxRcd); i++)
2481 {
2482 mnuInitDataItem(&list_menu_data->List[i]);
2483
2484 /*
2485 * set network name
2486 */
2487
2488 #ifdef NO_ASCIIZ
2489 if (network_data.pplmn[i].network_long.len NEQ 0 )
2490 {
2491 list_menu_data->List[i].str = (char *)network_data.pplmn[i].network_long.data;
2492 }
2493 #else
2494 if (strlen((char *)network_data.pplmn[i].network_long) NEQ 0 )
2495 {
2496 list_menu_data->List[i].str = (char *)network_data.pplmn[i].network_long;
2497 }
2498 #endif
2499 else
2500 {
2501 list_menu_data->List[i].str = GET_TEXT(TxtEmpty);
2502 TRACE_EVENT ("network_long == 0");
2503 }
2504
2505 list_menu_data->List[i].flagFunc = item_flag_none;
2506
2507 }
2508 /*
2509 * Fill common parameter for list handling
2510 */
2511
2512
2513 list_menu_data->ListLength = network_data.pplmn_mem.maxRcd;
2514 list_menu_data->ListPosition = 1;
2515 list_menu_data->CursorPosition = 1;
2516 list_menu_data->SnapshotSize = network_data.pplmn_mem.maxRcd;
2517 list_menu_data->Font = 0;
2518 list_menu_data->LeftSoftKey = TxtSoftOptions; /* SPR#2354 - SH - Change 'Select' to 'Options' */
2519 list_menu_data->RightSoftKey = TxtSoftBack;
2520 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
2521 list_menu_data->Reason = 0;
2522 list_menu_data->Strings = TRUE;
2523 list_menu_data->Attr = &network_menuAttrib;
2524 list_menu_data->autoDestroy = TRUE;
2525 list_menu_data->listCol = COLOUR_LIST_XX;
2526
2527 return list_menu_data;
2528 }
2529
2530 /*******************************************************************************
2531
2532 $Function: network_create_mobile_list
2533
2534 $Description:
2535
2536 $Returns:
2537
2538 $Arguments:
2539
2540 *******************************************************************************/
2541 static ListMenuData * network_create_mobile_list (T_network_OPT * data)
2542 {
2543 UBYTE i;
2544
2545 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof(ListMenuData));
2546
2547 if (list_menu_data EQ 0)
2548 {
2549 TRACE_EVENT ("failed to create the list");
2550 return NULL;
2551 }
2552
2553 mfwCheckMemoryLeft();
2554
2555 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (MAX_SHOW_OF_PLMN * sizeof (T_MFW_MNU_ITEM));
2556
2557 mfwCheckMemoryLeft();
2558
2559 if (list_menu_data->List EQ 0)
2560 {
2561 TRACE_EVENT ("failed to create the list");
2562 return NULL;
2563 }
2564
2565 TRACE_EVENT ("network_create_mobile_list ()");
2566
2567
2568
2569 /*
2570 * Fill Menu List
2571 */
2572 for (i=0; i < MAX_SHOW_OF_PLMN; i++)
2573 {
2574 mnuInitDataItem(&list_menu_data->List[i]);
2575
2576 /*
2577 * set network name
2578 */
2579
2580 /*SPR 2635 copy set list strings pointing at longname strings*/
2581 if (data->pplmn_longnames[i][0] NEQ 0 )
2582 {
2583 list_menu_data->List[i].str =data->pplmn_longnames[i];
2584 }
2585 else
2586
2587 {
2588 list_menu_data->List[i].str = GET_TEXT(TxtEmpty);
2589 }
2590
2591 /*SPR 2635, end*/
2592
2593 list_menu_data->List[i].flagFunc = item_flag_none;
2594
2595 }
2596 /*
2597 * Fill common parameter for list handling
2598 */
2599
2600
2601 list_menu_data->ListLength = MAX_SHOW_OF_PLMN;
2602 list_menu_data->ListPosition = 1;
2603 list_menu_data->CursorPosition = 1;
2604 list_menu_data->SnapshotSize = MAX_SHOW_OF_PLMN;
2605 list_menu_data->Font = 0;
2606 list_menu_data->LeftSoftKey = TxtSoftSelect;
2607 list_menu_data->RightSoftKey = TxtSoftBack;
2608 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
2609 list_menu_data->Reason = 0;
2610 list_menu_data->Strings = TRUE;
2611 list_menu_data->Attr = &network_menuAttrib;
2612 list_menu_data->autoDestroy = TRUE; /*destroy the menulist after press any sofkey*/
2613 list_menu_data->listCol = COLOUR_LIST_XX;
2614
2615 return list_menu_data;
2616 }
2617
2618 #if(0) /* x0039928 - Lint warning removal */
2619 /*******************************************************************************
2620
2621 $Function: network_submenu
2622
2623 $Description: Creates a submenu for the preferred list.
2624
2625 $Returns:
2626
2627 $Arguments:
2628
2629 *******************************************************************************/
2630 static ListMenuData * network_submenu (T_network * data, T_MFW_NETWORK_STRUCT * plmn_list)
2631 {
2632 UBYTE i;
2633
2634
2635 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
2636
2637 if (list_menu_data EQ 0)
2638 return NULL;
2639
2640 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY ((NETWORK_MENU_ITEM) * sizeof (T_MFW_MNU_ITEM));
2641 if (list_menu_data->List EQ 0)
2642 return NULL;
2643
2644 /*
2645 * Fill Menu List
2646 */
2647 for (i=0;i<(NETWORK_MENU_ITEM);i++)
2648 {
2649 mnuInitDataItem(&list_menu_data->List[i]);
2650
2651 /*
2652 * set network name
2653 */
2654 #ifdef NO_ASCIIZ
2655 if (plmn_list->network_long.len NEQ 0)
2656 list_menu_data->List[i].str = (char *)plmn_list->network_long.data;
2657 #else
2658 if (strlen((char *)plmn_list->network_long) NEQ 0)
2659 list_menu_data->List[i].str = (char *)plmn_list->network_long;
2660 #endif
2661
2662 else
2663 ;
2664 //strncpy ((char *)list_menu_data->List[i].str,(char *)empty, 6);
2665
2666
2667 plmn_list ++;
2668
2669 }
2670 /*
2671 * Fill common parameter for list handling
2672 */
2673 list_menu_data->ListLength = data->pplmn_mem.maxRcd;
2674 list_menu_data->ListPosition = 1;
2675 list_menu_data->CursorPosition = 1;
2676 list_menu_data->SnapshotSize = data->pplmn_mem.maxRcd;
2677 list_menu_data->Font = 0;
2678 list_menu_data->LeftSoftKey = TxtSoftSelect;
2679 list_menu_data->RightSoftKey = TxtSoftBack;
2680 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
2681 list_menu_data->Reason = NETWORK_PREF_LIST_SELECTED;
2682 list_menu_data->Strings = TRUE;
2683 list_menu_data->Attr = &network_menuAttrib;
2684 list_menu_data->listCol = COLOUR_LIST_XX;
2685
2686 return list_menu_data;
2687 }
2688
2689 #endif
2690
2691 /*******************************************************************************
2692
2693 $Function: network_list_cb
2694
2695 $Description: Callback function list dialog.
2696
2697 $Returns:
2698
2699 $Arguments:
2700
2701 *******************************************************************************/
2702 static void network_list_cb(T_MFW_HND win, ListMenuData * ListData)
2703 {
2704 TRACE_FUNCTION ("network_list_cb()");
2705
2706 #ifndef NEPTUNE_BOARD
2707 if (ListData->Reason != LISTS_REASON_BACK)
2708 {
2709 SEND_EVENT (win, NETWORK_LIST_SELECT_PLMN, ListData->CursorPosition, NULL);
2710 }
2711
2712 #else
2713 if (ListData->Reason EQ LISTS_REASON_SELECT)
2714 {
2715 SEND_EVENT (win, NETWORK_LIST_SELECT_PLMN, ListData->CursorPosition, NULL);
2716 SEND_EVENT (win, NETWORK_LIST_DESTORY, NULL, NULL);
2717 }
2718
2719 if ((ListData->Reason EQ LISTS_REASON_BACK) ||
2720 (ListData->Reason EQ LISTS_REASON_CLEAR)||
2721 (ListData->Reason EQ LISTS_REASON_HANGUP))
2722
2723 {
2724 SEND_EVENT (win, NETWORK_LIST_DESTORY, NULL, NULL);
2725 }
2726 #endif
2727
2728 }
2729
2730 /*******************************************************************************
2731
2732 $Function: network_pref_list_cb
2733
2734 $Description: Callback function pref. list dialog.
2735
2736 $Returns:
2737
2738 $Arguments:
2739
2740 *******************************************************************************/
2741 static void network_pref_list_cb(T_MFW_HND win, ListMenuData * ListData)
2742 {
2743 TRACE_FUNCTION ("network_pref_list_cb()");
2744
2745 if (ListData->Reason EQ LISTS_REASON_SELECT)
2746 {
2747
2748 // call here the MenuOptions with the items "Select from the list"
2749
2750 FREE_MEMORY ((UBYTE *)network_data.network_list->List, (network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
2751
2752 FREE_MEMORY ((UBYTE *)network_data.network_list, sizeof (ListMenuData));
2753 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
2754 //Commented FREE_MEMORY for network_data.pplmn as this is required when we enter the option menu.
2755 // Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
2756 // Solution: Comment network_data.pplmn memory free.
2757 /*
2758 // cq12719 Stop the memory leak 17-03-04 MZ.
2759 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2760 */
2761 //keep the position of the selected PLMN, need it later to update the list
2762 network_data.Listposition = ListData->ListPosition;
2763
2764 network_MNU_start(win,&network_OPTAttrib);
2765 }
2766 else
2767 {
2768
2769 //user pressed Exit to go back to the network submenu
2770 FREE_MEMORY ((UBYTE *)network_data.network_list->List, (network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
2771
2772 FREE_MEMORY ((UBYTE *)network_data.network_list, sizeof (ListMenuData));
2773
2774 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2775
2776 }
2777
2778
2779 }
2780
2781 /*******************************************************************************
2782
2783 $Function: network_mobile_list_cb
2784
2785 $Description: Callback function international list dialog.
2786
2787 $Returns:
2788
2789 $Arguments:
2790
2791 *******************************************************************************/
2792 static void network_mobile_list_cb(T_MFW_HND win, ListMenuData * ListData)
2793 {
2794
2795 /* UBYTE i;*/ /* Warning Correction */
2796
2797 T_MFW_PPLMN_MODE mode;
2798
2799 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2800 T_network_OPT * data = (T_network_OPT *)win_data->user;
2801 T_DISPLAY_DATA display_info;
2802
2803 TRACE_EVENT ("network_mobile_list_cb()");
2804
2805
2806 switch (ListData->Reason)
2807 {
2808 case LISTS_REASON_SELECT: /* */
2809
2810 mode = REPLACE_PREF_PLMN; /* Overwrite an existing entry at a given index */
2811 /*SPR 2635, use new function to replace preferred PLMN using the longname*/
2812 nm_change_pref_plmn_longname(mode,(network_data.Listposition) +1 , 0, data->pplmn_longnames[ListData->ListPosition]);
2813
2814 /* SPR#2354 - SH - Now display "Changed". On callback, redraw network list */
2815 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtChanged, TxtNull, COLOUR_STATUS_NETWORKS);
2816 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_mobile_list_changed_cb, THREE_SECS, 0 );
2817
2818 info_dialog (win, &display_info);
2819
2820 break;
2821 case LISTS_REASON_BACK: /* back to previous menu */
2822
2823 TRACE_EVENT ("pressed Back-key");
2824
2825 //API - SPR 2025 - 22/05/03 - De Allocate memory to avoid memory leak and also Crash
2826 if ( network_data.pplmn != NULL )
2827 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2828
2829 network_MNU_destroy(data->win);
2830
2831 break;
2832 default:
2833 return;
2834 }
2835
2836
2837 }
2838
2839 /*******************************************************************************
2840
2841 $Function: network_mobile_list_changed_cb
2842
2843 $Description: Callback from "Changed" message. Destroys the list and recreates the
2844 updated network list.
2845
2846 $Returns:
2847
2848 $Arguments:
2849
2850 *******************************************************************************/
2851
2852 void network_mobile_list_changed_cb(T_MFW_HND win , USHORT identifier, UBYTE reason)
2853 {
2854 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2855 T_network_OPT * data = (T_network_OPT *)win_data->user;
2856 /* T_DISPLAY_DATA display_info; */ /* Warning Correction */
2857
2858 /* destroy the Menu */
2859 network_MNU_destroy(data->win);
2860
2861 /* request the pref. PLMN list */
2862 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
2863
2864 return;
2865 }
2866
2867
2868 /*******************************************************************************
2869
2870 $Function: network_start_animation
2871
2872 $Description: Starts the network animation.
2873
2874 $Returns:
2875
2876 $Arguments:
2877
2878 *******************************************************************************/
2879 static void network_start_animation(void)
2880 {
2881 T_DISPLAY_DATA display_info;
2882
2883 TRACE_FUNCTION ("network_start_animation()");
2884
2885 if (network_data.network_search_win != NULL)
2886 {
2887 network_stop_animation();
2888 }
2889 /* REF: OMAPS00061046 possible to cancel the searching with right soft key although
2890 * the option is not available.
2891 */
2892 #ifdef NEPTUNE_BOARD
2893 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtCancel, "Searching for", "Networks", COLOUR_STATUS_NETWORKS);
2894 #else
2895 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "Searching for", "Networks", COLOUR_STATUS_NETWORKS);
2896 #endif
2897 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, FOREVER, KEY_CLEAR | KEY_RIGHT);
2898 /*
2899 * Call Info Screen
2900 */
2901
2902 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2903 }
2904
2905
2906 /*******************************************************************************
2907
2908 $Function: network_start_animation_plmn_selection
2909
2910 $Description: Starts the plmn selection animation.
2911
2912 $Returns:
2913
2914 $Arguments:
2915
2916 *******************************************************************************/
2917 static void network_start_animation_plmn_selection(int plmn_value)
2918 {
2919 T_DISPLAY_DATA display_info;
2920 /* T_MFW_PLMN_LIST * plmn_list; */ /* Warning Correction */
2921
2922 TRACE_FUNCTION ("network_start_animation()");
2923
2924 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "Requesting....", NULL, COLOUR_STATUS_NETWORKS);
2925 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, FOREVER, KEY_CLEAR| KEY_RIGHT );
2926
2927 /*
2928 * Call Info Screen
2929 */
2930
2931 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2932 }
2933
2934
2935 /*******************************************************************************
2936
2937 $Function: network_forbidden_plmn
2938
2939 $Description: Starts the forbidden plmn data screen.
2940
2941 $Returns:
2942
2943 $Arguments:
2944
2945 *******************************************************************************/
2946 static void network_forbidden_plmn(void)
2947 {
2948 T_DISPLAY_DATA display_info;
2949
2950 TRACE_FUNCTION ("network_forbidden_plmn()");
2951
2952 if (network_data.network_search_win != NULL)
2953 {
2954 network_stop_animation();
2955 }
2956
2957 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNetwork, TxtForbidden, COLOUR_STATUS_NETWORKS);
2958 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, 3500, KEY_CLEAR| KEY_RIGHT );
2959 /*
2960 * Call Info Screen
2961 */
2962 //Feb 08,2007 DRT: OMAPS00115060 x00061088(Prachi)
2963 network_data.network_search_win = info_dialog (0, &display_info);
2964 }
2965
2966
2967 /*******************************************************************************
2968
2969 $Function: network_selected
2970
2971 $Description: displays info screen on network selected
2972
2973 $Returns:
2974
2975 $Arguments:
2976
2977 *******************************************************************************/
2978 static void network_selected(void)
2979 {
2980 T_DISPLAY_DATA display_info;
2981
2982 TRACE_FUNCTION ("network_start_animation()");
2983
2984 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNetwork, TxtSelected, COLOUR_STATUS_NETWORKS);
2985 // Jul 21, 2004 REF: CRR 13348 xvilliva
2986 // We use a new callback to return to idle screen after the alert is flashed.
2987 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_select_animation_cb, 3500, KEY_CLEAR| KEY_RIGHT );
2988
2989 /*
2990 * Call Info Screen
2991 */
2992
2993 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2994 }
2995
2996 /*******************************************************************************
2997
2998 $Function: network_no_plmns
2999
3000 $Description: Indicate Info Screen that the network list is empty.
3001
3002 $Returns:
3003
3004 $Arguments:
3005
3006 *******************************************************************************/
3007 static void network_no_plmns(void)
3008 {
3009 T_DISPLAY_DATA display_info;
3010
3011 TRACE_FUNCTION ("network_no_plmns()");
3012
3013 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "No networks", "available", COLOUR_STATUS_NETWORKS);
3014 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, THREE_SECS, KEY_CLEAR| KEY_RIGHT );
3015 /*
3016 * Call Info Screen
3017 */
3018 info_dialog (0, &display_info);
3019
3020 }
3021 /*******************************************************************************
3022
3023 $Function: network_stop_animation
3024
3025 $Description: Stops the network animation.
3026
3027 $Returns:
3028
3029 $Arguments:
3030
3031 *******************************************************************************/
3032 static void network_stop_animation(void)
3033 {
3034 TRACE_FUNCTION ("network_stop_animation()");
3035
3036 if (network_data.network_search_win)
3037 {
3038 SEND_EVENT(network_data.network_search_win,DIALOG_DESTROY,0,0);
3039 network_data.network_search_win = 0;
3040 }
3041 }
3042 /*******************************************************************************
3043
3044 $Function: network_animation_cb
3045
3046 $Description: Callback for information dialog (not used)n
3047
3048 $Returns:
3049
3050 $Arguments:
3051
3052 *******************************************************************************/
3053 void network_animation_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
3054 {
3055 TRACE_FUNCTION ("network_animation_cb()");
3056
3057 network_data.network_search_win = 0;
3058 network_data.aborted = TRUE;
3059 }
3060
3061 /*******************************************************************************
3062
3063 $Function: network_select_animation_cb
3064
3065 $Description: Callback for information dialog "Network Selected".
3066
3067 $Returns:
3068
3069 $Arguments:
3070
3071 *******************************************************************************/
3072 void network_select_animation_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
3073 {
3074 TRACE_FUNCTION ("network_select_animation_cb()");
3075
3076 network_data.network_search_win = 0;
3077 network_data.aborted = TRUE;
3078 // Jul 21, 2004 REF: CRR 13348 xvilliva
3079 // If "gPhbkMenu" is not NULL, we destroy phonebook menu
3080 // to return to idle screen.
3081 if(gPhbkMenu != NULL)
3082 {
3083 bookPhonebookDestroy( gPhbkMenu );
3084 }
3085 }
3086
3087 /*******************************************************************************
3088
3089 $Function: network_MNU_start
3090
3091 $Description: called when the user press the Edit Softkey to enter the
3092 Option Menu "Select from the list" & "Enter the Network Code" &
3093 "Delete"
3094 $Returns:
3095
3096 $Arguments:
3097
3098 *******************************************************************************/
3099
3100 T_MFW_HND network_MNU_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
3101 {
3102 T_MFW_HND win;
3103
3104 TRACE_FUNCTION ("network_MNU_start()");
3105
3106 win = network_MNU_create (parent_window);
3107 if (win NEQ NULL)
3108 {
3109 SEND_EVENT (win, E_INIT, NULL, (void *)menuAttr);
3110 }
3111 return win;
3112 }
3113
3114 /*******************************************************************************
3115
3116 $Function: network_MNU_create
3117
3118 $Description: Create the Option window
3119
3120 $Returns: mfw window handle
3121
3122 $Arguments: parent_window -parent window handle
3123
3124 *******************************************************************************/
3125
3126 static T_MFW_HND network_MNU_create(MfwHnd parent_window)
3127 {
3128 T_network_OPT * data = (T_network_OPT *)ALLOC_MEMORY (sizeof (T_network_OPT));
3129 T_MFW_WIN * win;
3130
3131 TRACE_FUNCTION ("network_MNU_create()");
3132
3133 /*
3134 * Create window handler
3135 */
3136
3137 data->win =
3138 win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)network_MNU_win_cb);
3139 if (data->win EQ NULL)
3140 {
3141 return NULL;
3142 }
3143
3144 /*
3145 * connect the dialog data to the MFW-window
3146 */
3147
3148 data->mmi_control.dialog = (T_DIALOG_FUNC)network_MNU_exec_cb;
3149 data->mmi_control.data = data;
3150 win = ((T_MFW_HDR *)data->win)->data;
3151 win->user = (void *)data;
3152 data->parent = parent_window;
3153
3154 /*
3155 * return window handle
3156 */
3157
3158 return data->win;
3159 }
3160
3161 /*******************************************************************************
3162
3163 $Function: network_MNU_destroy
3164
3165 $Description: Destroy the Option window
3166
3167 $Returns: mfw window handle
3168
3169 $Arguments: own_window - current window
3170
3171 *******************************************************************************/
3172
3173 static void network_MNU_destroy(MfwHnd own_window)
3174 {
3175 T_MFW_WIN * win_data;
3176 T_network_OPT * data;
3177 /* T_MFW_PPLMN_MEM *pplmn_mem; */ /* Warning Correction */
3178
3179 TRACE_FUNCTION ("network_MNU_destroy()");
3180
3181 if (own_window)
3182 {
3183 win_data = ((T_MFW_HDR *)own_window)->data;
3184 data = (T_network_OPT *)win_data->user;
3185
3186 if (data)
3187 {
3188 kbd_delete(data->kbd);
3189 kbd_delete(data->kbd_long);
3190 mnuDelete (data->menu);
3191 /*
3192 * Delete WIN handler
3193 */
3194 win_delete (data->win);
3195 TRACE_EVENT("END of WIN DELETE");
3196
3197 if(data->network_list != NULL)
3198 {
3199 TRACE_EVENT("START FREE MEMORY");
3200
3201 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
3202 #ifndef NEPTUNE_BOARD
3203 FREE_MEMORY ((UBYTE *)data->network_list->List, MAX_SHOW_OF_PLMN* sizeof (T_MFW_MNU_ITEM));
3204 #else
3205 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
3206 #endif
3207
3208 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
3209
3210 /*SPR 2635, free list of pointers to longname atrings*/
3211 FREE_MEMORY ((UBYTE *)data->pplmn_longnames,MAX_SHOW_OF_PLMN* sizeof (char*));
3212
3213 TRACE_EVENT("END of FREE MEMORY");
3214 }
3215
3216 /*
3217 * Free Memory
3218 */
3219
3220 FREE_MEMORY ((void *)data, sizeof (T_network_OPT));
3221 }
3222 else
3223 {
3224 TRACE_EVENT ("network_MNU_destroy() called twice");
3225 }
3226 }
3227 }
3228
3229 /*******************************************************************************
3230
3231 $Function: network_MNU_exec_cb
3232
3233 $Description: Exec callback function for the Option window
3234
3235 $Returns: none
3236
3237 $Arguments: win - current window
3238 event - event id
3239 value - unique id
3240 parameter - optional data.
3241
3242 *******************************************************************************/
3243
3244 void network_MNU_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
3245 {
3246 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
3247 T_network_OPT * data = (T_network_OPT *)win_data->user;
3248 /* T_MFW_HND * l_parent; */ /* Warning Correction */
3249 /* SHORT l_id; */ /* Warning Correction */
3250 /* T_MFW_HDR * parent = data->parent; */ /* Warning Correction */
3251 /* T_MFW_EVENT MfwEvents; */ /* Warning Correction */
3252
3253 TRACE_FUNCTION ("network_MNU_exec_cb()");
3254
3255
3256 switch (event)
3257 {
3258 case E_INIT:
3259 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)network_MNU_kbd_cb);
3260 data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)network_MNU_kbd_cb);
3261 data->menu = mnuCreate(data->win,&network_OPTAttrib, E_MNU_ESCAPE, (MfwCb)network_MNU_mnu_cb);
3262 mnuLang(data->menu,mainMmiLng);
3263
3264 /* put the (new) dialog window on top of the window stack */
3265 mnuUnhide(data->menu);
3266 winShow(win);
3267
3268 break;
3269 default:
3270 return;
3271 }
3272 }
3273
3274 /*******************************************************************************
3275
3276 $Function: network_MNU_mnu_cb
3277
3278 $Description: Menu callback function for the Option window
3279
3280 $Returns: none
3281
3282 $Arguments: e - event id
3283 m - menu handle
3284 *******************************************************************************/
3285
3286 static int network_MNU_mnu_cb (MfwEvt e, MfwMnu *m)
3287 {
3288 T_MFW_HND win = mfwParent(mfw_header());
3289 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3290 T_network_OPT * data = (T_network_OPT *)win_data->user;
3291 /* T_MFW_HND * l_parent; */ /* Warning Correction */
3292 /* SHORT l_id; */ /* Warning Correction */
3293
3294 TRACE_FUNCTION ("network_MNU_mnu_cb()");
3295
3296 switch (e)
3297 {
3298 case E_MNU_ESCAPE: /* back to previous menu "pref. network list"*/
3299 network_MNU_destroy(data->win);
3300
3301 // request MFW to fill up the pref. PLMN list
3302 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
3303
3304
3305 break;
3306 default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */
3307 return MFW_EVENT_REJECTED;
3308 }
3309 return MFW_EVENT_CONSUMED;
3310 }
3311
3312 /*******************************************************************************
3313
3314 $Function: network_MNU_win_cb
3315
3316 $Description: Window callback function for the Option window
3317
3318 $Returns: execution status
3319
3320 $Arguments: e - event id
3321 w - window handle
3322 *******************************************************************************/
3323
3324 static int network_MNU_win_cb (MfwEvt e, MfwWin *w)
3325 {
3326 TRACE_FUNCTION ("network_MNU_win_cb()");
3327
3328 switch (e)
3329 {
3330 case MfwWinVisible: /* window is visible */
3331 displaySoftKeys(TxtSoftSelect,TxtSoftBack);
3332 break;
3333 case MfwWinFocussed: /* input focus / selected */
3334 case MfwWinDelete: /* window will be deleted */
3335 default:
3336 return MFW_EVENT_REJECTED;
3337 }
3338 return MFW_EVENT_CONSUMED;
3339 }
3340
3341 /*******************************************************************************
3342
3343 $Function: network_MNU_kbd_cb
3344
3345 $Description: Exec callback function for the Option window
3346
3347 $Returns: execution status
3348
3349 $Arguments: e - event id
3350 k - keyboard info
3351 *******************************************************************************/
3352
3353 static int network_MNU_kbd_cb (MfwEvt e, MfwKbd *k)
3354 {
3355 T_MFW_HND win = mfwParent(mfw_header());
3356 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3357 T_network_OPT * data = (T_network_OPT *)win_data->user;
3358
3359 TRACE_FUNCTION ("network_MNU_kbd_cb()");
3360
3361 if (e & KEY_LONG)
3362 {
3363 switch (k->code)
3364 {
3365 case KCD_HUP: /* back to previous menu */
3366 mnuEscape(data->menu);
3367 break;
3368 case KCD_RIGHT: /* Power Down */
3369 return MFW_EVENT_REJECTED; /* handled by idle */
3370 default: /* no response to all other keys */
3371 return MFW_EVENT_CONSUMED;
3372 }
3373 }
3374 else
3375 {
3376 switch (k->code)
3377 {
3378 case KCD_MNUUP: /* highlight previous entry */
3379 mnuUp(data->menu);
3380 break;
3381 case KCD_MNUDOWN: /* highlight next entry */
3382 mnuDown(data->menu);
3383 break;
3384 case KCD_LEFT: /* activate this entry */
3385 mnuSelect(data->menu);
3386 break;
3387 case KCD_HUP: /* back to previous menu */
3388 case KCD_RIGHT: /* back to previous menu */
3389 mnuEscape(data->menu);
3390 break;
3391 default: /* no response to all other keys */
3392 return MFW_EVENT_CONSUMED;
3393 }
3394 }
3395 return MFW_EVENT_CONSUMED;
3396 }
3397
3398 /*******************************************************************************
3399
3400 $Function: network_request_plnm_list
3401
3402 $Description: Request existing network list in Mobile
3403
3404 $Returns:
3405
3406 $Arguments:
3407
3408
3409 *******************************************************************************/
3410 static int network_request_plnm_list(MfwMnu* m, MfwMnuItem* i)
3411 {
3412 T_MFW_HND win = mfwParent(mfw_header());
3413 /* T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; */ /* Warning Correction */
3414 /* T_network_OPT * data = (T_network_OPT *)win_data->user; */ /* Warning Correction */
3415 T_DISPLAY_DATA display_info;
3416
3417 TRACE_FUNCTION("network_request_plnm_list");
3418
3419 /* SPR#2354 - SH - Display "Choose Replacement" dialogue,
3420 * so the function of the second list is more evident */
3421
3422 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtChooseReplacement1, TxtChooseReplacement2, COLOUR_STATUS_NETWORKS);
3423 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_request_plmn_list_cb, TWO_SECS, 0 );
3424
3425 info_dialog (win, &display_info);
3426
3427 return 1;
3428 }
3429
3430 /*******************************************************************************
3431
3432 $Function: network_request_plnm_list_cb
3433
3434 $Description: User has been advised to "choose replacement", now display the list!
3435
3436 $Returns: None
3437
3438 $Arguments: Usual info dialogue callback arguments.
3439
3440 *******************************************************************************/
3441
3442 static void network_request_plmn_list_cb(T_MFW_HND win, USHORT identifier, UBYTE reason)
3443 {
3444 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3445 T_network_OPT * data = (T_network_OPT *)win_data->user;
3446 /*SPR 2635, just alloc pointers to strings */
3447 data->pplmn_longnames = (char**)ALLOC_MEMORY ((MAX_SHOW_OF_PLMN) * sizeof (char*));
3448
3449 if (data->pplmn_longnames NEQ 0)
3450 {
3451 //now fill up the "data->pplmn_longnames" with the PLMN list from ACI
3452 nm_plnm_list_longnames(data->pplmn_longnames, 1, MAX_SHOW_OF_PLMN);
3453
3454 }
3455 /*SPR 2635 end*/
3456 else
3457 {
3458 TRACE_EVENT("create the list failed");
3459 return;
3460 }
3461
3462 //show the list on the screen now
3463 data->network_list = network_create_mobile_list (data);
3464 listDisplayListMenu (data->win, data->network_list,(ListCbFunc)network_mobile_list_cb,0);
3465
3466 return;
3467 }
3468
3469
3470 /*******************************************************************************
3471
3472 $Function: network_delete
3473
3474 $Description:
3475
3476 $Returns:
3477
3478 $Arguments:
3479
3480
3481 *******************************************************************************/
3482
3483 static int network_delete(MfwMnu* m, MfwMnuItem* i)
3484 {
3485
3486 T_MFW_HND win = mfwParent(mfw_header());
3487
3488 TRACE_FUNCTION ("network_delete()");
3489
3490 #ifdef NO_ASCIIZ
3491 if (network_data.pplmn[network_data.Listposition].network_short.len NEQ 0 )
3492 #else
3493 if (strlen((char *)network_data.pplmn[network_data.Listposition].network_short) NEQ 0 )
3494 #endif
3495 {
3496 // if the user selected a pref. PLMN
3497 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3498 //Made network_info_screen as a generic function as it can be reused to display different messgaes to the user
3499 //Hence need to pass the callback funtion as a parameter
3500 network_info_screen (win, TxtDeleted,(T_VOID_FUNC)network_delete_pref_plnm);
3501 }
3502 else
3503 {
3504 // if the user selected a empty item
3505 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3506 //Made network_info_screen as a generic function as it can be reused to display different messgaes to the user
3507 //Hence need to pass the callback funtion as a parameter
3508 network_info_screen (win, TxtEmptyList,(T_VOID_FUNC)network_delete_pref_plnm);
3509 }
3510
3511 // destroy the Menu
3512 network_MNU_destroy(win);
3513
3514 /* Warning Correction - BEGIN */
3515 return 1;
3516 /* END */
3517
3518
3519 }
3520
3521 /*******************************************************************************
3522
3523 $Function: network_delete_pref_plnm
3524
3525 $Description: Delete the selected pref. PLMN l
3526
3527 $Returns:
3528
3529 $Arguments:
3530
3531
3532 *******************************************************************************/
3533 void network_delete_pref_plnm (T_MFW_HND win , USHORT identifier, UBYTE reason)
3534 {
3535
3536 T_MFW_PPLMN_MODE mode;
3537 UBYTE i;
3538 /* T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; */ /* Warning Correction */
3539 /* T_network_OPT * data = (T_network_OPT *)win_data->user; */ /* Warning Correction */
3540
3541 TRACE_FUNCTION ("network_delete_pref_plnm()");
3542
3543
3544 mode = DELETE_PREF_PLMN; /* Delete an entry from the list */
3545
3546 //update now the pref. PLMN list
3547 //(network_data.Listposition) "+1" because the zero is counted as well
3548 nm_change_pref_plmn(mode, (network_data.Listposition) +1 , 0, 0);
3549
3550 // clear all the PLMN and fill up with updated list
3551 for (i=0; i < network_data.pplmn_mem.maxRcd; i++)
3552 {
3553
3554 #ifdef NO_ASCIIZ
3555 network_data.pplmn[i].network_long.len = 0;
3556 network_data.pplmn[i].network_short.len = 0;
3557 #else
3558 memset(network_data.pplmn[i].network_long, '\0', LONG_NAME);
3559 memset(network_data.pplmn[i].network_short, '\0', SHORT_NAME);
3560 #endif
3561 memset(network_data.pplmn[i].network_numeric, '\0', NUMERIC_LENGTH);
3562 }
3563
3564
3565 // request the updated pref. PLMN list
3566 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
3567
3568 }
3569
3570 /*******************************************************************************
3571
3572 $Function: network_info_screen
3573
3574 $Description: confirm the deleted PLMN
3575
3576 $Returns:
3577
3578 $Arguments:
3579
3580 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3581 //Made this as a generic function so that it can be reused to display different messgaes to the user
3582 //Added the call back function pointer as the argument.
3583 *******************************************************************************/
3584 void network_info_screen (T_MFW_HND win, USHORT MessageId, T_VOID_FUNC funt_ptr )
3585 {
3586 T_DISPLAY_DATA display_info;
3587
3588 TRACE_FUNCTION ("network_info_screen()");
3589
3590 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, MessageId, TxtNull, COLOUR_STATUS_NETWORKS);
3591 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)funt_ptr, THREE_SECS, 0 );
3592
3593 info_dialog (win, &display_info);
3594 }
3595
3596
3597 /*******************************************************************************
3598
3599 $Function: network_OPT_EDT_start
3600
3601 $Description:
3602
3603 $Returns:
3604
3605 $Arguments:
3606
3607 *******************************************************************************/
3608 T_MFW_HND network_EDT_start (MfwMnu* m, MfwMnuItem* i)
3609 {
3610 T_MFW_HND win;
3611 T_MFW_HND parent_window = mfwParent(mfw_header());
3612
3613 TRACE_FUNCTION ("network_OPT_EDT_start()");
3614
3615 win = network_EDT_create (parent_window);
3616
3617 if (win NEQ NULL)
3618 {
3619 SEND_EVENT (win, E_INIT, 0, 0);
3620 }
3621 return win;
3622 }
3623
3624 /*******************************************************************************
3625
3626 $Function: network_OPT_EDT_create
3627
3628 $Description:
3629
3630 $Returns:
3631
3632 $Arguments:
3633
3634 *******************************************************************************/
3635 static T_MFW_HND network_EDT_create(MfwHnd parent_window)
3636 {
3637 T_network_OPT * data = (T_network_OPT *)ALLOC_MEMORY (sizeof (T_network_OPT));
3638 T_MFW_WIN * win;
3639
3640 TRACE_FUNCTION ("network_EDT_create()");
3641
3642 /*
3643 * Create window handler
3644 */
3645
3646 data->win = win_create (parent_window, 0, 0, NULL);
3647
3648 if (data->win EQ NULL)
3649 {
3650 return NULL;
3651 }
3652
3653 /*
3654 * connect the dialog data to the MFW-window
3655 */
3656
3657 data->mmi_control.dialog = (T_DIALOG_FUNC)network_EDT_exec_cb;
3658 data->mmi_control.data = data;
3659 win = ((T_MFW_HDR *)data->win)->data;
3660 win->user = (void *)data;
3661 data->parent = parent_window;
3662
3663 /*
3664 * return window handle
3665 */
3666
3667 winShow(data->win);
3668 return data->win;
3669 }
3670
3671
3672 /*******************************************************************************
3673
3674 $Function: network_EDT_destroy
3675
3676 $Description:
3677
3678 $Returns:
3679
3680 $Arguments:
3681
3682 *******************************************************************************/
3683 static void network_EDT_destroy(MfwHnd own_window)
3684 {
3685 T_MFW_WIN * win_data;
3686 T_network_OPT * data;
3687
3688
3689 TRACE_FUNCTION ("networkT_EDT_destroy()");
3690
3691 if (own_window)
3692 {
3693 win_data = ((T_MFW_HDR *)own_window)->data;
3694 data = (T_network_OPT *)win_data->user;
3695
3696 if (data)
3697 {
3698 /*
3699 * Delete WIN handler
3700 */
3701 win_delete (data->win);
3702
3703 /*
3704 * Free Memory
3705 */
3706 FREE_MEMORY ((void *)data, sizeof (T_network_OPT));
3707 }
3708 else
3709 {
3710 TRACE_EVENT ("network_EDT_destroy() called twice");
3711 }
3712 }
3713 }
3714
3715
3716 /*******************************************************************************
3717
3718 $Function: network_EDT_exec_cb
3719
3720 $Description:
3721
3722 $Returns:
3723
3724 $Arguments:
3725
3726 *******************************************************************************/
3727 void network_EDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
3728 {
3729 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
3730 T_network_OPT * data = (T_network_OPT *)win_data->user;
3731 /* T_MFW_HND * l_parent; */ /* Warning Correction */
3732 /* SHORT l_id; */ /* Warning Correction */
3733 /* int index; */ /* Warning Correction */
3734
3735 TRACE_FUNCTION ("network_EDT_exec_cb()");
3736
3737 switch (event)
3738 {
3739 case E_INIT:
3740 /* SPR#1428 - SH - New Editor changes */
3741 #ifdef NEW_EDITOR
3742 AUI_edit_SetDefault(&data->editor_info);
3743 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT);
3744 AUI_edit_SetEvents(&data->editor_info, value, TRUE, FOREVER, (T_AUI_EDIT_CB)network_EDT_editor_cb);
3745 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtMCCMNC, NULL);
3746 AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_UNDERLINE);
3747 AUI_edit_SetAltTextStr(&data->editor_info, 5, TxtNull, TRUE, TxtSoftBack);
3748 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->buffer, 6);
3749
3750 AUI_edit_Start(data->win, &data->editor_info);
3751 #else /* NEW_EDITOR */
3752 data->editor_info.editor_attr.win.px = 6;
3753 data->editor_info.editor_attr.win.py = /*12*/Mmi_layout_line(2);
3754 data->editor_info.editor_attr.win.sx = /*80*/SCREEN_SIZE_X;
3755 data->editor_info.editor_attr.win.sy = /*20 */Mmi_layout_line_height()*2;
3756 data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX;
3757 data->editor_info.editor_attr.font = 0;
3758 data->editor_info.editor_attr.mode = edtCurBar1;
3759 data->editor_info.editor_attr.controls = 0;
3760 data->editor_info.editor_attr.text = data->buffer; /* buffer to be edited */
3761 data->editor_info.editor_attr.size = 6;
3762 data->editor_info.LeftSoftKey = TxtSoftOK;
3763 data->editor_info.RightSoftKey = TxtDelete;
3764 data->editor_info.TextId = TxtMCCMNC;
3765 data->editor_info.Identifier = value; /* optional */
3766 data->editor_info.mode = DIGITS_MODE;
3767 data->editor_info.Callback = (T_EDIT_CB)network_EDT_editor_cb;
3768 data->editor_info.destroyEditor = TRUE;
3769 data->editor_info.hide = FALSE;
3770 data->editor_info.AlternateLeftSoftKey = TxtNull;
3771 data->editor_info.TextString = NULL;
3772 data->editor_info.min_enter = 5;
3773 data->editor_info.timeout = FOREVER;
3774
3775 /* create the dialog handler */
3776 editor_start(data->win, &data->editor_info); /* start the editor */
3777 #endif /* NEW_EDITOR */
3778
3779
3780 break;
3781 case E_ABORT:
3782 case E_EXIT: /* defaultreaction */
3783 network_EDT_destroy(data->win);
3784 break;
3785 default:
3786 return;
3787 }
3788 }
3789
3790
3791 /*******************************************************************************
3792
3793 $Function: network_change_pref_plmn
3794
3795 $Description: Populates the preffered plmn List.
3796
3797 $Returns:
3798
3799 $Arguments:
3800 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3801 *******************************************************************************/
3802 void network_change_pref_plmn (T_MFW_HND win , USHORT identifier, UBYTE reason)
3803 {
3804
3805 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
3806
3807 }
3808 /*******************************************************************************
3809
3810 $Function: network_EDT_editor_cb
3811
3812 $Description:
3813
3814 $Returns:
3815
3816 $Arguments:
3817
3818 *******************************************************************************/
3819 static void network_EDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event)
3820 {
3821 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3822 T_network_OPT * data = (T_network_OPT *)win_data->user;
3823 T_MFW_HND * l_parent;
3824 T_MFW_PPLMN_MODE mode;
3825
3826 TRACE_FUNCTION ("network_EDT_editor_cb()");
3827
3828
3829 l_parent = data->parent;
3830
3831 switch(event)
3832 {
3833 case INFO_KCD_LEFT:
3834
3835 mode = REPLACE_PREF_PLMN; /* Overwrite an existing entry at a given index */
3836
3837 //update now the pref. PLMN list
3838 //Overwrite an existing entry
3839 //(network_data.Listposition) "+1" because the zero is counted as well
3840 nm_change_pref_plmn(mode, (network_data.Listposition) +1 , 0, (UBYTE*) data->buffer);
3841
3842 // destroy the Editor
3843 network_EDT_destroy(data->win);
3844 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3845 //Added this info screen so that sim is updated by nm_change_pref_plmn with the new code
3846 //before populating the new list with nm_pref_plmn_list
3847 network_info_screen (win, TxtPleaseWait,(T_VOID_FUNC)network_change_pref_plmn);
3848 // destroy the MENU
3849 network_MNU_destroy(l_parent);
3850 break;
3851 case INFO_KCD_RIGHT:
3852 case INFO_KCD_HUP:
3853 // destroy the Editor
3854 network_EDT_destroy(data->win);
3855 // destroy the MENU
3856 network_MNU_destroy(l_parent);
3857
3858 // Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
3859 // Solution: Free network_data.pplmn.
3860 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
3861
3862 break;
3863 default:
3864 break;
3865 }
3866 return;
3867 }
3868
3869 //x0pleela 30 May, 2007 DR: OMAPS00133201
3870 /*******************************************************************************
3871
3872 $Function: nm_abort_network
3873
3874 $Description: remove the searhing window dialog
3875
3876 $Returns:
3877
3878 $Arguments:
3879
3880 *******************************************************************************/
3881 void nm_abort_network( void )
3882 {
3883 TRACE_FUNCTION ("nm_abort_network()");
3884 //destroy the searching window dialog
3885 dialog_info_destroy (network_data.network_search_win);
3886 network_data.network_search_win = 0;
3887 network_data.aborted = TRUE;
3888
3889 return;
3890 }
3891
3892 //x0012849: Jagannatha 01 June, 2006 ER: OMAPS00079607 -To Support AcC and Info numbers
3893 /*******************************************************************************
3894
3895 $Function: getRoamingStatus
3896
3897 $Description: Returns the value of roaming_indicator.
3898
3899 $Returns: TRUE or FALSE based on the roaming status.
3900
3901 $Arguments: None.
3902
3903 *******************************************************************************/
3904 #ifdef FF_CPHS
3905 UBYTE getRoamingStatus()
3906 {
3907
3908 return network_data.roaming_indicator;
3909 }
3910 #endif
3911
3912 // June 02, 2006 DR: OMAPS00078005 x0021334
3913 // Descripton: Test for NITZ (Network Identity and Timezone) support - No New time was displayed
3914 /*******************************************************************************
3915
3916 $Function: nw_time_update_callback
3917
3918 $Description: Call back function for network time update info dialog.
3919
3920 $Returns: Result code
3921
3922 $Arguments:
3923
3924 *******************************************************************************/
3925 //Dec 13,2006 DR:OMAPS00098351 x0066814 - Added the FF_TIMEZONE flag
3926 #ifdef FF_TIMEZONE
3927 static int nw_time_update_callback(T_MFW_HND win, USHORT identifier, UBYTE reason)
3928 {
3929 int res = MFW_EVENT_CONSUMED; // Result code to be returned by this function
3930
3931 TRACE_FUNCTION("nw_time_update_callback()");
3932
3933 switch(reason)
3934 {
3935 case INFO_KCD_RIGHT: // Reject offer of network time updation
3936 TRACE_EVENT("INFO_KCD_RIGHT");
3937 break;
3938
3939 case INFO_KCD_LEFT: // Accept offer of network time/date updation
3940 TRACE_EVENT("INFO_KCD_LEFT");
3941
3942 // Update RTC with new time info
3943 mfw_td_set_time(&newTime);
3944
3945 // Update RTC with new date info
3946 mfw_td_set_date(&newDate);
3947
3948 // Send IDLE_UPDATE event to force idle screen refresh
3949 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, 0);
3950 break;
3951
3952 case INFO_KCD_HUP: // Ignore offer of network time updation
3953 TRACE_EVENT("INFO_KCD_HUP");
3954 // No further action required
3955 break;
3956
3957 default:
3958 TRACE_EVENT_P1("Unexpected reason: %d", reason);
3959 res = MFW_EVENT_REJECTED;
3960 break;
3961 }
3962
3963 return res;
3964 }
3965 #endif
3966
3967 //Feb 28,,2007 DR:OMAPS00098351 x0066814
3968 /*******************************************************************************
3969
3970 $Function: settingsNITZ
3971
3972 $Description: Settings the time update to On, Off or Automatic
3973
3974 $Returns:
3975
3976 $Arguments:
3977
3978 *******************************************************************************/
3979 #ifdef FF_TIMEZONE
3980 int settingsNITZ (T_MFW_MNU *menu, T_MFW_MNU_ITEM *i)
3981 {
3982
3983 T_MFW_HND parent_win = mfwParent(mfw_header());
3984 int txtId = TxtAutomatic;
3985
3986 switch(menu->lCursor[menu->level])
3987 {
3988 case 0:
3989 TRACE_EVENT("Menu option 0: Automatic");
3990 FFS_flashData.nitz_option=NitzAutomatic;
3991 txtId = TxtAutomatic;
3992 break;
3993
3994 case 1:
3995 TRACE_EVENT("Menu option 1: NITZOn");
3996 FFS_flashData.nitz_option=NitzOn;
3997 txtId = TxtOn;
3998 break;
3999
4000 case 2:
4001 TRACE_EVENT("Menu option 2: NITZOff");
4002 FFS_flashData.nitz_option=NitzOff;
4003 txtId = TxtOff;
4004 break;
4005
4006 }
4007 flash_write();
4008 bookShowInfoScreen(parent_win, txtId, TxtSelected, NULL,NULL,3000);
4009 return MFW_EVENT_CONSUMED;
4010 }
4011 #endif