comparison src/ui3/bmi/MmiSimToolkit.c @ 420:e8ddbb0837ed

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
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: MMI
15 $File: MmiSimToolkit.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 $History: MmiSimToolkit.c
30
31 Apr 18, 2006 Ref:OMAPS00116309 R.Prabakar (a0393213)
32 CT-GCF[27.22.4.7.1]- MMI crashes on REFERSH seq 1.2
33 Solution : Data type mismatch between ACI and MMI sorted out
34
35
36 Jan 19, 2007 REF:DR OMAPS00110946 x0043642
37 Description: CT GCF / PTCRB - TC27.22.4.12.2 SEND USSD (Icon support) - Unexpected TERMINAL RESPONSE performed
38 Solution: Send unknown command terminal response for invalid ss length
39
40 16 Jan 2006, Ref OMAPS00110997, X0043642
41 Description: CT PTCRB - TC27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) - Unexpected TERMINAL RESPONSE performed
42 Solution: Set satResult as unknownData icon is not present.
43
44
45 Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
46 Description: CT GCF - TC27.22.4.13.1 Seq 1.10 - PROACTIVE SIM COMMANDS:
47 SET UP CALL (NORMAL) - Call Set-up Failed
48 Solution: Removed the Redial flag enabling code.
49
50 Oct 13, 2006 OMAPS00095266 a0393213(R.Prabakar)
51 Description : CT-GCF[27.22.4.22.1]-Incorrect string display
52 Solution : The DCS attribute is set dynamically
53
54 06 Oct 2006, Ref OMAPS00095263, Archana(x0047075)
55 Description : CT-GCF[27.22.4.24.1]-MS Resets
56 Solution : Editor dialog is destroyed on destroy event instead of timeout.
57
58 Nov 07, 2006 ER:OMAPS00070661 R.Prabakar(a0393213)
59 R99 network compliancy : Implemented Language Notification and Provide Local Information (Language setting)
60 SAT proactive commands and Language Selection SAT event
61
62 10 Jul 2006, Ref OMAPS00077654, R.Prabakar(a0393213)
63 Description : Cyrillic character support in MMI to pass GCF/PTCRB UCS2 TC (SATK)
64 Solution : UCS2 display added to terminal profile. Made some changes for long idle screen text display and
65 UCS2 display for SAT icon
66
67 Jun 06, 2006 DR: OMAPS00080543 - xreddymn
68 Changes to display long SAT messages correctly on idle screen.
69
70 29 May 2006 REF: OMAPS00071366, x0045876
71 Description: IT3 verdict: FAIL, [Step 13] The ME did not display idle screen without the message
72 "Idle Mode Text" as expected.
73
74 xrashmic 16 Feb, 2006 OMAPS00064413
75 When a SIM RESET occurs, while recreating the simtoolkit list view, the list win is also recreated.
76
77 May 26, 2006 REF: OMAPS00076094, x0045876
78 Description: MMI's Terminal Profile (TP) setup is not in line with the SAT class e implementation
79 Solution: TP is updated based on the current support by MMI.
80
81 May 24, 2006 REF: In SET UP CALL RESULT, Editor is not initialized, x0045876
82 Solution: Initialized Editor
83
84 May 09, 2006 REF: OMAPS00064076, x0045876
85 Description: SAT IDLE TEXT - UCS2 Display
86 Solution: Added UCS2 support to display UCS2 characters in IDLE MODE.
87
88 xrashmic 16 Feb, 2006 OMAPS00064413
89 When a SIM RESET occurs, while recreating the simtoolkit list view, the list win is also recreated.
90
91 Mar 11, 2006 REF:DR:OMAPS00061467 x0035544
92 Description: 27.22.4.13.3 SET UP CALL (display of icons) fails.
93 Solution: In the function sim_toolkit_exec() for the event SAT_SETUP_CALL copied the icon data which is
94 got through the sat command on to the structures data->call_setup_parameter.iconInfo and to the data->call_setup_parameter.iconInfo2
95 appropriately.And For the event SAT_CALL_END freed the memory allocated for the icon data.
96 on to the
97
98 Feb 02, 2006 DR: OMAPS00061468 - x0035544.
99 Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails
100 Solution : SAT SET UP IDLE MODE TEXT (Icon) support added.
101
102 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S.
103 Description: SAT Icon support
104 Solution : SAT icon support added.
105
106 Dec 23, 2005 REF: OMAPS00062166 x0039928
107 Bug: CT-TIB-GCF[27.22.4.24.1]-sequence 1.2 crashes
108 Fix: Initialize the editor buffer. Initialization is taken care for DTMF and also for SS.
109
110
111 xreddymn Sep-06-2005 MMI-SPR-33876:
112 Initialize editor buffer when displaying message box
113 in case of SAT_SEND_SMS
114
115 Aug 16, 2004 REF: CRR 24323 Deepa M.D
116 Bug:Clenup of sprintf used for tracing
117 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
118
119 25/10/00 Original Condat(UK) BMI version.
120 21/02/03 removed all calls to function sat_add_unicode_tag_if_needed() and the
121 function itself
122 26-05-04 CRR 19656 Sandip and Deepa M.D
123 Fix for The Dsample doesn't display lines ( <CR> or <LF> ) in the SETUP IDLE
124 TEXT command.
125 Fix for The idle screen is empty when a SETUP IDLE TEXT command is sent with
126 a long text ( 239 characters ).
127
128
129 $End
130
131 *******************************************************************************/
132
133 #define ENTITY_MFW
134
135 /* includes */
136 #include <string.h>
137 #include <stdio.h>
138 #include <stdlib.h>
139
140 #if defined (NEW_FRAME)
141
142 #include "typedefs.h"
143 #include "vsi.h"
144 #include "pei.h"
145 #include "custom.h"
146 #include "gsm.h"
147
148 #else
149
150 #include "STDDEFS.H"
151 #include "custom.h"
152 #include "gsm.h"
153 #include "vsi.h"
154
155 #endif
156
157 #include "gdi.h"
158 #include "audio.h"
159
160 #include "pconst.cdg"
161 #include "mconst.cdg"
162 #include "message.h"
163 #include "ccdapi.h"
164 #include "prim.h"
165 #include "cus_aci.h"
166 #include "cnf_aci.h"
167 #include "mon_aci.h"
168
169 #include "tok.h"
170
171 #include "prim.h"
172 #ifndef PCM_2_FFS
173 #include "pcm.h"
174 #endif
175
176
177 #include "mfw_mfw.h"
178 #include "mfw_kbd.h"
179 #include "mfw_tim.h"
180 #include "mfw_lng.h"
181 #include "mfw_win.h"
182 #include "mfw_icn.h"
183 #include "mfw_sim.h"
184 #include "mfw_nm.h"
185 #include "mfw_sat.h" // x0021334 : To test SAT session end - CQ33597
186 /* SPR#1428 - SH - New Editor changes */
187 #ifndef NEW_EDITOR
188 #include "mfw_edt.h"
189 #endif
190 #include "mfw_mnu.h"
191 #include "mfw_phb.h"
192 #include "mfw_sms.h"
193
194 #include "dspl.h"
195
196
197 #include "p_mmi.h"
198 #include "message.h"
199 #include "prim.h"
200 #include "aci_cmh.h"
201 #include "mfw_mme.h"
202
203 #include "MmiMmi.h"
204
205 #include "Mmiicons.h"
206 #include "MmiPins.h"
207 #include "MmiMain.h"
208 #include "MmiDialogs.h"
209 #include "MmiIdle.h"
210 #include "MmiStart.h"
211 #include "mmiCall.h"
212 #include "MmiSimToolkit.h"
213
214 #include "MmiLists.h"
215 #include "MmiSounds.h"
216 #include "MmiResources.h"
217 #include "MmiTimeDate.h"
218 #include "mmiSat_i.h"
219 /* SPR#1428 - SH - New Editor changes */
220 #ifdef NEW_EDITOR
221 #include "ATBCommon.h"
222 #include "ATBDisplay.h"
223 #include "ATBEditor.h"
224 #include "AUIEditor.h"
225 #else
226 #include "MmiEditor.h"
227 #endif
228 #include "MmiMenu.h" // SH - 20/11/01 - included to provide symbol SimMenuFunc
229 #include "mmiSmsRead.h" /*MC SPR 940/2*/
230
231 #include "cus_aci.h"
232 #include "prim.h"
233
234 #ifndef PCM_2_FFS
235 #include "pcm.h"
236 #endif
237
238 #include "mmiSatClassE.h"
239
240 #include "mmiColours.h" /* SPR#2321 - DS */
241 #include "MmiDialogs.h" /* SPR#2321 - DS */
242
243
244 #ifdef MMI_HOMEZONE_ENABLED
245 #include "MmiHomezone.h"
246 #endif
247
248 #ifdef FF_WAP
249 #include "AUIWapext.h"
250 #endif
251
252 #if defined(FF_WAP)
253 #define MMI_TEST_SAT_LAUNCH_BROWSER
254 #endif
255
256 #ifdef MMI_TEST_SAT_LAUNCH_BROWSER
257 void mmiOpenDummyBrowser(T_MFW_HND win,char* information);
258 #define INFORMATION_SIZE 100
259 char information[INFORMATION_SIZE];
260 #endif
261 /*
262 * Local definitions
263 */
264 typedef struct
265 {
266 T_MMI_CONTROL mmi_control;
267 T_MFW_HND win;
268 T_MFW_HND sat_handle;
269 T_SAT_CMD * sat_command; /* mfw storage of actual command */
270 T_SAT_CMD * sat_setup_menu_command; /* dynamic storage of setup menu */
271 T_MFW_HND sat_setup_menu_win; /* c030 rsa window associated with the setup menu command */
272 T_MFW_HND sat_setup_menu_listmnu_win; /* NDH : Window associated with the SAT ListMenu */
273 T_MFW_HND info_win; /* window used for simple info screens */
274 T_MFW_HND sat_call_setup_win; /* window associated with the call setup command */
275 T_SAT_call_setup_parameter * call_setup_parameter; /* parameter psace of call setup to be passed to call() */
276 T_SAT_EVENTS active_sat_session; /* event which caused the currently active session */
277 #ifdef NEW_EDITOR
278 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
279 #else
280 T_EDITOR_DATA editor_data;
281 #endif
282 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
283 -Deleted Redial flag enabling/disabling code*/
284 UBYTE sat_available_on_SIM;
285 } T_sim_toolkit;
286
287 static T_sim_toolkit * g_sim_toolkit_data;
288
289 /*MC SPR 1257, merged in from b-sample version of this file*/
290 char * sat_mainmenu_label = NULL;
291 UBYTE header_len;
292 /*MC end*/
293
294 BOOL sat_call_active = FALSE; // Marcus: Issue 1812: 13/03/2003
295
296 /* PROTOTYPES */
297 static T_MFW_HND sim_toolkit_create (T_MFW_HND parent_window);
298 static void sim_toolkit_destroy (T_MFW_HND own_window);
299 //sandip 16292 . added this new function
300 unsigned char DecodeGSM7ToASCII(U8 * encoded, U8 * plain, U8 Length);
301 /*
302 * Marcus: Issue 1057: 21/01/2003: Removed "static" from the following two
303 * function prototypes for their use in MmiCall.c
304 */
305 T_MFW_HND sat_get_setup_menu_win (void);
306 T_MFW_HND sat_get_call_setup_win (void);
307
308 static void sat_setup_menu_proc (T_SAT_CMD * sat_command);
309 static void sat_info_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason);
310
311 extern UBYTE call_SATCall; // Marcus: Issue 1057: 21/01/2003
312
313
314 /*******************************************************************************
315
316 $Function: sim_toolkit_check
317
318 $Description: If there is no support for SAT on SIM card
319 the item SIM TOOLKIT will not appear in the menulist
320
321 $Returns:
322
323 $Arguments:
324
325 *******************************************************************************/
326 USHORT sim_toolkit_check (struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
327 {
328
329 T_sim_toolkit * data = g_sim_toolkit_data;
330
331 TRACE_FUNCTION("sim_toolkit_check");
332
333 if (data->sat_available_on_SIM EQ TRUE)
334 {
335 //show the SAT item in the menulist
336 return 0;
337 }
338 else
339 {
340 return 1;
341 }
342
343 }
344
345
346
347
348 /*******************************************************************************
349
350 $Function: simToolkitInit
351
352 $Description: This is the start-up time initialisation routine.
353 For compatibility reasons the functions is still there.
354
355
356 $Returns: none.
357
358 $Arguments:
359
360 *******************************************************************************/
361 void simToolkitInit (T_MFW_HND parent_window)
362 {
363 TRACE_FUNCTION("simToolkitInit");
364
365 g_sim_toolkit_data = (T_sim_toolkit *)ALLOC_MEMORY (sizeof (T_sim_toolkit));
366
367 winAutoFocus (TRUE);
368 sat_set_setup_menu_win(NULL);
369 sat_set_call_setup_win(NULL);
370 sim_toolkit_create (parent_window);
371 }
372 /*******************************************************************************
373
374 $Function: simToolkitExit
375
376 $Description: This is the shutdown time clean-up routine.
377
378 $Returns: none.
379
380 $Arguments:
381
382 *******************************************************************************/
383 void simToolkitExit(void)
384 {
385 TRACE_FUNCTION("simTookitExit");
386 sim_toolkit_destroy (g_sim_toolkit_data->win);
387 // FREE_MEMORY ((U8 *)g_sim_toolkit_data, sizeof (T_sim_toolkit));
388 if (sat_mainmenu_label != NULL)
389 {
390 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label);
391 sat_mainmenu_label = NULL;
392 }
393 }
394
395
396 /********************************************************************
397 *
398 * SIM Toolkit Dialog
399 *
400 * Window - Structure
401 *
402 * sim_toolkit ----> sat_play_tone
403 * ----> sat_display_text
404 * ----> sat_get_key
405 * ----> sat_setup_call
406 * ----> sat_get_string
407 * ----> sat_setup_menu
408 * ----> sat_select_item
409 * ----> sat_send_sms
410 * ----> sat_send_ss
411 *
412 ********************************************************************/
413 static const UBYTE sat_terminal_profile [13] =
414 {
415 #ifdef SAT_TP1_PRF_DNL
416
417 (SAT_TP1_PRF_DNL | SAT_TP1_MENU_SEL),
418
419 /* 26-05-2006, x0045876 (OMAPS00076094 - Removed SAT_TP2_UCS2_ENTRY, SAT_TP2_UCS2_DSPL,
420 SAT_TP2_DSPL_EXT) */
421 /*10 Jul 2006, Ref OMAPS00077654, R.Prabakar(a0393213)
422 Description : Cyrillic character support in MMI to pass GCF/PTCRB UCS2 TC (SATK)
423 Solution : UCS2 display added to terminal profile*/
424 (SAT_TP2_CMD_RES|SAT_TP2_CC|SAT_TP2_ALPHA_ID|
425 SAT_TP2_UCS2_DSPL),
426
427 (SAT_TP3_DSPL_TXT|SAT_TP3_GET_INKEY|SAT_TP3_GET_INPUT|
428 SAT_TP3_PLAY_TONE|SAT_TP3_REFRESH),
429
430 (SAT_TP4_SEL_ITEM|SAT_TP4_SEND_SMS|SAT_TP4_SEND_SS|
431 SAT_TP4_SEND_USSD|SAT_TP4_SETUP_CALL|SAT_TP4_SETUP_MENU),
432
433 (SAT_TP5_EVENT_LIST | SAT_TP5_USER_ACT | SAT_TP5_SCR_AVAIL),
434
435 #ifdef FF_MMI_R99_SAT_LANG
436 (SAT_TP6_LANG_SEL), /*OMAPS00070661 R.Prabakar(a0393213) Language Selection Enabled */
437 #else
438 0x0,
439 #endif
440
441 0x0,
442
443 (SAT_TP8_BIN_GET_INKEY | SAT_TP8_IDLE_TXT | SAT_TP8_AI2_SETUP_CALL),
444
445 #if defined(FF_WAP)
446 #ifdef FF_MMI_R99_SAT_LANG
447 /*OMAPS00070661 R.Prabakar(a0393213) Language Notification and Local Information(language setting)*/
448 (SAT_TP9_SUST_DSPL_TXT|SAT_TP9_LAUNCH_BROWSER | SAT_TP9_PLI_LANG | SAT_TP9_LANG_NOTIFY),
449 #else
450 (SAT_TP9_SUST_DSPL_TXT|SAT_TP9_LAUNCH_BROWSER),
451 #endif
452 #else
453 #ifdef FF_MMI_R99_SAT_LANG
454 /*OMAPS00070661 R.Prabakar(a0393213) Language Notification and Local Information(language setting)*/
455 (SAT_TP9_SUST_DSPL_TXT | SAT_TP9_PLI_LANG | SAT_TP9_LANG_NOTIFY),
456 #else
457 SAT_TP9_SUST_DSPL_TXT,
458 #endif
459 #endif
460
461 /* 26-05-2006, x0045876 (OMAPS00076094 - Added Softkeys) */
462 0x03,
463
464 0x0,
465
466 (SAT_TP12_OPEN_CHANNEL | SAT_TP12_CLOSE_CHANNEL | SAT_TP12_RECEIVE_DATA |
467 SAT_TP12_SEND_DATA),
468
469 (SAT_TP13_CSD_SUPP_BY_ME | SAT_TP13_GPRS_SUPP_BY_ME)
470
471 #else
472 /* START: 11-05-2006, x0045876 (OMAPS00076094) */
473 /* 0x09, 0x73, 0x17, 0x37,0x00 // c032 rsa */
474 #ifdef FF_MMI_R99_SAT_LANG
475 /*OMAPS00070661 R.Prabakar(a0393213) Language Notification, Local Information(language setting) and Language Selection Enabled*/
476 0x09, 0x7B, 0x97, 0x3F, 0x61, 0x01, 0x00, 0x58, 0x29, 0x03, 0x00 /*, 0x0F, 0x03*/
477 #else
478 0x09, 0x7B, 0x97, 0x3F, 0x61, 0x00, 0x00, 0x58, 0x01, 0x03, 0x00 /*, 0x0F, 0x03*/
479 #endif
480 /* END: 11-05-2006, x0045876 (OMAPS00076094) */
481 #endif
482 };
483
484 static void sim_toolkit_destroy (T_MFW_HND own_window);
485 static void sim_toolkit_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
486 static int sim_toolkit_sat_cb (T_MFW_EVENT event, T_MFW_SAT * sat_bits);
487 /*******************************************************************************
488
489 $Function: sim_toolkit_create
490
491 $Description: Creation of an instance for the SIM Toolkit dialog.
492 Type of dialog : SINGLE_STATIC
493 Top Window must be available at any time, only one instance.
494
495
496 $Returns: none.
497
498 $Arguments:
499
500 *******************************************************************************/
501 static T_MFW_HND sim_toolkit_create (T_MFW_HND parent_window)
502 {
503 T_sim_toolkit * data = g_sim_toolkit_data;
504 T_MFW_WIN * win;
505
506 TRACE_FUNCTION("sim_toolkit_create");
507
508 data->win = win_create (parent_window, 0, 0, NULL); // c013 rsa
509
510 if (data->win EQ NULL)
511 return NULL;
512
513 /*
514 * Create window handler
515 */
516 data->mmi_control.dialog = (T_DIALOG_FUNC)sim_toolkit_exec;
517 data->mmi_control.data = data;
518 win = ((T_MFW_HDR *)data->win)->data;
519 win->user = (MfwUserDataPtr)data;
520
521 data->sat_command = (T_SAT_CMD *)ALLOC_MEMORY (sizeof (T_SAT_CMD)); // c022 rsa
522
523 /*
524 * Create any other handler
525 */
526 data->sat_handle = sat_create (
527 data->win, // parent window
528 /* possible SAT events */
529 MfwSatSessionEnd | /* end of session */
530 MfwSatRefresh | /* refresh SIM fields */
531 MfwSatDataRefreshed | /*data Refreshed */
532 MfwSatTextOut| /* display string */
533 MfwSatGetKey| /* get user keystroke */
534 MfwSatGetString| /* get user input */
535 MfwSatPlayTone| /* play audio tone */
536 MfwSatSetupMenu| /* setup toolkit menu */
537 MfwSatSelectItem| /* select menu item */
538 MfwSatSendSMS| /* send short message */
539 MfwSatSendSS| /* send service command */
540 MfwSatSendUSSD| /* send USSD command */
541 MfwSatSendDTMF| /* send dtmf command */
542 MfwSatCall| /* setup a call */
543 MfwSatSetEvents| /* setup event lists */
544 MfwSatIdleText| /* set idle text */
545 MfwSatCcRes| /* call control result */
546 MfwSatCcAlert /* call control alerting */
547 #if defined(FF_WAP)
548 |MfwSatLaunchBrowser
549 #else
550 #endif
551 |MfwSatOpenChannel|
552 MfwSatCloseChannel|
553 MfwSatSendData|
554 MfwSatReceiveData|
555 MfwSatErrBusy /* SAT error handling */
556 #ifdef FF_MMI_R99_SAT_LANG
557 |MfwSatLangNotify | /*OMAPS00070661 (SAT-lang notify and local info(lang setting)) a0393213(R.Prabakar)*/
558 MfwSatLocalInfo
559 #endif
560 ,
561 (T_MFW_CB)sim_toolkit_sat_cb, // event callback
562 data->sat_command); // control block for MFW
563
564 /*
565 * initialize global variables
566 */
567 data->sat_setup_menu_command = NULL;
568 data->sat_command = NULL;
569 data->info_win = NULL;
570 data->call_setup_parameter = NULL;
571 data->active_sat_session = SAT_SESSION_END;
572 data->sat_available_on_SIM = FALSE;
573 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
574 -Deleted Redial flag enabling/disabling code*/
575 sat_mainmenu_label = NULL;
576
577 /*
578 * Initialise MFW
579 */
580 sat_init ((UBYTE *)sat_terminal_profile, (UBYTE)sizeof (sat_terminal_profile));
581
582 /*
583 * return window handle
584 */
585 win_show(data->win);
586 return data->win;
587 }
588 /*******************************************************************************
589
590 $Function: sim_toolkit_destroy
591
592 $Description: Destroy the sim toolkit dialog.
593
594 $Returns: none.
595
596 $Arguments:
597
598 *******************************************************************************/
599 static void sim_toolkit_destroy (T_MFW_HND own_window)
600 {
601 T_MFW_WIN * win;
602 T_sim_toolkit * data;
603
604 if (own_window)
605 {
606 win = ((T_MFW_HDR *)own_window)->data;
607 data = (T_sim_toolkit *)win->user;
608
609 if (data)
610 {
611 /*
612 * Exit SAT and Delete SAT Handler
613 */
614 sat_exit ();
615 sat_delete (data->sat_handle);
616
617 /*
618 * Delete WIN Handler
619 */
620 win_delete (data->win);
621 /*
622 * Free Memory
623 */
624 if (data->sat_setup_menu_command NEQ NULL)
625 {
626 FREE_MEMORY ((U8 *)data->sat_setup_menu_command, sizeof (T_SAT_CMD));
627 data->sat_setup_menu_command = NULL;
628 }
629 if (data->sat_command != NULL)
630 {
631 FREE_MEMORY ((U8 *)data->sat_command, sizeof (T_SAT_CMD)); // c022 rsa
632 data->sat_command = NULL;
633 }
634 FREE_MEMORY ((U8 *)data, sizeof (T_sim_toolkit));
635 }
636 }
637 }
638
639 /*******************************************************************************
640
641 $Function: sim_toolkit_exec
642
643 $Description: Dialog function for sim toolkit top window.
644 Handle the SAT commands delivered by MFW<-ACI<-SIM
645
646 $Returns: none.
647
648 $Arguments:
649
650 *******************************************************************************/
651 static void sim_toolkit_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
652 {
653 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
654 T_sim_toolkit * data = (T_sim_toolkit *)win_data->user;
655 T_MFW_HND sat_win;
656 T_SAT_RES sat_res;
657
658 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
659 #ifdef FF_MMI_SAT_ICON
660 USHORT icon_length;
661 #endif
662 #ifdef FF_MMI_R99_SAT_LANG
663 T_DISPLAY_DATA display_info;
664 #endif
665
666 TRACE_FUNCTION ("sim_toolkit_exec()");
667
668 if (event NEQ SAT_SESSION_END)
669 data->active_sat_session = (T_SAT_EVENTS) event;
670
671 if (data->info_win != NULL)
672 {
673 SEND_EVENT (data->info_win, E_ED_DEINIT, 0, NULL);
674 data->info_win = NULL;
675 }
676
677
678 switch (event)
679 {
680 #ifdef FF_MMI_R99_SAT_LANG
681 case SAT_LOCAL_INFO:
682 /*OMAPS00070661(SAT-Local Info(lang setting)) a0393213(R.Prabakar)*/
683 TRACE_EVENT ("SAT Local Information ");
684 if(sat_command->qual==LOCAL_INFO_LANG_SETTING_QUALIFIER)/*local information - language setting*/
685 {
686 UBYTE lang[2];
687
688 switch(Mmi_getCurrentLanguage())
689 {
690 case ENGLISH_LANGUAGE:
691 lang [0] = ASCII_FOR_E; /* 'e' */
692 lang [1] = ASCII_FOR_N; /* 'n' */
693 sat_res[SAT_ERR_INDEX] = SAT_RES_SUCCESS;
694 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
695 break;
696 case CHINESE_LANGUAGE:
697 lang [0] = ASCII_FOR_Z; /* 'z' */
698 lang [1] = ASCII_FOR_H; /* 'h' */
699 sat_res[SAT_ERR_INDEX] = SAT_RES_SUCCESS;
700 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
701 break;
702 case GERMAN_LANGUAGE:
703 lang [0] = ASCII_FOR_D; /* 'd' */
704 lang [1] = ASCII_FOR_E; /* 'e' */
705 sat_res[SAT_ERR_INDEX] = SAT_RES_SUCCESS;
706 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
707 break;
708 default:
709 sat_res[SAT_ERR_INDEX]=SAT_RES_MISSING;
710 sat_res[SAT_AI_INDEX] = SatResAiNoService;
711 }
712 /* Terminal Response - Specifying language set in ME */
713 satLocalInfo(sat_command, sat_res, sizeof(sat_res), lang, sizeof(lang));
714 }
715 break;
716 case SAT_LANGUAGE_NOTIFY:
717 /*OMAPS00070661(SAT-Lang notify) a0393213(R.Prabakar)*/
718 TRACE_EVENT ("Language Notification ");
719
720 /* Terminal Response to SIM - OK for getting the notification of language */
721 sat_res[SAT_ERR_INDEX] = SAT_RES_SUCCESS;
722 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
723
724 if(sat_command->qual == LANG_NOTIFY_SPEC_LANG_QUALIFIER) /*specified language notification*/
725 {
726 /* Check for language and set the respective language */
727 if ((sat_command->c.language.lang[0] == ASCII_FOR_E) && (sat_command->c.language.lang[1] == ASCII_FOR_N)) /* English */
728 {
729 /* set as English */
730 Mmi_Set2Language(ENGLISH_LANGUAGE);
731 }
732 else if ((sat_command->c.language.lang[0] == ASCII_FOR_D) && (sat_command->c.language.lang[1] == ASCII_FOR_E)) /* German */
733 {
734 /* Set as German */
735 Mmi_Set2Language(GERMAN_LANGUAGE);
736
737 }
738 else if ((sat_command->c.language.lang[0] == ASCII_FOR_Z) && (sat_command->c.language.lang[1] == ASCII_FOR_H)) /* Chineese */
739 {
740 /* Set as Chineese */
741 Mmi_Set2Language (CHINESE_LANGUAGE);
742 }
743 else
744 {
745 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNotAllowed, TxtNull , COLOUR_STATUS_PINS);
746 dlg_initDisplayData_events( &display_info, NULL, THREE_SECS, KEY_CLEAR | KEY_RIGHT );
747 info_dialog (0, &display_info);
748 /* Terminal Response to SIM - OK for getting the notification of language */
749 sat_res[SAT_ERR_INDEX] = SAT_RES_REJECT;/*error - language not set*/
750 sat_res[SAT_AI_INDEX] = SatResAiNoService;
751 }
752 }
753 else if(sat_command->qual == LANG_NOTIFY_NON_SPEC_LANG_QUALIFIER) /* non-specified language notification*/
754 {
755 Mmi_Set2Language(ENGLISH_LANGUAGE);
756 }
757 sat_done (sat_command, sat_res);
758 break;
759 #endif /*FF_MMI_R99_SAT_LANG*/
760 case SAT_DISPLAY_TEXT:
761 TRACE_EVENT("SAT_DISPLAY_TEXT");
762 /*
763 * Text with normal priority will be displayed
764 * only in idle screen and in SAT Menu Item
765 */
766 if ((sat_command->qual & SAT_M_TEXT_HIGH_PRIO) EQ 0)
767 {
768 TRACE_EVENT("NOT SAT_M_TEXT_HIGH_PRIO");
769 /* Check if Idle AND Sat Session are inactiv */
770 if ((!g_SATsession_is_active)&&(!idleIsFocussed()))
771 {
772 TRACE_EVENT("BUSY SCREEN");
773 /* idle is not in focus and not currently in a SAT session: we are busy elsewhere */
774 sat_res[SAT_ERR_INDEX] = SAT_RES_BUSY_ME;
775 sat_res[SAT_AI_INDEX] = SatResAiBusyScreen;
776 sat_done (sat_command, sat_res);
777 return;
778 }
779 }
780
781 sat_win = sat_display_text_create (data->win);
782 if (sat_win)
783 {
784 data->sat_command = sat_command;
785 SEND_EVENT (sat_win, event, 0, data->sat_command);
786 }
787 else
788 {
789 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
790 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
791 sat_done (sat_command, sat_res);
792 }
793 break;
794
795 case SAT_PLAY_TONE:
796 TRACE_EVENT("SAT_PLAY_TONE");
797 /*
798 * Create and initiate Play Tone Window
799 */
800 sat_win = sat_play_tone_create (data->win);
801 if (sat_win)
802 {
803 data->sat_command = sat_command;
804 SEND_EVENT (sat_win, event, 0, data->sat_command);
805 }
806 else
807 {
808 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
809 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
810 sat_done (sat_command, sat_res);
811 }
812 break;
813
814 case SAT_GET_KEY:
815 TRACE_EVENT("SAT_GET_KEY");
816 /*
817 * Create and initiate Get Key Window
818 */
819 sat_win = sat_get_key_create (data->win);
820 if (sat_win)
821 {
822 data->sat_command = sat_command;
823 SEND_EVENT (sat_win, event, 0, data->sat_command);
824 }
825 else
826 {
827 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
828 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
829 sat_done (sat_command, sat_res);
830 }
831 break;
832 case SAT_GET_STRING:
833 TRACE_EVENT("SAT_GET_STRING");
834 /*
835 * Create and initiate Get String Window
836 */
837 sat_win = sat_get_string_create (data->win);
838 if (sat_win)
839 {
840 data->sat_command = sat_command;
841 SEND_EVENT (sat_win, event, 0, data->sat_command);
842 }
843 else
844 {
845 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
846 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
847 sat_done (sat_command, sat_res);
848 }
849 break;
850
851 // c016 rsa
852 case SAT_SETUP_MENU:
853 TRACE_EVENT("SAT_SETUP_MENU");
854
855 sat_call_active = FALSE; // Marcus: Issue 1812: 13/03/2003
856 //SAT is on the SIM available
857 data->sat_available_on_SIM = TRUE;
858
859 /*
860 * initiate Setup Menu
861 */
862 sat_setup_menu_proc(sat_command);
863 sat_res[SAT_ERR_INDEX] = SatResSuccess;
864 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
865 sat_done (sat_command, sat_res);
866 break;
867
868 case SAT_SELECT_ITEM:
869 TRACE_EVENT("SAT_SELECT_ITEM");
870 /*
871 * Create and initiate select item Window
872 */
873 sat_win = sat_select_item_create (data->win);
874 if (sat_win)
875 {
876 data->sat_command = sat_command;
877 SEND_EVENT (sat_win, event, 0, data->sat_command);
878 }
879 else
880 {
881 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
882 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
883 sat_done (sat_command, sat_res);
884 }
885 break;
886 // end c016 rsa
887
888 // c001 xas
889 case SAT_SEND_SMS:
890 TRACE_EVENT("SAT_SEND_SMS");
891 /*
892 * --> display alpha identifier if available
893 */
894 if ((sat_command->c.sms.info.len NEQ 0) &&
895 (sat_command->c.sms.info.len NEQ (U8)-1))
896 {
897 char *TextString = (char *)sat_create_TEXT_ASCIIZ (&sat_command->c.sms.info);
898 /*
899 * Setup an editor to display a string
900 */
901
902
903
904 /* SPR#1428 - SH - New Editor changes */
905 #ifdef NEW_EDITOR
906 AUI_edit_SetDefault(&data->editor_data);
907 AUI_edit_SetTextStr(&data->editor_data, TxtNull, TxtNull, TxtNull, (UBYTE *)TextString);
908 AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
909 AUI_edit_SetEvents(&data->editor_data, event, TRUE, FOREVER, (T_AUI_EDIT_CB)sat_info_cb);
910 // xreddymn Sep-06-2005 MMI-SPR-33876: Initialize editor buffer
911 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE*)"", 1);
912 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
913 #ifdef FF_MMI_SAT_ICON
914 /*Check if the SAT command has icon*/
915 if(sat_command->c.sms.info.icon.qual != 0xFF)
916 {
917 /* Copy the icon data to the editor attributes*/
918 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.sms.info.iconInfo.width;
919 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.sms.info.iconInfo.height;
920
921 icon_length = sat_command->c.sms.info.iconInfo.width * sat_command->c.sms.info.iconInfo.height;
922
923 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length);
924
925 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.sms.info.iconInfo.dst, icon_length);
926 data->editor_data.editor_attr.TitleIcon.isTitle = TRUE;
927
928 /* Icon is self-explanatory. No need to display text for this case.*/
929 if(sat_command->c.sms.info.icon.qual == 0x00)
930 {
931 /* Icon is self-explanatory. Do not display the text*/
932 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE;
933 }
934
935 /* Free the memory of icon data that we got through the SATK command*/
936 mfwFree((U8 *)sat_command->c.sms.info.iconInfo.dst, icon_length);
937 sat_command->c.sms.info.iconInfo.dst = NULL;
938
939 }
940 #endif
941
942 data->info_win = AUI_edit_Start(win, &data->editor_data);
943 #else /* NEW_EDITOR */
944 data->editor_data.LeftSoftKey = TxtNull;
945 data->editor_data.AlternateLeftSoftKey = TxtNull;
946 data->editor_data.RightSoftKey = TxtNull;
947 data->editor_data.hide = FALSE;
948 data->editor_data.mode = E_EDIT_READ_ONLY_MODE;
949 data->editor_data.timeout = FOREVER;
950 data->editor_data.Identifier = event;
951 data->editor_data.destroyEditor = TRUE;
952 data->editor_data.Callback = (T_EDIT_CB)sat_info_cb;
953 data->editor_data.TextString = (char *)TextString;
954 data->editor_data.min_enter = 0;
955 data->info_win = editor_start(win, &data->editor_data);
956 #endif /* NEW_EDITOR */
957 }
958 break;
959
960 case SAT_SEND_SS:
961 TRACE_EVENT("SAT_SEND_SS");
962 TRACE_EVENT_P1("sat_command->c.ss.info.len = %d", sat_command->c.ss.info.len);
963 /*
964 * --> display alpha identifier if available
965 */
966 if ((sat_command->c.ss.info.len NEQ 0) &&
967 (sat_command->c.ss.info.len NEQ (U8)-1))
968 {
969 char *TextString = (char *)sat_create_TEXT_ASCIIZ (&sat_command->c.ss.info);
970
971
972 /*
973 * Setup an editor to display a string
974 */
975 /* SPR#1428 - SH - New Editor changes */
976 #ifdef NEW_EDITOR
977 AUI_edit_SetDefault(&data->editor_data);
978 AUI_edit_SetTextStr(&data->editor_data, TxtNull, TxtNull, TxtNull, (UBYTE *)TextString);
979 AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
980 AUI_edit_SetEvents(&data->editor_data, event, TRUE, FOREVER, (T_AUI_EDIT_CB)sat_info_cb);
981 // Dec 23, 2005 REF: OMAPS00062166 x0039928
982 // Fix: Initialize the editor buffer
983 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE*)"", 1);
984
985 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
986 #ifdef FF_MMI_SAT_ICON
987 /*Check if the SAT command has icon*/
988 if(sat_command->c.ss.info.icon.qual != 0xFF)
989 {
990 /* Copy the icon data to the editor attributes*/
991 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.ss.info.iconInfo.width;
992 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.ss.info.iconInfo.height;
993
994 icon_length = sat_command->c.ss.info.iconInfo.width * sat_command->c.ss.info.iconInfo.height;
995
996 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length);
997
998 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.ss.info.iconInfo.dst, icon_length);
999 data->editor_data.editor_attr.TitleIcon.isTitle = TRUE;
1000
1001 /* Icon is self-explanatory. No need to display text for this case.*/
1002 if(sat_command->c.ss.info.icon.qual == 0x00)
1003 {
1004 /* Icon is self-explanatory. Do not display the text*/
1005 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE;
1006 }
1007
1008 /* Free the memory of icon data that we got through the SATK command*/
1009 mfwFree((U8 *)sat_command->c.ss.info.iconInfo.dst, icon_length);
1010 sat_command->c.ss.info.iconInfo.dst = NULL;
1011
1012 }
1013 #endif
1014
1015 data->info_win = AUI_edit_Start(win, &data->editor_data);
1016
1017 #else /* NEW_EDITOR */
1018 data->editor_data.LeftSoftKey = TxtNull;
1019 data->editor_data.AlternateLeftSoftKey = TxtNull;
1020 data->editor_data.RightSoftKey = TxtNull;
1021 data->editor_data.hide = FALSE;
1022 data->editor_data.mode = E_EDIT_READ_ONLY_MODE;
1023 data->editor_data.timeout = FOREVER;
1024 data->editor_data.Identifier = event;
1025 data->editor_data.Callback = (T_EDIT_CB)sat_info_cb;
1026 data->editor_data.destroyEditor = TRUE;
1027 data->editor_data.TextString = TextString;
1028
1029 data->editor_data.min_enter = 0;
1030 data->info_win = editor_start(win, &data->editor_data);
1031 #endif /* NEW_EDITOR */
1032 }
1033
1034 /* 19 -Jan -2007 x0043642 OMAPS00110997 */
1035 else
1036 {
1037
1038 #ifdef FF_MMI_SAT_ICON
1039 /*Check if the SAT command has icon*/
1040 if(sat_command->c.ss.info.icon.qual != 0xFF)
1041 {
1042 /* Free the memory of icon data that we got through the SATK command*/
1043 mfwFree((U8 *)sat_command->c.ss.info.iconInfo.dst, sat_command->c.ss.info.iconInfo.width *
1044 sat_command->c.ss.info.iconInfo.height);
1045 sat_command->c.ss.info.iconInfo.dst = NULL;
1046 }
1047 #endif
1048 sat_res[SAT_ERR_INDEX] = SatResUnknownData;
1049 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1050 sat_done(sat_command, sat_res);
1051 }
1052 break;
1053 // end c001 xas
1054
1055
1056 case SAT_SEND_DTMF:
1057 TRACE_EVENT("SAT_SEND_DTMF");
1058 /*
1059 * --> display alpha identifier if available
1060 */
1061 if ((sat_command->c.cmd.info.len NEQ 0) &&
1062 (sat_command->c.cmd.info.len NEQ (U8)-1))
1063 {
1064 char *TextString = (char *)sat_create_TEXT_ASCIIZ (&sat_command->c.cmd.info);
1065
1066
1067 /*
1068 * Setup an editor to display a string
1069 */
1070 /* SPR#1428 - SH - New Editor changes */
1071 #ifdef NEW_EDITOR
1072 AUI_edit_SetDefault(&data->editor_data);
1073 AUI_edit_SetTextStr(&data->editor_data, TxtNull, TxtNull, TxtNull, (UBYTE *)TextString);
1074 AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
1075 /*06 OCT 2006, Ref OMAPS00095263, Archana(x0047075)
1076 Description : CT-GCF[27.22.4.24.1]-MS Resets
1077 Solution : Editor dialog is destroyed on destroy event instead of timeout. */
1078 AUI_edit_SetEvents(&data->editor_data, event, TRUE, FOREVER, (T_AUI_EDIT_CB)sat_info_cb);
1079 // Dec 23, 2005 REF: OMAPS00062166 x0039928
1080 // Fix: Initialize the editor buffer
1081 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE*)"", 1);
1082
1083 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
1084 #ifdef FF_MMI_SAT_ICON
1085 /*Check if the SAT command has icon*/
1086 if(sat_command->c.cmd.info.icon.qual != 0xFF)
1087 {
1088 /* Copy the icon data to the editor attributes*/
1089 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.cmd.info.iconInfo.width;
1090 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.cmd.info.iconInfo.height;
1091
1092 icon_length = sat_command->c.cmd.info.iconInfo.width * sat_command->c.cmd.info.iconInfo.height;
1093
1094 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length);
1095
1096 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.cmd.info.iconInfo.dst, icon_length);
1097 data->editor_data.editor_attr.TitleIcon.isTitle = TRUE;
1098
1099 /* Icon is self-explanatory. No need to display text for this case.*/
1100 if(sat_command->c.cmd.info.icon.qual == 0x00)
1101 {
1102 /* Icon is self-explanatory. Do not display the text*/
1103 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE;
1104 }
1105
1106 /* Free the memory of icon data that we got through the SATK command*/
1107 mfwFree((U8 *)sat_command->c.cmd.info.iconInfo.dst, icon_length);
1108 sat_command->c.cmd.info.iconInfo.dst = NULL;
1109
1110 }
1111 #endif
1112
1113 data->info_win = AUI_edit_Start(win, &data->editor_data);
1114
1115 #else /* NEW_EDITOR */
1116 data->editor_data.LeftSoftKey = TxtNull;
1117 data->editor_data.AlternateLeftSoftKey = TxtNull;
1118 data->editor_data.RightSoftKey = TxtNull;
1119 data->editor_data.hide = FALSE;
1120 data->editor_data.mode = E_EDIT_READ_ONLY_MODE;
1121 /*06 OCT 2006, Ref OMAPS00095263, Archana(x0047075)
1122 Description : CT-GCF[27.22.4.24.1]-MS Resets
1123 Solution : Editor dialog is destroyed on destroy event instead of timeout. */
1124 data->editor_data.timeout = FOREVER;
1125 data->editor_data.Identifier = event;
1126 data->editor_data.Callback = (T_EDIT_CB)sat_info_cb;
1127 data->editor_data.destroyEditor = TRUE;
1128 data->editor_data.TextString = TextString;
1129
1130 data->editor_data.min_enter = 0;
1131 data->info_win = editor_start(win, &data->editor_data);
1132 #endif /* NEW_EDITOR */
1133 }
1134 break;
1135 case SAT_SETUP_CALL:
1136 TRACE_EVENT("SAT_SETUP_CALL");
1137
1138 TRACE_EVENT_P2("Redial durUnit %d durValue %d",
1139 sat_command->c.call.durUnit,sat_command->c.call.durValue);
1140 data->sat_command = sat_command;
1141
1142 /* create parameter space for call, or reuse old */
1143 if (data->call_setup_parameter EQ NULL)
1144 {
1145 data->call_setup_parameter =
1146 (T_SAT_call_setup_parameter *)ALLOC_MEMORY (sizeof(T_SAT_call_setup_parameter));
1147 }
1148
1149 /* SPR#1784 - DS - If command qualifier is set to 'with redial' (01, 03 or 05) set a global redial flag */
1150 if ( (sat_command->qual & 0x01) == TRUE )
1151 {
1152 if (sat_command->qual > 0x05)
1153 {
1154 TRACE_EVENT("Invalid call command qualifier!");
1155 }
1156 else
1157 {
1158 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
1159 -Deleted Redial flag enabling/disabling code*/
1160 }
1161 }
1162
1163
1164 /* gather the name of the called party (if any) */
1165 if ((sat_command->c.call.info.len NEQ 0) &&
1166 (sat_command->c.call.info.len NEQ (U8)-1))
1167 {
1168 TRACE_EVENT("call.info contains data.");
1169 data->call_setup_parameter->TextString = sat_create_TEXT_ASCIIZ(&sat_command->c.call.info);
1170 //x0035544 Feb 07, 2006 DR:OMAPS00061467
1171 //copy the icon data for the first alpha identifier
1172 #ifdef FF_MMI_SAT_ICON
1173 if (sat_command->c.call.info.icon.qual != 0xFF)
1174 {
1175 data->call_setup_parameter->IconInfo.width = sat_command->c.call.info.iconInfo.width;
1176 data->call_setup_parameter->IconInfo.height= sat_command->c.call.info.iconInfo.height;
1177 icon_length = sat_command->c.call.info.iconInfo.width * sat_command->c.call.info.iconInfo.height;
1178 if(sat_command->c.call.info.iconInfo.dst != NULL)
1179 {
1180 data->call_setup_parameter->IconInfo.dst = (char *)ALLOC_MEMORY (icon_length);
1181 memcpy(data->call_setup_parameter->IconInfo.dst, sat_command->c.call.info.iconInfo.dst, icon_length);
1182 }
1183 if(sat_command->c.call.info.icon.qual == 0x00)
1184 {
1185 /* Icon is self-explanatory. Do not display the text*/
1186 data->call_setup_parameter->IconInfo.selfExplanatory = TRUE;
1187
1188 }
1189 else
1190 data->call_setup_parameter->IconInfo.selfExplanatory = FALSE;
1191
1192 /* Free the memory of icon data that we got through the SATK command*/
1193 if(sat_command->c.call.info.iconInfo.dst != NULL)
1194 {
1195 mfwFree((U8 *)sat_command->c.call.info.iconInfo.dst, icon_length);
1196 sat_command->c.call.info.iconInfo.dst = NULL;
1197 }
1198 }
1199 else
1200 {
1201 data->call_setup_parameter->IconInfo.dst = NULL;
1202 data->call_setup_parameter->IconInfo.width = 0;
1203 data->call_setup_parameter->IconInfo.height = 0;
1204 data->call_setup_parameter->IconInfo.selfExplanatory = FALSE;
1205 }
1206
1207 #endif
1208 }
1209 else
1210 {
1211 /* provide an empty string; NULL would crash in info_dialog() */
1212 TRACE_EVENT("call.info contains no data!");
1213 sat_command->c.call.info.len = 0;
1214
1215 /* SPR#1700 - DS - Set string to NULL */
1216 data->call_setup_parameter->TextString = NULL;
1217
1218 /* SPR#1700 - DS - Commented out code below. Checks in call() in mmiCall.c ensure
1219 * a NULL string is not sent to info_dialog
1220 */
1221 #if 0
1222 data->call_setup_parameter->TextString = sat_create_TEXT_ASCIIZ(&sat_command->c.call.info);
1223 #endif /* 0 */
1224 }
1225
1226 /* SPR#1700 - DS - Save info2 (if available). This should be used for the "calling" dialog.
1227 * If not available, info (above) can be used.
1228 */
1229
1230 /* gather the name of the called party (if any) */
1231 if ((sat_command->c.call.info2.len NEQ 0) &&
1232 (sat_command->c.call.info2.len NEQ (U8)-1))
1233 {
1234 TRACE_EVENT("call.info2 contains data.");
1235 data->call_setup_parameter->TextString2 = sat_create_TEXT_ASCIIZ(&sat_command->c.call.info2);
1236 //x0035544 Feb 07, 2006 DR:OMAPS00061467
1237 //copy the icon data for the second alpha identifier
1238 #ifdef FF_MMI_SAT_ICON
1239 if (sat_command->c.call.info2.icon.qual != 0xFF)
1240 {
1241 data->call_setup_parameter->IconInfo2.width= sat_command->c.call.info2.iconInfo.width;
1242 data->call_setup_parameter->IconInfo2.height = sat_command->c.call.info2.iconInfo.height;
1243 data->call_setup_parameter->IconInfo2.dst = data->call_setup_parameter->IconInfo.dst;
1244 if(sat_command->c.call.info2.icon.qual == 0x00)
1245 {
1246 // Icon is self-explanatory. Do not display the text
1247 data->call_setup_parameter->IconInfo2.selfExplanatory = TRUE;
1248 }
1249 else
1250 data->call_setup_parameter->IconInfo2.selfExplanatory = FALSE;
1251 }
1252 else
1253 {
1254 data->call_setup_parameter->IconInfo2.dst = NULL;
1255 data->call_setup_parameter->IconInfo2.width = 0;
1256 data->call_setup_parameter->IconInfo2.height = 0;
1257 data->call_setup_parameter->IconInfo2.selfExplanatory = FALSE;
1258 }
1259
1260 #endif
1261 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialogue displays them correctly*/
1262 sat_add_unicode_tag_if_needed(data->call_setup_parameter->TextString2);
1263 #endif
1264 }
1265 else
1266 {
1267 /* provide an empty string; NULL would crash in info_dialog() */
1268 TRACE_EVENT("call.info2 contains no data!");
1269 sat_command->c.call.info2.len = 0;
1270
1271 /* SPR#1700 - DS - Set string to NULL */
1272 data->call_setup_parameter->TextString2 = NULL;
1273
1274 /* SPR#1700 - DS - Commented out code below. Checks in call() in mmiCall.c ensure
1275 * a NULL string is not sent to info_dialog
1276 */
1277 #if 0
1278 data->call_setup_parameter->TextString2 = sat_create_TEXT_ASCIIZ(&sat_command->c.call.info2);
1279 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialogue displays them correctly*/
1280 sat_add_unicode_tag_if_needed(data->call_setup_parameter->TextString2);
1281 #endif
1282 #endif /* 0 */
1283 }
1284 break;
1285
1286 case SAT_CALL_RESULT:
1287 if (data->call_setup_parameter EQ NULL)
1288 {
1289 /* we are NOT in a SETUP CALL session;this is a "normal" Call Result */
1290 TRACE_EVENT("SAT_CALL_RESULT a");
1291 /*
1292 * --> display alpha identifier if available
1293 */
1294
1295 TRACE_EVENT_P1("Redial Time %d",sat_command->c.ccres.redialTime);
1296
1297 if ((sat_command->c.ccres.info.len NEQ 0) &&
1298 (sat_command->c.ccres.info.len NEQ (U8)-1))
1299 {
1300 char *TextString = (char *)sat_create_TEXT_ASCIIZ (&sat_command->c.ccres.info);
1301
1302
1303 /*
1304 * Setup an editor to display a string
1305 */
1306 /* SPR#1428 - SH - New Editor changes */
1307 #ifdef NEW_EDITOR
1308 AUI_edit_SetDefault(&data->editor_data);
1309 AUI_edit_SetTextStr(&data->editor_data, TxtNull, TxtNull, TxtNull, (UBYTE *)TextString);
1310 AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
1311 AUI_edit_SetEvents(&data->editor_data, event, TRUE, FOREVER, (T_AUI_EDIT_CB)sat_info_cb);
1312 /* 01-06-2006, x0045876 (OMAPS00070741) */
1313 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE*)"", 1);
1314
1315 data->info_win = AUI_edit_Start(win, &data->editor_data);
1316 #else /* NEW_EDITOR */
1317 SmsSend_loadEditDefault(&data->editor_data);
1318 data->editor_data.LeftSoftKey = TxtNull;
1319 data->editor_data.AlternateLeftSoftKey = TxtNull;
1320 data->editor_data.RightSoftKey = TxtNull;
1321 data->editor_data.hide = FALSE;
1322 data->editor_data.mode = E_EDIT_READ_ONLY_MODE;
1323 data->editor_data.timeout = FOREVER;
1324 data->editor_data.Identifier = event;
1325 data->editor_data.Callback = (T_EDIT_CB)sat_info_cb;
1326 data->editor_data.destroyEditor = TRUE;
1327 data->editor_data.TextId = TxtNull;
1328 data->editor_data.TextString = TextString;
1329 data->editor_data.min_enter = 0;
1330 data->info_win = editor_start(win, &data->editor_data);
1331 #endif /* NEW_EDITOR */
1332
1333 }
1334 }
1335 else
1336 {
1337 /* we are in a SETUP CALL session;this is a SATN return */
1338 U8 general_result;
1339 U8 additional_info;
1340
1341 TRACE_EVENT("SAT_CALL_RESULT b");
1342
1343 /* process result of a call setup */
1344 general_result = (U8)(sat_command->c.ccres.result); /*SPR#2042 - DS - Changed from .redialTime */
1345 additional_info = (U8)(sat_command->c.ccres.callId);
1346
1347 if (((general_result & (U8)0xF0) EQ (U8)0x00) ||
1348 ((general_result & (U8)0xF0) EQ (U8)0x10))
1349 {
1350 /* command has been performed */
1351 /*
1352 * destroying the display of SETUP MENU will focus the idle screen (in order to show the incall info)
1353 * furthermore it's necessary to keep track of the used resources
1354 */
1355 #if 0 /* CQ16437 : Do not need to exit menu in order to handle the call correctly */
1356 TRACE_EVENT("destroy SETUP menu");
1357 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL);
1358 #endif
1359 return;
1360 }
1361 else if ((general_result & (U8)0xF0) EQ (U8)0x20)
1362 {
1363 /* command failed: may be worth to retry */
1364 switch (general_result)
1365 {
1366 case 0x20: /* ME currently unable to process command */
1367 TRACE_EVENT("SAT: ME unable");
1368 break;
1369 case 0x21: /* NW currently unable to process command */
1370 TRACE_EVENT("SAT: NW unable");
1371 #ifdef FF_2TO1_PS
1372 if ((additional_info EQ (U8)CAUSE_NWCC_USER_BUSY) &&
1373 #else
1374 if ((additional_info EQ (U8)M_CC_CAUSE_USER_BUSY) &&
1375 #endif
1376 (data->call_setup_parameter NEQ NULL))
1377 {
1378 SEND_EVENT (sat_get_call_setup_win(), SAT_CALL_REDIAL, 0, data->call_setup_parameter); /* redial */
1379 return; /* do NOT release the call setup parameter */
1380 }
1381 break;
1382 case 0x22: /* user rejected call setup */
1383 TRACE_EVENT("user rejected call setup");
1384 case 0x23: /* user cleared down call */
1385 TRACE_EVENT("user cleared down call");
1386 default:
1387 TRACE_EVENT("default reason");
1388 break;
1389 }
1390 }
1391 else if ((general_result & (U8)0xF0) EQ (U8)0x30)
1392 {
1393 /* command failed: not worth to retry with identical command */
1394 TRACE_EVENT("SAT_CALL_RESULT permanent problem");
1395 /* await SAT_SESSION_END in order to react */
1396 }
1397 else
1398 {
1399 TRACE_EVENT("SAT_CALL_RESULT unexp. result code");
1400 }
1401 SEND_EVENT (win, SAT_CALL_END, 0, NULL); /* release the call setup parameter */
1402 }
1403 break;
1404
1405 case SAT_CALL_ALERT:
1406 TRACE_EVENT("SAT_CALL_ALERT");
1407 if (data->call_setup_parameter EQ NULL)
1408 {
1409 /* in case we are called withoud previous CALL_SETUP (which shouldn't happen!) */
1410 data->call_setup_parameter =
1411 (T_SAT_call_setup_parameter *)ALLOC_MEMORY (sizeof(T_SAT_call_setup_parameter));
1412
1413 /* provide an empty string; NULL would crash in info_dialog() */
1414 sat_command->c.ccres.info.len = 0;
1415 data->call_setup_parameter->TextString = sat_create_TEXT_ASCIIZ(&sat_command->c.ccres.info);
1416
1417 }
1418
1419 /* gather callId and redialTime */
1420 data->call_setup_parameter->callId = sat_command->c.ccres.callId;
1421 data->call_setup_parameter->redialTime = sat_command->c.ccres.redialTime;
1422
1423 /* start a dialog to accept or reject the call */
1424 sat_win = sat_call_setup_create(data->win);
1425 if (sat_win)
1426 {
1427 data->sat_command = sat_command;
1428 SEND_EVENT (sat_win, event,0,data->call_setup_parameter);
1429 }
1430 else
1431 {
1432 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1433 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1434 sat_done (sat_command, sat_res);
1435 }
1436 break;
1437
1438 case SAT_SESSION_END:
1439 ETRACE(sprintf(buf, "SAT_SESSION_END %d", data->active_sat_session));
1440 data->active_sat_session = (T_SAT_EVENTS)event;
1441
1442 if (data->info_win NEQ NULL)
1443 {
1444 /* destroy any infoscreen */
1445 /* SPR#1428 - SH - New Editor changes */
1446 #ifdef NEW_EDITOR
1447 SEND_EVENT (data->info_win, E_ED_DEINIT, 0, NULL);
1448 #else /* NEW_EDITOR */
1449 SEND_EVENT (data->info_win, E_EDITOR_DEINIT, 0, NULL);
1450 #endif /* NEW_EDITOR */
1451 data->info_win = NULL;
1452 }
1453
1454
1455 /*
1456 * Marcus: Issue 1057: 21/01/2003: Made SEND_EVENT conditional on
1457 * call_SATCall being FALSE.
1458 */
1459 if (call_SATCall == FALSE)
1460 {
1461 /* Marcus: Issue 1812: 13/03/2003: Start */
1462 if (sat_call_active)
1463 {
1464 sat_call_active = FALSE;
1465 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL);
1466 }
1467 else
1468 {
1469 SEND_EVENT (sat_get_setup_menu_win(), SAT_RETURN, 0, NULL); /* recreate the SETUP MENU */
1470 }
1471 /* Marcus: Issue 1812: 13/03/2003: End */
1472 }
1473 break;
1474
1475 case SAT_CALL_END:
1476 TRACE_EVENT("SAT_CALL_END");
1477 if (data->call_setup_parameter NEQ NULL)
1478 {
1479 /* release the call setup parameters */
1480 sat_destroy_TEXT_ASCIIZ(data->call_setup_parameter->TextString);
1481
1482 //x0035544 Feb 07, 2006 DR:OMAPS00061467 ARUNKS
1483 //Release the icon data.
1484 #ifdef FF_MMI_SAT_ICON
1485 if (data->call_setup_parameter->IconInfo.dst != NULL)
1486 {
1487 FREE_MEMORY((U8 *)data->call_setup_parameter->IconInfo.dst, data->call_setup_parameter->IconInfo.width *
1488 data->call_setup_parameter->IconInfo.height);
1489 data->call_setup_parameter->IconInfo.dst = NULL;
1490 }
1491
1492 #endif
1493 FREE_MEMORY ((U8 *)data->call_setup_parameter, sizeof (T_SAT_call_setup_parameter));
1494 data->call_setup_parameter = NULL;
1495
1496 SEND_EVENT (sat_get_call_setup_win(), event, 0, NULL); /* destroy the window */
1497
1498
1499 }
1500
1501 /* SPR#1784 - DS - Destroy any information screen.
1502 */
1503 if (data->info_win NEQ NULL)
1504 {
1505 TRACE_EVENT("Destroy the info screen");
1506
1507 /* destroy any infoscreen */
1508 #ifdef NEW_EDITOR
1509 SEND_EVENT (data->info_win, E_ED_DEINIT, 0, NULL);
1510 #else /* NEW_EDITOR */
1511 SEND_EVENT (data->info_win, E_EDITOR_DEINIT, 0, NULL);
1512 #endif /* NEW_EDITOR */
1513 data->info_win = NULL;
1514 }
1515
1516 break;
1517
1518 case SAT_UNKNOWN:
1519 TRACE_EVENT("SAT_UNKNOWN");
1520 /*
1521 * unknown SAT commands are rejected
1522 */
1523 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1524 sat_res[SAT_AI_INDEX] = SatResAiNoService;
1525 sat_done (sat_command, sat_res);
1526 break;
1527
1528 case SAT_REFRESH:
1529 TRACE_EVENT("SAT_REFRESH");
1530 #ifdef MMI_HOMEZONE_ENABLED
1531 {
1532 int i;
1533 for (i=0;i<sat_command->c.refFiles.files_nr;i++)
1534 {
1535 /*a0393213 OMAPS00116309 Data type of 'files' changed from U16* to T_file_info*
1536 because of R99 change in ACI*/
1537 switch(sat_command->c.refFiles.files[i].datafield)
1538 {
1539 case HZ_SIM_PARAMETERS:
1540 case HZ_SIM_CELL_CACHE:
1541 case HZ_SIM_CELL_CACHE+1:
1542 case HZ_SIM_CELL_CACHE+2:
1543 case HZ_SIM_CELL_CACHE+3:
1544 /* Read new sim fields into memory. SPR877 - SH - Parameter specifies that SIM fields
1545 * should be read in, even if they were already read at startup. */
1546 homezoneReadSim(HZ_READ_SIM_AGAIN);
1547 return;
1548 default:
1549 break;
1550 }
1551 }
1552 }
1553 #endif
1554 break;
1555
1556 case SAT_SET_EVENTS:
1557 break;
1558 case SAT_IDLE_TEXT:
1559 {
1560 /* xreddymn OMAPS00080543 Jun-06-2006 */
1561 SatTxt *inText;
1562 unsigned char *txtBuf; /* a0393213 LINT warning removal - char* changed to unsigned char* */
1563 UBYTE outDCS;
1564 U16 length;
1565
1566 inText = &sat_command->c.text;
1567
1568 if (inText->len == 0)
1569 {
1570 // 09-Dec-2005, Shashi Shekar B.S., a0876501, START
1571 #ifdef FF_MMI_SAT_ICON
1572 addSatMessage(NULL, 0, 0, NULL, FALSE, SAT_ICON_IDLEMODE_TEXT);
1573 /* Free the memory of icon data that we got through the SATK command*/
1574 if(sat_command->c.text.iconInfo.dst != NULL)
1575 {
1576 mfwFree((U8 *)sat_command->c.text.iconInfo.dst, sat_command->c.text.iconInfo.width *
1577 sat_command->c.text.iconInfo.height);
1578 sat_command->c.text.iconInfo.dst = NULL;
1579 }
1580
1581 #else
1582 addSatMessage(NULL);
1583 #endif
1584
1585 /* 09-May-2006, x0045876 (OMAPS00064076 - By sending SatResUnKnownData,
1586 TC 27.22.4.22.1 SEQ 1.3 was failing. It was changed due to integration problem) */
1587
1588 /* 16 -Jan -2007 x0043642 OMAPS00110997 */
1589 #ifdef FF_MMI_SAT_ICON
1590 if(sat_command->c.text.icon.qual != 0xFF)
1591 {
1592 sat_res[SAT_ERR_INDEX] = SatResUnknownData;
1593 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1594 sat_done(sat_command, sat_res);
1595
1596 }
1597
1598 else
1599 #endif
1600 {
1601
1602 sat_res[SAT_ERR_INDEX] = SatResSuccess;
1603 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1604 sat_done(sat_command, sat_res);
1605 }
1606 }
1607 else
1608 {
1609 /* xreddymn OMAPS00080543 Jun-06-2006 */
1610 /* GSM 7-bit DCS */
1611 if ((inText->code == 0x00) || ((inText->code & 0x0c) == 0x00))
1612 {
1613 length = (((inText->len * 8) + 7) / 7) + 1;
1614 }
1615 /* 8-bit DCS (ASCII) or UCS2 DCS */
1616 else
1617 {
1618 length = inText->len + 1;
1619 }
1620 txtBuf = (unsigned char *)ALLOC_MEMORY(length);
1621
1622 if (!txtBuf)
1623 {
1624 sat_res[SAT_ERR_INDEX] = SatResImpossible;
1625 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1626 sat_done(sat_command, sat_res);
1627 }
1628 else
1629 {
1630 /* xreddymn OMAPS00080543 Jun-06-2006 */
1631 memset(txtBuf, 0x00, length);
1632
1633 /* START: 09-May-2006, x0045876 (OMAPS00064076) */
1634 if (inText->code==MFW_DCS_UCS2)
1635 {
1636 outDCS = MFW_DCS_UCS2;
1637 /* Oct 13, 2006 OMAPS00095266 a0393213(R.Prabakar)
1638 Description : CT-GCF[27.22.4.22.1]-Incorrect string display
1639 Solution : Editor DCS attribute set dynamically based upon the DCS of the incoming text*/
1640 #ifdef NEW_EDITOR
1641 idle_data.editor_attr_sat.text.dcs=ATB_DCS_UNICODE;
1642 #endif
1643 }
1644 else
1645 {
1646 outDCS = MFW_ASCII;
1647 /* Oct 13, 2006 OMAPS00095266 a0393213(R.Prabakar)
1648 Description : CT-GCF[27.22.4.22.1]-Incorrect string display
1649 Solution : Editor DCS attribute set dynamically based upon the DCS of the incoming text*/
1650 #ifdef NEW_EDITOR
1651 idle_data.editor_attr_sat.text.dcs=ATB_DCS_ASCII;
1652 #endif
1653 }
1654 /* END: 09-May-2006, x0045876 (OMAPS00064076) */
1655
1656 TRACE_EVENT_P3("NDH >>> inDcs : %02x, outDCS : %02x, Text Len : %d", inText->code,
1657 outDCS, inText->len);
1658
1659 if ((inText->code == 0x00) || ((inText->code & 0x0c) == 0x00)) // GSM 7-Bit
1660 {
1661 ATB_convert_String((char *)inText + inText->text,
1662 MFW_DCS_7bits, inText->len,
1663 (char*)txtBuf,
1664 /* xreddymn OMAPS00080543 Jun-06-2006
1665 * Removed hardcoded length.
1666 */
1667 outDCS, length-1,
1668 TRUE);
1669 }
1670 else if ((inText->code & 0x0c) == 0x04) // ASCII 8-Bit
1671 {
1672 /* xreddymn OMAPS00080543 Jun-06-2006
1673 * Since long idle screen text display is now supported, we no longer
1674 * need to check length of the message.
1675 */
1676 #if 0
1677 if (outDCS == MFW_ASCII)
1678 {
1679 if (inText->len > length-1)
1680 {
1681 //CQ - 19656 Sandip Start
1682 //For Input DCS 0x00, we are handling long strings , so also for input DCS 0x04 we should handle long strings
1683 #if 0
1684 /*
1685 ** Display Text too long ... Send failure TR to SIM
1686 */
1687 sat_res[SAT_ERR_INDEX] = SatResImpossible;
1688 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1689 sat_done(sat_command, sat_res);
1690
1691 FREE_MEMORY((U8 *)txtBuf, MAX_CBMSG_LEN);
1692 return;
1693 #endif
1694 //CQ - 19656 Sandip
1695 ATB_convert_String((char *)inText + inText->text,
1696 MFW_DCS_8bits, inText->len,
1697 txtBuf,
1698 outDCS, MAX_CBMSG_LEN-1,
1699 TRUE);
1700 //CQ - 19656 Sandip End
1701 }
1702 else
1703 {
1704 //MMI_FIX-19656 Using 8 bit table for dispay start
1705 ATB_convert_String((char *)inText + inText->text,
1706 MFW_DCS_8bits, inText->len,
1707 txtBuf,
1708 outDCS, MAX_CBMSG_LEN-1,
1709 TRUE);
1710 //MMI_FIX-19656 Using 8 bit table for dispay end
1711 //memcpy(txtBuf, (char *)inText + inText->text, inText->len);
1712 }
1713 }
1714 else
1715 #endif
1716 {
1717 ATB_convert_String((char *)inText + inText->text,
1718 MFW_DCS_8bits, inText->len,
1719 (char*)txtBuf,
1720 /* xreddymn OMAPS00080543 Jun-06-2006
1721 * Removed hardcoded length.
1722 */
1723 outDCS, length-1,
1724 TRUE);
1725 }
1726 }
1727 else // UCS2
1728 /* xreddymn OMAPS00080543 Jun-06-2006
1729 * Since long idle screen text display is now supported, we no longer
1730 * need to check length of the message.
1731 */
1732 /*10 Jul 2006, Ref OMAPS00077654, R.Prabakar(a0393213)
1733 Description : Cyrillic character support in MMI to pass GCF/PTCRB UCS2 TC (SATK)
1734 Solution : #if 0 added for OMAPS00080543 moved*/
1735
1736 {
1737
1738 if (outDCS == MFW_DCS_UCS2)
1739 {
1740 #if 0
1741 if (inText->len > MAX_CBMSG_LEN-1)
1742 {
1743 /*
1744 ** Display Text too long ... Send failure TR to SIM
1745 */
1746 sat_res[SAT_ERR_INDEX] = SatResImpossible;
1747 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1748 sat_done(sat_command, sat_res);
1749
1750 FREE_MEMORY((U8 *)txtBuf, MAX_CBMSG_LEN);
1751 return;
1752 }
1753 else
1754 #endif
1755 {
1756 /*Oct 13, 2006 OMAPS00095266 a0393213(R.Prabakar)
1757 Solution : Changes made as part of OMAPS00064076 undone.
1758 Before we were appending 0x80 and 0x7F to the original string to describe that the following text is UNICODE.
1759 Now since the attribute of the editor is already set to UNICODE, no need to append 0x80 and 0x7F*/
1760 memcpy(txtBuf, (UBYTE*)inText+inText->text, inText->len);
1761
1762 }
1763 }
1764 else
1765
1766 {
1767 ATB_convert_String((char *)inText + inText->text,
1768 MFW_DCS_UCS2, inText->len,
1769 (char*)txtBuf,
1770 /* xreddymn OMAPS00080543 Jun-06-2006
1771 * Removed hardcoded length.
1772 */
1773 outDCS, length-1,
1774 TRUE);
1775 }
1776 }
1777
1778 TRACE_EVENT_P1("NDH >>> txtBuf is : %s", txtBuf);
1779
1780 // 09-Dec-2005, Shashi Shekar B.S., a0876501, START
1781 #ifdef FF_MMI_SAT_ICON
1782 /*Check if the SAT command has icon*/
1783 if(sat_command->c.text.icon.qual != 0xFF)
1784 {
1785 /* Icon is self-explanatory. No need to display text for this case.*/
1786 if(sat_command->c.text.icon.qual == 0x00)
1787 {
1788 /* Icon is self-explanatory. Do not display the text.
1789 Send a TRUE to the Idle window. */
1790 /*Oct 13, 2006 OMAPS00095266 a0393213(R.Prabakar)
1791 Solution : Changes made as part of OMAPS00077654 undone.
1792 Before we were setting the first two bytes to 0x80 and 0x7F and sending the text from the third byte.
1793 Now we are not appending any string to the original string. So the buffer is sent right from the first byte*/
1794 addSatMessage((char*)txtBuf, sat_command->c.text.iconInfo.width, sat_command->c.text.iconInfo.height,
1795 (char *)sat_command->c.text.iconInfo.dst, TRUE, SAT_ICON_IDLEMODE_TEXT);
1796 }
1797 else
1798 {
1799 addSatMessage((char*)txtBuf, sat_command->c.text.iconInfo.width, sat_command->c.text.iconInfo.height,
1800 (char *)sat_command->c.text.iconInfo.dst, FALSE, SAT_ICON_IDLEMODE_TEXT);
1801 }
1802 }
1803 else
1804 {
1805 addSatMessage((char*)txtBuf, 0, 0, NULL, FALSE, SAT_ICON_NONE);
1806 }
1807
1808 #else
1809 /* START: 09-May-2006, x0045876 (OMAPS00064076) */
1810 addSatMessage((char*)txtBuf);
1811 /* END: 09-May-2006, x0045876 (OMAPS00064076) */
1812 #endif
1813
1814 sat_res[SAT_ERR_INDEX] = SatResSuccess;
1815 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1816 sat_done(sat_command, sat_res);
1817 // 09-Dec-2005, Shashi Shekar B.S., a0876501, START
1818 #ifdef FF_MMI_SAT_ICON
1819 /* Free the memory of icon data that we got through the SATK command*/
1820 if(sat_command->c.text.iconInfo.dst != NULL)
1821 {
1822 mfwFree((U8 *)sat_command->c.text.iconInfo.dst, sat_command->c.text.iconInfo.width *
1823 sat_command->c.text.iconInfo.height);
1824 sat_command->c.text.iconInfo.dst = NULL;
1825 }
1826 #endif
1827 /* xreddymn OMAPS00080543 Jun-06-2006 */
1828 FREE_MEMORY((U8 *)txtBuf, length);
1829 }
1830 }
1831 }
1832 break;
1833
1834 #ifdef FF_WAP
1835 case SAT_LAUNCH_BROWSER:
1836
1837 break;
1838 #endif
1839 case SAT_OPEN_CHANNEL:
1840 TRACE_EVENT("SAT_OPEN_CHANNEL");
1841
1842 /*
1843 * Create and initiate Open Channel Window
1844 */
1845 sat_win = sat_class_e_create (data->win);
1846
1847 if (sat_win)
1848 {
1849 data->sat_command = sat_command;
1850 SEND_EVENT (sat_win, event, 0, data->sat_command);
1851 }
1852 else
1853 {
1854 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1855 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1856 sat_done (sat_command, sat_res);
1857 }
1858 break;
1859 case SAT_CLOSE_CHANNEL:
1860 TRACE_EVENT("SAT_CLOSE_CHANNEL");
1861
1862 /*
1863 * Create and initiate Close Channel window
1864 */
1865 sat_win = sat_class_e_create (data->win);
1866
1867 if (sat_win)
1868 {
1869 data->sat_command = sat_command;
1870 SEND_EVENT (sat_win, event, 0, data->sat_command);
1871 }
1872 else
1873 {
1874 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1875 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1876 sat_done (sat_command, sat_res);
1877 }
1878 break;
1879 case SAT_SEND_DATA:
1880 TRACE_EVENT("SAT_SEND_DATA");
1881
1882 /*
1883 * Create and initiate Send Data window
1884 */
1885 sat_win = sat_class_e_create (data->win);
1886
1887 if (sat_win)
1888 {
1889 data->sat_command = sat_command;
1890 SEND_EVENT (sat_win, event, 0, data->sat_command);
1891 }
1892 else
1893 {
1894 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1895 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1896 sat_done (sat_command, sat_res);
1897 }
1898 break;
1899 case SAT_RECEIVE_DATA:
1900
1901 TRACE_EVENT("SAT_RECEIVE_DATA");
1902
1903 /*
1904 * Create and initiate Receive Data window
1905 */
1906 sat_win = sat_class_e_create (data->win);
1907
1908 if (sat_win)
1909 {
1910 data->sat_command = sat_command;
1911 SEND_EVENT (sat_win, event, 0, data->sat_command);
1912 }
1913 else
1914 {
1915 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1916 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1917 sat_done (sat_command, sat_res);
1918 }
1919 break;
1920 default:
1921 TRACE_EVENT("sim_toolkit_exec() unexp. event");
1922 break;
1923 }
1924 }
1925 /*******************************************************************************
1926
1927 $Function: sim_toolkit_sat_cb
1928
1929 $Description: Callback function for SAT handler of top window
1930
1931 $Returns: none.
1932
1933 $Arguments:
1934
1935 *******************************************************************************/
1936 static int sim_toolkit_sat_cb ( T_MFW_EVENT event, T_MFW_SAT * sat_bits)
1937 {
1938 USHORT sat_event = 0; // RAVI
1939
1940 TRACE_EVENT("sim_toolkit_sat_cb");
1941 /*
1942 * check whether a decoded message is available
1943 */
1944 if ((sat_bits EQ NULL) || (g_sim_toolkit_data->win EQ NULL))
1945 {
1946 TRACE_EVENT("sim_toolkit_sat_cb() unexp. event");
1947 return MFW_EVENT_CONSUMED;
1948 }
1949
1950 /* convert the flag into an event */
1951 if (event == MfwSatSessionEnd)
1952 {
1953 sat_event = SAT_SESSION_END;
1954 }
1955 else
1956 {
1957 switch (event)
1958 {
1959 case MfwSatTextOut: /* display string */
1960 sat_event = SAT_DISPLAY_TEXT;
1961 break;
1962 case MfwSatGetKey: /* get user keystroke */
1963 sat_event = SAT_GET_KEY;
1964 break;
1965 case MfwSatGetString: /* get user input */
1966 sat_event = SAT_GET_STRING;
1967 break;
1968 case MfwSatPlayTone: /* play audio tone */
1969 sat_event = SAT_PLAY_TONE;
1970 break;
1971 case MfwSatSetupMenu: /* setup toolkit menu */
1972 sat_event = SAT_SETUP_MENU;
1973 break;
1974 case MfwSatSelectItem: /* select menu item */
1975 sat_event = SAT_SELECT_ITEM;
1976 break;
1977 case MfwSatSendSMS: /* send short message */
1978 sat_event = SAT_SEND_SMS;
1979 break;
1980 case MfwSatSendUSSD:
1981 case MfwSatSendSS: /* send service command */
1982 sat_event = SAT_SEND_SS;
1983 break;
1984 case MfwSatSendDTMF: /* send service command */
1985 sat_event = SAT_SEND_DTMF;
1986 break;
1987 case MfwSatCall: /* setup a call */
1988 sat_event = SAT_SETUP_CALL;
1989 break;
1990 case MfwSatCcRes: /* call control result */
1991 sat_event = SAT_CALL_RESULT;
1992 break;
1993 case MfwSatCcAlert: /* call control alerting */
1994 sat_event = SAT_CALL_ALERT;
1995 break;
1996 case MfwSatRefresh: /* refresh SIM fields */
1997 sat_event = SAT_REFRESH;
1998 break;
1999 case MfwSatSetEvents: /* Sat Set Events updated */
2000 sat_event = SAT_SET_EVENTS;
2001 break;
2002 case MfwSatIdleText: /* Sat Set Events updated */
2003 sat_event = SAT_IDLE_TEXT;
2004 break;
2005 case MfwSatDataRefreshed: /* Data refreshed */
2006 TRACE_EVENT("MfwSatDataRefreshed event sent");
2007 break;
2008 case MfwSatOpenChannel: /* Open channel */
2009 sat_event = SAT_OPEN_CHANNEL;
2010 break;
2011 case MfwSatCloseChannel: /* Close channel */
2012 sat_event = SAT_CLOSE_CHANNEL;
2013 break;
2014 case MfwSatSendData: /* Send data */
2015 sat_event = SAT_SEND_DATA;
2016 break;
2017 case MfwSatReceiveData: /* Receive data */
2018 sat_event = SAT_RECEIVE_DATA;
2019 break;
2020 #ifdef FF_WAP /*Disable for testing without WAP*/
2021 case MfwSatLaunchBrowser:
2022 TRACE_EVENT("SAT_LAUNCH_BROWSER got to MMI");
2023 #ifdef MMI_TEST_SAT_LAUNCH_BROWSER
2024 {
2025 #define LENGTH_URL 40
2026 T_SAT_RES sat_res;
2027 SatLaunchBrowser laun_brow;
2028 char prov_url[LENGTH_URL];
2029 short pos = 0;
2030 int i;
2031
2032 sat_res[SAT_ERR_INDEX] = SAT_RES_SUCCESS;
2033 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
2034 sat_done (sat_bits->cmd, sat_res);
2035 sat_event = SAT_LAUNCH_BROWSER;
2036 laun_brow = sat_bits->cmd->c.browser;
2037 memset(information,'\0',INFORMATION_SIZE);
2038 TRACE_EVENT_P1("Browser identity -> %d",laun_brow.identity);
2039 memcpy(&prov_url,laun_brow.url,LENGTH_URL);
2040 prov_url[LENGTH_URL-1] = '\0';
2041 TRACE_EVENT_P1("Browser url -> %s",prov_url);
2042 pos += sprintf(information+pos,
2043 "BROWSER\n-Identity=%d\n-Url=%s\n-Bearers(%d)=",
2044 laun_brow.identity,
2045 prov_url,
2046 laun_brow.n_bearer);
2047 for (i=0;i<5;i++)
2048 pos+=sprintf(information+pos," %d",*laun_brow.bearer++);
2049 mmiOpenDummyBrowser(g_sim_toolkit_data->win,information);
2050 }
2051 break;
2052 #endif /*FF_WAP*/
2053 #endif /* MMI_TEST_SAT_LAUNCH_BROWSER */
2054 #ifdef FF_MMI_R99_SAT_LANG
2055 case MfwSatLangNotify: /*OMAPS00070661(SAT-Lang notify) a0393213(R.Prabakar)*/
2056 sat_event = SAT_LANGUAGE_NOTIFY;
2057 break;
2058 case MfwSatLocalInfo: /*OMAPS00070661(SAT-Local Info) a0393213(R.Prabakar)*/
2059 sat_event = SAT_LOCAL_INFO;
2060 break;
2061 #endif /*FF_MMI_R99_SAT_LANG*/
2062 case MfwSatErrBusy:
2063 TRACE_EVENT("MfwSatError reached BMI");
2064 {
2065 T_DISPLAY_DATA display_info;
2066
2067 /* SPR#2321 - DS - Display "SAT Busy" dialog */
2068
2069 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, "SAT Busy", "Reset App" , COLOUR_STATUS);
2070 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_RIGHT | KEY_LEFT );
2071 info_dialog (g_sim_toolkit_data->win, &display_info);
2072 }
2073
2074 /* No SEND_EVENT */
2075
2076 return MFW_EVENT_CONSUMED;
2077 default:
2078 sat_event = SAT_UNKNOWN;
2079 break;
2080 }
2081 }
2082 SEND_EVENT (g_sim_toolkit_data->win, sat_event, 0, sat_bits->cmd);
2083 return MFW_EVENT_CONSUMED;
2084 }
2085
2086 /*******************************************************************************
2087
2088 $Function: sat_setup_menu_proc
2089
2090 $Description: process SAT_SETUP_MENU event
2091
2092 $Returns: none.
2093
2094 $Arguments:
2095
2096 *******************************************************************************/
2097 static void sat_setup_menu_proc(T_SAT_CMD * sat_command)
2098 {
2099 TRACE_FUNCTION("sat_setup_menu_proc");
2100
2101 if (sat_command->c.menu.items[0].len EQ 0)
2102 {
2103 /*
2104 * "Item data object for item 1" is a null data object:
2105 * hide the SIM toolkit menu item in the main menu
2106 */
2107 menuDisableSimMenu();
2108 g_sim_toolkit_data->sat_available_on_SIM = FALSE;
2109 //release the labe of the mainmenu
2110 //GW-SPR#1035 Free memory using sat_destroy_TEXT_ASCIIZ (as it is allocated using corresponding procedure)
2111 if (sat_mainmenu_label NEQ NULL)
2112 {
2113 sat_destroy_TEXT_ASCIIZ (sat_mainmenu_label);
2114 sat_mainmenu_label = NULL;
2115 }
2116
2117 if (sat_get_setup_menu_win() NEQ NULL)
2118 {
2119 /* there's an active SETUP MENU */
2120 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL); /* SETUP_MENU shall selfdestroy */
2121 }
2122 if (g_sim_toolkit_data->sat_setup_menu_command NEQ NULL)
2123 {
2124 FREE_MEMORY ((U8 *)(g_sim_toolkit_data->sat_setup_menu_command), sizeof (T_SAT_CMD));
2125 g_sim_toolkit_data->sat_setup_menu_command = NULL;
2126 }
2127 }
2128 else
2129 {
2130 /* install new setup menu */
2131 if (sat_get_setup_menu_win() NEQ NULL)
2132 {
2133 /* there's already an active SETUP MENU */
2134 SEND_EVENT (sat_get_setup_menu_win(), SAT_EXIT, 0, NULL); /* SETUP_MENU shall selfdestroy */
2135 //xrashmic 16 Feb, 2006 OMAPS00064413
2136 //List win should be set to null, when destroying the setup menu.
2137 sat_set_setup_menu_listmnu_win(NULL);
2138 }
2139
2140 /* store command contents for later use in sat_setup_menu_start() */
2141 if (g_sim_toolkit_data->sat_setup_menu_command EQ NULL)
2142 {
2143 /* if not already allocated, get storage for the SETUP MENU command */
2144 g_sim_toolkit_data->sat_setup_menu_command =
2145 (T_SAT_CMD *)ALLOC_MEMORY (sizeof (T_SAT_CMD));
2146 }
2147 *(g_sim_toolkit_data->sat_setup_menu_command) = *sat_command; /* copy contents */
2148
2149 /*#ifdef CHINESE_MMI*/
2150 /*
2151 The label for the main menu
2152
2153 */
2154 TRACE_EVENT("SAT: Creating main menu label");
2155 {
2156 #ifdef NO_ASCIIZ
2157 /*MC, SPR 940/2if we're in chinese, header may be converted from ASCII to Unicode*/
2158 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
2159 header_len = g_sim_toolkit_data->sat_setup_menu_command->c.menu.header.len *2;
2160 else
2161 #endif
2162 /* taking the label from menu command file and convert to ascii */
2163 header_len = g_sim_toolkit_data->sat_setup_menu_command->c.menu.header.len;
2164
2165
2166 sat_mainmenu_label = sat_create_TEXT_ASCIIZ (&g_sim_toolkit_data->sat_setup_menu_command->c.menu.header);
2167 if(sat_mainmenu_label)
2168 {
2169 sat_mainmenu_label[header_len] = '\0';
2170 /*JVJ #1576 The SimToolkit Title string is set here */
2171 res_set_SIMToolkit_title_string(sat_mainmenu_label);
2172 }
2173 }
2174 /* unhide the SIM toolkit menu item in the main menu */
2175 menuEnableSimMenu
2176 (
2177 "", /* label */
2178 (SimMenuFunc)sat_setup_menu_start, /* callback when menu entered */
2179 g_sim_toolkit_data->sat_setup_menu_command /* parameter to callback */
2180 );
2181 }
2182 sat_set_setup_menu_win(NULL); // avoid notifications to a non-existent window
2183 }
2184
2185
2186 /*******************************************************************************
2187
2188 $Function: sat_win_cb
2189
2190 $Description: Default sat window event handler. Avoid intermediate visibility of lower menus
2191
2192
2193 $Returns: none.
2194
2195 $Arguments:
2196
2197 *******************************************************************************/
2198 int sat_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
2199 {
2200 TRACE_FUNCTION("sat_win_cb");
2201
2202 if (win EQ NULL)
2203 return MFW_EVENT_CONSUMED;
2204
2205 switch (event)
2206 {
2207 case E_WIN_VISIBLE: /* window changed visibility */
2208 if (win->flags & E_WIN_VISIBLE)
2209 {
2210 /* window becomes visible */
2211 dspl_ClearAll(); /* overwrite redraw of lower menus with cleared screen */
2212 dspl_TextOut(0,12,/*DSPL_TXTATTR_NORMAL*/DSPL_TXTATTR_CURRENT_MODE/*MC*/,GET_TEXT(TxtPleaseWait)); /* sbh - so we don't get blank screen */
2213 }
2214 break;
2215 default:
2216 return MFW_EVENT_REJECTED;
2217 }
2218 return MFW_EVENT_CONSUMED;
2219 }
2220
2221 /*******************************************************************************
2222
2223 $Function: sat_kbd_cb
2224
2225 $Description: Default sat window keyboard handler
2226
2227
2228 $Returns: none.
2229
2230 $Arguments:
2231
2232 *******************************************************************************/
2233 int sat_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * key)
2234 {
2235 T_MFW_HND win = mfwParent( mfw_header() );
2236
2237 TRACE_FUNCTION("sat_kbd_cb");
2238
2239 /* make sure we handle null keyboards
2240 */
2241 if ( key == NULL )
2242 return MFW_EVENT_CONSUMED;
2243
2244 /* deal with the incoming key code
2245 */
2246 switch( key->code )
2247 {
2248
2249 /* Destroy the window on either right softkey or hangup keypresses */
2250 case KCD_HUP:
2251 case KCD_RIGHT:
2252 {
2253 SEND_EVENT(win, SAT_DESTROY_WINDOW, 0, 0);
2254 break;
2255 }
2256 }
2257
2258 return MFW_EVENT_CONSUMED;
2259 }
2260
2261
2262 /*******************************************************************************
2263
2264 $Function: sat_info_cb
2265
2266 $Description: Callback function information dialog.
2267
2268 $Returns: none.
2269
2270 $Arguments:
2271
2272 *******************************************************************************/
2273 static void sat_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
2274 {
2275 /* INFO DISPLAY */
2276 T_MFW_WIN * info_win_data = ((T_MFW_HDR *)win)->data;
2277 T_sim_toolkit * info_data = (T_sim_toolkit *)info_win_data->user;
2278
2279 TRACE_FUNCTION("sat_info_cb");
2280
2281 if (win EQ NULL)
2282 return;
2283
2284 /*
2285 * Who has initiated the information screen
2286 */
2287 switch (identifier)
2288 {
2289 //x0035544 added fix done by x0021334 for CQ-33597 21-11-2005
2290 case SAT_SEND_DTMF: // x0021334 : To test SAT session end - CQ33597
2291 {
2292 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2293 #ifdef FF_MMI_SAT_ICON
2294 if (info_data->editor_data.editor_attr.TitleIcon.data != NULL)
2295 {
2296 FREE_MEMORY((U8 *)info_data->editor_data.editor_attr.TitleIcon.data, info_data->editor_data.editor_attr.TitleIcon.width *
2297 info_data->editor_data.editor_attr.TitleIcon.height);
2298 info_data->editor_data.editor_attr.TitleIcon.data = NULL;
2299 }
2300 #endif
2301
2302 switch(reason)
2303 {
2304 case INFO_KCD_RIGHT:
2305 case INFO_KCD_HUP:
2306 // Call mfw function to end the session
2307 Mfw_SAT_DTMF_EndSession();
2308 #ifdef NEW_EDITOR
2309 AUI_edit_Destroy(info_data->info_win);
2310 #else /* NEW_EDITOR */
2311 editor_destroy(info_data->info_win);
2312 #endif /* NEW_EDITOR */
2313 info_data->info_win = NULL;
2314 break;
2315 default:
2316 TRACE_EVENT("sat_info_cb(): unexp. event");
2317 break;
2318 }
2319 }
2320 break;
2321
2322 case SAT_SEND_SMS:
2323 case SAT_SEND_SS:
2324 //case SAT_SEND_DTMF: x0035544 CQ-33597 21-11-2005
2325 case SAT_CALL_RESULT:
2326 if ((info_win_data EQ NULL) || (info_data EQ NULL))
2327 return;
2328
2329 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2330 #ifdef FF_MMI_SAT_ICON
2331 if (info_data->editor_data.editor_attr.TitleIcon.data != NULL)
2332 {
2333 FREE_MEMORY((U8 *)info_data->editor_data.editor_attr.TitleIcon.data, info_data->editor_data.editor_attr.TitleIcon.width *
2334 info_data->editor_data.editor_attr.TitleIcon.height);
2335 info_data->editor_data.editor_attr.TitleIcon.data = NULL;
2336 }
2337 #endif
2338 /* SPR#1428 - SH - New Editor changes */
2339 #ifdef NEW_EDITOR
2340 sat_destroy_TEXT_ASCIIZ((char*)info_data->editor_data.TitleString); /* displayed text */
2341 #else /* NEW_EDITOR */
2342 sat_destroy_TEXT_ASCIIZ((char*)info_data->editor_data.TextString); /* displayed text */
2343 #endif /* NEW_EDITOR */
2344 break;
2345 default:
2346 TRACE_EVENT("sat_info_cb(): unexp. event");
2347 break;
2348 }
2349 }
2350
2351
2352 /*******************************************************************************
2353
2354 $Function: sat_set_setup_menu_win
2355
2356 $Description: set the window associated with the setup menu command
2357
2358 $Returns: none.
2359
2360 $Arguments:
2361
2362 *******************************************************************************/
2363 void sat_set_setup_menu_win(T_MFW_HND win)
2364 {
2365 TRACE_FUNCTION("sat_set_setup_menu_win");
2366
2367 g_sim_toolkit_data->sat_setup_menu_win = win;
2368 }
2369
2370
2371 /*******************************************************************************
2372
2373 $Function: sat_get_setup_menu_win
2374
2375 $Description: get the window associated with the setup menu command
2376
2377 $Returns: none.
2378
2379 $Arguments:
2380
2381 *******************************************************************************/
2382 T_MFW_HND sat_get_setup_menu_win(void)
2383 {
2384 TRACE_EVENT("sat_get_setup_menu_win");
2385 return g_sim_toolkit_data->sat_setup_menu_win;
2386 }
2387
2388
2389 /*******************************************************************************
2390
2391 $Function: sat_set_setup_menu_listmnu_win
2392
2393 $Description: set the window associated with the sat list menu
2394
2395 $Returns: none.
2396
2397 $Arguments:
2398
2399 *******************************************************************************/
2400 void sat_set_setup_menu_listmnu_win(T_MFW_HND win)
2401 {
2402 TRACE_FUNCTION("sat_set_setup_menu_listmnu_win");
2403
2404 g_sim_toolkit_data->sat_setup_menu_listmnu_win= win;
2405 }
2406
2407
2408 /*******************************************************************************
2409
2410 $Function: sat_get_setup_menu_listmnu_win
2411
2412 $Description: get the window associated with the setup list menu
2413
2414 $Returns: none.
2415
2416 $Arguments:
2417
2418 *******************************************************************************/
2419 T_MFW_HND sat_get_setup_menu_listmnu_win(void)
2420 {
2421 TRACE_EVENT("sat_get_setup_menu_listmnu_win");
2422 return g_sim_toolkit_data->sat_setup_menu_listmnu_win;
2423 }
2424
2425
2426 /*******************************************************************************
2427
2428 $Function: sat_set_call_setup_win
2429
2430 $Description: set the window associated with the call setup command
2431
2432 $Returns: none.
2433
2434 $Arguments:
2435
2436 *******************************************************************************/
2437 void sat_set_call_setup_win(T_MFW_HND win)
2438 {
2439 TRACE_FUNCTION("sat_set_call_setup_win");
2440 g_sim_toolkit_data->sat_call_setup_win = win;
2441 }
2442
2443
2444 /*******************************************************************************
2445
2446 $Function: sat_get_call_setup_win
2447
2448 $Description: get the window associated with the call setup command
2449
2450 $Returns: none.
2451
2452 $Arguments:
2453
2454 *******************************************************************************/
2455 /* Marcus: Issue 1057: 21/01/2003: Made public */
2456 T_MFW_HND sat_get_call_setup_win(void)
2457 {
2458 TRACE_FUNCTION("sat_get_call_setup_win");
2459 return g_sim_toolkit_data->sat_call_setup_win;
2460 }
2461
2462 /*******************************************************************************
2463
2464 $Function: g_ascii_gsm_table
2465
2466 $Description: convert a string coded in ASCIIZ into GSM alphabet
2467
2468 $Returns: none.
2469
2470 $Arguments:
2471
2472 *******************************************************************************/
2473 static const char g_ascii_gsm_table[256] = {
2474 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //000-007
2475 0x20,0x20, 10,0x20,0x20, 13,0x20,0x20, //008-015
2476 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //016-023
2477 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //024-031
2478 32, 33, 34, 35, 2, 37, 38, 39, //032-039
2479 40, 41, 42, 43, 44, 45, 46, 47, //040-047
2480 48, 49, 50, 51, 52, 53, 54, 55, //048-055
2481 56, 57, 58, 59, 60, 61, 62, 63, //056-063
2482 0, 65, 66, 67, 68, 69, 70, 71, //064-071
2483 72, 73, 74, 75, 76, 77, 78, 79, //072-079
2484 80, 81, 82, 83, 84, 85, 86, 87, //080-087
2485 88, 89, 90,0x20,0x20,0x20,0x20,0x20, //088-095
2486 0x20, 97, 98, 99, 100, 101, 102, 103, //096-103
2487 104, 105, 106, 107, 108, 109, 110, 111, //104-111
2488 112, 113, 114, 115, 116, 117, 118, 119, //112-119
2489 120, 121, 122,0x20,0x20,0x20,0x20,0x20, //120-127
2490 9, 126, 5,0x20, 123, 127, 15,0x20, //128-135
2491 0x20,0x20, 4,0x20,0x20, 7, 91, 14, //136-143
2492 31, 29, 28,0x20, 124, 8,0x20, 6, //144-151
2493 0x20, 92, 94,0x20, 1, 3,0x20,0x20, //152-159
2494 0x20,0x20,0x20,0x20, 125, 93,0x20,0x20, //160-167
2495 96, 17,0x20,0x20,0x20, 64,0x20,0x20, //168-175
2496 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //176-183
2497 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //184-191
2498 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //192-199
2499 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //200-207
2500 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //208-215
2501 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //216-223
2502 0x20, 30, 19, 22, 24,0x20,0x20,0x20, //224-231
2503 18, 25, 21,0x20,0x20,0x20,0x20, 20, //232-239
2504 26,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //240-247
2505 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, //248-255
2506 };
2507
2508 void sat_ascii_to_gsm (char * gsm_string, char * ascii_string, U16 length)
2509 {
2510 U16 i;
2511 TRACE_FUNCTION("sat_ascii_to_gsm");
2512
2513 for (i = 0; i < length; i++)
2514 gsm_string[i] = g_ascii_gsm_table[ascii_string[i]];
2515 }
2516
2517 /*******************************************************************************
2518
2519 $Function: sat_ascii_to_ucode
2520
2521 $Description: convert a string coded in ASCIIZ into UCS2 alphabet
2522
2523 $Returns: none.
2524
2525 $Arguments:
2526
2527 *******************************************************************************/
2528 void sat_ascii_to_ucode (wchar_t * UCS2_chars, char * ascii_string, U16 length)
2529 {
2530 U16 i;
2531 TRACE_FUNCTION("sat_ascii_to_ucode");
2532 for (i = 0; i < length; i++)
2533 UCS2_chars[i] = (wchar_t)(int)(ascii_string[i]);/*a0393213 extra casting done to avoid lint warning*/
2534 }
2535
2536 /*******************************************************************************
2537
2538 $Function: sat_ucode_to_ascii
2539
2540 $Description: convert a string coded in UCS2 into ASCII alphabet
2541
2542 $Returns: none.
2543
2544 $Arguments:
2545
2546 *******************************************************************************/
2547 void sat_ucode_to_ascii (char * ascii_string, wchar_t * UCS2_chars, U16 length)
2548 {
2549 U16 i;
2550 TRACE_FUNCTION("sat_ucode_to_asci");
2551
2552 for (i = 0; i < length; i++)
2553 ascii_string[i] = (char)UCS2_chars[i];
2554 ascii_string[i] = '\0';
2555 }
2556 /*******************************************************************************
2557
2558 $Function: g_gsm_ascii_table
2559
2560 $Description: convert a string coded in GSM alphabet into an ASCIIZ string
2561
2562 $Returns: none.
2563
2564 $Arguments:
2565
2566 *******************************************************************************/
2567
2568 static const unsigned char g_gsm_ascii_table[128] = {
2569 64, 156, 36, 157, 138, 130, 151, 141,
2570 149, 128, 10,0x20 , 32, 13, 143, 134,
2571 0x20, 169, 232, 226, 239, 234, 227,0x20,
2572 228, 233, 240,0x20, 146, 145, 225, 144,
2573 32, 33, 34, 35,0x20, 37, 38, 39,
2574 40, 41, 42, 43, 44, 45, 46, 47,
2575 48, 49, 50, 51, 52, 53, 54, 55,
2576 56, 57, 58, 59, 60, 61, 62, 63,
2577 173, 65, 66, 67, 68, 69, 70, 71,
2578 72, 73, 74, 75, 76, 77, 78, 79,
2579 80, 81, 82, 83, 84, 85, 86, 87,
2580 88, 89, 90, 142, 153, 165, 154,0x20,
2581 168, 97, 98, 99, 100, 101, 102, 103,
2582 104, 105, 106, 107, 108, 109, 110, 111,
2583 112, 113, 114, 115, 116, 117, 118, 119,
2584 120, 121, 122, 132, 148, 164, 129, 133
2585 };
2586
2587 void sat_gsm_to_ascii (char * ascii_string, char * gsm_string, U16 length)
2588 {
2589 U16 i;
2590 TRACE_FUNCTION("sat_gsm_to_ascii");
2591 // Jun 02, 2004 REF: CRR 15747 xpradipg-SASKEN
2592 // Fix: The string is terminated if the length is reached or if it encounters '0xFF'
2593 // gsm_string[i]!=0xFF is introduced to check if the string is terminated prior to the specified length
2594 for (i = 0; i < length && gsm_string[i]!= (char)0xFF; i++)
2595 ascii_string[i] = (char)g_gsm_ascii_table[(gsm_string[i] & (U8)0x7F)];
2596 ascii_string[i] = '\0';
2597 }
2598
2599
2600 /*******************************************************************************
2601
2602 $Function: sat_TEXT_to_ASCIIZ
2603
2604 $Description: This routine converts a MFW SAT text descriptor into a
2605 conventional ASCIIZ string
2606 $Returns: none.
2607
2608 $Arguments:
2609
2610 *******************************************************************************/
2611 void sat_TEXT_to_ASCIIZ (char * destination, T_SAT_TXT * txt)
2612 {
2613 UBYTE * temp_buffer;
2614 char* txt_start;
2615
2616 TRACE_FUNCTION("sat_TEXT_to_ASCIIZ");
2617
2618 TRACE_EVENT_P1("T_SAT_TXT txt->code=%x", txt->code);
2619
2620 switch (txt->code)
2621 {
2622 case MFW_DCS_7bits:
2623 temp_buffer = (UBYTE *)ALLOC_MEMORY(((txt->len*8)/7)+1);
2624 utl_cvt7To8 ((UBYTE *)txt + txt->text, txt->len, temp_buffer,0);
2625
2626 //Sandip CQ 16292 . commented
2627 /*sat_gsm_to_ascii (destination, (char *)temp_buffer, len);*/
2628 /*Sandip CQ 16292 . added this new function . Problem with current TI GSM 7-bit default function*/
2629 DecodeGSM7ToASCII((unsigned char*)txt+txt->text, (unsigned char*) destination, txt->len);
2630 FREE_MEMORY ((U8 *)temp_buffer, ((txt->len*8)/7)+1);
2631 break;
2632 case MFW_DCS_8bits:
2633 /* SPR#1700 - DS - Modified to handle 0x80 style unicode */
2634 txt_start = (char*)txt + txt->text;
2635 if ((*txt_start == (char)0x80) && (txt->len & 1))
2636 {
2637 TRACE_EVENT("0x80 style unicode");
2638 memset(destination,0,txt->len+2);
2639 memcpy(destination,txt_start+1,txt->len-1);
2640 txt->code = MFW_DCS_UCS2;
2641 }
2642 else
2643 {
2644 sat_gsm_to_ascii (destination, (char *)txt + txt->text, (UBYTE)txt->len);
2645 }
2646 break;
2647 case MFW_DCS_UCS2:
2648 sat_ucode_to_ascii (destination, (wchar_t *)((char *)txt + txt->text), txt->len);
2649 break;
2650 default:
2651 sat_gsm_to_ascii (destination, (char *)txt + txt->text, (UBYTE)txt->len); /* SH - got txt->code=244, so need generic response to this*/
2652 TRACE_EVENT("sat_TEXT_to_ASCIIZ() unexp. DCS");
2653 }
2654 }
2655
2656 //sandip 16292
2657 // Converts a given 8-bit encoded string into original 7-bit GSM data string according to TS 31.102
2658 /*******************************************************************************
2659
2660 $Function: DecodeGSM7ToASCII
2661
2662 $Description: This function decodes a GSM 7-bit string into ASCII equivalent
2663
2664 $Returns: length of decoded string
2665
2666 $Arguments: encoded - GSM string pointer
2667 plain - Buffer to hold the decoded ASCII string
2668 Length - Length of the encoded GSM string
2669
2670
2671 *******************************************************************************/
2672 unsigned char DecodeGSM7ToASCII(U8 * encoded, U8 * plain, U8 Length)
2673 {
2674 U8 bits, i, j;
2675 U8 c;
2676
2677 /* Extract the ascii characters from the bytes,
2678 */
2679
2680 for (i = j = bits = 0; j < Length; i++, j++)
2681 {
2682 if (bits > 0)
2683 c = encoded[i-1] >> (8-bits);
2684 else
2685 c=0;
2686
2687 if (bits < 7)
2688 c |= encoded[i] << bits;
2689
2690 *plain++ = c & 0x7f;
2691 bits = (bits + 1)%8; /* x0039928 - Lint warning fix */
2692 if (bits == 0)
2693 {
2694 i -= 1;
2695 Length++;
2696 }
2697 }
2698
2699 *plain = '\0';
2700 return (Length);
2701 }
2702 /*******************************************************************************
2703
2704 $Function: sat_create_TEXT_ASCIIZ
2705
2706 $Description: This routine creates out of an MFW SAT text descriptor an
2707 dynamically allocated ASCIIZ string pointer
2708
2709 $Returns: none.
2710
2711 $Arguments:
2712
2713 MC, Note: text returned by this function has no Unicode tag at beginning
2714 $Returns: none.
2715
2716 $Arguments:
2717
2718 *******************************************************************************/
2719 /*MC, SPR 940/2 uncommented function back in, and then rewrote it :)*/
2720 void sat_TEXT_to_UCODE (char* destination, int size, T_SAT_TXT * txt)
2721 {
2722
2723 UBYTE * temp_buffer;
2724
2725 char debug[50];
2726
2727
2728 TRACE_EVENT("sat_TEXT_to_UCODE()");
2729
2730 switch (txt->code) /*DCS of Text*/
2731 {
2732 case MFW_DCS_7bits:
2733 temp_buffer = (UBYTE *)ALLOC_MEMORY(((txt->len*8)/7)+1);
2734 /*convert from 7 to 8 bit*/
2735 utl_cvt7To8 ((UBYTE *)txt + txt->text, txt->len, temp_buffer, 0);
2736
2737 /*MC, convert from 8 bit to UCS2*/
2738 /*SPR2175, use new function for conversion*/
2739 ATB_convert_String((char*)temp_buffer, MFW_DCS_8bits, (((txt->len*8)/7)+1), (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE);
2740 FREE_MEMORY ((U8 *)temp_buffer, ((txt->len*8)/7)+1);
2741 break;
2742 case MFW_DCS_8bits:/*DCS tends to come out as 8 bit whatever it is*/
2743 if (*((UBYTE*)txt+txt->text) !=0x80)/*MC, if ASCII, convert to Unicode*/
2744 {
2745 #ifdef SAT_TEXT_TRACING
2746 //string_GSM_to_UCS2((UBYTE)txt->len, (UBYTE *)txt + txt->text, (USHORT)(txt->len), destination);
2747 sprintf(debug, "Length of MENU HEADER:%d", txt->len);
2748 TRACE_EVENT(debug);
2749 #endif
2750 /*MC, convert from 8 bit to UCS2*/
2751 /*SPR2175, use new function for conversion*/
2752 ATB_convert_String((char *)txt +txt->text, MFW_DCS_8bits, txt->len, (char*)destination, MFW_DCS_UCS2, /*txt->len*2*/size, FALSE);
2753 }
2754 else
2755 {
2756 /*MC, unicode string, convert to our display format*/
2757 destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/
2758 destination[1] = (char)0x7f;
2759
2760 memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1);
2761
2762 }
2763 break;
2764 case MFW_DCS_UCS2:/*MC, unicode string, convert to our display format*/
2765 { destination[0] = (char)0x80;/*SPR 1728, add unicode tag*/
2766 destination[1] = (char)0x7f;
2767
2768 //memcpy(&destination[2], (UBYTE*)txt+txt->text+1, txt->len-1);
2769 memcpy(&destination[2], (UBYTE*)txt+txt->text, txt->len); /* SPR#2340 - DS - Corrected len */
2770
2771 }
2772
2773 break;
2774 default:
2775 TRACE_EVENT("sat_TEXT_to_UCODE() unexp. DCS");
2776 }
2777 /*MC, SPR 1086 Commented out traces here, as long buffers cause a crash*/
2778 {int i;
2779
2780 for (i=0; i <size && i<20; i++)
2781 { if (destination[i] == 0)
2782 debug[i] ='0';
2783 else
2784 debug[i] = destination[i];
2785 }
2786 debug[i+1] = 0x00; /* SPR#2321 - DS - Terminate debug buffer after UCS2 string */
2787 TRACE_EVENT(debug);
2788 }
2789 }
2790 /*JVJE*/
2791
2792 /*******************************************************************************
2793
2794 $Function: sat_create_TEXT_ASCIIZ
2795
2796 $Description: This routine creates out of an MFW SAT text descriptor an
2797 dynamically allocated ASCIIZ string pointer
2798
2799 $Returns: none.
2800
2801 $Arguments:
2802
2803 *******************************************************************************/
2804 #define SAT_LEN_SIZE (U16)sizeof(U16) /* used to hold the allocation size */
2805 #define SAT_TERMINATOR_SIZE (U16)sizeof(U16) /* used to hold terminating '\0' in U8 and U16 */
2806
2807 char * sat_create_TEXT_ASCIIZ (T_SAT_TXT * txt)
2808 {
2809
2810 char * res;
2811 U16 size;
2812 UBYTE first_char= *((UBYTE*)txt+txt->text);/*SPR 1728*/
2813 TRACE_EVENT("sat_create_TEXT_ASCIIZ ()");
2814 #ifdef NO_ASCIIZ
2815 TRACE_EVENT_P3("DCS:%d first_char:%d len: %d", txt->code, first_char, txt->len);
2816 /*SPR 1728, if unicode string format it for display*/
2817 if ( first_char==0x80 ||txt->code==MFW_DCS_UCS2)
2818 { return (char*)sat_create_TEXT_UCODE (txt);}
2819 #endif
2820
2821 /* SPR#2321 - DS - Format not Unicode therefore return NULL if string length is zero */
2822 if (txt->len == 0)
2823 return NULL;
2824
2825 /* SPR#2321 - DS - SAT has sent a NULL string. Set first char to ASCII code for <space> */
2826 if (txt->len == 1 && first_char == 0x00)
2827 {
2828 *((UBYTE*)txt+txt->text) = 0x20;
2829 }
2830
2831 /* SPR#2321 - DS - Check if SAT has supplied a NULL string (first_char 0x00, dcs not UCS2) */
2832 if (first_char == 0x00 && txt->code != MFW_DCS_UCS2)
2833 return NULL;
2834
2835 /* allocate sufficient space for the converted string */
2836 if (txt->code == MFW_DCS_7bits)
2837 size = SAT_LEN_SIZE + ((txt->len*8)/7)*sizeof(char) + SAT_TERMINATOR_SIZE;
2838 else
2839 size = SAT_LEN_SIZE + txt->len*sizeof(char) + SAT_TERMINATOR_SIZE;
2840 res = (char *)ALLOC_MEMORY (size);
2841 *(U16 *) res = size; /* store allocated size in first 2 bytes (for deallocation purposes) */
2842 res += SAT_LEN_SIZE, /* set the pointer to the string, not to the alloc size */
2843
2844 /* convert the string */
2845 sat_TEXT_to_ASCIIZ (res, txt);
2846
2847
2848 return res;
2849 }
2850
2851 /*******************************************************************************
2852
2853 $Function: sat_create_TEXT_UCODE
2854
2855 $Description: This routine creates out of an MFW SAT text descriptor an
2856 dynamically allocated UCS2 string pointer
2857
2858 $Returns: none.
2859
2860 $Arguments:
2861
2862 *******************************************************************************/
2863 /*JVJE*/
2864 /*MC, SPR 940/2 uncommneted and then re-written function, pointers to wide chars now are pointers to chars*/
2865 char* sat_create_TEXT_UCODE (T_SAT_TXT * txt)
2866 {
2867 char * res;
2868 U16 size;
2869
2870 TRACE_EVENT("sat_create_TEXT_UCODE()");
2871
2872 if (txt->code == MFW_DCS_7bits) /*MC SPR 1086, add 2 extra chars in case UCS2 tag is to be added later*/
2873 size = SAT_LEN_SIZE + sizeof(char) + ((txt->len*8)/7) * /*sizeof(wchar_t)*/2+SAT_TERMINATOR_SIZE*2;
2874 else /*MC SPR 1086, add 2 extra chars in case UCS2 tag is to be added later*/
2875 //size = SAT_LEN_SIZE + sizeof(char) + txt->len * /*sizeof(wchar_t)*/2+SAT_TERMINATOR_SIZE*2;
2876 size = SAT_LEN_SIZE + (sizeof(U16) * txt->len) + SAT_TERMINATOR_SIZE*2; /* SPR#2321 - DS - Improve clarity of mem alloc */
2877 res = (char *)ALLOC_MEMORY (size);
2878 *(U16 *)res = size;
2879 res = ((char *)res + SAT_LEN_SIZE);
2880
2881 TRACE_EVENT_P1("size: %d", size);
2882
2883 sat_TEXT_to_UCODE (res,size, txt);
2884
2885 return res;
2886 }
2887
2888
2889 /*******************************************************************************
2890
2891 $Function: sat_create_ITEM_ASCIIZ
2892
2893 $Description: This routine converts a MFW SAT Item descriptor into a
2894 conventional String pointer
2895 MC, note: this function will add a Unicode tag to the beginning of Unicode
2896 strings returned
2897
2898 $Returns: none.
2899
2900 $Arguments:
2901
2902 *******************************************************************************/
2903 /*MC, SPR 940/2 changed this func to output Unicode string when appropriate*/
2904 char * sat_create_ITEM_ASCIIZ (SatItem * item)
2905 {
2906 char * res;
2907 U16 size;
2908 UBYTE first_char= *((UBYTE*)item+item->text);
2909
2910 TRACE_FUNCTION("sat_create_ITEM_ASCIIZ()");
2911
2912 TRACE_EVENT_P2("first_char:%d len: %d", first_char, item->len);
2913
2914 /* SPR#2321 - DS - Return NULL if string length is zero */
2915 if (item->len == 0)
2916 {
2917 //return NULL;//sandip-CQ 16306
2918 *((UBYTE*)item+item->text) = 0x20;
2919 }
2920
2921 /* SPR#2321 - DS - SAT has sent a NULL string. Set first char to ASCII code for <space> */
2922 if ((item->len == 1) && (first_char == 0x00))
2923 {
2924 *((UBYTE*)item+item->text) = 0x20;
2925 }
2926
2927 /* allocate sufficient space for the converted string */
2928 size = SAT_LEN_SIZE + item->len/**sizeof(wchar_t)*/*2 + 3*SAT_TERMINATOR_SIZE;
2929 res = (char *)ALLOC_MEMORY (size);
2930 *(U16 *) res = size; /* store allocated size in first 2 bytes (for deallocation purposes) */
2931 res += SAT_LEN_SIZE; /* set the pointer to the string, not to the alloc size */
2932
2933 /*
2934 * item->text is offset of string from start of item
2935 */
2936 #ifdef NO_ASCIIZ /*MC SPR 940/2 check if we're in Chinese or string is unicode and deal with it*/
2937
2938 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)/*if chinese*/
2939 {
2940 #ifdef SAT_TEXT_TRACING
2941 /***************************Go-lite Optimization changes Start***********************/
2942 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2943 TRACE_EVENT_P1("Length of menu item:%d", item->len);
2944 /***************************Go-lite Optimization changes end***********************/
2945 #endif
2946 if (*((char*)item+item->text) != (char)0x80)/*MC, if item ASCII*/
2947 { // int i; // RAVI
2948 /*convert to unicode*/
2949 TRACE_EVENT("Adding menu item in ASCII->UCS2");
2950 // SmsRead_convertSMSmsg((char *)item + item->text, MFW_DCS_8bits, item->len, &res[2], MFW_DCS_UCS2, size-4, FALSE);
2951 // res[0] = 0x80;/*add tag to beginning of string*/
2952 // res[1] =0x7F;
2953 /*MC, SPR 1086 8 bit to UCS2 conversion causes menu update problems*/
2954 /*Thought it might be due to memory leaks/overwrites, but can't find any*/
2955 /*Easy solution is to convert to ASCII rather than UCS2*/
2956 sat_gsm_to_ascii (res, (char *)item + item->text, item->len);
2957 }
2958 else /*if Unicode tag*/
2959 { TRACE_EVENT("Adding menu item in UCS2");
2960 /*Shift string up one byte*/
2961 memcpy(res+2, (char *)item + item->text+1, item->len-1);
2962 res[0] = (char)0x80;/*add tag at beginning of string*/
2963 res[1] = (char)0x7f;
2964 }
2965 }
2966 else /*if not chinese BUT unicode tag, convert to display Unicode format*/
2967 { if (*((char*)item+item->text) == (char)0x80)
2968 { memcpy(res+2, (char *)item + item->text+1, item->len-1);
2969 res[0] = (char)0x80;
2970 res[1] = (char)0x7f;
2971 }
2972
2973 else /*if not chinese and ascii string, convert from GSM to ASCII*/
2974 #endif
2975 sat_gsm_to_ascii (res, (char *)item + item->text, item->len);
2976 #ifdef NO_ASCIIZ
2977 }
2978 #endif
2979
2980
2981 return res;
2982 }
2983
2984 /*******************************************************************************
2985
2986 $Function: sat_destroy_TEXT_ASCIIZ
2987
2988 $Description: destroy an ASCIIZ string previously created with
2989 sat_create_TEXT_ASCIIZ() or sat_create_ITEM_ASCIIZ()
2990
2991 $Returns: none.
2992
2993 $Arguments:
2994
2995 *******************************************************************************/
2996 void sat_destroy_TEXT_ASCIIZ (char * str)
2997 {
2998 /*MC, SPR 940/2 if we're in chinese, use Unicode string destuctor*/
2999 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
3000 { sat_destroy_TEXT_UCODE(str);
3001 return;
3002 }
3003
3004 TRACE_FUNCTION("sat_destroy_TEXT_ASCIIZ");
3005
3006 if (str NEQ NULL)
3007 {
3008 /* the two bytes before the string are holding the alloc size info */
3009 FREE_MEMORY ((U8 *)(str-SAT_LEN_SIZE), *(U16 *) (str-SAT_LEN_SIZE));
3010 str = NULL;
3011 }
3012 }
3013
3014 #ifdef MMI_TEST_SAT_LAUNCH_BROWSER
3015 void mmiOpenDummyBrowser(T_MFW_HND win,char* information)
3016 {
3017 #ifdef NEW_EDITOR
3018 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
3019 #else
3020 T_EDITOR_DATA editor_data;
3021 #endif
3022
3023 TRACE_FUNCTION("mmiOpenDummyBrowser");
3024
3025 /* SPR#1428 - SH - New Editor changes */
3026
3027 #ifdef NEW_EDITOR
3028 AUI_edit_SetDefault(&editor_data);
3029 AUI_edit_SetTextStr(&editor_data, TxtNull, TxtNull, TxtNull, NULL);
3030 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)information, INFORMATION_SIZE);
3031 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
3032
3033 AUI_edit_Start(win, &editor_data);
3034 #else /* NEW_EDITOR */
3035
3036 #ifdef DBG1
3037 editor_data_init();
3038 #endif
3039 editor_data.TextString = "WAP";
3040 editor_data.LeftSoftKey = TxtSoftOK;
3041 editor_data.RightSoftKey = NULL;
3042 editor_data.AlternateLeftSoftKey = NULL;
3043 editor_data.Callback = NULL;
3044 editor_data.Identifier = 0;
3045 editor_data.hide = FALSE;
3046 editor_data.mode = READ_ONLY_MODE;
3047 editor_data.timeout = FOREVER;
3048 editor_data.min_enter = 0;
3049 editor_data.destroyEditor = TRUE;
3050 editor_data.editor_attr.win.px = 0;
3051 editor_data.editor_attr.win.py = 8;
3052 editor_data.editor_attr.win.sx = 84;
3053 editor_data.editor_attr.win.sy = 24;
3054 editor_data.editor_attr.font = 0;
3055 editor_data.editor_attr.mode = edtCurNone;
3056 editor_data.editor_attr.controls = 0;
3057 editor_data.editor_attr.size = INFORMATION_SIZE;
3058
3059 editor_data.editor_attr.text = information;
3060
3061 /* create the dialog handler */
3062 editor_start(win, &editor_data); /* start the editor */
3063 #endif
3064
3065 return;
3066 }
3067
3068 #endif
3069 //GW SPR#1035 - Added SAT changes
3070 /*******************************************************************************
3071
3072 $Function: sat_release_the_editor
3073
3074 $Description: The SAT-application initiate a setup call and
3075 the MMI opens for this call status a new editor.
3076 Normally the event "SAT_SESSION_END" release the editor
3077 but for some reason this event doesnt come up !
3078 This function allows from the MMICall.c in the case of "disconnect"
3079 to release the editor as well.
3080
3081 $Returns: none.
3082
3083 $Arguments:
3084
3085 *******************************************************************************/
3086 void sat_release_the_editor (void)
3087 {
3088 TRACE_FUNCTION("sat_release_the_editor()");
3089
3090 if (g_sim_toolkit_data->info_win NEQ NULL)
3091 {
3092 /* destroy any infoscreen if exist */
3093 /* SPR#1428 - SH - New Editor changes */
3094 #ifdef NEW_EDITOR
3095 SEND_EVENT (g_sim_toolkit_data->info_win, E_ED_DEINIT, 0, NULL);
3096 #else /* NEW_EDITOR */
3097 SEND_EVENT (g_sim_toolkit_data->info_win, E_EDITOR_DEINIT, 0, NULL);
3098 #endif /* NEW_EDITOR */
3099 g_sim_toolkit_data->info_win = NULL;
3100 }
3101 }
3102
3103 /*MC, SPR 940/2 uncommented function and changed param to char* */
3104 void sat_destroy_TEXT_UCODE (/*cp_wstring_t*/char* str)
3105 {
3106 if (str NEQ NULL)
3107 {
3108 FREE_MEMORY ((U8 *)((char *)str-SAT_LEN_SIZE), *(U16 *) ((char *)str-SAT_LEN_SIZE));
3109 str = NULL;
3110 }
3111 }
3112 /*******************************************************************************
3113
3114 $Function: sat_add_unicode_tag_if_needed
3115
3116 $Description: Checks if string ought to be pre-pended with a unicode tag and if it ought to,
3117 adds the tag (note, the string has to already have 2 "extra" chars allocated
3118 to it; this normally happens in the create_TEXT_UCODE function)
3119
3120 $Returns: none.
3121
3122 $Arguments: string
3123
3124 *******************************************************************************/
3125 /*SPR1257, new function*/
3126 void sat_add_unicode_tag_if_needed(char* string)
3127 {/*Add tag to Unicode strings so info dialogue displays them correctly*/
3128 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE&& string[0]!= (char)0x80 )
3129 {
3130 char TempString[MAX_MSG_LEN_SGL];/*MC, SPR 1292, more sensible length*/
3131 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */
3132 memcpy(&TempString[2], GET_TEXT(TxtSoftCall), ATB_string_UCLength((USHORT*)string)*sizeof(USHORT));
3133 #else /* NEW_EDITOR */
3134 memcpy(&TempString[2], string, strlenUnicode((U16*) string));
3135 #endif /* NEW_EDITOR */
3136
3137 TempString[0] = (char)0x80;
3138 TempString[1] = (char)0x7f;
3139 #ifdef NEW_EDITOR /* SPR#1428 - SH - New Editor changes - new function to calculate length of unicode string */
3140 memcpy(string, TempString, (ATB_string_UCLength((USHORT*)TempString)+1)*sizeof(USHORT));
3141 #else /* NEW_EDITOR */
3142 memcpy( string, TempString, strlenUnicode((U16*)TempString));
3143 #endif /* NEW_EDITOR */
3144
3145 }
3146 }
3147
3148 /* Nov 17, 2006 REF:DR:OMAPS00104580 x0039928
3149 -Deleted Redial flag enabling/disabling code*/
3150