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