comparison src/aci2/bmi/mmiNetwork.c @ 120:3c2acfa1a72f

src/aci2/bmi: file renames to make filename case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 07 Oct 2016 03:46:05 +0000
parents src/aci2/bmi/MmiNetwork.c@93999a60b835
children
comparison
equal deleted inserted replaced
119:b92a33c204b6 120:3c2acfa1a72f
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 Feb 15, 2006 ER: OMAPS00065203 x0pleela
32 Description: Cingular Operator Name Prioritization implementation required
33 Solution: Incorporated review comments
34 - Included flag NEPTUNE_BOARD to retain old code for operator get name and
35 added new code for this ER also
36 - Removed the global variable gOper_sel_done and have introduced 2 functions which will
37 set and get the status of the operator selection
38
39 Feb 09, 2006 ER: OMAPS00065203 x0pleela
40 Description: Cingular Operator Name Prioritization implementation required
41 Solution: In function network(), check if EONS is allocated and activated. If not, get operator name from other sources
42 Removed CPHS check code as prioritized operator name is already updated to network_data
43
44 xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
45 Added a please wait screen so that the sim is updated with the new code before
46 populating the list again when deleting or when entering a newtwork code
47
48 Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
49 Description: Phone crashes on invoking Manual option in Network Selection Menu.
50 Solution: Memory free of network_data.pplmn is done when the editor exits instead of
51 list exit by option selection so that the pplmn data is available when the list is invoked once again.
52
53 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
54 Description: The homezone/cityzone tags were not being displayed properly.
55 Solution: Modified to save the tags properly in caches and also made the
56 appropriate modifications to update the same properly during mobility.
57
58 Sep 23, 2004 REF: CRR 24562 xvilliva
59 Bug: Enable/disable the manual network selection option depending
60 on ENS.
61 Fix: If the manual network selection is disabled we check if an
62 error is returned and flash an alert to the user.
63
64 Sep 8, 2004 REF: CRR 16062 xvilliva
65 Bug: If a PLMN is selected (by using the middle key) from the PLMN list
66 presented upon a manual search the D-Sample may freeze.
67 Fix: The "KEY_MNUSELECT" event is also monitered which was not
68 done earlier and was resulting in the PLMN list shown again.
69
70 Jul 21, 2004 REF: CRR 13348 xvilliva
71 Bug: After selecting HPLMN manually, the idle screen is not shown.
72 Fix: After the "Network Selected" alert is flashed, we destroy the
73 phonebook menu to return to the idle screen.
74
75
76 // Apr 14, 2004 REF: CRR 12641 xpradipg
77 // The network when selected using "Automatic" is not showing an alert after selection.
78 // A flag has been used to show the alert when ever network is selected using
79 // "Automatic" method. As the flag is present it will not flash this alert when the
80 // device is restarted.
81
82 25/10/00 Original Condat(UK) BMI version.
83
84 08-03-2006 REF: OMAPS00061049 x0020906
85
86 Bug: The sample crashed many times while trying to camp onto a FPLMN. PCO stucked when tracing this TC,
87 therefore no PCO traces available; only L1 traces (TestHarness).
88
89 Fix: During manual selection from the indication will get the plmn list count and used the count for allocating
90 plmn_list pointer and then destorying the list and free the pointer allocation when particular network is selected
91 or when back softkey is pressed.
92
93
94 $End
95 // Issue Number : SPR#12654 on 07/04/04 by Pradeep/Vadiraj
96 *******************************************************************************/
97
98
99 /*******************************************************************************
100
101 Include Files
102
103 *******************************************************************************/
104
105 #define ENTITY_MFW
106
107 /* includes */
108 #include <string.h>
109 #include <stdio.h>
110 #include <stdlib.h>
111
112 #if defined (NEW_FRAME)
113
114 #include "typedefs.h"
115 #include "vsi.h"
116 #include "pei.h"
117 #include "custom.h"
118 #include "gsm.h"
119
120 #else
121
122 #include "STDDEFS.H"
123 #include "custom.h"
124 #include "gsm.h"
125 #include "vsi.h"
126
127 #endif
128 #include "mfw_sys.h"
129
130 #include "prim.h"
131
132 #include "mfw_mfw.h"
133 #include "mfw_win.h"
134 #include "mfw_kbd.h"
135 /* SPR#1428 - SH - New Editor changes */
136 #ifndef NEW_EDITOR
137 #include "mfw_edt.h"
138 #endif
139 #include "mfw_lng.h"
140 #include "mfw_icn.h"
141 #include "mfw_mnu.h"
142 #include "mfw_tim.h"
143 #include "mfw_sim.h"
144 #include "mfw_nm.h"
145 #include "mfw_cm.h"
146 #include "mfw_sat.h"
147 #include "mfw_phb.h"
148 #include "mfw_sms.h"
149
150
151 #include "dspl.h"
152
153 #include "ksd.h"
154 #include "psa.h"
155
156
157 #include "MmiDummy.h"
158 #include "MmiMmi.h"
159 #include "MmiMain.h"
160 #include "MmiStart.h"
161 #include "MmiPins.h"
162
163 #include "MmiDialogs.h"
164 #include "MmiLists.h"
165 /* SPR#1428 - SH - New Editor changes */
166 #ifdef NEW_EDITOR
167 #include "ATBCommon.h"
168 #include "ATBDisplay.h"
169 #include "ATBEditor.h"
170 #include "AUIEditor.h"
171 #else
172 #include "MmiEditor.h"
173 #endif
174
175 #include "MmiMenu.h"
176 #include "MmiIdle.h"
177 #include "mmiCall.h"
178 #include "MmiBookController.h"
179 #include "MmiNetwork.h"
180 #include "MmiSoftKeys.h"
181 #include "MmiSounds.h"
182 #include "MmiPcm.h"
183
184 #include "prim.h"
185 #ifndef PCM_2_FFS
186 #include "pcm.h"
187 #endif
188
189 #include "mfw_ffs.h"
190 #include "MmiCPHS.h"
191
192 #ifdef MMI_HOMEZONE_ENABLED
193 #include "MmiHomezone.h"
194 #endif
195
196 #include "MmiNetwork.h"
197
198 #include "cus_aci.h"
199
200 #include "mmiColours.h"
201
202 /* BEGIN ADD: Neptune Alignment */
203 #ifdef NEPTUNE_BOARD
204 #include "bmi_integ_misc.h"
205 #endif
206 /* END ADD: Neptune Alignment */
207 #ifdef NEPTUNE_BOARD
208 /* PLMN list count obtained from indication, stored in the global static variable*/
209 /*OMAPS00061049 - 08-03-2006 */
210 static int Plmn_list_count = 0;
211 #endif
212
213
214 /*
215 * Data for top window
216 */
217 typedef struct
218 {
219 T_MMI_CONTROL mmi_control;
220 T_MFW_HND network_win; /* MFW win handler */
221 T_MFW_HND nm_handle; /* MFW network handler */
222 UBYTE aborted;
223 UBYTE forbidden;
224 UBYTE keep_plmn_list;
225 T_MFW_NETWORK_STRUCT *pplmn; /* pref. PLMN list */
226 T_MFW_PPLMN_MEM pplmn_mem;
227 UBYTE plmn_name[SIZE_PLMN_NAME]; /* textual network name */
228 UBYTE network_name[SIZE_NETWORK_NAME]; /* numeric network name */
229 USHORT status; /* current status */
230 UBYTE roaming_indicator; /* Roaming Indicator */
231 ListMenuData * network_list; /* PLMN available List */
232 UBYTE network_list_status;/* Network List Status */
233 UBYTE network_search_name[MAX_PLMN][6]; /* numeric network name */
234 T_MFW_HND network_search_win;
235 UBYTE Listposition;
236 } T_network;
237
238 T_network network_data;
239
240 typedef struct
241 {
242 T_MMI_CONTROL mmi_control;
243 T_MFW_HND win;
244 SHORT id;
245 T_MFW_HND parent;
246 T_MFW_HND kbd;
247 T_MFW_HND kbd_long;
248 T_MFW_HND menu;
249 T_MFW_HND dialog_win;
250 ListMenuData *network_list;
251 /*SPR 2635, replace pplmn data structure pointer with pointer to array of strings*/
252 char** pplmn_longnames;
253 CHAR buffer[6];
254 #ifdef NEW_EDITOR
255 T_AUI_EDITOR_DATA editor_info; /* SPR#1428 - SH - New Editor data */
256 #else
257 T_EDITOR_DATA editor_info; /* storage for editor attributes */
258 #endif
259 } T_network_OPT;
260
261
262 typedef enum
263 {
264 E_INIT,
265 E_BACK,
266 E_RETURN,
267 E_ABORT,
268 E_EXIT
269 } e_lists_events;
270
271 // Apr 14, 2004 REF: CRR 12641 xpradipg
272 static BOOLEAN Auto_Network_Select=false;
273 extern T_MFW_HND gPhbkMenu;// Jul 21, 2004 REF: CRR 13348 xvilliva
274 // Sep 23, 2004 REF: CRR 24562 xvilliva
275 extern int g_ensErr;
276
277 //x0pleela 10 Feb, 2006 ER: OMAPS00065203
278 EXTERN UBYTE gEons_alloc_active; /* EONS allocation and activation */
279
280 /*
281 * Local prototypes
282 */
283 static int network_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
284 static int network_nm_cb (T_MFW_EVENT event, T_MFW_HND para);
285 static void network_remove_network_log (void);
286 static UBYTE network_log_enabled (void);
287 static void network_list_cb (T_MFW_HND win, ListMenuData * ListData);
288 static void network_pref_list_cb (T_MFW_HND win, ListMenuData * ListData);
289 static ListMenuData * network_create_list (T_network * data, T_MFW_PLMN_LIST * plmn_list);
290 static ListMenuData * network_create_pref_list (T_network * data);
291 static ListMenuData * network_create_mobile_list (T_network_OPT * data);
292 static void network_start_animation_plmn_selection (int plmn_value);
293 static void network_start_animation (void);
294 static void network_stop_animation (void);
295 static void network_selected (void);
296 static void network_forbidden_plmn (void);
297 static void network_no_plmns (void);
298 void network_animation_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
299 //Jul 21, 2004 REF: CRR 13348 xvilliva
300 //We use a seperate callback for "Network Selected".
301 void network_select_animation_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
302 T_MFW_HND network_MNU_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr);
303 static T_MFW_HND network_MNU_create(MfwHnd parent_window);
304 static void network_MNU_destroy(MfwHnd own_window);
305 void network_MNU_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
306 static int network_MNU_mnu_cb (MfwEvt e, MfwMnu *m);
307 static int network_MNU_win_cb (MfwEvt e, MfwWin *w);
308 static int network_MNU_kbd_cb (MfwEvt e, MfwKbd *k);
309 static int network_request_plnm_list (MfwMnu* m, MfwMnuItem* i);
310 void network_delete_pref_plnm (T_MFW_HND win , USHORT identifier, UBYTE reason);
311 void network_info_screen (T_MFW_HND win, USHORT MessageId, T_VOID_FUNC funt_ptr );// xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
312 static int network_delete(MfwMnu* m, MfwMnuItem* i);
313 T_MFW_HND network_EDT_start (MfwMnu* m, MfwMnuItem* i);
314 static T_MFW_HND network_EDT_create (T_MFW_HND parent);
315 static void network_EDT_destroy (T_MFW_HND window);
316 static void network_EDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
317 static void network_EDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event);
318 /* SPR#2354 - SH -Added two new callbacks */
319 static void network_request_plmn_list_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
320 void network_mobile_list_changed_cb(T_MFW_HND win , USHORT identifier, UBYTE reason);
321
322
323 /*
324 * Local Definitions
325 */
326 #define NETWORK_LIMITED_SERVICE 420
327 #define NETWORK_NO_NETWORK 421
328 #define NETWORK_PLMN_LIST 422
329 #define NETWORK_PREFERRED_LIST 423
330 #define NETWORK_PPLMN_MEM_LIST 424
331 /* SPR759 - SH - Cell reselection */
332 #define NETWORK_CELL_SELECT 425
333
334 #define NETWORK_LIST_DISPLAY 430
335 #define NETWORK_LIST_SELECT_PLMN 432
336
337 #ifdef NEPTUNE_BOARD
338 /* List destory not done - added - OMAPS00061049 - 08-03-2006 */
339 #define NETWORK_LIST_DESTORY 440
340 #endif
341
342 /*
343 * Local Network List Status
344 */
345 #define NETWORK_LIST_DISPLAY_FIRST 1
346 #define NETWORK_LIST_SELECTED 2
347 #define NETWORK_LIST_REGISTRATION 3
348 #define NETWORK_PREF_LIST_SELECTED 4
349 #define NETWORK_MENU_ITEM 2
350
351 //nm 5.3.01 this number will be change
352 #define MAX_SHOW_OF_PLMN 99
353
354 static MfwMnuItem network_OPTItems [] =
355 {
356 {0,0,0,(char *)TxtSelectFromList, 0, (MenuFunc)network_request_plnm_list, item_flag_none},
357 {0,0,0,(char *)TxtEnterNetworkCode, 0, (MenuFunc)network_EDT_start, item_flag_none},
358 {0,0,0,(char *)TxtDelete, 0, (MenuFunc)network_delete, item_flag_none}
359 };
360
361 static MfwMnuAttr network_OPTAttrib =
362 {
363 &network_menuArea,
364 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
365 -1, /* use default font */
366 network_OPTItems, /* with these items */
367 sizeof(network_OPTItems)/sizeof(MfwMnuItem), /* number of items */
368 COLOUR_LIST_NETWORK, TxtNull, NULL, MNUATTRSPARE
369
370
371 };
372
373
374
375 static MfwMnuAttr network_menuAttrib =
376 {
377 &network_menuArea,
378 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
379 -1, /* use default font */
380 NULL, /* with these items */
381 0, /* number of items */
382 COLOUR_LIST_NETWORK, TxtNull, NULL, MNUATTRSPARE
383
384 };
385
386
387 /*******************************************************************************
388
389 $Function: networkInit
390
391 $Description:
392
393 $Returns:
394
395 $Arguments:
396
397 *******************************************************************************/
398 T_MFW_HND networkInit (T_MFW_HND parent_window)
399 {
400 return (network_create (parent_window));
401 }
402
403
404 /*******************************************************************************
405
406 $Function: networkExit
407
408 $Description: exit network handling (Backward Compatibility interface)
409
410 $Returns:
411
412 $Arguments:
413 *********************************************************************/
414
415
416 void networkExit (void)
417 {
418 network_destroy (network_data.network_win);
419 }
420
421 /*********************************************************************
422 *
423 * Network Dialog
424 *
425 * Window - Structure
426 *
427 * network --> network_list
428 * --> network_search_animation
429 *
430 *********************************************************************/
431
432 /*******************************************************************************
433
434 $Function: network_create
435
436 $Description: create network top window
437
438 $Returns:
439
440 $Arguments:
441
442 *******************************************************************************/
443 T_MFW_HND network_create (T_MFW_HND parent_window)
444 {
445 T_network * data = &network_data;
446 T_MFW_WIN * win;
447
448 TRACE_FUNCTION ("network_create()");
449
450 data->network_win = win_create (parent_window, 0, 0, (T_MFW_CB)network_win_cb);
451
452 if (data->network_win EQ 0)
453 return 0;
454
455 /*
456 * Create window handler
457 */
458 data->mmi_control.dialog = (T_DIALOG_FUNC)network;
459 data->mmi_control.data = data;
460 win = ((T_MFW_HDR *)data->network_win)->data;
461 win->user = (void *) data;
462
463 /*
464 * Initialise MFW
465 */
466 nm_init ();
467
468 /*
469 * Create any other handler
470 */
471 data->nm_handle = nm_create (data->network_win, E_NM_ALL_SERVICES, (T_MFW_CB)network_nm_cb);
472
473 memset (data->plmn_name, 0, SIZE_PLMN_NAME);
474 memset (data->network_name, 0, SIZE_NETWORK_NAME);
475
476 data->aborted = FALSE;
477 data->keep_plmn_list = FALSE;
478 data->forbidden = FALSE;
479
480 data->status = NETWORK_NO_SERVICE;
481 data->network_list = NULL;
482 data->network_search_win = 0;
483 data->Listposition = 0;
484
485
486
487 winShow(data->network_win);
488 /*
489 * return window handle
490 */
491 return data->network_win;
492 }
493
494 /*******************************************************************************
495
496 $Function: network_destroy
497
498 $Description: destroy network top window
499
500 $Returns:
501
502 $Arguments:
503
504 *******************************************************************************/
505 void network_destroy (T_MFW_HND own_window)
506 {
507 T_MFW_WIN * win;
508 T_network * data;
509
510 TRACE_FUNCTION ("network_destroy()");
511
512 if (own_window)
513 {
514 win = ((T_MFW_HDR *)own_window)->data;
515 data = (T_network *)win->user;
516
517 if (data)
518 {
519 /*
520 * Exit NM and delete NM handler
521 */
522 nm_exit ();
523 nm_delete (data->nm_handle);
524
525 /*
526 * Delete WIN handler
527 */
528 win_delete (data->network_win);
529 }
530 }
531 }
532
533 /*******************************************************************************
534
535 $Function: network
536
537 $Description: network top window dialog function
538
539 $Returns:
540
541 $Arguments:
542
543 *******************************************************************************/
544 void network (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
545 {
546 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
547 T_network * data = (T_network *)win_data->user;
548 T_MFW_NETWORK_STRUCT * plmn_ident;
549
550 TRACE_FUNCTION(">>> network()");
551
552
553 switch (event)
554 {
555 case NETWORK_NO_SERVICE:
556 case NETWORK_LIMITED_SERVICE:
557 TRACE_EVENT ("NETWORK NO/LIMITED SERVICE");
558 /*
559 * Set Status
560 */
561 data->status = NETWORK_NO_SERVICE;
562
563 /*
564 * Check if network log is enabled
565 */
566 if (network_log_enabled ())
567 {
568 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
569 }
570 else
571 {
572 SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
573 if (data->network_list NEQ NULL)
574 {
575 switch (data->network_list_status)
576 {
577 case NETWORK_LIST_REGISTRATION:
578 TRACE_EVENT ("NETWORK_LIST_REGISTRATION");
579 /*
580 * Present list of available PLMNs again
581 *
582 * Start the available plmn search
583 */
584 nm_avail_plmn_list();
585 //Sep 23, 2004 REF: CRR 24562 xvilliva
586 //After retrieving the list we see if an error occured
587 //and flash an alert to the user accordingly.
588 if(g_ensErr == 1)
589 {
590 g_ensErr = 0;
591 info_screen(0, TxtNotAllowed, TxtNull, NULL);
592 }
593
594 /*
595 * remove network log if needed
596 */
597 network_remove_network_log ();
598
599 network_data.forbidden = TRUE;
600 break;
601
602 case NETWORK_LIST_SELECTED:
603 TRACE_EVENT ("NETWORK_LIST_SELECTED");
604 /*
605 * After registration start, MFW returns the current status
606 */
607 data->network_list_status= NETWORK_LIST_REGISTRATION;
608 data->keep_plmn_list = TRUE;
609 break;
610 }
611 }
612 }
613 #ifdef MMI_HOMEZONE_ENABLED
614 /* sh - tell homezone there is no network */
615 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
616 //Modified to incorporate the third argument.
617 homezoneUpdate(0,0,0);
618 #endif
619 break;
620
621 case NETWORK_SEARCH_NETWORK:
622 TRACE_EVENT ("NETWORK SEARCH NETWORK");
623 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
624 break;
625
626 case NETWORK_FULL_SERVICE:
627 TRACE_EVENT("NETWORK_FULL_SERVICE");
628 /*
629 * Set Status
630 */
631 data->status = NETWORK_FULL_SERVICE;
632
633 /*
634 * Copy Network Name in textual and numerical format
635 *
636 * NOTE: Service Provider Name is not used
637 * Operator Name from SIM needs CPHS support by MFW
638 */
639 plmn_ident = (T_MFW_NETWORK_STRUCT *)parameter;
640
641 //x0pleela 15 Feb, 2006 ER: OMAPs00065203
642 //Removed the global variable gOper_sel_done and have introduced 2 functions which will
643 //set and get the status of the operator selection
644
645 //x0pleela 9 Feb, 2006 ER:OMAPS00065203
646 //Check if EONS is allocated and activated. If not, and if operator name is not yet obtained from other sources
647 //get operator name from other sources
648 if((!gEons_alloc_active ) AND(!get_opn_sel_done()) )
649 {
650 //get operator name from other sources CPHS or NITZ or ROM
651 nm_get_opername(plmn_ident);
652 }
653 set_opn_sel_done(FALSE);
654
655 #ifdef NO_ASCIIZ
656 memcpy (data->plmn_name, &plmn_ident->network_long.data, SIZE_PLMN_NAME);
657 #else
658 memcpy (data->plmn_name, plmn_ident->network_long, SIZE_PLMN_NAME);
659 #endif
660 memcpy (data->network_name, plmn_ident->network_numeric, SIZE_NETWORK_NAME);
661
662 /*
663 * If network name is not known use numeric representation as default.
664 */
665 #ifdef NO_ASCIIZ
666 if (plmn_ident->network_long.len EQ 0)
667 #else
668 if (strlen ((char *)(plmn_ident->network_long)) EQ 0)
669 #endif
670 strcpy ((char *)data->plmn_name, (char *)data->network_name);
671
672 /*
673 * Store Roaming Indicator
674 */
675 data->roaming_indicator = plmn_ident->roaming_indicator;
676
677 network_stop_animation ();
678 /*
679 * Inform Idle screen
680 */
681 SEND_EVENT (idle_get_window(), NETWORK_FULL_SERVICE, 0, 0);
682
683 /*
684 * If network list is available
685 */
686 if (data->network_list NEQ NULL)
687 {
688 switch (data->network_list_status)
689 {
690 case NETWORK_LIST_REGISTRATION:
691 if(data->keep_plmn_list EQ FALSE)
692 {
693 TRACE_EVENT("NETWORK_LIST_REGISTRATION No 1");
694
695 #ifdef FF_2TO1_PS
696 #ifndef NEPTUNE_BOARD
697 FREE_MEMORY ((UBYTE *)data->network_list->List,
698 MMREG_MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
699 #else
700 /* Free the allocated memory for PLMN list window -
701 OMAPS00061049 - 08-03-2006 */
702 FREE_MEMORY ((UBYTE *)data->network_list->List,
703 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
704 #endif
705
706 #else
707
708 #ifndef NEPTUNE_BOARD
709 FREE_MEMORY ((UBYTE *)data->network_list->List,
710 MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
711 #else
712 /* Free the allocated memory for PLMN list window -
713 OMAPS00061049 - 08-03-2006 */
714 FREE_MEMORY ((UBYTE *)data->network_list->List,
715 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
716 #endif
717
718 #endif
719 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
720 data->network_list = NULL;
721 }
722 data->keep_plmn_list = FALSE;
723 break;
724 case NETWORK_LIST_SELECTED:
725 /*
726 * After registration start, MFW returns the current status
727 */
728 TRACE_EVENT("NETWORK_LIST_SELECTED");
729 data->network_list_status= NETWORK_LIST_REGISTRATION;
730 /* Commented out and moved
731 network_selected(); */
732 break;
733 }
734 // API - Moved from previous position
735 network_selected();
736 }
737
738 // Apr 14, 2004 REF: CRR 12641 xpradipg
739 if(Auto_Network_Select==true)
740 {
741 network_selected();
742 Auto_Network_Select=false;
743 }
744
745 break;
746
747 case NETWORK_NO_NETWORK:
748 TRACE_EVENT ("NETWORK NO NETWORK");
749 /*
750 * No PLMN found after search for available PLMNs
751 */
752 network_stop_animation ();
753 if (network_log_enabled ())
754 {
755 data->status = NETWORK_NO_SERVICE;
756 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
757 }
758 else
759 {
760 /*
761 * No Networks found.
762 */
763 data->status = NETWORK_NO_SERVICE;
764 SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
765 }
766 #ifdef MMI_HOMEZONE_ENABLED
767 /* sh - tell homezone there is no network */
768 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
769 //Modified to incorporate the third argument.
770 homezoneUpdate(0,0,0);
771 #endif
772 break;
773
774 case NETWORK_PLMN_LIST:
775 TRACE_EVENT ("NETWORK PLMN LIST");
776 TRACE_EVENT (">>NETWORK PLMN LIST");
777 /*
778 * PLMN list found
779 */
780 if (network_data.aborted != TRUE)
781 {
782 if (network_log_enabled ())
783 {
784 data->status = NETWORK_NO_SERVICE;
785 SEND_EVENT (idle_get_window(), NETWORK_NO_PLMN_XXX_AVAIL, 0, 0);
786 }
787 else
788 {
789 T_MFW_PLMN_LIST * plmn_list;
790 /*
791 * Networks founds.
792 */
793 data->status = NETWORK_NO_SERVICE;
794 /*
795 * If network list is available, destroy
796 */
797 if (data->network_list NEQ NULL)
798 {
799
800 #ifdef FF_2TO1_PS
801 #ifndef NEPTUNE_BOARD
802 FREE_MEMORY ((UBYTE *)data->network_list->List,
803 MMREG_MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
804 #else
805 /* Free the allocated memory for PLMN list window -
806 OMAPS00061049 - 08-03-2006 */
807 FREE_MEMORY ((UBYTE *)data->network_list->List,
808 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
809 #endif
810
811 #else
812 #ifndef NEPTUNE_BOARD
813 FREE_MEMORY ((UBYTE *)data->network_list->List,
814 MAX_PLMN_ID * sizeof (T_MFW_MNU_ITEM));
815 #else
816 /* Free the allocated memory for PLMN list window -
817 OMAPS00061049 - 08-03-2006 */
818 FREE_MEMORY ((UBYTE *)data->network_list->List,
819 Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
820 #endif
821
822 #endif
823
824 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
825 data->network_list = NULL;
826 }
827
828 /*
829 * If list is empty, show info screen
830 */
831 plmn_list = (T_MFW_PLMN_LIST *)parameter;
832
833 #ifdef NEPTUNE_BOARD
834 /* Count assigned to global static variable - OMAPS00061049 - 08-03-2006 */
835 Plmn_list_count = plmn_list->count;
836 #endif
837
838 if (plmn_list->count EQ 0)
839 {
840 network_stop_animation ();
841 network_no_plmns ();
842 }
843 else
844 {
845 /*
846 * Create and present list of available PLMNs
847 *
848 */
849
850 /* Pass the plmn_list which already hold the parameter data - OMAPS00061049 - 08-03-2006 */
851 #ifndef NEPTUNE_BOARD
852 data->network_list = network_create_list (data, parameter);
853 #else
854 data->network_list = network_create_list (data, plmn_list );
855 #endif
856 data->network_list_status = NETWORK_LIST_DISPLAY_FIRST;
857 network_stop_animation ();
858 listDisplayListMenu (win, data->network_list, (ListCbFunc)network_list_cb,0);
859
860 // change by Sasken ( Pradeep/Vadiraj) on Apr 07th 2004
861 // Issue Number : SPR#12654 on 07/04/04 by Pradeep/Vadiraj
862 // Bug : Pressing "search" button does not trigger anything
863 // Solution: When the ME is already camped on to a network the NoNetwork event is not sent.
864 // Commented the following line
865 // SEND_EVENT (idle_get_window(), NETWORK_NO_SERVICE, 0, 0);
866
867 if (network_data.forbidden == TRUE)
868 {
869 network_forbidden_plmn();
870 network_data.forbidden = FALSE;
871 }
872 }
873 }
874 }
875 else
876 {
877 network_data.aborted = FALSE;
878 }
879 #ifdef MMI_HOMEZONE_ENABLED
880 /* sh - tell homezone there is no network */
881 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
882 //Modified to incorporate the third argument.
883 homezoneUpdate(0,0,0);
884 #endif
885 break;
886
887 case NETWORK_LIST_SELECT_PLMN:
888 TRACE_EVENT ("NETWORK LIST_SELECT");
889 TRACE_EVENT (">> NETWORK LIST_SELECT");
890 /*
891 * A network has been selected from the PLMN available list
892 * Start manual registration and start Search animation.
893 */
894 network_start_animation_plmn_selection (value);
895 data->network_list_status = NETWORK_LIST_SELECTED;
896 nm_select_plmn ((U8 *)network_data.network_search_name[value]);
897 //Sep 23, 2004 REF: CRR 24562 xvilliva
898 //After retrieving the list we see if an error occured
899 //and flash an alert to the user accordingly.
900 if(g_ensErr == 1)
901 {
902 g_ensErr = 0;
903 info_screen(0, TxtNotAllowed, TxtNull, NULL);
904 }
905 break;
906 case NETWORK_PPLMN_MEM_LIST:
907 {
908 T_MFW_PPLMN_MEM *pplmn_mem;
909 UBYTE i;
910
911 TRACE_EVENT (">> NETWORK PPLMN MEM LIST");
912 /* Save the number of PLMN records:
913 * maxRcd = maximum preferred PLMN records on the SIM card
914 * usedRcd = used preferred PLMN records on the SIM card
915 */
916 pplmn_mem = (T_MFW_PPLMN_MEM *)parameter;
917
918 network_data.pplmn_mem.maxRcd = pplmn_mem->maxRcd;
919 network_data.pplmn_mem.usedRcd = pplmn_mem->usedRcd;
920
921 /*
922 * Request preferred PLMN list from the SIM
923 */
924
925
926 network_data.pplmn = (T_MFW_NETWORK_STRUCT *)ALLOC_MEMORY ((pplmn_mem->maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
927
928 if (network_data.pplmn EQ 0)
929 {
930 return;
931 }
932
933 if (pplmn_mem->usedRcd > 0)
934 {
935 // request MFW to fill up the pref. PLMN list
936 nm_pref_plmn_list(network_data.pplmn, pplmn_mem->maxRcd, 1);
937 }
938 else
939 {
940 // doesnt make sense to request the MFW to fill up the list
941 // when the "pplmn_mem->usedRcd" is 0
942
943 TRACE_EVENT(">> NETWORK PPLMN MEM LIST - ELSE Loop");
944 for (i=0; i < (network_data.pplmn_mem.maxRcd); i++)
945 {
946 #ifdef NO_ASCIIZ
947 network_data.pplmn[i].network_long.len = 0;
948 network_data.pplmn[i].network_short.len = 0;
949 #else
950 memset(network_data.pplmn[i].network_long, '\0', LONG_NAME);
951 memset(network_data.pplmn[i].network_short, '\0', SHORT_NAME);
952 #endif
953 memset(network_data.pplmn[i].network_numeric, '\0', NUMERIC_LENGTH);
954 }
955
956 data->network_list = network_create_pref_list (data);
957 listDisplayListMenu (win, data->network_list,(ListCbFunc)network_pref_list_cb,0);
958 }
959
960 }
961 break;
962
963 case NETWORK_PREFERRED_LIST:
964 {
965
966 /* UBYTE i; */ /* Warning Correction */
967
968
969 TRACE_EVENT (">>NETWORK PREFERRED LIST");
970 /*
971 * Create and present the preferred list of PLMNs
972 *
973 */
974
975 //nm network_stop_animation ();
976
977
978 data->network_list = network_create_pref_list (data);
979
980 /* cq12719 Check if prefered list info resource has been created.16-03-04 MZ */
981 if(data->network_list != NULL)
982 listDisplayListMenu (win, data->network_list,(ListCbFunc)network_pref_list_cb,0);
983 }
984 break;
985
986 case NETWORK_CELL_SELECT:
987 {
988 /* If Homezone is active, inform it of the new cell data */
989 T_MFW_CELL_STRUCT *cell_data;
990
991 TRACE_EVENT(">>NETWORK CELL SELECT");
992
993 cell_data = (T_MFW_CELL_STRUCT *)parameter;
994
995 #ifdef MMI_HOMEZONE_ENABLED
996 /* SPR759 - SH - send cell reselection info to homezone */
997
998 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
999 //Modified to incorporate the third argument.
1000 homezoneUpdate(cell_data->lid, cell_data->ci, 0);
1001 #endif
1002 break;
1003 #ifdef NEPTUNE_BOARD
1004 /* Destory the list when select softkey is pressed / back softkey is pressed */
1005 /* OMAPS00061049 - 08-03-2006 - BEGIN*/
1006 case NETWORK_LIST_DESTORY:
1007 TRACE_EVENT ("Inside NETWORK_LIST_DESTORY Event");
1008
1009 /* Destory the list window */
1010 listsDestroy(data->network_list->win);
1011
1012 TRACE_EVENT ("Destoryed list window successfully");
1013
1014 /*
1015 * If network list is available, destroy
1016 */
1017 if (data->network_list NEQ NULL)
1018 {
1019
1020 #ifdef FF_2TO1_PS
1021 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
1022 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1023 #else
1024 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
1025 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
1026 #endif
1027
1028 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
1029 data->network_list = NULL;
1030 }
1031
1032 TRACE_EVENT ("List window memory freed");
1033 break;
1034 /* OMAPS00061049 - 08-03-2006 - END */
1035 #endif
1036
1037
1038 }
1039 }
1040 }
1041
1042 /*******************************************************************************
1043
1044 $Function: network_win_cb
1045
1046 $Description: network top window
1047
1048 $Returns:
1049
1050 $Arguments:
1051
1052 *******************************************************************************/
1053 static int network_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
1054 {
1055 /*
1056 * Top Window has no output
1057 */
1058 return 1;
1059 }
1060
1061
1062 /*******************************************************************************
1063
1064 $Function: network_nm_cb
1065
1066 $Description: network handler (mfw callback handler)
1067
1068 $Returns:
1069
1070 $Arguments:
1071
1072 *******************************************************************************/
1073 static int network_nm_cb (T_MFW_EVENT event, T_MFW_HND para)
1074 {
1075 TRACE_FUNCTION("network_nm_cb");
1076
1077 switch(event)
1078 {
1079 case E_NM_FULL_SERVICE:
1080 //x0pleela 9 Feb, 2006 ER:OMAPS00065203
1081 //Handling E_NM_OPN for operator name display
1082 case E_NM_OPN:
1083 SEND_EVENT (network_data.network_win, NETWORK_FULL_SERVICE, 0, para);
1084 break;
1085
1086 case E_NM_LIMITED_SERVICE:
1087 SEND_EVENT (network_data.network_win, NETWORK_LIMITED_SERVICE, 0, para);
1088 break;
1089
1090 case E_NM_NO_SERVICE:
1091 SEND_EVENT (network_data.network_win, NETWORK_NO_SERVICE, 0, para);
1092 break;
1093
1094 case E_NM_SEARCH_NETWORK:
1095 SEND_EVENT (network_data.network_win, NETWORK_SEARCH_NETWORK, 0, para);
1096 break;
1097
1098 case E_NM_NO_NETWORK:
1099 SEND_EVENT (network_data.network_win, NETWORK_NO_NETWORK, 0, para);
1100 break;
1101
1102 case E_NM_PLMN_LIST:
1103 SEND_EVENT (network_data.network_win, NETWORK_PLMN_LIST, 0, para);
1104 break;
1105
1106 case E_NM_DEREGISTRATION:
1107 TRACE_EVENT("MmiNetwork:E_NM_DEREGISTRATION");
1108 mainShutdown();
1109 break;
1110 case E_NM_PREF_PLMN_LIST:
1111 TRACE_EVENT("MmiNetwork:E_NM_PREF_PLMN_LIST");
1112 SEND_EVENT (network_data.network_win, NETWORK_PREFERRED_LIST, 0, para);
1113 break;
1114 case E_NM_PPLMN_MEM:
1115 TRACE_EVENT("MmiNetwork:E_NM_PPLMN_MEM");
1116 SEND_EVENT (network_data.network_win, NETWORK_PPLMN_MEM_LIST, 0, para);
1117 break;
1118 /* SH 29-04-02 - Cell reselection */
1119 case E_NM_CELL_SELECT:
1120 TRACE_EVENT("MmiNetwork:E_NM_CELL_SELECT");
1121 SEND_EVENT (network_data.network_win, NETWORK_CELL_SELECT, 0, para);
1122 break;
1123 /* SPR919 - SH - Band selection */
1124 case E_NM_BAND:
1125 TRACE_EVENT("MmiNetwork:E_NM_BAND");
1126 nm_registration (nm_get_mode (),0, 0);
1127 //Sep 23, 2004 REF: CRR 24562 xvilliva
1128 //After retrieving the list we see if an error occured
1129 //and flash an alert to the user accordingly.
1130 if(g_ensErr == 1)
1131 {
1132 g_ensErr = 0;
1133 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1134 }
1135 break;
1136
1137 default:
1138 return 0;
1139 }
1140 return 1;
1141 }
1142
1143 /*******************************************************************************
1144
1145 $Function: nm_flag_log_off
1146
1147 $Description: Attribut function for menu entries.
1148 It defines whether the network log off function shall
1149 be displayed or not.
1150
1151 $Returns:
1152
1153 $Arguments:
1154
1155 *******************************************************************************/
1156 USHORT nm_flag_log_off (T_MFW_MNU * m, T_MFW_MNU_ATTR * ma, T_MFW_MNU_ITEM * mi)
1157 {
1158 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
1159 return 0;
1160
1161 return MNU_ITEM_HIDE;
1162 }
1163 /*******************************************************************************
1164
1165 $Function: nm_flag_log_off
1166
1167 $Description: Attribut function for menu entries.
1168 It defines whether the network log off function shall
1169 be displayed or not.
1170
1171 $Returns:
1172
1173 $Arguments:
1174
1175 *******************************************************************************/
1176 USHORT nm_flag_log_on (T_MFW_MNU * m, T_MFW_MNU_ATTR * ma, T_MFW_MNU_ITEM * mi)
1177 {
1178 if (FFS_flashData.network_name == NULL)
1179 {
1180 return MNU_ITEM_HIDE;
1181 }
1182 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_NOT_USED)
1183 return 0;
1184
1185 return MNU_ITEM_HIDE;
1186 }
1187
1188 /*******************************************************************************
1189
1190 $Function: network_set_mode_auto
1191
1192 $Description: Start a automatic registration
1193
1194 $Returns:
1195
1196 $Arguments:
1197
1198 *******************************************************************************/
1199 int network_set_mode_auto(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1200 {
1201 TRACE_FUNCTION ("network_set_mode_auto()");
1202
1203 /*
1204 * Save the automatic mode in PCM for next power on
1205 */
1206 nm_set_mode(NM_AUTOMATIC);
1207
1208 /*
1209 * Start the registration of full service
1210 */
1211 nm_registration (NM_AUTOMATIC,0, FALSE);
1212
1213 /*
1214 * remove network log if needed
1215 */
1216 network_remove_network_log ();
1217
1218 /*
1219 * Remove Main Menu
1220 */
1221 //JVJEmenuExit();
1222
1223 network_start_animation ();
1224 // Apr 14, 2004 REF: CRR 12641 xpradipg
1225 Auto_Network_Select=true;
1226 return 1;
1227 }
1228 /*******************************************************************************
1229
1230 $Function: network_set_mode_man
1231
1232 $Description: Start a manual registration
1233
1234 $Returns:
1235
1236 $Arguments:
1237
1238 *******************************************************************************/
1239 int network_set_mode_man(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1240 {
1241 TRACE_FUNCTION ("network_set_mode_man()");
1242
1243 /*
1244 * Save the automatic mode in PCM for next power on
1245 */
1246 nm_set_mode(NM_MANUAL);
1247
1248 /*
1249 * Start the available plmn search
1250 */
1251 nm_avail_plmn_list();
1252 //Sep 23, 2004 REF: CRR 24562 xvilliva
1253 //After retrieving the list we see if an error occured
1254 //and flash an alert to the user accordingly.
1255 if(g_ensErr == 1)
1256 {
1257 g_ensErr = 0;
1258 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1259 return 1;
1260 }
1261
1262 /*
1263 * remove network log if needed
1264 */
1265 network_remove_network_log ();
1266
1267 /*
1268 * Remove Main Menu
1269 */
1270 //nm menuExit();
1271
1272 network_start_animation ();
1273
1274 network_data.aborted = FALSE;
1275 return 1;
1276 }
1277
1278 /*
1279 +--------------------------------------------------------------------+
1280 | PROJECT : MMI (6366) MODULE : MmiNetwork |
1281 | STATE : code ROUTINE : network_pref_list |
1282 +--------------------------------------------------------------------+
1283
1284 PURPOSE : Show the preferred list
1285
1286 */
1287 int network_pref_list(T_MFW_MNU *m, T_MFW_MNU_ITEM *mi)
1288 {
1289 //TRACE_FUNCTION ("network_pref_list()");
1290
1291 /*
1292 * Request the maximum number of preferred PLMN records
1293 * on the SIM card
1294 */
1295 nm_pplmn_mem_req();
1296
1297
1298
1299 return 1;
1300 }
1301
1302
1303 /*******************************************************************************
1304
1305 $Function: network_remove_network_log
1306
1307 $Description: Reset network log if set.
1308
1309 $Returns:
1310
1311 $Arguments:
1312
1313 *******************************************************************************/
1314 static void network_remove_network_log (void)
1315 {
1316
1317 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
1318 {
1319 /*
1320 * Until now the network log has been used.
1321 * Now write to FFS
1322 */
1323 FFS_flashData.net_log_status = NM_LOG_AVAIL_NOT_USED;
1324 flash_write();
1325
1326 }
1327 }
1328
1329 /*******************************************************************************
1330
1331 $Function: network_log_off
1332
1333 $Description: Removes a network log and returns to automatic registration.
1334
1335 $Returns:
1336
1337 $Arguments:
1338
1339 *******************************************************************************/
1340 int network_log_off(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1341 {
1342 TRACE_FUNCTION ("network_log_off()");
1343
1344 /*
1345 * Same behaviour as automatic registration
1346 */
1347 network_set_mode_auto (m,i);
1348
1349
1350 network_start_animation ();
1351
1352 return 1;
1353 }
1354
1355 /*******************************************************************************
1356
1357 $Function: network_log_on
1358
1359 $Description: Sets a network log.
1360
1361 $Returns:
1362
1363 $Arguments:
1364
1365 *******************************************************************************/
1366 int network_log_on(T_MFW_MNU *m, T_MFW_MNU_ITEM *i)
1367 {
1368
1369
1370 TRACE_FUNCTION ("network_log_on()");
1371
1372
1373 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_NOT_USED OR
1374 FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
1375 {
1376 /*
1377 * Until now the network log has been not used.
1378 * Now set the PCM.
1379 */
1380 FFS_flashData.net_log_status = NM_LOG_AVAIL_USED;
1381 memcpy (FFS_flashData.plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
1382 memcpy (FFS_flashData.network_name, network_data.network_name, SIZE_NETWORK_NAME);
1383
1384
1385 flash_write();
1386 /*
1387 * Save the manual mode in PCM for next power on
1388 */
1389 nm_set_mode(NM_MANUAL);
1390
1391 /*
1392 * Start the registration of the logged network
1393 */
1394 nm_select_plmn (network_data.network_name);
1395 //Sep 23, 2004 REF: CRR 24562 xvilliva
1396 //After retrieving the list we see if an error occured
1397 //and flash an alert to the user accordingly.
1398 if(g_ensErr == 1)
1399 {
1400 g_ensErr = 0;
1401 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1402 }
1403 }
1404
1405
1406 network_start_animation ();
1407
1408 return 1;
1409 }
1410
1411 /*******************************************************************************
1412
1413 $Function: network_start_full_service
1414
1415 $Description: Starts a full service registration.
1416 a) manual selection
1417 b) automatic selection
1418 c) network log selection
1419
1420 $Returns:
1421
1422 $Arguments:
1423
1424 *******************************************************************************/
1425 void network_start_full_service(void)
1426 {
1427
1428 TRACE_FUNCTION ("network_start_full_service()");
1429
1430 network_data.status = NETWORK_SEARCH_NETWORK;
1431
1432 if(FFS_flashData.plmn_name == NULL) //if no network data
1433 { /*
1434 * Start normal Registration
1435 */
1436 #if defined (WIN32)
1437 EXTERN UBYTE mmi_reg_mode;
1438
1439 if (mmi_reg_mode EQ 0)
1440 nm_registration (NM_AUTOMATIC,0, 0);
1441 else
1442 nm_registration (NM_MANUAL,0, 0);
1443 #else
1444 if (nm_get_mode() == NM_MANUAL)
1445 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
1446 nm_registration (nm_get_mode (),0, 0);
1447 #endif
1448 }
1449 else
1450 {
1451 switch (FFS_flashData.net_log_status)
1452 {
1453 case NM_LOG_AVAIL_USED:
1454 memcpy (network_data.plmn_name, FFS_flashData.plmn_name, SIZE_PLMN_NAME);
1455 memcpy (network_data.network_name, FFS_flashData.network_name, SIZE_NETWORK_NAME);
1456 nm_select_plmn (network_data.network_name);
1457 break;
1458 default:
1459 if (nm_get_mode() == NM_MANUAL)
1460 SEND_EVENT (idle_get_window(), NETWORK_SEARCH_NETWORK, 0, 0);
1461 nm_registration (nm_get_mode (),0, 0);
1462 break;
1463 }
1464 }
1465 //Sep 23, 2004 REF: CRR 24562 xvilliva
1466 //After retrieving the list we see if an error occured
1467 //and flash an alert to the user accordingly.
1468 if(g_ensErr == 1)
1469 {
1470 g_ensErr = 0;
1471 info_screen(0, TxtNotAllowed, TxtNull, NULL);
1472 }
1473 }
1474
1475 /*******************************************************************************
1476
1477 $Function: network_get_name
1478
1479 $Description: Returns the textual and numeric representation of the
1480 network name.
1481
1482 $Returns:
1483
1484 $Arguments:
1485
1486 *******************************************************************************/
1487 void network_get_name(T_CURRENT_NETWORK * nm)
1488 {
1489 #ifdef NO_ASCIIZ
1490 T_MFW_SP_NAME service_provider_name;
1491 #else
1492 U8 service_provider_name[LONG_NAME];
1493 #endif
1494 TRACE_FUNCTION ("network_get_name()");
1495
1496 //x0pleela 15 Feb, 2006 ER: OMAPS00065203
1497 //Included flag NEPTUNE_BOARD to retain old code for operator get name and
1498 //added new code for this ER also
1499
1500 #ifndef NEPTUNE_BOARD
1501
1502 //x0pleela 09 Feb, 2006 ER: OMAPS00065203
1503 //Removed the code as prioritized operator name is already updated to network_data
1504 // and CPHS check is not required
1505
1506 //x0pleela 09 Feb, 2006 ER: OMAPS00065203
1507 //Updating prioritized operator name
1508 memset( nm->plmn_name, 0, SIZE_PLMN_NAME );
1509 memset( nm->network_name, 0, SIZE_NETWORK_NAME );
1510 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
1511 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
1512
1513 memset( nm->service_provider_name, 0, SP_NAME );
1514 #else
1515 if (CphsPresent() )//if CPHS supported
1516 {
1517 T_MFW_CPHS_OP_NAME* operator_name;
1518 operator_name = CphsRequestOperatorName(); //get operator name
1519
1520 if (operator_name->longName.data[0] != NULL)//if name not blank
1521 {
1522 memcpy(nm->plmn_name, operator_name->longName.data, SIZE_PLMN_NAME);
1523 TRACE_EVENT("Reading PLMN from SIM");
1524 }
1525 else
1526 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
1527
1528 if (operator_name->shortName.data[0] != NULL)//if name not blank
1529 {
1530 memcpy(nm->network_name, operator_name->shortName.data, SIZE_NETWORK_NAME);
1531 }
1532 else
1533 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
1534 }
1535 else
1536 {
1537
1538 memcpy (nm->plmn_name, network_data.plmn_name, SIZE_PLMN_NAME);
1539 memcpy (nm->network_name, network_data.network_name, SIZE_NETWORK_NAME);
1540
1541 }
1542 /* Marcus: Issue 1618: 24/01/2003: Start */
1543 /* Obtain the service provider name (from the SIM EF-SPN file) if any */
1544 nm->service_provider_name[0] = '\0';
1545 #endif
1546 #ifdef NO_ASCIIZ
1547 nm_get_spn(&service_provider_name);
1548 if ((service_provider_name.len != 0) &&
1549 (service_provider_name.data[0] != '\0'))
1550 {
1551 if (service_provider_name.len > sizeof(nm->service_provider_name)-1)
1552 service_provider_name.len = sizeof(nm->service_provider_name)-1;
1553
1554 memcpy(nm->service_provider_name,
1555 service_provider_name.data,
1556 service_provider_name.len);
1557
1558 nm->service_provider_name[service_provider_name.len] = '\0';
1559 }
1560 #else
1561 nm_get_spn(service_provider_name);
1562 if (strlen(service_provider_name))
1563 {
1564 strncpy(nm->service_provider_name,
1565 service_provider_name,
1566 sizeof(nm->service_provider_name)-1);
1567
1568 nm->service_provider_name[sizeof(nm->service_provider_name)-1] = '\0';
1569 }
1570 #endif
1571 /* Marcus: Issue 1618: 24/01/2003: End */
1572 nm->roaming_indicator = network_data.roaming_indicator;
1573 }
1574
1575 /*******************************************************************************
1576
1577 $Function: network_log_enabled
1578
1579 $Description: Checks whether a network log is active or not.
1580
1581 $Returns:
1582
1583 $Arguments:
1584
1585 *******************************************************************************/
1586 static UBYTE network_log_enabled (void)
1587 {
1588
1589 TRACE_FUNCTION ("network_log_enabled()");
1590
1591 if (FFS_flashData.net_log_status EQ NM_LOG_AVAIL_USED)
1592 return TRUE;
1593
1594 return FALSE;
1595 }
1596
1597 /*******************************************************************************
1598
1599 $Function: ListMenuData
1600
1601 $Description: Creates a list of available PLMNs for selection.
1602
1603 $Returns:
1604
1605 $Arguments:
1606
1607 *******************************************************************************/
1608 static ListMenuData * network_create_list (T_network * data, T_MFW_PLMN_LIST * plmn_list)
1609 {
1610 UBYTE i;
1611
1612 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
1613
1614 if (list_menu_data EQ 0)
1615 return NULL;
1616
1617 /* Allocated memory only for availble number of plmn list count */
1618 /* OMAPS00061049 - 08-03-2006 */
1619 #ifndef NEPTUNE_BOARD
1620 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (MAX_PLMN * sizeof (T_MFW_MNU_ITEM));
1621 #else
1622 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (plmn_list->count * sizeof (T_MFW_MNU_ITEM));
1623 #endif
1624
1625 if (list_menu_data->List EQ 0)
1626 return NULL;
1627
1628 /*
1629 * Fill Menu List
1630 */
1631 #ifdef FF_2TO1_PS
1632 for (i=0;i<MMREG_MAX_PLMN_ID;i++)
1633 #else
1634 for (i=0;i<MAX_PLMN_ID;i++)
1635 #endif
1636 {
1637 #ifndef NEPTUNE_BOARD
1638 /* Taken this statement inside the condition */
1639 /* OMAPS00061049 - 08-03-2006 */
1640 mnuInitDataItem(&list_menu_data->List[i]);
1641 #endif
1642
1643 if (i < plmn_list->count)
1644 {
1645 #ifdef NEPTUNE_BOARD
1646 mnuInitDataItem(&list_menu_data->List[i]);
1647 #endif
1648
1649 /*
1650 * set network name
1651 */
1652 #ifdef NO_ASCIIZ
1653 if (plmn_list->plmn[i].network_long.len NEQ 0)
1654 {
1655 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_long.data;
1656 }
1657 #else
1658 if (strlen((char *)plmn_list->plmn[i].network_long) NEQ 0)
1659 {
1660 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_long;
1661 }
1662 #endif
1663 else
1664 {
1665 list_menu_data->List[i].str = (char *)plmn_list->plmn[i].network_numeric;
1666 }
1667
1668 /*
1669 * Store numeric network name in any case
1670 */
1671 strncpy ((char *)data->network_search_name[i], (char *)plmn_list->plmn[i].network_numeric, 6);
1672
1673
1674 /*
1675 * NOTE : add forbidden indicator
1676 */
1677 list_menu_data->List[i].flagFunc = item_flag_none;
1678 }
1679 else
1680 {
1681 }
1682 }
1683
1684 /*
1685 * Fill common parameter for list handling
1686 */
1687
1688 list_menu_data->ListLength = plmn_list->count;
1689 list_menu_data->ListPosition = 1;
1690 list_menu_data->CursorPosition = 1;
1691 list_menu_data->SnapshotSize = plmn_list->count;
1692 list_menu_data->Font = 0;
1693 list_menu_data->LeftSoftKey = TxtSoftSelect;
1694 list_menu_data->RightSoftKey = TxtSoftBack;
1695 // Sep 8, 2004 REF: CRR 16062 xvilliva
1696 //Though all the key events are monitered, the listsKeyEvent()
1697 //responds to a few keys which includes KCD_MNUSELECT.
1698 list_menu_data->KeyEvents = KEY_ALL;
1699 list_menu_data->Reason = 0;
1700 list_menu_data->Strings = TRUE;
1701 list_menu_data->Attr = &network_menuAttrib;
1702 list_menu_data->autoDestroy = TRUE;
1703 list_menu_data->listCol = COLOUR_LIST_XX;
1704
1705
1706 return list_menu_data;
1707 }
1708
1709 /*******************************************************************************
1710
1711 $Function: network_create_pref_list
1712
1713 $Description: Creates a list of preferred PLMNs for selection.
1714
1715 $Returns:
1716
1717 $Arguments:
1718
1719 *******************************************************************************/
1720 static ListMenuData * network_create_pref_list (T_network * data)
1721 {
1722 UBYTE i;
1723
1724 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
1725
1726 if (list_menu_data EQ 0)
1727 {
1728 return NULL;
1729 }
1730
1731 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY ((data->pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
1732
1733 if (list_menu_data->List EQ 0)
1734 {
1735
1736 /* cq12719 If second memory alloc fails Free the memory allocated for list menu data. 16-03-04 MZ */
1737 if(NULL != list_menu_data)
1738 FREE_MEMORY ((void *)list_menu_data, sizeof (ListMenuData));
1739
1740 return NULL;
1741 }
1742
1743 TRACE_EVENT ("network_create_pref_list ()");
1744
1745
1746
1747 /*
1748 * Fill Menu List
1749 */
1750 for (i=0; i < (network_data.pplmn_mem.maxRcd); i++)
1751 {
1752 mnuInitDataItem(&list_menu_data->List[i]);
1753
1754 /*
1755 * set network name
1756 */
1757
1758 #ifdef NO_ASCIIZ
1759 if (network_data.pplmn[i].network_long.len NEQ 0 )
1760 {
1761 list_menu_data->List[i].str = (char *)network_data.pplmn[i].network_long.data;
1762 }
1763 #else
1764 if (strlen((char *)network_data.pplmn[i].network_long) NEQ 0 )
1765 {
1766 list_menu_data->List[i].str = (char *)network_data.pplmn[i].network_long;
1767 }
1768 #endif
1769 else
1770 {
1771 list_menu_data->List[i].str = GET_TEXT(TxtEmpty);
1772 TRACE_EVENT ("network_long == 0");
1773 }
1774
1775 list_menu_data->List[i].flagFunc = item_flag_none;
1776
1777 }
1778 /*
1779 * Fill common parameter for list handling
1780 */
1781
1782
1783 list_menu_data->ListLength = network_data.pplmn_mem.maxRcd;
1784 list_menu_data->ListPosition = 1;
1785 list_menu_data->CursorPosition = 1;
1786 list_menu_data->SnapshotSize = network_data.pplmn_mem.maxRcd;
1787 list_menu_data->Font = 0;
1788 list_menu_data->LeftSoftKey = TxtSoftOptions; /* SPR#2354 - SH - Change 'Select' to 'Options' */
1789 list_menu_data->RightSoftKey = TxtSoftBack;
1790 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
1791 list_menu_data->Reason = 0;
1792 list_menu_data->Strings = TRUE;
1793 list_menu_data->Attr = &network_menuAttrib;
1794 list_menu_data->autoDestroy = TRUE;
1795 list_menu_data->listCol = COLOUR_LIST_XX;
1796
1797 return list_menu_data;
1798 }
1799
1800 /*******************************************************************************
1801
1802 $Function: network_create_mobile_list
1803
1804 $Description:
1805
1806 $Returns:
1807
1808 $Arguments:
1809
1810 *******************************************************************************/
1811 static ListMenuData * network_create_mobile_list (T_network_OPT * data)
1812 {
1813 UBYTE i;
1814
1815 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof(ListMenuData));
1816
1817 if (list_menu_data EQ 0)
1818 {
1819 return NULL;
1820 TRACE_EVENT ("failed to create the list");
1821 }
1822
1823 mfwCheckMemoryLeft();
1824
1825 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY (MAX_SHOW_OF_PLMN * sizeof (T_MFW_MNU_ITEM));
1826
1827 mfwCheckMemoryLeft();
1828
1829 if (list_menu_data->List EQ 0)
1830 {
1831 return NULL;
1832 TRACE_EVENT ("failed to create the list");
1833 }
1834
1835 TRACE_EVENT ("network_create_mobile_list ()");
1836
1837
1838
1839 /*
1840 * Fill Menu List
1841 */
1842 for (i=0; i < MAX_SHOW_OF_PLMN; i++)
1843 {
1844 mnuInitDataItem(&list_menu_data->List[i]);
1845
1846 /*
1847 * set network name
1848 */
1849
1850 /*SPR 2635 copy set list strings pointing at longname strings*/
1851 if (data->pplmn_longnames[i][0] NEQ 0 )
1852 {
1853 list_menu_data->List[i].str =data->pplmn_longnames[i];
1854 }
1855 else
1856
1857 {
1858 list_menu_data->List[i].str = GET_TEXT(TxtEmpty);
1859 }
1860
1861 /*SPR 2635, end*/
1862
1863 list_menu_data->List[i].flagFunc = item_flag_none;
1864
1865 }
1866 /*
1867 * Fill common parameter for list handling
1868 */
1869
1870
1871 list_menu_data->ListLength = MAX_SHOW_OF_PLMN;
1872 list_menu_data->ListPosition = 1;
1873 list_menu_data->CursorPosition = 1;
1874 list_menu_data->SnapshotSize = MAX_SHOW_OF_PLMN;
1875 list_menu_data->Font = 0;
1876 list_menu_data->LeftSoftKey = TxtSoftSelect;
1877 list_menu_data->RightSoftKey = TxtSoftBack;
1878 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
1879 list_menu_data->Reason = 0;
1880 list_menu_data->Strings = TRUE;
1881 list_menu_data->Attr = &network_menuAttrib;
1882 list_menu_data->autoDestroy = TRUE; /*destroy the menulist after press any sofkey*/
1883 list_menu_data->listCol = COLOUR_LIST_XX;
1884
1885 return list_menu_data;
1886 }
1887
1888
1889 /*******************************************************************************
1890
1891 $Function: network_submenu
1892
1893 $Description: Creates a submenu for the preferred list.
1894
1895 $Returns:
1896
1897 $Arguments:
1898
1899 *******************************************************************************/
1900 static ListMenuData * network_submenu (T_network * data, T_MFW_NETWORK_STRUCT * plmn_list)
1901 {
1902 UBYTE i;
1903
1904
1905 ListMenuData *list_menu_data = (ListMenuData *)ALLOC_MEMORY (sizeof (ListMenuData));
1906
1907 if (list_menu_data EQ 0)
1908 return NULL;
1909
1910 list_menu_data->List = (T_MFW_MNU_ITEM *) ALLOC_MEMORY ((NETWORK_MENU_ITEM) * sizeof (T_MFW_MNU_ITEM));
1911 if (list_menu_data->List EQ 0)
1912 return NULL;
1913
1914 /*
1915 * Fill Menu List
1916 */
1917 for (i=0;i<(NETWORK_MENU_ITEM);i++)
1918 {
1919 mnuInitDataItem(&list_menu_data->List[i]);
1920
1921 /*
1922 * set network name
1923 */
1924 #ifdef NO_ASCIIZ
1925 if (plmn_list->network_long.len NEQ 0)
1926 list_menu_data->List[i].str = (char *)plmn_list->network_long.data;
1927 #else
1928 if (strlen((char *)plmn_list->network_long) NEQ 0)
1929 list_menu_data->List[i].str = (char *)plmn_list->network_long;
1930 #endif
1931
1932 else
1933 ;
1934 //strncpy ((char *)list_menu_data->List[i].str,(char *)empty, 6);
1935
1936
1937 plmn_list ++;
1938
1939 }
1940 /*
1941 * Fill common parameter for list handling
1942 */
1943 list_menu_data->ListLength = data->pplmn_mem.maxRcd;
1944 list_menu_data->ListPosition = 1;
1945 list_menu_data->CursorPosition = 1;
1946 list_menu_data->SnapshotSize = data->pplmn_mem.maxRcd;
1947 list_menu_data->Font = 0;
1948 list_menu_data->LeftSoftKey = TxtSoftSelect;
1949 list_menu_data->RightSoftKey = TxtSoftBack;
1950 list_menu_data->KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUUP | KEY_MNUDOWN;
1951 list_menu_data->Reason = NETWORK_PREF_LIST_SELECTED;
1952 list_menu_data->Strings = TRUE;
1953 list_menu_data->Attr = &network_menuAttrib;
1954 list_menu_data->listCol = COLOUR_LIST_XX;
1955
1956 return list_menu_data;
1957 }
1958
1959
1960
1961 /*******************************************************************************
1962
1963 $Function: network_list_cb
1964
1965 $Description: Callback function list dialog.
1966
1967 $Returns:
1968
1969 $Arguments:
1970
1971 *******************************************************************************/
1972 static void network_list_cb(T_MFW_HND win, ListMenuData * ListData)
1973 {
1974 TRACE_FUNCTION ("network_list_cb()");
1975
1976 #ifndef NEPTUNE_BOARD
1977 if (ListData->Reason != LISTS_REASON_BACK)
1978 {
1979 SEND_EVENT (win, NETWORK_LIST_SELECT_PLMN, ListData->CursorPosition, NULL);
1980 }
1981
1982 #else
1983 if (ListData->Reason EQ LISTS_REASON_SELECT)
1984 {
1985 SEND_EVENT (win, NETWORK_LIST_SELECT_PLMN, ListData->CursorPosition, NULL);
1986 SEND_EVENT (win, NETWORK_LIST_DESTORY, NULL, NULL);
1987 }
1988
1989 if ((ListData->Reason EQ LISTS_REASON_BACK) ||
1990 (ListData->Reason EQ LISTS_REASON_CLEAR)||
1991 (ListData->Reason EQ LISTS_REASON_HANGUP))
1992
1993 {
1994 SEND_EVENT (win, NETWORK_LIST_DESTORY, NULL, NULL);
1995 }
1996 #endif
1997
1998 }
1999
2000 /*******************************************************************************
2001
2002 $Function: network_pref_list_cb
2003
2004 $Description: Callback function pref. list dialog.
2005
2006 $Returns:
2007
2008 $Arguments:
2009
2010 *******************************************************************************/
2011 static void network_pref_list_cb(T_MFW_HND win, ListMenuData * ListData)
2012 {
2013 TRACE_FUNCTION ("network_pref_list_cb()");
2014
2015 if (ListData->Reason EQ LISTS_REASON_SELECT)
2016 {
2017
2018 // call here the MenuOptions with the items "Select from the list"
2019
2020 FREE_MEMORY ((UBYTE *)network_data.network_list->List, (network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
2021
2022 FREE_MEMORY ((UBYTE *)network_data.network_list, sizeof (ListMenuData));
2023 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
2024 //Commented FREE_MEMORY for network_data.pplmn as this is required when we enter the option menu.
2025 // Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
2026 // Solution: Comment network_data.pplmn memory free.
2027 /*
2028 // cq12719 Stop the memory leak 17-03-04 MZ.
2029 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2030 */
2031 //keep the position of the selected PLMN, need it later to update the list
2032 network_data.Listposition = ListData->ListPosition;
2033
2034 network_MNU_start(win,&network_OPTAttrib);
2035 }
2036 else
2037 {
2038
2039 //user pressed Exit to go back to the network submenu
2040 FREE_MEMORY ((UBYTE *)network_data.network_list->List, (network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_MNU_ITEM));
2041
2042 FREE_MEMORY ((UBYTE *)network_data.network_list, sizeof (ListMenuData));
2043
2044 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2045
2046 }
2047
2048
2049 }
2050
2051 /*******************************************************************************
2052
2053 $Function: network_mobile_list_cb
2054
2055 $Description: Callback function international list dialog.
2056
2057 $Returns:
2058
2059 $Arguments:
2060
2061 *******************************************************************************/
2062 static void network_mobile_list_cb(T_MFW_HND win, ListMenuData * ListData)
2063 {
2064
2065 /* UBYTE i;*/ /* Warning Correction */
2066
2067 T_MFW_PPLMN_MODE mode;
2068
2069 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2070 T_network_OPT * data = (T_network_OPT *)win_data->user;
2071 T_DISPLAY_DATA display_info;
2072
2073 TRACE_EVENT ("network_mobile_list_cb()");
2074
2075
2076 switch (ListData->Reason)
2077 {
2078 case LISTS_REASON_SELECT: /* */
2079
2080 mode = REPLACE_PREF_PLMN; /* Overwrite an existing entry at a given index */
2081 /*SPR 2635, use new function to replace preferred PLMN using the longname*/
2082 nm_change_pref_plmn_longname(mode,(network_data.Listposition) +1 , 0, data->pplmn_longnames[ListData->ListPosition]);
2083
2084 /* SPR#2354 - SH - Now display "Changed". On callback, redraw network list */
2085 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtChanged, TxtNull, COLOUR_STATUS_NETWORKS);
2086 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_mobile_list_changed_cb, THREE_SECS, 0 );
2087
2088 info_dialog (win, &display_info);
2089
2090 break;
2091 case LISTS_REASON_BACK: /* back to previous menu */
2092
2093 TRACE_EVENT ("pressed Back-key");
2094
2095 //API - SPR 2025 - 22/05/03 - De Allocate memory to avoid memory leak and also Crash
2096 if ( network_data.pplmn != NULL )
2097 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
2098
2099 network_MNU_destroy(data->win);
2100
2101 break;
2102 default:
2103 return;
2104 }
2105
2106
2107 }
2108
2109 /*******************************************************************************
2110
2111 $Function: network_mobile_list_changed_cb
2112
2113 $Description: Callback from "Changed" message. Destroys the list and recreates the
2114 updated network list.
2115
2116 $Returns:
2117
2118 $Arguments:
2119
2120 *******************************************************************************/
2121
2122 void network_mobile_list_changed_cb(T_MFW_HND win , USHORT identifier, UBYTE reason)
2123 {
2124 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2125 T_network_OPT * data = (T_network_OPT *)win_data->user;
2126 /* T_DISPLAY_DATA display_info; */ /* Warning Correction */
2127
2128 /* destroy the Menu */
2129 network_MNU_destroy(data->win);
2130
2131 /* request the pref. PLMN list */
2132 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
2133
2134 return;
2135 }
2136
2137
2138 /*******************************************************************************
2139
2140 $Function: network_start_animation
2141
2142 $Description: Starts the network animation.
2143
2144 $Returns:
2145
2146 $Arguments:
2147
2148 *******************************************************************************/
2149 static void network_start_animation(void)
2150 {
2151 T_DISPLAY_DATA display_info;
2152
2153 TRACE_FUNCTION ("network_start_animation()");
2154
2155 if (network_data.network_search_win != NULL)
2156 {
2157 network_stop_animation();
2158 }
2159
2160 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "Searching for", "Networks", COLOUR_STATUS_NETWORKS);
2161 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, FOREVER, KEY_CLEAR| KEY_RIGHT );
2162 /*
2163 * Call Info Screen
2164 */
2165
2166 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2167 }
2168
2169
2170 /*******************************************************************************
2171
2172 $Function: network_start_animation_plmn_selection
2173
2174 $Description: Starts the plmn selection animation.
2175
2176 $Returns:
2177
2178 $Arguments:
2179
2180 *******************************************************************************/
2181 static void network_start_animation_plmn_selection(int plmn_value)
2182 {
2183 T_DISPLAY_DATA display_info;
2184 /* T_MFW_PLMN_LIST * plmn_list; */ /* Warning Correction */
2185
2186 TRACE_FUNCTION ("network_start_animation()");
2187
2188 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "Requesting....", NULL, COLOUR_STATUS_NETWORKS);
2189 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, FOREVER, KEY_CLEAR| KEY_RIGHT );
2190
2191 /*
2192 * Call Info Screen
2193 */
2194
2195 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2196 }
2197
2198
2199 /*******************************************************************************
2200
2201 $Function: network_forbidden_plmn
2202
2203 $Description: Starts the forbidden plmn data screen.
2204
2205 $Returns:
2206
2207 $Arguments:
2208
2209 *******************************************************************************/
2210 static void network_forbidden_plmn(void)
2211 {
2212 T_DISPLAY_DATA display_info;
2213
2214 TRACE_FUNCTION ("network_forbidden_plmn()");
2215
2216 if (network_data.network_search_win != NULL)
2217 {
2218 network_stop_animation();
2219 }
2220
2221 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNetwork, TxtForbidden, COLOUR_STATUS_NETWORKS);
2222 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, 3500, KEY_CLEAR| KEY_RIGHT );
2223 /*
2224 * Call Info Screen
2225 */
2226
2227 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2228 }
2229
2230
2231 /*******************************************************************************
2232
2233 $Function: network_selected
2234
2235 $Description: displays info screen on network selected
2236
2237 $Returns:
2238
2239 $Arguments:
2240
2241 *******************************************************************************/
2242 static void network_selected(void)
2243 {
2244 T_DISPLAY_DATA display_info;
2245
2246 TRACE_FUNCTION ("network_start_animation()");
2247
2248 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNetwork, TxtSelected, COLOUR_STATUS_NETWORKS);
2249 // Jul 21, 2004 REF: CRR 13348 xvilliva
2250 // We use a new callback to return to idle screen after the alert is flashed.
2251 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_select_animation_cb, 3500, KEY_CLEAR| KEY_RIGHT );
2252
2253 /*
2254 * Call Info Screen
2255 */
2256
2257 network_data.network_search_win = info_dialog (network_data.network_win, &display_info);
2258 }
2259
2260 /*******************************************************************************
2261
2262 $Function: network_no_plmns
2263
2264 $Description: Indicate Info Screen that the network list is empty.
2265
2266 $Returns:
2267
2268 $Arguments:
2269
2270 *******************************************************************************/
2271 static void network_no_plmns(void)
2272 {
2273 T_DISPLAY_DATA display_info;
2274
2275 TRACE_FUNCTION ("network_no_plmns()");
2276
2277 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "No networks", "available", COLOUR_STATUS_NETWORKS);
2278 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_animation_cb, THREE_SECS, KEY_CLEAR| KEY_RIGHT );
2279 /*
2280 * Call Info Screen
2281 */
2282 info_dialog (0, &display_info);
2283
2284 }
2285 /*******************************************************************************
2286
2287 $Function: network_stop_animation
2288
2289 $Description: Stops the network animation.
2290
2291 $Returns:
2292
2293 $Arguments:
2294
2295 *******************************************************************************/
2296 static void network_stop_animation(void)
2297 {
2298 TRACE_FUNCTION ("network_stop_animation()");
2299
2300 if (network_data.network_search_win)
2301 {
2302 SEND_EVENT(network_data.network_search_win,DIALOG_DESTROY,0,0);
2303 network_data.network_search_win = 0;
2304 }
2305 }
2306 /*******************************************************************************
2307
2308 $Function: network_animation_cb
2309
2310 $Description: Callback for information dialog (not used)n
2311
2312 $Returns:
2313
2314 $Arguments:
2315
2316 *******************************************************************************/
2317 void network_animation_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
2318 {
2319 TRACE_FUNCTION ("network_animation_cb()");
2320
2321 network_data.network_search_win = 0;
2322 network_data.aborted = TRUE;
2323 }
2324
2325 /*******************************************************************************
2326
2327 $Function: network_select_animation_cb
2328
2329 $Description: Callback for information dialog "Network Selected".
2330
2331 $Returns:
2332
2333 $Arguments:
2334
2335 *******************************************************************************/
2336 void network_select_animation_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
2337 {
2338 TRACE_FUNCTION ("network_select_animation_cb()");
2339
2340 network_data.network_search_win = 0;
2341 network_data.aborted = TRUE;
2342 // Jul 21, 2004 REF: CRR 13348 xvilliva
2343 // If "gPhbkMenu" is not NULL, we destroy phonebook menu
2344 // to return to idle screen.
2345 if(gPhbkMenu != NULL)
2346 {
2347 bookPhonebookDestroy( gPhbkMenu );
2348 }
2349 }
2350
2351 /*******************************************************************************
2352
2353 $Function: network_MNU_start
2354
2355 $Description: called when the user press the Edit Softkey to enter the
2356 Option Menu "Select from the list" & "Enter the Network Code" &
2357 "Delete"
2358 $Returns:
2359
2360 $Arguments:
2361
2362 *******************************************************************************/
2363
2364 T_MFW_HND network_MNU_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
2365 {
2366 T_MFW_HND win;
2367
2368 TRACE_FUNCTION ("network_MNU_start()");
2369
2370 win = network_MNU_create (parent_window);
2371 if (win NEQ NULL)
2372 {
2373 SEND_EVENT (win, E_INIT, NULL, (void *)menuAttr);
2374 }
2375 return win;
2376 }
2377
2378 /*******************************************************************************
2379
2380 $Function: network_MNU_create
2381
2382 $Description: Create the Option window
2383
2384 $Returns: mfw window handle
2385
2386 $Arguments: parent_window -parent window handle
2387
2388 *******************************************************************************/
2389
2390 static T_MFW_HND network_MNU_create(MfwHnd parent_window)
2391 {
2392 T_network_OPT * data = (T_network_OPT *)ALLOC_MEMORY (sizeof (T_network_OPT));
2393 T_MFW_WIN * win;
2394
2395 TRACE_FUNCTION ("network_MNU_create()");
2396
2397 /*
2398 * Create window handler
2399 */
2400
2401 data->win =
2402 win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)network_MNU_win_cb);
2403 if (data->win EQ NULL)
2404 {
2405 return NULL;
2406 }
2407
2408 /*
2409 * connect the dialog data to the MFW-window
2410 */
2411
2412 data->mmi_control.dialog = (T_DIALOG_FUNC)network_MNU_exec_cb;
2413 data->mmi_control.data = data;
2414 win = ((T_MFW_HDR *)data->win)->data;
2415 win->user = (void *)data;
2416 data->parent = parent_window;
2417
2418 /*
2419 * return window handle
2420 */
2421
2422 return data->win;
2423 }
2424
2425 /*******************************************************************************
2426
2427 $Function: network_MNU_destroy
2428
2429 $Description: Destroy the Option window
2430
2431 $Returns: mfw window handle
2432
2433 $Arguments: own_window - current window
2434
2435 *******************************************************************************/
2436
2437 static void network_MNU_destroy(MfwHnd own_window)
2438 {
2439 T_MFW_WIN * win_data;
2440 T_network_OPT * data;
2441 /* T_MFW_PPLMN_MEM *pplmn_mem; */ /* Warning Correction */
2442
2443 TRACE_FUNCTION ("network_MNU_destroy()");
2444
2445 if (own_window)
2446 {
2447 win_data = ((T_MFW_HDR *)own_window)->data;
2448 data = (T_network_OPT *)win_data->user;
2449
2450 if (data)
2451 {
2452 kbd_delete(data->kbd);
2453 kbd_delete(data->kbd_long);
2454 mnuDelete (data->menu);
2455 /*
2456 * Delete WIN handler
2457 */
2458 win_delete (data->win);
2459 TRACE_EVENT("END of WIN DELETE");
2460
2461 if(data->network_list != NULL)
2462 {
2463 TRACE_EVENT("START FREE MEMORY");
2464
2465 /* Free the allocated memory for PLMN list window - OMAPS00061049 - 08-03-2006 */
2466 #ifndef NEPTUNE_BOARD
2467 FREE_MEMORY ((UBYTE *)data->network_list->List, MAX_SHOW_OF_PLMN* sizeof (T_MFW_MNU_ITEM));
2468 #else
2469 FREE_MEMORY ((UBYTE *)data->network_list->List, Plmn_list_count * sizeof (T_MFW_MNU_ITEM));
2470 #endif
2471
2472 FREE_MEMORY ((UBYTE *)data->network_list, sizeof (ListMenuData));
2473
2474 /*SPR 2635, free list of pointers to longname atrings*/
2475 FREE_MEMORY ((UBYTE *)data->pplmn_longnames,MAX_SHOW_OF_PLMN* sizeof (char*));
2476
2477 TRACE_EVENT("END of FREE MEMORY");
2478 }
2479
2480 /*
2481 * Free Memory
2482 */
2483
2484 FREE_MEMORY ((void *)data, sizeof (T_network_OPT));
2485 }
2486 else
2487 {
2488 TRACE_EVENT ("network_MNU_destroy() called twice");
2489 }
2490 }
2491 }
2492
2493 /*******************************************************************************
2494
2495 $Function: network_MNU_exec_cb
2496
2497 $Description: Exec callback function for the Option window
2498
2499 $Returns: none
2500
2501 $Arguments: win - current window
2502 event - event id
2503 value - unique id
2504 parameter - optional data.
2505
2506 *******************************************************************************/
2507
2508 void network_MNU_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
2509 {
2510 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
2511 T_network_OPT * data = (T_network_OPT *)win_data->user;
2512 /* T_MFW_HND * l_parent; */ /* Warning Correction */
2513 /* SHORT l_id; */ /* Warning Correction */
2514 /* T_MFW_HDR * parent = data->parent; */ /* Warning Correction */
2515 /* T_MFW_EVENT MfwEvents; */ /* Warning Correction */
2516
2517 TRACE_FUNCTION ("network_MNU_exec_cb()");
2518
2519
2520 switch (event)
2521 {
2522 case E_INIT:
2523 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)network_MNU_kbd_cb);
2524 data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)network_MNU_kbd_cb);
2525 data->menu = mnuCreate(data->win,&network_OPTAttrib, E_MNU_ESCAPE, (MfwCb)network_MNU_mnu_cb);
2526 mnuLang(data->menu,mainMmiLng);
2527
2528 /* put the (new) dialog window on top of the window stack */
2529 mnuUnhide(data->menu);
2530 winShow(win);
2531
2532 break;
2533 default:
2534 return;
2535 }
2536 }
2537
2538 /*******************************************************************************
2539
2540 $Function: network_MNU_mnu_cb
2541
2542 $Description: Menu callback function for the Option window
2543
2544 $Returns: none
2545
2546 $Arguments: e - event id
2547 m - menu handle
2548 *******************************************************************************/
2549
2550 static int network_MNU_mnu_cb (MfwEvt e, MfwMnu *m)
2551 {
2552 T_MFW_HND win = mfwParent(mfw_header());
2553 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2554 T_network_OPT * data = (T_network_OPT *)win_data->user;
2555 /* T_MFW_HND * l_parent; */ /* Warning Correction */
2556 /* SHORT l_id; */ /* Warning Correction */
2557
2558 TRACE_FUNCTION ("network_MNU_mnu_cb()");
2559
2560 switch (e)
2561 {
2562 case E_MNU_ESCAPE: /* back to previous menu "pref. network list"*/
2563 network_MNU_destroy(data->win);
2564
2565 // request MFW to fill up the pref. PLMN list
2566 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
2567
2568
2569 break;
2570 default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */
2571 return MFW_EVENT_REJECTED;
2572 }
2573 return MFW_EVENT_CONSUMED;
2574 }
2575
2576 /*******************************************************************************
2577
2578 $Function: network_MNU_win_cb
2579
2580 $Description: Window callback function for the Option window
2581
2582 $Returns: execution status
2583
2584 $Arguments: e - event id
2585 w - window handle
2586 *******************************************************************************/
2587
2588 static int network_MNU_win_cb (MfwEvt e, MfwWin *w)
2589 {
2590 TRACE_FUNCTION ("network_MNU_win_cb()");
2591
2592 switch (e)
2593 {
2594 case MfwWinVisible: /* window is visible */
2595 displaySoftKeys(TxtSoftSelect,TxtSoftBack);
2596 break;
2597 case MfwWinFocussed: /* input focus / selected */
2598 case MfwWinDelete: /* window will be deleted */
2599 default:
2600 return MFW_EVENT_REJECTED;
2601 }
2602 return MFW_EVENT_CONSUMED;
2603 }
2604
2605 /*******************************************************************************
2606
2607 $Function: network_MNU_kbd_cb
2608
2609 $Description: Exec callback function for the Option window
2610
2611 $Returns: execution status
2612
2613 $Arguments: e - event id
2614 k - keyboard info
2615 *******************************************************************************/
2616
2617 static int network_MNU_kbd_cb (MfwEvt e, MfwKbd *k)
2618 {
2619 T_MFW_HND win = mfwParent(mfw_header());
2620 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2621 T_network_OPT * data = (T_network_OPT *)win_data->user;
2622
2623 TRACE_FUNCTION ("network_MNU_kbd_cb()");
2624
2625 if (e & KEY_LONG)
2626 {
2627 switch (k->code)
2628 {
2629 case KCD_HUP: /* back to previous menu */
2630 mnuEscape(data->menu);
2631 break;
2632 case KCD_RIGHT: /* Power Down */
2633 return MFW_EVENT_REJECTED; /* handled by idle */
2634 default: /* no response to all other keys */
2635 return MFW_EVENT_CONSUMED;
2636 }
2637 }
2638 else
2639 {
2640 switch (k->code)
2641 {
2642 case KCD_MNUUP: /* highlight previous entry */
2643 mnuUp(data->menu);
2644 break;
2645 case KCD_MNUDOWN: /* highlight next entry */
2646 mnuDown(data->menu);
2647 break;
2648 case KCD_LEFT: /* activate this entry */
2649 mnuSelect(data->menu);
2650 break;
2651 case KCD_HUP: /* back to previous menu */
2652 case KCD_RIGHT: /* back to previous menu */
2653 mnuEscape(data->menu);
2654 break;
2655 default: /* no response to all other keys */
2656 return MFW_EVENT_CONSUMED;
2657 }
2658 }
2659 return MFW_EVENT_CONSUMED;
2660 }
2661
2662 /*******************************************************************************
2663
2664 $Function: network_request_plnm_list
2665
2666 $Description: Request existing network list in Mobile
2667
2668 $Returns:
2669
2670 $Arguments:
2671
2672
2673 *******************************************************************************/
2674 static int network_request_plnm_list(MfwMnu* m, MfwMnuItem* i)
2675 {
2676 T_MFW_HND win = mfwParent(mfw_header());
2677 /* T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; */ /* Warning Correction */
2678 /* T_network_OPT * data = (T_network_OPT *)win_data->user; */ /* Warning Correction */
2679 T_DISPLAY_DATA display_info;
2680
2681 TRACE_FUNCTION("network_request_plnm_list");
2682
2683 /* SPR#2354 - SH - Display "Choose Replacement" dialogue,
2684 * so the function of the second list is more evident */
2685
2686 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtChooseReplacement1, TxtChooseReplacement2, COLOUR_STATUS_NETWORKS);
2687 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)network_request_plmn_list_cb, TWO_SECS, 0 );
2688
2689 info_dialog (win, &display_info);
2690
2691 return 1;
2692 }
2693
2694 /*******************************************************************************
2695
2696 $Function: network_request_plnm_list_cb
2697
2698 $Description: User has been advised to "choose replacement", now display the list!
2699
2700 $Returns: None
2701
2702 $Arguments: Usual info dialogue callback arguments.
2703
2704 *******************************************************************************/
2705
2706 static void network_request_plmn_list_cb(T_MFW_HND win, USHORT identifier, UBYTE reason)
2707 {
2708 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2709 T_network_OPT * data = (T_network_OPT *)win_data->user;
2710 /*SPR 2635, just alloc pointers to strings */
2711 data->pplmn_longnames = (char**)ALLOC_MEMORY ((MAX_SHOW_OF_PLMN) * sizeof (char*));
2712
2713 if (data->pplmn_longnames NEQ 0)
2714 {
2715 //now fill up the "data->pplmn_longnames" with the PLMN list from ACI
2716 nm_plnm_list_longnames(data->pplmn_longnames, 1, MAX_SHOW_OF_PLMN);
2717
2718 }
2719 /*SPR 2635 end*/
2720 else
2721 {
2722 TRACE_EVENT("create the list failed");
2723 return;
2724 }
2725
2726 //show the list on the screen now
2727 data->network_list = network_create_mobile_list (data);
2728 listDisplayListMenu (data->win, data->network_list,(ListCbFunc)network_mobile_list_cb,0);
2729
2730 return;
2731 }
2732
2733
2734 /*******************************************************************************
2735
2736 $Function: network_delete
2737
2738 $Description:
2739
2740 $Returns:
2741
2742 $Arguments:
2743
2744
2745 *******************************************************************************/
2746
2747 static int network_delete(MfwMnu* m, MfwMnuItem* i)
2748 {
2749
2750 T_MFW_HND win = mfwParent(mfw_header());
2751
2752 TRACE_FUNCTION ("network_delete()");
2753
2754 #ifdef NO_ASCIIZ
2755 if (network_data.pplmn[network_data.Listposition].network_short.len NEQ 0 )
2756 #else
2757 if (strlen((char *)network_data.pplmn[network_data.Listposition].network_short) NEQ 0 )
2758 #endif
2759 {
2760 // if the user selected a pref. PLMN
2761 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
2762 //Made network_info_screen as a generic function as it can be reused to display different messgaes to the user
2763 //Hence need to pass the callback funtion as a parameter
2764 network_info_screen (win, TxtDeleted,(T_VOID_FUNC)network_delete_pref_plnm);
2765 }
2766 else
2767 {
2768 // if the user selected a empty item
2769 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
2770 //Made network_info_screen as a generic function as it can be reused to display different messgaes to the user
2771 //Hence need to pass the callback funtion as a parameter
2772 network_info_screen (win, TxtEmptyList,(T_VOID_FUNC)network_delete_pref_plnm);
2773 }
2774
2775 // destroy the Menu
2776 network_MNU_destroy(win);
2777
2778 /* Warning Correction - BEGIN */
2779 return 1;
2780 /* END */
2781
2782
2783 }
2784
2785 /*******************************************************************************
2786
2787 $Function: network_delete_pref_plnm
2788
2789 $Description: Delete the selected pref. PLMN l
2790
2791 $Returns:
2792
2793 $Arguments:
2794
2795
2796 *******************************************************************************/
2797 void network_delete_pref_plnm (T_MFW_HND win , USHORT identifier, UBYTE reason)
2798 {
2799
2800 T_MFW_PPLMN_MODE mode;
2801 UBYTE i;
2802 /* T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; */ /* Warning Correction */
2803 /* T_network_OPT * data = (T_network_OPT *)win_data->user; */ /* Warning Correction */
2804
2805 TRACE_FUNCTION ("network_delete_pref_plnm()");
2806
2807
2808 mode = DELETE_PREF_PLMN; /* Delete an entry from the list */
2809
2810 //update now the pref. PLMN list
2811 //(network_data.Listposition) "+1" because the zero is counted as well
2812 nm_change_pref_plmn(mode, (network_data.Listposition) +1 , 0, 0);
2813
2814 // clear all the PLMN and fill up with updated list
2815 for (i=0; i < network_data.pplmn_mem.maxRcd; i++)
2816 {
2817
2818 #ifdef NO_ASCIIZ
2819 network_data.pplmn[i].network_long.len = 0;
2820 network_data.pplmn[i].network_short.len = 0;
2821 #else
2822 memset(network_data.pplmn[i].network_long, '\0', LONG_NAME);
2823 memset(network_data.pplmn[i].network_short, '\0', SHORT_NAME);
2824 #endif
2825 memset(network_data.pplmn[i].network_numeric, '\0', NUMERIC_LENGTH);
2826 }
2827
2828
2829 // request the updated pref. PLMN list
2830 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
2831
2832 }
2833
2834 /*******************************************************************************
2835
2836 $Function: network_info_screen
2837
2838 $Description: confirm the deleted PLMN
2839
2840 $Returns:
2841
2842 $Arguments:
2843
2844 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
2845 //Made this as a generic function so that it can be reused to display different messgaes to the user
2846 //Added the call back function pointer as the argument.
2847 *******************************************************************************/
2848 void network_info_screen (T_MFW_HND win, USHORT MessageId, T_VOID_FUNC funt_ptr )
2849 {
2850 T_DISPLAY_DATA display_info;
2851
2852 TRACE_FUNCTION ("network_info_screen()");
2853
2854 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, MessageId, TxtNull, COLOUR_STATUS_NETWORKS);
2855 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)funt_ptr, THREE_SECS, 0 );
2856
2857 info_dialog (win, &display_info);
2858 }
2859
2860
2861 /*******************************************************************************
2862
2863 $Function: network_OPT_EDT_start
2864
2865 $Description:
2866
2867 $Returns:
2868
2869 $Arguments:
2870
2871 *******************************************************************************/
2872 T_MFW_HND network_EDT_start (MfwMnu* m, MfwMnuItem* i)
2873 {
2874 T_MFW_HND win;
2875 T_MFW_HND parent_window = mfwParent(mfw_header());
2876
2877 TRACE_FUNCTION ("network_OPT_EDT_start()");
2878
2879 win = network_EDT_create (parent_window);
2880
2881 if (win NEQ NULL)
2882 {
2883 SEND_EVENT (win, E_INIT, 0, 0);
2884 }
2885 return win;
2886 }
2887
2888 /*******************************************************************************
2889
2890 $Function: network_OPT_EDT_create
2891
2892 $Description:
2893
2894 $Returns:
2895
2896 $Arguments:
2897
2898 *******************************************************************************/
2899 static T_MFW_HND network_EDT_create(MfwHnd parent_window)
2900 {
2901 T_network_OPT * data = (T_network_OPT *)ALLOC_MEMORY (sizeof (T_network_OPT));
2902 T_MFW_WIN * win;
2903
2904 TRACE_FUNCTION ("network_EDT_create()");
2905
2906 /*
2907 * Create window handler
2908 */
2909
2910 data->win = win_create (parent_window, 0, 0, NULL);
2911
2912 if (data->win EQ NULL)
2913 {
2914 return NULL;
2915 }
2916
2917 /*
2918 * connect the dialog data to the MFW-window
2919 */
2920
2921 data->mmi_control.dialog = (T_DIALOG_FUNC)network_EDT_exec_cb;
2922 data->mmi_control.data = data;
2923 win = ((T_MFW_HDR *)data->win)->data;
2924 win->user = (void *)data;
2925 data->parent = parent_window;
2926
2927 /*
2928 * return window handle
2929 */
2930
2931 winShow(data->win);
2932 return data->win;
2933 }
2934
2935
2936 /*******************************************************************************
2937
2938 $Function: network_EDT_destroy
2939
2940 $Description:
2941
2942 $Returns:
2943
2944 $Arguments:
2945
2946 *******************************************************************************/
2947 static void network_EDT_destroy(MfwHnd own_window)
2948 {
2949 T_MFW_WIN * win_data;
2950 T_network_OPT * data;
2951
2952
2953 TRACE_FUNCTION ("networkT_EDT_destroy()");
2954
2955 if (own_window)
2956 {
2957 win_data = ((T_MFW_HDR *)own_window)->data;
2958 data = (T_network_OPT *)win_data->user;
2959
2960 if (data)
2961 {
2962 /*
2963 * Delete WIN handler
2964 */
2965 win_delete (data->win);
2966
2967 /*
2968 * Free Memory
2969 */
2970 FREE_MEMORY ((void *)data, sizeof (T_network_OPT));
2971 }
2972 else
2973 {
2974 TRACE_EVENT ("network_EDT_destroy() called twice");
2975 }
2976 }
2977 }
2978
2979
2980 /*******************************************************************************
2981
2982 $Function: network_EDT_exec_cb
2983
2984 $Description:
2985
2986 $Returns:
2987
2988 $Arguments:
2989
2990 *******************************************************************************/
2991 void network_EDT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
2992 {
2993 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
2994 T_network_OPT * data = (T_network_OPT *)win_data->user;
2995 /* T_MFW_HND * l_parent; */ /* Warning Correction */
2996 /* SHORT l_id; */ /* Warning Correction */
2997 /* int index; */ /* Warning Correction */
2998
2999 TRACE_FUNCTION ("network_EDT_exec_cb()");
3000
3001 switch (event)
3002 {
3003 case E_INIT:
3004 /* SPR#1428 - SH - New Editor changes */
3005 #ifdef NEW_EDITOR
3006 AUI_edit_SetDefault(&data->editor_info);
3007 AUI_edit_SetDisplay(&data->editor_info, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT);
3008 AUI_edit_SetEvents(&data->editor_info, value, TRUE, FOREVER, (T_AUI_EDIT_CB)network_EDT_editor_cb);
3009 AUI_edit_SetTextStr(&data->editor_info, TxtSoftOK, TxtDelete, TxtMCCMNC, NULL);
3010 AUI_edit_SetMode(&data->editor_info, 0, ED_CURSOR_UNDERLINE);
3011 AUI_edit_SetAltTextStr(&data->editor_info, 5, TxtNull, TRUE, TxtSoftBack);
3012 AUI_edit_SetBuffer(&data->editor_info, ATB_DCS_ASCII, (UBYTE *)data->buffer, 6);
3013
3014 AUI_edit_Start(data->win, &data->editor_info);
3015 #else /* NEW_EDITOR */
3016 data->editor_info.editor_attr.win.px = 6;
3017 data->editor_info.editor_attr.win.py = /*12*/Mmi_layout_line(2);
3018 data->editor_info.editor_attr.win.sx = /*80*/SCREEN_SIZE_X;
3019 data->editor_info.editor_attr.win.sy = /*20 */Mmi_layout_line_height()*2;
3020 data->editor_info.editor_attr.edtCol = COLOUR_EDITOR_XX;
3021 data->editor_info.editor_attr.font = 0;
3022 data->editor_info.editor_attr.mode = edtCurBar1;
3023 data->editor_info.editor_attr.controls = 0;
3024 data->editor_info.editor_attr.text = data->buffer; /* buffer to be edited */
3025 data->editor_info.editor_attr.size = 6;
3026 data->editor_info.LeftSoftKey = TxtSoftOK;
3027 data->editor_info.RightSoftKey = TxtDelete;
3028 data->editor_info.TextId = TxtMCCMNC;
3029 data->editor_info.Identifier = value; /* optional */
3030 data->editor_info.mode = DIGITS_MODE;
3031 data->editor_info.Callback = (T_EDIT_CB)network_EDT_editor_cb;
3032 data->editor_info.destroyEditor = TRUE;
3033 data->editor_info.hide = FALSE;
3034 data->editor_info.AlternateLeftSoftKey = TxtNull;
3035 data->editor_info.TextString = NULL;
3036 data->editor_info.min_enter = 5;
3037 data->editor_info.timeout = FOREVER;
3038
3039 /* create the dialog handler */
3040 editor_start(data->win, &data->editor_info); /* start the editor */
3041 #endif /* NEW_EDITOR */
3042
3043
3044 break;
3045 case E_ABORT:
3046 case E_EXIT: /* defaultreaction */
3047 network_EDT_destroy(data->win);
3048 break;
3049 default:
3050 return;
3051 }
3052 }
3053
3054
3055 /*******************************************************************************
3056
3057 $Function: network_change_pref_plmn
3058
3059 $Description: Populates the preffered plmn List.
3060
3061 $Returns:
3062
3063 $Arguments:
3064 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3065 *******************************************************************************/
3066 void network_change_pref_plmn (T_MFW_HND win , USHORT identifier, UBYTE reason)
3067 {
3068 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3069 T_network_OPT * data = (T_network_OPT *)win_data->user;
3070
3071 nm_pref_plmn_list(network_data.pplmn, network_data.pplmn_mem.maxRcd, 1);
3072
3073 }
3074 /*******************************************************************************
3075
3076 $Function: network_EDT_editor_cb
3077
3078 $Description:
3079
3080 $Returns:
3081
3082 $Arguments:
3083
3084 *******************************************************************************/
3085 static void network_EDT_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event)
3086 {
3087 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
3088 T_network_OPT * data = (T_network_OPT *)win_data->user;
3089 T_MFW_HND * l_parent;
3090 T_MFW_PPLMN_MODE mode;
3091
3092 TRACE_FUNCTION ("network_EDT_editor_cb()");
3093
3094
3095 l_parent = data->parent;
3096
3097 switch(event)
3098 {
3099 case INFO_KCD_LEFT:
3100
3101 mode = REPLACE_PREF_PLMN; /* Overwrite an existing entry at a given index */
3102
3103 //update now the pref. PLMN list
3104 //Overwrite an existing entry
3105 //(network_data.Listposition) "+1" because the zero is counted as well
3106 nm_change_pref_plmn(mode, (network_data.Listposition) +1 , 0, (UBYTE*) data->buffer);
3107
3108 // destroy the Editor
3109 network_EDT_destroy(data->win);
3110 // xrashmic 10 Nov, 2004 MMI-SPR-OMAPS00044200-OMAPS00044851
3111 //Added this info screen so that sim is updated by nm_change_pref_plmn with the new code
3112 //before populating the new list with nm_pref_plmn_list
3113 network_info_screen (win, TxtPleaseWait,(T_VOID_FUNC)network_change_pref_plmn);
3114 // destroy the MENU
3115 network_MNU_destroy(l_parent);
3116 break;
3117 case INFO_KCD_RIGHT:
3118 case INFO_KCD_HUP:
3119 // destroy the Editor
3120 network_EDT_destroy(data->win);
3121 // destroy the MENU
3122 network_MNU_destroy(l_parent);
3123
3124 // Nov 02, 2005 REF: omaps00044855 Sumanth Kumar.C
3125 // Solution: Free network_data.pplmn.
3126 FREE_MEMORY ((UBYTE *)network_data.pplmn,(network_data.pplmn_mem.maxRcd) * sizeof (T_MFW_NETWORK_STRUCT));
3127
3128 break;
3129 default:
3130 break;
3131 }
3132 return;
3133 }
3134
3135