comparison src/ui3/mfw/mfw_sat.c @ 420:e8ddbb0837ed

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_sat.c $|
4 | $Author:: Xsp $ CONDAT GmbH $Revision:: 12 $|
5 | CREATED: 07.05.99 $Modtime:: 23/02/00 20:23 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_SAT
10
11 PURPOSE : SIM Application Toolkit Handling
12
13 EXPORT :
14
15 TO DO :
16
17 $History:: mfw_sat.c
18 Apr 18, 2006 Ref:OMAPS00116309 R.Prabakar (a0393213)
19 CT-GCF[27.22.4.7.1]- MMI crashes on REFERSH seq 1.2
20 Solution : Data type mismatch between ACI and MMI sorted out
21
22 Nov 07, 2006 ER:OMAPS00070661 R.Prabakar(a0393213)
23 R99 network compliancy : Implemented Language Notification and Provide Local Information (Language setting)
24 SAT proactive commands and Language Selection SAT event
25
26 10 Jul 2006, Ref OMAPS00077654, R.Prabakar(a0393213)
27 Description : Cyrillic character support in MMI to pass GCF/PTCRB UCS2 TC (SATK)
28 Solution : UCS2 Display added to terminal profile
29
30 May 26, 2006 REF: OMAPS00076094, x0045876
31 Description: MMI's Terminal Profile (TP) setup is not in line with the SAT class e implementation
32 Solution: TP is updated based on the current support by MMI.
33
34 March 29, 2006 REF: OMAPS00060199, x0045876
35 Description: DISPLAY TEXT (Normal) SEQ 1.9 - ME got hanged
36 Solution: If there is no text string supplied in the function decDispText(), only SatResponse was sent saying that
37 command data not understood by Me and return statement was missed out.
38
39 Shashi Shekar B.S., a0876501, 16 Mar, 2006, OMAPS00061462
40 Icon support for SetupMenu & Select item.
41
42 Mar 11, 2006 REF:DR:OMAPS00061467 x0035544
43 Description: 27.22.4.13.3 SET UP CALL (display of icons) fails.
44 Solution: SAT icon is supported for the SAT CALL SETUP.
45
46 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S.
47 Description: SAT Icon support
48 Solution : SAT icon support added.
49
50 Aug 31, 2005 REF: CRR 33619 x0021334
51 Description: RE: Notification of SATK File Change
52 Solution: Added the stub function 'rAT_PercentSIMEF()'.
53
54 July 26, 2005 REF: SPR 29520 x0018858
55 Issue: 27.22.4.5 Proactive SIM Command: PLAY TONE fails
56 Solution: The window which used to come up "Please wait" was not getting destroyed.
57 Care has been taken to check this.
58
59 Jun 16, 2005 REF: CRR 31543 x0021334
60 Issue: SATK: cannot get TR for send ussd command
61 Solution: When the user presses "Hang up" key when the SAT USSD session is in progress,
62 a call is made to function 'sAT_end_ussd()' to end the USSD session.
63
64 Aug 16, 2004 REF: CRR 24323 Deepa M.D
65 Bug:Clenup of sprintf used for tracing
66 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX $
67
68 Jun 08,2006 x0047685
69 Changed satChangeNotify() and satRefreshNotification(), added file_info instead of file_id
70 due to Locosto REL99 SIM Interface changes.
71 *
72 * ***************** Version 12 *****************
73 * User: Xsp Date: 24/02/00 Time: 5:42
74 * Updated in $/GSM/Condat/MS/SRC/MFW
75 * Debugged MmiSimToolkit...
76 *
77 * ***************** Version 11 *****************
78 * User: Fk Date: 23.02.00 Time: 18:33
79 * Updated in $/GSM/Condat/MS/SRC/MFW
80 * Comprehension flags provided for default Terminal Response
81 *
82 * ***************** Version 10 *****************
83 * User: Xsp Date: 16/02/00 Time: 19:22
84 * Updated in $/GSM/Condat/MS/SRC/MFW
85 * Fixed double allocation in satCreate()...
86 *
87 * ***************** Version 9 *****************
88 * User: Xsp Date: 14/02/00 Time: 18:11
89 * Updated in $/GSM/Condat/MS/SRC/MFW
90 * Solved compiler errors...
91 *
92 * ***************** Version 8 *****************
93 * User: Xsp Date: 14/02/00 Time: 14:43
94 * Updated in $/GSM/Condat/MS/SRC/MFW
95 * Added window pointers to sat structure...
96 *
97 * ***************** Version 7 *****************
98 * User: Fk Date: 11.02.00 Time: 15:40
99 * Updated in $/GSM/Condat/MS/SRC/MFW
100 * New event 'SAT Session End' derived from empty command
101 *
102 * ***************** Version 6 *****************
103 * User: Fk Date: 10.02.00 Time: 16:43
104 * Updated in $/GSM/Condat/MS/SRC/MFW
105 * Filter for Terminal Profile
106 *
107 * ***************** Version 5 *****************
108 * User: Vo Date: 17.11.99 Time: 10:47
109 * Updated in $/GSM/Condat/MS/SRC/MFW
110 |
111 | ***************** Version 4 *****************
112 | User: Le Date: 1.10.99 Time: 15:28
113 | Updated in $/GSM/Condat/MS/SRC/MFW
114 *
115 * ***************** Version 3 *****************
116 * User: Es Date: 9.07.99 Time: 14:32
117 * Updated in $/GSM/DEV/MS/SRC/MFW
118 *
119 * ***************** Version 2 *****************
120 * User: Es Date: 8.07.99 Time: 12:04
121 * Updated in $/GSM/DEV/MS/SRC/MFW
122 *
123 * ***************** Version 1 *****************
124 * User: Es Date: 6.07.99 Time: 12:42
125 * Created in $/GSM/DEV/MS/SRC/MFW
126 * SIM application toolkit handler
127 * Initial
128 */
129 #define ENTITY_MFW
130
131 #include <stdio.h>
132 #include <string.h>
133
134 #if defined (NEW_FRAME)
135
136 #include "typedefs.h"
137 #include "vsi.h"
138 #include "custom.h"
139 #include "gsm.h"
140 #include "tok.h"
141
142 #else
143
144 #include "STDDEFS.H"
145 #include "custom.h"
146 #include "gsm.h"
147 #include "vsi.h"
148 #include "tok.h"
149
150 #endif
151
152 #include "message.h"
153 #include "prim.h"
154 #include "aci_cmh.h"
155 #include "ati_cmd.h"
156 //#include "aci_cmd.h"
157 #include "aci.h"
158 #include "prim.h"
159 #include "psa.h"
160 #include "psa_sim.h"
161 #include "psa_cc.h"
162 #include "psa_sat.h"
163
164 #include "mfw_mfw.h"
165 #include "mfw_sys.h"
166 #include "aci_cmh.h"
167 #include "mfw_win.h"
168 #include "mfw_sat.h"
169
170 #include "mfw_phb.h"
171 #include "mfw_nm.h"
172 #include "mfw_sima.h"
173 #include "mfw_nmi.h"
174 #include "mfw_sim.h"
175 #include "mfw_simi.h"
176 #include "mfw_cphs.h"
177 #include "mfw_cphsi.h"
178 #include "mfw_sms.h"
179 #include "mfw_smsi.h"
180 #ifdef FF_MMI_R99_SAT_LANG
181 #include "mfw_lng.h" /*OMAPS00070661 R.Prabakar(a0393213)*/
182 #endif
183
184 #include "cus_aci.h"
185
186 #ifndef PCM_2_FFS
187 #include "pcm.h"
188 #endif
189
190
191
192 extern char mfwSATLPRefresh;
193
194 #define TRM_RSP_LEN (256) /*SPR#2121 - DS - Length of Terminal Response buffer */
195 #define CMD_DETAILS_LEN (5) /*SPR#2121 - DS - Length of default command details buffer */
196
197 char mfwSatMoAccepted = 0;
198 static U8 lenResponse; /* len of terminal response */
199 static const U8 defResponse [] = /* default response values */ /*a0393213 compiler warnings removal - storage class made first*/
200 {
201 0x81, 0x03, 0x00, 0x00, 0x00, /* command details */
202 0x82, 0x02, 0x82, 0x81, /* device identities */
203 0x83, 0x01, 0x32 /* result */
204 };
205 static U8 defCmdDetails [CMD_DETAILS_LEN]; /*SPR#2121 - DS - Default SAT command details */
206 static U8 satNoResponse = 0; /* flag: no resp. from MFW */
207
208 static U8 curCR; /* current TLV CR flag */
209 static U8 curTag; /* current TLV tag */
210 static U8 curLen; /* current TLV length */
211 static U8 *curVal; /* current TLV value */
212
213 SHORT curSatCallId;
214
215 static U8 *curCmd; /* current command pointer */
216 static S16 curCmdLen; /* len of current command */
217 static U8 *curData; /* data storage /end buffer */
218 static SatCmd cmd; /* temp storage for command */
219 SatCmd* sat_cmd_saved; /* SPR#2321 - DS - Copy of SAT cmd details */
220
221 static U8 partialCompr; /* partial comprehension */
222
223 static U16 eventList;
224
225 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
226 #ifdef FF_MMI_SAT_ICON
227 static U32 curSATCmd = MfwSatCmdNone;
228 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
229 // Modified the below defn to accomodate changes for SetupMenu / Select Item.
230 static U8 isAlphaIdIconPresent = FALSE;
231 static U8 isItemIconPresent = FALSE;
232 static T_EF_IMG icon_image;
233 U8 read_image_instance_file = FALSE;
234 //x0035544 Mar 11, 2006. DR:OMAPS00061467
235 static U8 setupCall_Executed = FALSE;
236
237 #define BW_ICON 0x11
238 #define COLOR_ICON 0x21
239
240 #define MAX_SIM_EF_SIZE 0xFF
241
242 /* Assuming 8-bpp, RGB 332 format for destination */
243
244 #define RGB_TO_PIXEL(R, G, B, value) \
245 do \
246 { \
247 value = ((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6); \
248 } while(0)
249 #endif
250
251 typedef struct
252 {
253 U8 count;
254 USHORT fields[MFW_MAX_NT_SIZE];
255 } T_MFW_UPDATE_FIELDS;
256
257 static T_MFW_UPDATE_FIELDS udNotify; /* update fields */
258 static int fuRef;
259 static BOOL fu_aborted;
260 static int satCommand (U32 cmd, void *h);
261 static void satResponse (U8 res);
262
263 static const U8 satMfWSuppTPrf[] = { /* Profile supported by MFW */ /*a0393213 compiler warnings removal - storage class made first and type 'U8' added*/
264 #ifdef SAT_TP1_PRF_DNL
265
266 (SAT_TP1_PRF_DNL | SAT_TP1_MENU_SEL),
267
268 /* 26-05-2006, x0045876 (OMAPS00076094 - Removed SAT_TP2_UCS2_ENTRY, SAT_TP2_UCS2_DSPL,
269 SAT_TP2_DSPL_EXT) */
270 /*10 Jul 2006, Ref OMAPS00077654, R.Prabakar(a0393213)
271 Description : Cyrillic character support in MMI to pass GCF/PTCRB UCS2 TC (SATK)
272 Solution : UCS2 Display added to terminal profile*/
273
274 (SAT_TP2_CMD_RES | SAT_TP2_CC | SAT_TP2_MOSMC | SAT_TP2_ALPHA_ID| SAT_TP2_UCS2_DSPL),
275
276 (SAT_TP3_DSPL_TXT | SAT_TP3_GET_INKEY | SAT_TP3_GET_INPUT|
277 SAT_TP3_PLAY_TONE | SAT_TP3_REFRESH),
278
279 /* 26-05-2006, x0045876 (OMAPS00076094 - Changed the order of bits) */
280 (SAT_TP4_SEL_ITEM | SAT_TP4_SEND_SMS | SAT_TP4_SEND_SS
281 | SAT_TP4_SEND_USSD | SAT_TP4_SETUP_CALL | SAT_TP4_SETUP_MENU),
282
283 (SAT_TP5_EVENT_LIST | SAT_TP5_USER_ACT | SAT_TP5_SCR_AVAIL),
284 #ifdef FF_MMI_R99_SAT_LANG
285 (SAT_TP6_LANG_SEL), /*OMAPS00070661 R.Prabakar(a0393213) Language Selection Enabled */
286 #else
287 0x0,
288 #endif
289
290 0x0,
291
292 (SAT_TP8_BIN_GET_INKEY | SAT_TP8_IDLE_TXT | SAT_TP8_AI2_SETUP_CALL),
293
294 #if defined(FF_WAP)
295 #ifdef FF_MMI_R99_SAT_LANG
296 /*OMAPS00070661 R.Prabakar(a0393213) Language Notification and Local Information(language setting)*/
297 (SAT_TP9_SUST_DSPL_TXT|SAT_TP9_LAUNCH_BROWSER | SAT_TP9_PLI_LANG | SAT_TP9_LANG_NOTIFY),
298 #else
299 (SAT_TP9_SUST_DSPL_TXT|SAT_TP9_LAUNCH_BROWSER),
300 #endif
301 #else
302 #ifdef FF_MMI_R99_SAT_LANG
303 (SAT_TP9_SUST_DSPL_TXT | SAT_TP9_PLI_LANG | SAT_TP9_LANG_NOTIFY) ,
304 #else
305 SAT_TP9_SUST_DSPL_TXT,
306 #endif
307 #endif /*FF_WAP*/
308
309 /* 26-05-2006, x0045876 (OMAPS00076094 - Added Softkeys) */
310 0x03,
311
312 0x0,
313
314 (SAT_TP12_OPEN_CHANNEL | SAT_TP12_CLOSE_CHANNEL | SAT_TP12_RECEIVE_DATA |
315 SAT_TP12_SEND_DATA),
316
317 (SAT_TP13_CSD_SUPP_BY_ME | SAT_TP13_GPRS_SUPP_BY_ME)
318
319 #else
320
321 #ifdef FF_2TO1_PS
322 /* START: 11-05-2006, x0045876 (OMAPS00076094) */
323 /* 0x09, 0x73, 0x17, 0x37 // c032 rsa */
324 #ifdef FF_MMI_R99_SAT_LANG
325 0x09, 0x7B, 0x97, 0x3F, 0x61, 0x01, 0x00, 0x58, 0x29, 0x03, 0x00, /*0x0F, 0x03*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
326 #else
327 0x09, 0x7B, 0x97, 0x3F, 0x61, 0x00, 0x00, 0x58, 0x01, 0x03, 0x00, /*0x0F, 0x03*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
328 #endif
329 /* END: 11-05-2006, x0045876 (OMAPS00076094) */
330 #else
331 /*0x09, 0x73, 0x17, 0x37 */ /* c032 rsa */
332 #endif
333
334 #endif
335 };
336
337 extern MfwHdr *current_mfw_elem;
338 //x0035544 added fixes done for CQ33597 by x0021334 on 21-11-2005
339 // x0021334 : To test SAT session end - CQ33597
340 /* Handler for cancel event sent by the MMI sim toolkit */
341 void Mfw_SAT_DTMF_EndSession(void)
342 {
343 sAT_PercentSATT( CMD_SRC_LCL, SATT_CS_EndSession);
344 return;
345 }
346
347
348
349 /*
350 +--------------------------------------------------------------------+
351 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
352 | STATE : code ROUTINE : satInit |
353 +--------------------------------------------------------------------+
354
355 PURPOSE : initialize SAT handler
356
357 */
358
359 MfwRes satInit (U8 *profile, U8 plen)
360 {
361 U8 index;
362 #ifdef FF_2TO1_PS
363 U8 combProfile [SIM_MAX_STK_PRF];
364 #else
365 U8 combProfile [MAX_STK_PRF];
366 #endif
367
368 TRACE_FUNCTION("satInit()");
369
370 mfwCommand[MfwTypSat] = (MfwCb) satCommand;
371 satNoResponse = 0;
372 mfwSatMoAccepted = 0;
373 mfwSATLPRefresh = 0;
374 eventList= 0;
375 fu_aborted = FALSE;
376 #ifdef FF_2TO1_PS
377 plen = MINIMUM(plen, SIM_MAX_STK_PRF);
378 #else
379 plen = MINIMUM(plen, MAX_STK_PRF);
380 #endif
381 sat_cmd_saved = NULL; /* SPR#2321 - DS - Initialise ptr to saved cmd */
382 for (index = 0; index < plen; index++) // check profile against
383 { // MFW capability
384 if (index < sizeof(satMfWSuppTPrf))
385 combProfile[index] = profile[index] & satMfWSuppTPrf[index];
386 else
387 combProfile[index] = 0;
388 }
389 sAT_PercentSATC(CMD_SRC_LCL,plen,combProfile);
390
391 /* install the call back for file change notification */
392 fuRef = -1;
393 psaSAT_FUNotifyRegister(satRefreshNotification);
394 psaSAT_FURegister (satChangeNotify);
395
396 return MfwResOk;
397 }
398
399
400 /*
401 +--------------------------------------------------------------------+
402 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
403 | STATE : code ROUTINE : satExit |
404 +--------------------------------------------------------------------+
405
406 PURPOSE : finalize SAT handler
407
408 */
409
410 MfwRes satExit (void)
411 {
412 mfwCommand[MfwTypSat] = 0;
413
414 return MfwResOk;
415 }
416
417
418 /*
419 +--------------------------------------------------------------------+
420 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
421 | STATE : code ROUTINE : satCreate |
422 +--------------------------------------------------------------------+
423
424 PURPOSE : create SAT control
425
426 */
427
428 MfwHnd satCreate (MfwHnd w, MfwEvt e, MfwCb f, SatCmd *c)
429 {
430 MfwSat *sat = (MfwSat*) mfwAlloc(sizeof(MfwSat));
431 MfwHdr *hdr = (MfwHdr *)mfwAlloc(sizeof(MfwHdr));
432 MfwHdr *insert_status =0;
433
434 if (!hdr || !sat)
435 {
436 TRACE_ERROR("ERROR: satCreate() Mem Alloc Failed.");
437
438 if(hdr)
439 mfwFree((U8*)hdr,sizeof(MfwHdr));
440 if(sat)
441 mfwFree((U8*)sat,sizeof(MfwSat));
442
443 return 0;
444 }
445
446 sat->map = e;
447 sat->evt = 0;
448 sat->handler = f;
449 sat->cmd = c;
450 sat->parentWindow = w;
451 sat->currentWindow = NULL;
452
453 hdr->data = sat;
454 hdr->type = MfwTypSat;
455
456 insert_status = mfwInsert(NULL,hdr);
457 if(!insert_status)
458 {
459 TRACE_ERROR("ERROR: satCreate() Failed to Install Handler. ");
460 mfwFree((U8*)hdr,sizeof(MfwHdr));
461 mfwFree((U8*)sat ,sizeof(MfwSat));
462 return 0;
463 }
464 return insert_status;
465 }
466
467
468 /*
469 +--------------------------------------------------------------------+
470 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
471 | STATE : code ROUTINE : satDelete |
472 +--------------------------------------------------------------------+
473
474 PURPOSE : delete SAT control
475
476 */
477
478 MfwRes satDelete (MfwHnd h)
479 {
480 MfwRes res;
481
482 if (!h)
483 return MfwResIllHnd;
484
485 res = (mfwRemove(h)) ? MfwResOk : MfwResIllHnd;
486
487 mfwFree(((MfwHdr *) h)->data,sizeof(MfwSat));
488 mfwFree(h,sizeof(MfwHdr));
489
490 return res;
491 }
492
493
494 /*
495 +--------------------------------------------------------------------+
496 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
497 | STATE : code ROUTINE : satString |
498 +--------------------------------------------------------------------+
499
500 PURPOSE : user string to SIM
501
502 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
503
504 */
505
506 MfwRes satString (SatCmd *cmd, SatTxt *txt, U8 *res, int rlen)
507 {
508 S16 ti;
509 U8* trmResponse = NULL;
510
511 TRACE_FUNCTION("satString()");
512
513 /* Allocate memory for Terminal Response buffer */
514 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
515
516 if (trmResponse == NULL)
517 {
518 /* Memory allocation failed */
519 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
520 return MfwResNoMem;
521 }
522
523 /*SPR#2121 - DS - Set up terminal response with default values */
524 lenResponse = sizeof(defResponse); /* prep. terminal response */
525 memcpy(trmResponse,defResponse,lenResponse);
526
527 trmResponse[2] = cmd->number; /* command number */
528 trmResponse[3] = cmd->type; /* command type */
529 trmResponse[4] = cmd->qual; /* command qualifier */
530
531 ti = sizeof(defResponse) - 2; /* result length */
532 if(res[1] != SatResAiNoCause) /* only attach additional information if existent*/
533 {
534 trmResponse[ti++] = rlen; /* dito */
535 while (rlen--)
536 trmResponse[ti++] = *res++; /* result data */
537 }
538 else /* result ok no additional resultcode attached*/
539 {
540 trmResponse[ti++] = 0x01;
541 trmResponse[ti++] = *res;
542 }
543 trmResponse[ti++] = 0x8D; /* text string tag + CR */
544 if (txt->len + 1 > 161) /* incl. coding scheme byte */
545 {
546 TRACE_ERROR("Text too long!!!");
547 return MfwResErr;
548 }
549 if (txt->len + 1 > 127)
550 trmResponse[ti++] = 0x81;
551 trmResponse[ti++] = txt->len + 1;
552 trmResponse[ti++] = txt->code; /* data coding scheme */
553 memcpy(trmResponse+ti,(U8*)txt+txt->text,txt->len);
554
555 sAT_PercentSATR(CMD_SRC_LCL,(S16)(ti+txt->len),trmResponse);
556
557 /* Deallocate memory used for Terminal Response buffer */
558 if (trmResponse != NULL)
559 {
560 mfwFree(trmResponse, TRM_RSP_LEN);
561 trmResponse = NULL;
562 }
563
564 return MfwResOk;
565 }
566
567
568 /*
569 +--------------------------------------------------------------------+
570 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
571 | STATE : code ROUTINE : satItem |
572 +--------------------------------------------------------------------+
573
574 PURPOSE : user selected popup item to SIM
575
576 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
577
578 */
579
580 MfwRes satItem (SatCmd *cmd, U8 itemId, U8 *res, int rlen)
581 {
582 S16 ti;
583 U8* trmResponse;
584
585 TRACE_FUNCTION("satItem()");
586
587 /* Allocate memory for Terminal Response buffer */
588 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
589
590 if (trmResponse == NULL)
591 {
592 /* Memory allocation failed */
593 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
594 return MfwResNoMem;
595 }
596
597 /*SPR#2121 - DS - Set up terminal response with default values */
598 lenResponse = sizeof(defResponse); /* prep. terminal response */
599 memcpy(trmResponse,defResponse,lenResponse);
600
601 trmResponse[2] = cmd->number; /* command number */
602 trmResponse[3] = cmd->type; /* command type */
603 trmResponse[4] = cmd->qual; /* command qualifier */
604
605 ti = sizeof(defResponse) - 2; /* result length */
606 if(res[1] != SatResAiNoCause) /* only attach additional information if existent*/
607 {
608 trmResponse[ti++] = rlen; /* dito */
609 while (rlen--)
610 trmResponse[ti++] = *res++; /* result data */
611 }
612 else /* result ok no additional resultcode attached*/
613 {
614 trmResponse[ti++] = 0x01;
615 trmResponse[ti++] = *res;
616 }
617 trmResponse[ti++] = 0x90; /* item identifier tag + CR */
618 trmResponse[ti++] = 1; /* length */
619 trmResponse[ti++] = itemId; /* selected item id */
620 TRACE_EVENT("SATR:satItem");
621 sAT_PercentSATR(CMD_SRC_LCL,ti,trmResponse);
622
623 /* Deallocate memory used for Terminal Response buffer */
624 if (trmResponse != NULL)
625 {
626 mfwFree(trmResponse, TRM_RSP_LEN);
627 trmResponse = NULL;
628 }
629
630 return MfwResOk;
631 }
632
633 #ifdef FF_MMI_R99_SAT_LANG
634 /*
635 +--------------------------------------------------------------------+
636 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
637 | STATE : code ROUTINE : satLocalInfo |
638 +--------------------------------------------------------------------+
639
640 PURPOSE : send terminal response for local info
641
642 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
643
644 */
645
646 MfwRes satLocalInfo (SatCmd *cmd, U8 *res, int rlen, U8* info, int info_len)
647 {
648 S16 ti;
649 U8* trmResponse;
650
651 TRACE_FUNCTION("satLocalInfo()");
652
653 /* Allocate memory for Terminal Response buffer */
654 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
655
656 if (trmResponse == NULL)
657 {
658 /* Memory allocation failed */
659 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
660 return MfwResNoMem;
661 }
662
663 /*SPR#2121 - DS - Set up terminal response with default values */
664 lenResponse = sizeof(defResponse); /* prep. terminal response */
665 memcpy(trmResponse,defResponse,lenResponse);
666
667 trmResponse[2] = cmd->number; /* command number */
668 trmResponse[3] = cmd->type; /* command type */
669 trmResponse[4] = cmd->qual; /* command qualifier */
670
671 ti = sizeof(defResponse) - 2; /* result length */
672 if(res[1] != SatResAiNoCause) /* only attach additional information if existent*/
673 {
674 trmResponse[ti++] = rlen; /* dito */
675 while (rlen--)
676 trmResponse[ti++] = *res++; /* result data */
677 }
678 else /* result ok no additional resultcode attached*/
679 {
680 trmResponse[ti++] = 0x01;
681 trmResponse[ti++] = *res;
682 }
683
684 if(cmd->qual==0x04) /*local info - lang setting*/
685 {
686 trmResponse[ti++] = 0xAD; /* item identifier tag + CR */
687 trmResponse[ti++] = info_len; /* length*/
688 while (info_len--)
689 trmResponse[ti++] = *info++; /* result data */
690
691 }
692
693 sAT_PercentSATR(CMD_SRC_LCL,ti,trmResponse);
694
695 /* Deallocate memory used for Terminal Response buffer */
696 if (trmResponse != NULL)
697 {
698 mfwFree(trmResponse, TRM_RSP_LEN);
699 trmResponse = NULL;
700 }
701
702 return MfwResOk;
703 }
704 #endif
705
706 /*
707 +--------------------------------------------------------------------+
708 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
709 | STATE : code ROUTINE : satMenuItem |
710 +--------------------------------------------------------------------+
711
712 PURPOSE : user selected menu item to SIM
713
714 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
715
716 */
717
718 MfwRes satMenuItem (U8 itemId, U8 help)
719 {
720 S16 ti = 0;
721 U8* trmResponse = NULL;
722
723 TRACE_FUNCTION("satMenuItem()");
724
725 /* Allocate memory for Terminal Response buffer */
726 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
727
728 if (trmResponse == NULL)
729 {
730 /* Memory allocation failed */
731 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
732 return MfwResNoMem;
733 }
734
735 trmResponse[ti++] = 0xD3; /* menu selection tag */
736 trmResponse[ti++] = 0; /* length (filled later) */
737 trmResponse[ti++] = 0x82; /* --device identities-- */
738 trmResponse[ti++] = 0x02; /* length */
739 trmResponse[ti++] = 0x01; /* source: Keypad */
740 trmResponse[ti++] = 0x81; /* destination: SIM */
741 trmResponse[ti++] = 0x90; /* --item identifier-- */
742 trmResponse[ti++] = 0x01; /* length */
743 trmResponse[ti++] = itemId; /* item id */
744 if (help)
745 {
746 trmResponse[ti++] = 0x95; /* --help request-- */
747 trmResponse[ti++] = 0x00; /* length */
748 }
749 trmResponse[1] = ti - 2; /* length of menu selection */
750
751 sAT_PercentSATE(CMD_SRC_LCL,ti,trmResponse);
752
753 /* Deallocate memory used for Terminal Response buffer */
754 if (trmResponse != NULL)
755 {
756 mfwFree(trmResponse, TRM_RSP_LEN);
757 trmResponse = NULL;
758 }
759
760 return MfwResOk;
761 }
762
763
764 /*
765 +--------------------------------------------------------------------+
766 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
767 | STATE : code ROUTINE : satEvtDownload |
768 +--------------------------------------------------------------------+
769
770 PURPOSE : download actual event to SAT (User activity and Idle Screen available)
771
772 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
773
774 */
775
776 MfwRes satEvtDownload (U8 evt)
777 {
778 S16 ti = 0;
779 U8 src;
780 U8 evtFlags=0;
781 U8* trmResponse = NULL;
782
783 TRACE_FUNCTION("satEvtDownload()");
784
785 /* Allocate memory for Terminal Response buffer */
786 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
787
788 if (trmResponse == NULL)
789 {
790 /* Memory allocation failed */
791 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
792 return MfwResNoMem;
793 }
794
795 switch (evt)
796 {
797 case SatEvtUserAction: /* user activity */
798 evtFlags = SatEvtUserActionActivated; /* source of event */
799 break;
800 case SatEvtIdleScreen: /* idle screen available */
801 evtFlags = SatEvtIdleScreenActivated; /* source of event */
802 break;
803 default:
804 TRACE_ERROR("ERROR: Unrecognised evt");
805 /* Deallocate memory used for Terminal Response buffer */
806 if (trmResponse != NULL)
807 {
808 mfwFree(trmResponse, TRM_RSP_LEN);
809 trmResponse = NULL;
810 }
811 return MfwResErr; /* illegal event */
812 }
813
814 if (!(eventList&evtFlags)) /*Only send registered events */
815 {
816 TRACE_ERROR("ERROR: evtFlags not registered in eventList");
817
818 /* Deallocate memory used for Terminal Response buffer */
819 if (trmResponse != NULL)
820 {
821 mfwFree(trmResponse, TRM_RSP_LEN);
822 trmResponse = NULL;
823 }
824 return MfwResErr;
825 }
826
827 switch (evt)
828 {
829 case SatEvtUserAction: /* user activity */
830 src = SatDevME; /* source of event */
831 break;
832 case SatEvtIdleScreen: /* idle screen available */
833 src = SatDevDisplay; /* source of event */
834 break;
835 default:
836 TRACE_ERROR("ERROR: Unrecognised evt");
837 /* Deallocate memory used for Terminal Response buffer */
838 if (trmResponse != NULL)
839 {
840 mfwFree(trmResponse, TRM_RSP_LEN);
841 trmResponse = NULL;
842 }
843 return MfwResErr; /* illegal event */
844 }
845
846 eventList&=(~evtFlags); /* Deregister event */
847
848
849
850 trmResponse[ti++] = 0xD6; /* event download tag */
851 trmResponse[ti++] = 0; /* length (filled later) */
852 trmResponse[ti++] = 0x99; /* --event list-- */
853 trmResponse[ti++] = 0x01; /* length */
854 trmResponse[ti++] = evt; /* actual event */
855 trmResponse[ti++] = 0x82; /* --device identities-- */
856 trmResponse[ti++] = 0x02; /* length */
857 trmResponse[ti++] = src; /* source */
858 trmResponse[ti++] = 0x81; /* destination: SIM */
859 trmResponse[1] = ti - 2; /* length of event download */
860
861 sAT_PercentSATE(CMD_SRC_LCL,ti,trmResponse);
862
863 /* Deallocate memory used for Terminal Response buffer */
864 if (trmResponse != NULL)
865 {
866 mfwFree(trmResponse, TRM_RSP_LEN);
867 trmResponse = NULL;
868 }
869 return MfwResOk;
870 }
871
872 #ifdef FF_MMI_R99_SAT_LANG
873 /*
874 +--------------------------------------------------------------------+
875 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
876 | STATE : code ROUTINE : satLanguageSelected |
877 +--------------------------------------------------------------------+
878
879 PURPOSE : download actual event to SAT (Language Selected)
880
881 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
882
883 */
884
885 MfwRes satLanguageSelected(U8 language)
886 {
887 S16 ti = 0;
888 U8* trmResponse = NULL;
889
890 TRACE_FUNCTION("satLanguageSelected");
891
892 if (!(eventList&SatEvtLangSelectActivated)) /*Only send registered events */
893 {
894 TRACE_ERROR("ERROR: language selection not registered in eventList");
895 return MfwResErr;
896 }
897
898 /* Allocate memory for Terminal Response buffer */
899 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
900
901 if (trmResponse == NULL)
902 {
903 /* Memory allocation failed */
904 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
905 return MfwResNoMem;
906 }
907 /*Fill up envelope*/
908 trmResponse[ti++] = 0xD6; /* event download tag */
909 trmResponse[ti++] = 0; /* length (filled later) */
910 trmResponse[ti++] = 0x19; /* --event list-- */
911 trmResponse[ti++] = 0x01; /* length */
912 trmResponse[ti++] = SatEvtLangSelection; /* actual event */
913 trmResponse[ti++] = 0x82; /* --device identities-- */
914 trmResponse[ti++] = 0x02; /* length */
915 trmResponse[ti++] = SatDevME; /* source */
916 trmResponse[ti++] = SatDevSIM; /* destination: SIM */
917 trmResponse[ti++] = 0x2D; /* Language tag */
918 trmResponse[ti++] = 0x02; /* Language length*/
919 switch(language)
920 {
921 case ENGLISH_LANGUAGE:
922 trmResponse[ti++]=0x65; /*'e'*/
923 trmResponse[ti++]=0x6E; /*'n'*/
924 break;
925 case CHINESE_LANGUAGE:
926 trmResponse[ti++]=0x7A; /*'z'*/
927 trmResponse[ti++]=0x68; /*'h'*/
928 break;
929 case GERMAN_LANGUAGE:
930 trmResponse[ti++]=0x64; /*'d'*/
931 trmResponse[ti++]=0x65; /*'e'*/
932 break;
933 default:
934 /* Deallocate memory used for Terminal Response buffer */
935 if (trmResponse != NULL)
936 {
937 mfwFree(trmResponse, TRM_RSP_LEN);
938 trmResponse = NULL;
939 }
940 return MfwResErr;
941
942
943 }
944 trmResponse[1] = ti - 2; /* length of event download */
945
946 sAT_PercentSATE(CMD_SRC_LCL,ti,trmResponse);
947
948 /* Deallocate memory used for Terminal Response buffer */
949 if (trmResponse != NULL)
950 {
951 mfwFree(trmResponse, TRM_RSP_LEN);
952 trmResponse = NULL;
953 }
954
955 return MfwResOk;
956
957 }
958 #endif
959
960 /*
961 +--------------------------------------------------------------------+
962 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
963 | STATE : code ROUTINE : satEvtRegistered |
964 +--------------------------------------------------------------------+
965
966 PURPOSE : Check if evt (User activity and Idle Screen available) has been
967 registered by previous SAT Setup Event List command.
968
969 SPR#2121 - DS - Created function.
970
971 */
972
973 int satEvtRegistered (int evt)
974 {
975 TRACE_FUNCTION("satEvtRegistered()");
976
977 if (eventList & evt)
978 {
979 return TRUE;
980 }
981 else
982 {
983 return FALSE;
984 }
985 }
986
987
988 /*
989 +--------------------------------------------------------------------+
990 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
991 | STATE : code ROUTINE : satDone |
992 +--------------------------------------------------------------------+
993
994 PURPOSE : SIM toolkit command confirmation
995
996 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
997
998 */
999
1000 MfwRes satDone (SatCmd *cmd, U8 *res, int rlen)
1001 {
1002 S16 ti;
1003 U8 response = *res;
1004 U8* trmResponse = NULL;
1005
1006 if (satNoResponse) /* no response, if ... */
1007 {
1008 TRACE_EVENT("satDone: no response. Handled by ACI");
1009 return MfwResOk; /* ... notified by ACI */
1010 }
1011
1012 /* Allocate memory for Terminal Response buffer */
1013 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
1014
1015 if (trmResponse == NULL)
1016 {
1017 /* Memory allocation failed */
1018 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
1019 return MfwResNoMem;
1020 }
1021
1022 /*SPR#2121 - DS - Set up terminal response with default values */
1023 lenResponse = sizeof(defResponse); /* prep. terminal response */
1024 memcpy(trmResponse,defResponse,lenResponse);
1025
1026 trmResponse[2] = cmd->number; /* command number */
1027 trmResponse[3] = cmd->type; /* command type */
1028 trmResponse[4] = cmd->qual; /* command qualifier */
1029
1030 ti = sizeof(defResponse) - 2; /* result length */
1031 if(res[1] != SatResAiNoCause) /* only attach additional information if existent*/
1032 {
1033 trmResponse[ti++] = rlen; /* dito */
1034 while (rlen--)
1035 trmResponse[ti++] = *res++; /* result data */
1036 }
1037 else /* result ok no additional resultcode attached*/
1038 {
1039 trmResponse[ti++] = 0x01;
1040 trmResponse[ti++] = *res;
1041 }
1042
1043 switch (response)
1044 {
1045 case SatResSuccess: /* performed successsfully */
1046 case SatResPartial: /* ok,partial comprehension */
1047 case SatResMissing: /* ok,missing information */
1048 case SatResAdditional: /* ok,additional EFs read */
1049 case SatResNoIcon: /* ok,no icon displayed */
1050 case SatResModified: /* ok,modified by SIM */
1051 case SatResUserAbort: /* terminated by user */
1052 case SatResUserBack: /* backward move by user */
1053 case SatResUserNoResp: /* no response from user */
1054 case SatResUserHelp: /* help request from user */
1055 case SatResUserAbortUSSD: /* USSD terminated by user */
1056 case SatResBusyME: /* ME temporary failure */
1057 case SatResBusyNet: /* Net temporary failure */
1058 case SatResReject: /* user reject call setup */
1059 case SatResCleared: /* call cleared (user/net) */
1060 case SatResTimerConflict: /* conflict on timer state */
1061 case SatResCCTemp: /* CC by SIM: temp failure */
1062 case SatResImpossible: /* ME cannot do it */
1063 case SatResUnknownType: /* type not understood */
1064 case SatResUnknownData: /* data not understood */
1065 case SatResUnknownNumber: /* number not understood */
1066 case SatResSSerror: /* SS return error */
1067 case SatResSMSerror: /* SMS-RP error */
1068 case SatResNoValues: /* missing required values */
1069 case SatResUSSDerror: /* USSD return error */
1070 case SatResMultiCard: /* Multiple card error */
1071 case SatResCCPermanent: /* CC by SIM: perm. failure */
1072 break;
1073 default:
1074 TRACE_ERROR("ill response code");
1075 break;
1076 }
1077
1078 TRACE_EVENT_P1("SATR:satdone. Response: %x", response);
1079
1080 sAT_PercentSATR(CMD_SRC_LCL,ti,trmResponse);
1081
1082 /* Deallocate memory used for Terminal Response buffer */
1083 if (trmResponse != NULL)
1084 {
1085 mfwFree(trmResponse, TRM_RSP_LEN);
1086 trmResponse = NULL;
1087 }
1088
1089 return MfwResOk;
1090 }
1091
1092
1093 /*
1094 +--------------------------------------------------------------------+
1095 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1096 | STATE : code ROUTINE : sigExec |
1097 +--------------------------------------------------------------------+
1098
1099 PURPOSE : execute SAT signal
1100
1101 */
1102
1103 static int sigExec (MfwHdr *curElem, U32 evt, void *data)
1104 {
1105 MfwSat *sc;
1106
1107 while (curElem)
1108 {
1109 if (curElem->type == MfwTypSat)
1110 {
1111 sc = curElem->data;
1112 if (sc->map & evt)
1113 { /* events match */
1114 if (sc->handler) /* handler valid */
1115 {
1116 current_mfw_elem = curElem; /* LE 06.06.00 */
1117 sc->evt = evt;
1118 if (sc->cmd)
1119 memcpy(sc->cmd,(U8 *)data,sizeof(SatCmd));
1120 if ((*(sc->handler))(evt,sc))
1121 return 1; /* event consumed */
1122 }
1123 }
1124 }
1125 curElem = curElem->next;
1126 }
1127
1128 return 0;
1129 }
1130
1131
1132 /*
1133 +--------------------------------------------------------------------+
1134 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1135 | STATE : code ROUTINE : satSignal |
1136 +--------------------------------------------------------------------+
1137
1138 PURPOSE : SAT event
1139
1140 */
1141
1142 void satSignal (U32 evt, void *data)
1143 {
1144 UBYTE temp = dspl_Enable(0);
1145
1146 TRACE_FUNCTION("satSignal event");
1147 TRACE_EVENT_P1("satSignal event %d",evt);
1148
1149 if (mfwSignallingMethod EQ 0)
1150 {
1151 if (mfwFocus)
1152 if (sigExec(mfwFocus,evt,data))
1153 {
1154 dspl_Enable(temp);
1155 return;
1156 }
1157 if (mfwRoot)
1158 sigExec(mfwRoot,evt,data);
1159 }
1160 else
1161 {
1162 MfwHdr* h = 0;
1163
1164 if (mfwFocus)
1165 h = mfwFocus;
1166 if (!h)
1167 h = mfwRoot;
1168 while (h)
1169 {
1170 if (sigExec(h,evt,data))
1171 {
1172 dspl_Enable(temp);
1173 return;
1174 }
1175 if (h == mfwRoot)
1176 {
1177 dspl_Enable(temp);
1178 return;
1179 }
1180 h = mfwParent(mfwParent(h));
1181 if (h)
1182 h = ((MfwWin *)(h->data))->elems;
1183 }
1184 sigExec (mfwRoot,evt,data);
1185 }
1186
1187 dspl_Enable(temp);
1188 return;
1189 }
1190
1191
1192 /*
1193 +--------------------------------------------------------------------+
1194 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1195 | STATE : code ROUTINE : satCommand |
1196 +--------------------------------------------------------------------+
1197
1198 PURPOSE : handle mfw windows command
1199
1200 */
1201
1202 static int satCommand (U32 cmd, void *h)
1203 {
1204 switch (cmd)
1205 {
1206 case MfwCmdDelete: /* delete me */
1207 if (!h)
1208 return 0;
1209 satDelete(h);
1210 return 1;
1211 default:
1212 break;
1213 }
1214
1215 return 0;
1216 }
1217
1218
1219 /*
1220 +--------------------------------------------------------------------+
1221 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1222 | STATE : code ROUTINE : satResponse |
1223 +--------------------------------------------------------------------+
1224
1225 PURPOSE : setup Terminal Response for SIM
1226
1227 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
1228
1229 */
1230
1231 static void satResponse (U8 res)
1232 {
1233 U8* trmResponse = NULL;
1234
1235 TRACE_FUNCTION("satResponse()");
1236
1237 if (satNoResponse) /* no response, if ... */
1238 return; /* ... notified by ACI */
1239
1240 /* Allocate memory for Terminal Response buffer */
1241 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
1242
1243 if (trmResponse == NULL)
1244 {
1245 /* Memory allocation failed */
1246 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
1247 return;
1248 }
1249
1250 /*SPR#2121 - DS - Set up terminal response with default values */
1251 lenResponse = sizeof(defResponse); /* prep. terminal response */
1252 memcpy(trmResponse,defResponse,lenResponse);
1253
1254 /*SPR#2121 - DS - Set up command specific details. defCmdDetails set up in rAT_PercentSATI */
1255 memcpy(trmResponse, defCmdDetails, CMD_DETAILS_LEN);
1256
1257 trmResponse[10] = 1;
1258 trmResponse[11] = res;
1259 sAT_PercentSATR(CMD_SRC_LCL,sizeof(defResponse),trmResponse);
1260
1261 /* Deallocate memory used for Terminal Response buffer */
1262 if (trmResponse != NULL)
1263 {
1264 mfwFree(trmResponse, TRM_RSP_LEN);
1265 trmResponse = NULL;
1266 }
1267
1268 return;
1269 }
1270
1271
1272 /*
1273 +--------------------------------------------------------------------+
1274 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1275 | STATE : code ROUTINE : getTLValue |
1276 +--------------------------------------------------------------------+
1277
1278 PURPOSE : check TLV:
1279 setup curCR, curTag, curLen
1280 return size of TL part
1281
1282 */
1283
1284 static U8 getTLValue (U8 *sc)
1285 {
1286 TRACE_FUNCTION("getTLValue()");
1287
1288 curCR = *(sc+0) & 0x80; /* comprehension required ? */
1289 curTag = *(sc+0) & 0x7f; /* TLV id */
1290 curLen = *(sc+1); /* length of TLV value part */
1291
1292 if (curLen < 0x80)
1293 return 2;
1294 if (curLen == 0x81)
1295 {
1296 curLen = *(sc+2); /* long length */
1297 return 3;
1298 }
1299 TRACE_ERROR("invalid length coding");
1300 satResponse(SatResUnknownData);
1301
1302 return 0; /* invalid TLV object */
1303 }
1304
1305
1306 /*
1307 +--------------------------------------------------------------------+
1308 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1309 | STATE : code ROUTINE : decTLV |
1310 +--------------------------------------------------------------------+
1311
1312 PURPOSE : decode TLV
1313
1314 */
1315
1316 static U8 decTLV (U8 tagWanted, U8 mandatory, char *id)
1317 {
1318 U8 *sc = curCmd;
1319 S16 len = curCmdLen;
1320 U8 tl, partial = 0;
1321
1322 TRACE_EVENT_P3("decTLV(%02x,%d,%s)",tagWanted,mandatory,id);
1323
1324 while (len > 0)
1325 {
1326 tl = getTLValue(sc);
1327 if (!tl)
1328 return 0;
1329 if (curTag == tagWanted)
1330 {
1331 sc += tl;
1332 curVal = sc;
1333 curCmd = sc + curLen;
1334 curCmdLen = len - (tl + curLen);
1335 TRACE_EVENT_P1("decTLV(): %d",partialCompr);
1336 partialCompr += partial;
1337 return 2;
1338 }
1339 TRACE_EVENT_P1("no %s TLV",id);
1340
1341 if (curCR)
1342 {
1343 if (mandatory)
1344 satResponse(SatResUnknownData);
1345 return !mandatory;
1346 }
1347 sc += tl + curLen;
1348 len -= tl + curLen;
1349 partial = 1;
1350 }
1351 if(!strcmp(id,"Tone"))
1352 {
1353 /*
1354 * according to GSM 11.14 if no tone is included play general beep
1355 */
1356 //July 26, 2005 REF: SPR 29520 x0018858
1357 //Value modified from integer to hex.
1358 *curVal = 0x10;
1359
1360 return 2;
1361 }
1362 if(!strcmp(id,"Duration"))
1363 {
1364 /*
1365 * according to GSM 11.14 if no duration is included set to a default value
1366 */
1367 *(curVal) = 1; /* Units = sec */
1368 *(curVal+1) = 5; /* play 5 seconds ??*/
1369 return 2;
1370 }
1371
1372 TRACE_EVENT_P1("not found: %s TLV",id);
1373
1374 if (mandatory)
1375 satResponse(SatResNoValues);
1376
1377 return !mandatory;
1378 }
1379
1380
1381 /*
1382 +--------------------------------------------------------------------+
1383 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1384 | STATE : code ROUTINE : decByte |
1385 +--------------------------------------------------------------------+
1386
1387 PURPOSE : decode TLV: miscelleaneous TLVs (single byte value)
1388
1389 */
1390
1391 static U8 decByte (U8 *t, U8 tagWanted, U8 mandatory)
1392 {
1393 U8 res;
1394
1395 TRACE_FUNCTION("decByte()");
1396
1397 res = decTLV(tagWanted,mandatory,"byte");
1398
1399 if (res > 1)
1400 {
1401 *t = *curVal;
1402 return 1;
1403 }
1404
1405 return res;
1406 }
1407 #ifdef FF_MMI_R99_SAT_LANG
1408 /*
1409 +--------------------------------------------------------------------+
1410 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1411 | STATE : code ROUTINE : decLang |
1412 +--------------------------------------------------------------------+
1413
1414 PURPOSE : decode TLV: miscelleaneous TLVs (language)
1415
1416 */
1417
1418 static U8 decLang (SatLanguageNotification*t, U8 tagWanted, U8 mandatory)
1419 {
1420 U8 res;
1421
1422 TRACE_FUNCTION("decLang()");
1423
1424 res = decTLV(tagWanted,mandatory,"language");
1425
1426 if (res > 1)
1427 {
1428 t->lang[0] = curVal[0];
1429 t->lang[1]=curVal[1];
1430 return 1;
1431 }
1432 return res;
1433 }
1434 #endif
1435 /*
1436 +--------------------------------------------------------------------+
1437 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1438 | STATE : code ROUTINE : decData |
1439 +--------------------------------------------------------------------+
1440
1441 PURPOSE : decode TLV: miscelleaneous TLVs (length, data)
1442
1443 */
1444
1445 static U8 decData (SatData *t, U8 tagWanted, U8 mandatory)
1446 {
1447 U8 res;
1448
1449 TRACE_FUNCTION("decData()");
1450
1451 res = decTLV(tagWanted,mandatory,"data");
1452
1453 if (res > 1)
1454 {
1455 t->len = curLen; /* data len */
1456 curData -= curLen;
1457 memcpy(curData,curVal,curLen); /* data itself */
1458 t->data = (U16) (curData - (U8*) t); /* save the offset */
1459 return 1;
1460 }
1461
1462 return res;
1463 }
1464
1465
1466 /*
1467 +--------------------------------------------------------------------+
1468 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1469 | STATE : code ROUTINE : decText |
1470 +--------------------------------------------------------------------+
1471
1472 PURPOSE : decode TLV: text string
1473
1474 */
1475
1476 static U8 decText (SatTxt *t, U8 tagWanted, U8 mandatory)
1477 {
1478 U8 res;
1479
1480 TRACE_FUNCTION("decText()");
1481
1482 res = decTLV(tagWanted,mandatory,"text");
1483
1484 TRACE_EVENT_P1("res %d", res);
1485
1486 if (res > 1)
1487 {
1488 if (curLen == 0x00) /* SPR#2340 - DS - Text len zero */
1489 t->len = 0;
1490 else
1491 t->len = curLen - 1; /* text len (not dcs) */
1492
1493 if (t->len)
1494 t->code = *curVal; /* data coding scheme */
1495 else
1496 t->code = 0;
1497 curData -= t->len;
1498 memcpy(curData,curVal+1,t->len); /* text itself */
1499 t->text = (U16) (curData - (U8*) t); /* save the offset */
1500
1501 TRACE_EVENT_P2("len %d, code(dcs) %d", t->len, t->code);
1502
1503 return 1;
1504 }
1505
1506 return res;
1507 }
1508
1509
1510 /*
1511 +--------------------------------------------------------------------+
1512 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1513 | STATE : code ROUTINE : decAddrSS |
1514 +--------------------------------------------------------------------+
1515
1516 PURPOSE : decode TLV: address or SS string
1517
1518 */
1519
1520 static U8 decAddrSS (SatAddress *t, U8 tagWanted, U8 mandatory)
1521 {
1522 U8 res;
1523
1524 TRACE_FUNCTION("decAddr-SS()");
1525
1526 res = decTLV(tagWanted,mandatory,"Addr-SS");
1527
1528 if (res > 1) /* address or ss string */
1529 {
1530 t->len = curLen - 1; /* number len wo ton/npi */
1531 curData -= t->len;
1532 t->ton = *curVal; /* type of number, npi */
1533 memcpy(curData,curVal+1,t->len); /* number itself */
1534 t->number = (U16) (curData - (U8*) t); /* offset */
1535 return 1;
1536 }
1537
1538 return res;
1539 }
1540
1541
1542 /*
1543 +--------------------------------------------------------------------+
1544 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1545 | STATE : code ROUTINE : decAlpha |
1546 +--------------------------------------------------------------------+
1547
1548 PURPOSE : decode TLV: alpha identifier
1549
1550 */
1551
1552 static U8 decAlpha (SatTxt *t, U8 mandatory)
1553 {
1554 U8 res;
1555
1556 TRACE_FUNCTION("decAlpha()");
1557
1558 res = decTLV(0x05,mandatory,"Alpha");
1559
1560 /* SPR#2340 - DS - Added check of val returned from decTLV */
1561 if (res > 1)
1562 {
1563 t->len = curLen; /* text len */
1564 if (t->len)
1565 t->code = 0x04; /* data coding scheme */
1566 else
1567 t->code = 0;
1568 curData -= t->len;
1569 memcpy(curData,curVal,t->len); /* text itself */
1570 t->text = (U16) (curData - (U8*) t); /* save the offset */
1571 return 1;
1572 }
1573 else
1574 {
1575 /* Alpha tag not present */
1576 t->len = 0x00;
1577 t->code = 0x00;
1578 t->text = 0x00;
1579 }
1580
1581 return res;
1582 }
1583
1584
1585
1586 /*
1587 +--------------------------------------------------------------------+
1588 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1589 | STATE : code ROUTINE : decSMS |
1590 +--------------------------------------------------------------------+
1591
1592 PURPOSE : decode TLV: SMS TPDU
1593
1594 */
1595
1596 static U8 decSMS (SatSmsPdu *t, U8 mandatory)
1597 {
1598 U8 res;
1599
1600 TRACE_FUNCTION("decSMS()");
1601
1602 res = decTLV(0x0B,mandatory,"SMS TPDU");
1603
1604 if (res > 1)
1605 {
1606 t->len = curLen; /* SMS len */
1607 curData -= t->len;
1608 memcpy(curData,curVal,t->len); /* SMS itself */
1609 t->data = (U16) (curData - (U8*) t); /* save the offset */
1610 return 1;
1611 }
1612
1613 return res;
1614 }
1615
1616
1617 /*
1618 +--------------------------------------------------------------------+
1619 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1620 | STATE : code ROUTINE : decItem |
1621 +--------------------------------------------------------------------+
1622
1623 PURPOSE : decode TLV: item
1624
1625 */
1626
1627 static U8 decItem (SatItem *t, U8 mandatory)
1628 {
1629 U8 res;
1630
1631 TRACE_FUNCTION("decItem()");
1632
1633 res = decTLV(0x0F,mandatory,"Item");
1634
1635 if (res > 1)
1636 {
1637 if (!curLen) /* no item: remove menu */
1638 {
1639 t->id = 0; /* no id */
1640 t->len = 0; /* no length */
1641 }
1642 else
1643 {
1644 t->id = *curVal;
1645 t->len = curLen - 1; /* without item id */
1646 }
1647 t->action = 0; /* filled in later */
1648 t->icon = 0; /* filled in later */
1649 curData -= t->len;
1650 memcpy(curData,curVal+1,t->len); /* item data */
1651 t->text = (U16) (curData - (U8*) t); /* save the offset */
1652 return 1;
1653 }
1654
1655 return res;
1656 }
1657
1658
1659 /*
1660 +--------------------------------------------------------------------+
1661 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1662 | STATE : code ROUTINE : decNextAction |
1663 +--------------------------------------------------------------------+
1664
1665 PURPOSE : decode TLV: next action
1666
1667 */
1668
1669 static U8 decNextAction (SatItem *t, U8 nItems, U8 mandatory)
1670 {
1671 U8 res;
1672
1673 TRACE_FUNCTION("decNextAction()");
1674
1675 res = decTLV(0x18,mandatory,"Next Action");
1676
1677 if (res > 1)
1678 {
1679 if (nItems > curLen)
1680 nItems = curLen;
1681 while (nItems--)
1682 {
1683 t->action = *curVal++; /* next action identifier */
1684 t++;
1685 }
1686 return 1;
1687 }
1688
1689 return res;
1690 }
1691
1692
1693 /*
1694 +--------------------------------------------------------------------+
1695 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1696 | STATE : code ROUTINE : decItemIcons |
1697 +--------------------------------------------------------------------+
1698
1699 PURPOSE : decode TLV: icon identifier list
1700
1701 */
1702
1703 static U8 decItemIcons (SatMenu *m, SatItem *t, U8 nItems, U8 mandatory)
1704 {
1705 U8 res;
1706
1707 TRACE_FUNCTION("decItemIcons()");
1708
1709 res = decTLV(0x1F,mandatory,"Item Icon List");
1710
1711 m->itemIconQual = 0xFF; /* default: not present */
1712 if (res > 1)
1713 {
1714 m->itemIconQual = *curVal++;
1715 curLen--;
1716 if (nItems > curLen)
1717 nItems = curLen;
1718 while (nItems--)
1719 {
1720 t->icon = *curVal++; /* next action identifier */
1721 t++;
1722 }
1723 return 1;
1724 }
1725
1726 return res;
1727 }
1728
1729
1730 /*
1731 +--------------------------------------------------------------------+
1732 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1733 | STATE : code ROUTINE : decDefItem |
1734 +--------------------------------------------------------------------+
1735
1736 PURPOSE : decode TLV: default item
1737
1738 */
1739
1740 static U8 decDefItem (SatItem *t, U8 nItems, U8 mandatory)
1741 {
1742 U8 res;
1743
1744 TRACE_FUNCTION("decDefItem()");
1745
1746 res = decTLV(0x10,mandatory,"Default Item");
1747
1748 if (res > 1)
1749 {
1750 if (curLen != 1)
1751 return res; /* ES!! error */
1752 while (nItems--)
1753 {
1754 if (t->id == *curVal)
1755 t->action |= 0x40; /* flag as default */
1756 t++;
1757 }
1758 return 1;
1759 }
1760
1761 return res;
1762 }
1763
1764
1765 /*
1766 +--------------------------------------------------------------------+
1767 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1768 | STATE : code ROUTINE : decTone |
1769 +--------------------------------------------------------------------+
1770
1771 PURPOSE : decode TLV: tone
1772
1773 */
1774
1775 static U8 decTone (U8 mandatory)
1776 {
1777 U8 res;
1778
1779 TRACE_FUNCTION("decTone()");
1780
1781 res = decTLV(0x0E,mandatory,"Tone");
1782
1783 if (res > 1)
1784 {
1785 switch (*curVal)
1786 {
1787 case 0x01: /* Dial Tone */
1788 case 0x02: /* Called Subscriber Busy */
1789 case 0x03: /* Congestion */
1790 case 0x04: /* Radio Path Ack */
1791 case 0x05: /* Radio Path Not Avail */
1792 case 0x06: /* Error / Special Info */
1793 case 0x07: /* Call Waiting */
1794 case 0x08: /* Ringing */
1795 case 0x10: /* General Beep */
1796 case 0x11: /* Positive Ack */
1797 case 0x12: /* Negative Ack or Error */
1798 cmd.c.tone.tone = *curVal; /* tone type */
1799 return 1;
1800
1801 default :
1802 satResponse(SatResUnknownData);
1803 return 0;
1804 }
1805 }
1806
1807 return res;
1808 }
1809
1810
1811 /*
1812 +--------------------------------------------------------------------+
1813 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1814 | STATE : code ROUTINE : decDuration |
1815 +--------------------------------------------------------------------+
1816
1817 PURPOSE : decode TLV: duration
1818
1819 */
1820 //Sandip CQ-16299
1821 //Reason : This function does not take care of reserved Time Interval 0x00
1822 #if 0
1823 static U8 decDuration (U8 *dur, U8 mandatory)
1824 {
1825 U8 res;
1826
1827 TRACE_FUNCTION("decDuration()");
1828
1829 res = decTLV(0x04,mandatory,"Duration");
1830
1831 if (res > 1)
1832 {
1833 *dur++ = *curVal++; /* duration unit */
1834 *dur++ = *curVal; /* duration value */
1835 return 1;
1836 }
1837
1838 return res;
1839 }
1840
1841 #endif
1842
1843 static U8 decDuration (U8 *dur, U8 mandatory)
1844 {
1845 U8 res;
1846
1847 TRACE_FUNCTION("decDuration()");
1848
1849 res = decTLV(0x04,mandatory,"Duration");
1850
1851 if (res > 1)
1852 {
1853 *dur++ = *curVal++; /* duration unit */
1854
1855 *dur++ = *curVal; /* duration value */
1856 if(*curVal ==0x00)
1857 {
1858 TRACE_EVENT_P1("Duration value is %d",*curVal);
1859
1860 satResponse(SatResUnknownData);
1861 return 0;
1862 }
1863 return 1;
1864 }
1865 return res;
1866 }
1867
1868 /*
1869 +--------------------------------------------------------------------+
1870 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1871 | STATE : code ROUTINE : decDevId |
1872 +--------------------------------------------------------------------+
1873
1874 PURPOSE : decode TLV: device identities
1875
1876 */
1877
1878 static U8 decDevId (U8 mandatory)
1879 {
1880 U8 res;
1881
1882 TRACE_FUNCTION("decDevId()");
1883
1884 res = decTLV(0x02,mandatory,"Devices");
1885
1886 if (res > 1)
1887 {
1888 cmd.source = *curVal++; /* source identifier */
1889 cmd.dest = *curVal; /* destination identifier */
1890 return 1;
1891 }
1892
1893 return res;
1894 }
1895
1896
1897 /*
1898 +--------------------------------------------------------------------+
1899 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1900 | STATE : code ROUTINE : decRespLen |
1901 +--------------------------------------------------------------------+
1902
1903 PURPOSE : decode TLV: response length
1904
1905 */
1906
1907 static U8 decRespLen (U8 mandatory)
1908 {
1909 U8 res;
1910
1911 TRACE_FUNCTION("decRespLen()");
1912
1913 res = decTLV(0x11,mandatory,"Response Length");
1914
1915 if (res > 1)
1916 {
1917 cmd.c.inp.rspMin = *curVal++; /* minimal length */
1918 cmd.c.inp.rspMax = *curVal; /* maximal length */
1919 /* MMI-SPR-16296: [mdf] verify the parameters as expected by GSM 11.14 */
1920 TRACE_EVENT_P2("decRespLen: Min=%d Max=%d",cmd.c.inp.rspMin,cmd.c.inp.rspMax);
1921 if ( cmd.c.inp.rspMin > cmd.c.inp.rspMax )
1922 {
1923 satResponse(SatResUnknownData); /* send TR(32), prms not understood */
1924 return 0;
1925 }
1926 /* end of MMI-SPR-16296: [mdf] verify the parameters as expected by GSM 11.14 */
1927
1928 return 1;
1929 }
1930
1931 return res;
1932 }
1933
1934
1935 /*
1936 +--------------------------------------------------------------------+
1937 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1938 | STATE : code ROUTINE : decIconId |
1939 +--------------------------------------------------------------------+
1940
1941 PURPOSE : decode TLV: icon identifier
1942
1943 */
1944
1945 static U8 decIconId (SatIconId *id, U8 mandatory)
1946 {
1947 U8 res;
1948
1949 TRACE_FUNCTION("decIconId()");
1950
1951 res = decTLV(0x1E,mandatory,"IconID");
1952
1953 if (res > 1)
1954 {
1955 id->qual = *curVal++; /* icon qualifier */
1956 id->id = *curVal; /* icon identifier */
1957 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
1958 #ifdef FF_MMI_SAT_ICON
1959 isAlphaIdIconPresent = TRUE;
1960 #endif
1961 return 1;
1962 }
1963 else
1964 {
1965 id->qual = 0xFF; /* not present */
1966 id->id = 0xFF;
1967 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
1968 #ifdef FF_MMI_SAT_ICON
1969 isAlphaIdIconPresent = FALSE;
1970 #endif
1971 }
1972
1973 return res;
1974 }
1975
1976 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
1977 #ifdef FF_MMI_SAT_ICON
1978 /*
1979 +--------------------------------------------------------------------+
1980 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
1981 | STATE : code ROUTINE : simReadIconData |
1982 +--------------------------------------------------------------------+
1983
1984 PURPOSE : Read SIM EF(IMG).
1985
1986 */
1987 void simReadIconData (U8 record_number)
1988 {
1989 T_SIM_ACCESS_PARAM sim_read_param;
1990
1991 TRACE_FUNCTION("simReadIconData()");
1992
1993 /* Check if the SIM card supports EF(IMG) & read the contents.
1994 Ideally we should be using SRV_RFU3 which corresponds to number 39
1995 but, the calls from MMI are using the number directly */
1996 if (sim_serv_table_check(39)
1997 == ALLOCATED_AND_ACTIVATED)
1998 {
1999 sim_read_param.data_id = SIM_IMG;
2000 sim_read_param.offset = 0;
2001 sim_read_param.record_number = record_number;
2002 sim_read_param.len = MAX_SIM_EF_SIZE;
2003 sim_read_param.max_length = MAX_SIM_EF_SIZE;
2004
2005 sim_read_sim_icon(&sim_read_param);
2006 }
2007 }
2008
2009
2010 /*
2011 +--------------------------------------------------------------------+
2012 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2013 | STATE : code ROUTINE : sim_img_cnf |
2014 +--------------------------------------------------------------------+
2015
2016 PURPOSE : SIM EF(IMG) read confirm.
2017
2018 */
2019
2020 void sim_img_cnf (USHORT error, UBYTE record_number, UBYTE *efimg)
2021 {
2022 USHORT simErr; /*a0393213 compiler warnings removal - variable,sim_read_param count removed*/
2023
2024
2025
2026 TRACE_FUNCTION("sim_img_cnf()");
2027
2028 #ifdef FF_2TO1_PS
2029 simErr = CAUSE_SIM_NO_ERROR;
2030 #else
2031 simErr = SIM_NO_ERROR;
2032 #endif
2033
2034 if (error == simErr)
2035 {
2036 if (*efimg >= 1)
2037 {
2038 /* Read the contents of the image file. */
2039 icon_image.number_of_image_instance = *efimg;
2040 efimg++;
2041
2042 icon_image.image_instance.image_width = *efimg;
2043 efimg++;
2044 icon_image.image_instance.image_height = *efimg;
2045 efimg++;
2046 icon_image.image_instance.image_coding = *efimg;
2047 efimg++;
2048
2049 /* Image instance file identifier*/
2050 icon_image.image_instance.image_instance_file_id = *efimg << 8;
2051 efimg++;
2052 icon_image.image_instance.image_instance_file_id |= *efimg;
2053 efimg++;
2054
2055 /* Offset to Image instance file identifier*/
2056 icon_image.image_instance.image_offset = *efimg << 8;
2057 efimg++;
2058 icon_image.image_instance.image_offset |= *efimg;
2059 efimg++;
2060
2061 /* Lenght of the Image instance file identifier.
2062 Do not completely depend on this length as this doesn't include the Palette length,
2063 so Color image decoding goes wrong!!!*/
2064 icon_image.image_instance.image_instance_length = *efimg << 8;
2065 efimg++;
2066 icon_image.image_instance.image_instance_length |= *efimg;
2067 efimg++;
2068
2069 read_image_instance_file = TRUE;
2070
2071 sim_read_sim(icon_image.image_instance.image_instance_file_id, MAX_SIM_EF_SIZE, MAX_SIM_EF_SIZE);
2072
2073 }
2074
2075 }
2076 }
2077
2078 /*
2079 +-----------------------------------------------------------------------------+
2080 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2081 | STATE : code ROUTINE : sim_img_instance_data_cnf |
2082 +-----------------------------------------------------------------------------+
2083
2084 PURPOSE : SIM EF(ImageInst) read confirm & image converter.
2085
2086 */
2087
2088 void sim_img_instance_data_cnf (USHORT error, UBYTE *data_instance)
2089 {
2090 USHORT simErr, CLUT_offset;
2091 char *dst = NULL;
2092 char *palette;
2093 UBYTE depth, width=0, height=0; /*a0393213 compiler warning removal- variable n_CLUT_entries removed*/
2094 UBYTE *data = (UBYTE *)data_instance;
2095
2096 TRACE_FUNCTION("sim_img_instance_data_cnf()");
2097
2098 #ifdef FF_2TO1_PS
2099 simErr = CAUSE_SIM_NO_ERROR;
2100 #else
2101 simErr = SIM_NO_ERROR;
2102 #endif
2103
2104 if (error == simErr)
2105 {
2106 /* Decode the Black & white image*/
2107 if(icon_image.image_instance.image_coding == BW_ICON)
2108 {
2109 width = *data;
2110 data++;
2111 height = *data;
2112 data++;
2113 dst = (char*)mfwAlloc(width * height);
2114
2115 if (dst == NULL)
2116 {
2117 /* Memory allocation failed, clean up & return */
2118 TRACE_ERROR("ERROR: Failed to allocate memory for sim_img_instance_data_cnf");
2119 satResponse(SatResImpossible);
2120 read_image_instance_file = FALSE;
2121 isAlphaIdIconPresent = FALSE;
2122 return;
2123 }
2124 /* B&W Converter function*/
2125 convert_11_image(width, height, (char *)data, dst);
2126 }
2127 /* Decode the Color image*/
2128 else if(icon_image.image_instance.image_coding == COLOR_ICON)
2129 {
2130 width = *data;
2131 data++;
2132 height = *data;
2133 data++;
2134 depth = *data;
2135 data++;
2136
2137 data++;
2138 CLUT_offset = (*data) << 8; /* HIGH: offset of CLUT */
2139 data++;
2140 CLUT_offset |= (*data); /* LOW: offset of CLUT */
2141 data++;
2142 dst = (char*)mfwAlloc(width * height);
2143
2144 if (dst == NULL)
2145 {
2146 /* Memory allocation failed, clean up & return */
2147 TRACE_ERROR("ERROR: Failed to allocate memory for sim_img_instance_data_cnf");
2148 satResponse(SatResImpossible);
2149 read_image_instance_file = FALSE;
2150 isAlphaIdIconPresent = FALSE;
2151 return;
2152 }
2153
2154 palette = (char *)(data + CLUT_offset - 6);
2155 /* Color Converter function*/
2156 convert_21_image(width, height, depth, data, (UBYTE *)palette, (UBYTE *)dst);
2157 }
2158
2159 switch (cmd.type)
2160 {
2161 case SatCmdDispText: iconDataUpdate(&cmd.c.text, width, height, dst); break;
2162 case SatCmdGetKey: iconDataUpdate(&cmd.c.text, width, height, dst); break;
2163 case SatCmdGetString: iconDataUpdate(&cmd.c.inp.prompt, width, height, dst); break;
2164 case SatCmdSetMenu:
2165 case SatCmdSelItem:
2166 {
2167 if(isAlphaIdIconPresent)
2168 {
2169 /* copy the header icon data & set the isAlphaIdIconPresent flag FALSE temporarily*/
2170 iconDataUpdate(&cmd.c.menu.header, width, height, dst);
2171 isAlphaIdIconPresent = FALSE;
2172 }
2173
2174 /* We have to read the icons present for each menu item now.
2175 We safely assume that the icons for each menu item is the same.
2176 Since the SAT Icon display is only for demo, we are not checking
2177 if separate icons has to be read for each item.
2178 */
2179 if(isItemIconPresent)
2180 {
2181 /* Copy the data into the cmd structure to be passed to BMI. */
2182 cmd.c.menu.items[0].iconInfo.dst = (char *) dst;
2183 cmd.c.menu.items[0].iconInfo.height = height;
2184 cmd.c.menu.items[0].iconInfo.width = width;
2185 isAlphaIdIconPresent = TRUE;
2186 isItemIconPresent = FALSE;
2187 }
2188
2189 if (!isAlphaIdIconPresent)
2190 {
2191 /* If the icon is present for menu items also, go ahead & read it. */
2192 if(cmd.c.menu.itemIconQual != 0xFF)
2193 {
2194 isItemIconPresent = TRUE;
2195 /* Set the Image instance flag to FALSE, so that we read the icons for the menu items. */
2196 read_image_instance_file = FALSE;
2197 /* Read the icon data present for Item menu list*/
2198 simReadIconData(cmd.c.menu.items[0].icon);
2199 }
2200 else
2201 isAlphaIdIconPresent = TRUE;
2202 }
2203 }
2204 break;
2205 case SatCmdSndSMS: iconDataUpdate(&cmd.c.sms.info, width, height, dst); break;
2206 case SatCmdSndSS: iconDataUpdate(&cmd.c.ss.info, width, height, dst); break;
2207 case SatCmdSndUSSD: iconDataUpdate(&cmd.c.ss.info, width, height, dst); break;
2208 case SatCmdCall: //x0035544 Feb 06, 2006 DR:OMAPS00061467
2209 //check if icon data is present for the first alpha identifier then update it. also check if icon data is present for alpha id2
2210 if(cmd.c.call.info.icon.qual != 0xFF)
2211 {
2212 iconDataUpdate(&cmd.c.call.info, width, height, dst);
2213 }
2214 if(cmd.c.call.info2.icon.qual != 0xFF)
2215 {
2216 // check if icon id for both the alpha identifiers is same or not. if so then get the same icon data.
2217 if(cmd.c.call.info2.icon.id == cmd.c.call.info.icon.id)
2218 iconDataUpdate(&cmd.c.call.info2, width, height, dst);
2219 //else part is not implemented as it is just for demonstration
2220 }
2221 break;
2222 case SatCmdIdleText: iconDataUpdate(&cmd.c.text, width, height, dst); break;
2223 case SatCmdExecAT: break;
2224 case SatCmdSndDTMF: iconDataUpdate(&cmd.c.cmd.info, width, height, dst); break;
2225 default:
2226 TRACE_ERROR("unknown command");
2227 satResponse(SatResUnknownType);
2228 return;
2229 }
2230
2231 }
2232
2233 if (curSATCmd && isAlphaIdIconPresent)
2234 {
2235 satSignal(curSATCmd,&cmd);
2236 read_image_instance_file = FALSE;
2237 isAlphaIdIconPresent = FALSE;
2238
2239 }
2240 //x0035544 Mar 11, 2006 DR:OMAPS00061467
2241 //Aafter SAT_SETUP_CALL event is executed then only send MfwSatCcAlert event
2242 if(setupCall_Executed == TRUE)
2243 {
2244 satSignal(MfwSatCcAlert,&cmd);
2245 setupCall_Executed = FALSE;
2246 }
2247
2248 }
2249
2250 /*
2251 +-----------------------------------------------------------------------------+
2252 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2253 | STATE : code ROUTINE : iconDataUpdate |
2254 +-----------------------------------------------------------------------------+
2255
2256 PURPOSE : To copy the image data details to be passed to BMI.
2257
2258 */
2259 void iconDataUpdate(SatTxt *t, UBYTE width, UBYTE height, char *dst)
2260 {
2261 TRACE_FUNCTION("iconDataUpdate()");
2262
2263 /* Copy the data into the cmd structure to be passed to BMI. */
2264 t->iconInfo.dst = (char *) dst;
2265 t->iconInfo.height = height;
2266 t->iconInfo.width = width;
2267
2268 }
2269
2270
2271 /*
2272 +-----------------------------------------------------------------------------+
2273 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2274 | STATE : code ROUTINE : convert_21_image |
2275 +-----------------------------------------------------------------------------+
2276
2277 PURPOSE : Image converter for Color icon.
2278
2279 */
2280 /* src = image data */
2281 /* dst = converted image data */
2282 void convert_21_image( UBYTE width, UBYTE height, UBYTE depth, UBYTE *src, UBYTE *palette, UBYTE *dst)
2283 {
2284 UBYTE i, j, k;
2285 USHORT src_offset, dst_offset;
2286 USHORT color_index;
2287 UBYTE src_mask = 0x80;
2288 UBYTE dst_mask;
2289 UBYTE value;
2290 USHORT R, G, B;
2291
2292 TRACE_FUNCTION("convert_21_image()");
2293
2294 src_offset = 0;
2295 dst_offset = 0;
2296
2297 for(j=0; j<height; j++)
2298 {
2299 for(i=0; i<width; i++)
2300 {
2301 color_index = 0;
2302 dst_mask = 1 << depth;
2303 for(k=0; k<depth; k++)
2304 {
2305 dst_mask = dst_mask >> 1;
2306 if(src[src_offset] & src_mask) color_index |= dst_mask;
2307
2308 if(src_mask == 0x01)
2309 {
2310 src_mask = 0x80;
2311 src_offset ++;
2312 }
2313 else src_mask = src_mask >> 1;
2314 }
2315 color_index *= 3;
2316 R = palette[color_index + 0];
2317 G = palette[color_index + 1];
2318 B = palette[color_index + 2];
2319 RGB_TO_PIXEL(R, G, B, value);
2320 dst[dst_offset] = value;
2321 dst_offset++;
2322 }
2323 }
2324
2325 }
2326
2327 /*
2328 +-----------------------------------------------------------------------------+
2329 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2330 | STATE : code ROUTINE : convert_11_image |
2331 +-----------------------------------------------------------------------------+
2332
2333 PURPOSE : Image converter for B/W icon.
2334
2335 */
2336 /* src = image data */
2337 /* dst = converted image data */
2338 void convert_11_image(UBYTE width, UBYTE height, char *src, char *dst)
2339 {
2340 UBYTE i, j;
2341 USHORT src_offset, dst_offset;
2342 USHORT mask = 0x80;
2343 UBYTE value;
2344
2345 TRACE_FUNCTION("convert_11_image()");
2346
2347 src_offset = 0;
2348 dst_offset = 0;
2349
2350 for(j=0; j<height; j++)
2351 {
2352 for(i=0; i<width; i++)
2353 {
2354 if(src[src_offset] & mask)
2355 value = 0x00;
2356 else
2357 value = 0xFF;
2358
2359 dst[dst_offset] = value;
2360 dst_offset++;
2361
2362 if(mask == 0x01)
2363 {
2364 mask = 0x80;
2365 src_offset ++;
2366 }
2367 else mask = mask >> 1;
2368 }
2369 }
2370 }
2371 #endif
2372
2373 /*
2374 +--------------------------------------------------------------------+
2375 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2376 | STATE : code ROUTINE : decRespFlag |
2377 +--------------------------------------------------------------------+
2378
2379 PURPOSE : decode TLV: immediate response
2380
2381 */
2382
2383 static U8 decRespFlag (U8 *flag, U8 mandatory)
2384 {
2385 U8 res;
2386
2387 TRACE_FUNCTION("decRespFlag()");
2388
2389 res = decTLV(0x2B,mandatory,"ResponseFlag");
2390
2391 if (res > 1)
2392 {
2393 *flag = 1; /* immediate response */
2394 return 1;
2395 }
2396 else
2397 {
2398 *flag = 0; /* no immediate response */
2399 }
2400
2401 return res;
2402 }
2403
2404 #ifdef FF_MMI_R99_SAT_LANG
2405 /*
2406 +--------------------------------------------------------------------+
2407 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2408 | STATE : code ROUTINE : decLangNotify |
2409 +--------------------------------------------------------------------+
2410
2411 PURPOSE : decode command: Language Notification
2412
2413 */
2414
2415 static U32 decLangNotify(void)
2416 {
2417
2418
2419 /* Need to decode and get the language selected in SIM */
2420 TRACE_FUNCTION("decLangNotify ()");
2421
2422 while (curCmdLen > 0)
2423 {
2424 if (!decDevId(1))
2425 return 0;
2426
2427 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
2428 break; /* success */
2429
2430 TRACE_ERROR("illegal device combination");
2431 if (curCR)
2432 {
2433 satResponse(SatResUnknownData);
2434 return 0;
2435 }
2436 partialCompr = 1;
2437 }
2438
2439 if (!decLang(&cmd.c.language,0x2D,0))
2440 return 0;
2441
2442 return MfwSatLangNotify;
2443 }
2444 #endif
2445 /*
2446 +--------------------------------------------------------------------+
2447 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2448 | STATE : code ROUTINE : decDispText |
2449 +--------------------------------------------------------------------+
2450
2451 PURPOSE : decode command: display text
2452
2453 */
2454
2455 static U32 decDispText (void)
2456 {
2457 TRACE_FUNCTION("decDispText()");
2458
2459 while (curCmdLen > 0)
2460 {
2461 if (!decDevId(1))
2462 return 0;
2463
2464 if (cmd.source == SatDevSIM && cmd.dest == SatDevDisplay)
2465 break; /* success */
2466
2467 TRACE_ERROR("illegal device combination");
2468 if (curCR)
2469 {
2470 satResponse(SatResUnknownData);
2471 return 0;
2472 }
2473 partialCompr = 1;
2474 }
2475 if (!decText(&cmd.c.text,0x0D,1))
2476 return 0;
2477
2478 if (!decIconId(&cmd.c.text.icon,0))
2479 return 0; /* fatal error */
2480
2481 if (!decRespFlag(&cmd.c.text.responseFlag,0))
2482 return 0; /* fatal error */
2483
2484 /* SPR#2340 - DS - If len is zero, string is empty */
2485 if (cmd.c.text.len == 0x00)
2486 {
2487 /* If no text string is supplied send result "Command data not understood by ME" */
2488 satResponse(SatResUnknownData);
2489 /* 29-Mar-2006, x0045876 (OMAPS00060199) */
2490 return 0;
2491 }
2492
2493 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2494 #ifdef FF_MMI_SAT_ICON
2495 /* Check if the icon data is present & needs to be read*/
2496 if (cmd.c.text.icon.qual != 0xFF)
2497 {
2498 /* Initialise the icon data members*/
2499 cmd.c.text.iconInfo.width = 0;
2500 cmd.c.text.iconInfo.height = 0;
2501 cmd.c.text.iconInfo.dst = NULL;
2502 simReadIconData(cmd.c.text.icon.id);
2503 }
2504 #endif
2505 return MfwSatTextOut;
2506 }
2507
2508
2509 /*
2510 +--------------------------------------------------------------------+
2511 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2512 | STATE : code ROUTINE : decGetKey |
2513 +--------------------------------------------------------------------+
2514
2515 PURPOSE : decode command: get inkey
2516
2517 */
2518
2519 static U32 decGetKey (void)
2520 {
2521 TRACE_FUNCTION("decGetKey()");
2522
2523 while (curCmdLen > 0)
2524 {
2525 if (!decDevId(1))
2526 return 0;
2527
2528 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
2529 break; /* success */
2530
2531 TRACE_ERROR("illegal device combination");
2532 if (curCR)
2533 {
2534 satResponse(SatResUnknownData);
2535 return 0;
2536 }
2537 partialCompr = 1;
2538 }
2539 if (!decText(&cmd.c.text,0x0D,1))
2540 return 0;
2541
2542 if (!decIconId(&cmd.c.text.icon,0))
2543 return 0; /* fatal error */
2544
2545 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2546 #ifdef FF_MMI_SAT_ICON
2547 /* Check if the icon data is present & needs to be read*/
2548 if (cmd.c.text.icon.qual != 0xFF)
2549 {
2550 /* Initialise the icon data members*/
2551 cmd.c.text.iconInfo.width = 0;
2552 cmd.c.text.iconInfo.height = 0;
2553 cmd.c.text.iconInfo.dst = NULL;
2554 simReadIconData(cmd.c.text.icon.id);
2555 }
2556 #endif
2557 return MfwSatGetKey;
2558 }
2559
2560
2561 /*
2562 +--------------------------------------------------------------------+
2563 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2564 | STATE : code ROUTINE : decGetString |
2565 +--------------------------------------------------------------------+
2566
2567 PURPOSE : decode command: get input
2568
2569 */
2570
2571 static U32 decGetString (void)
2572 {
2573 TRACE_FUNCTION("decGetString()");
2574
2575 while (curCmdLen > 0)
2576 {
2577 if (!decDevId(1))
2578 return 0;
2579
2580 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
2581 break; /* success */
2582
2583 TRACE_ERROR("illegal device combination");
2584 if (curCR)
2585 {
2586 satResponse(SatResUnknownData);
2587 return 0;
2588 }
2589 partialCompr = 1;
2590 }
2591 if (!decText(&cmd.c.inp.prompt,0x0D,1))
2592 return 0;
2593 if (!decRespLen(1))
2594 return 0;
2595
2596 cmd.c.inp.defRsp.len = 0; /* default settings */
2597 cmd.c.inp.defRsp.code = 0;
2598 cmd.c.inp.defRsp.text = 0;
2599
2600 if (!decText(&cmd.c.inp.defRsp,0x17,0))
2601 return 0; /* fatal error */
2602
2603 if (!decIconId(&cmd.c.inp.prompt.icon,0))
2604 return 0; /* fatal error */
2605
2606 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2607 #ifdef FF_MMI_SAT_ICON
2608 /* Check if the icon data is present & needs to be read*/
2609 if (cmd.c.inp.prompt.icon.qual != 0xFF)
2610 {
2611 /* Initialise the icon data members*/
2612 cmd.c.inp.prompt.iconInfo.width = 0;
2613 cmd.c.inp.prompt.iconInfo.height = 0;
2614 cmd.c.inp.prompt.iconInfo.dst = NULL;
2615 simReadIconData(cmd.c.inp.prompt.icon.id);
2616 }
2617 #endif
2618 return MfwSatGetString;
2619 }
2620
2621
2622 /*
2623 +--------------------------------------------------------------------+
2624 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2625 | STATE : code ROUTINE : decPlayTone |
2626 +--------------------------------------------------------------------+
2627
2628 PURPOSE : decode command: play tone
2629
2630 */
2631
2632 static U32 decPlayTone (void)
2633 {
2634 TRACE_FUNCTION("decPlayTone()");
2635
2636 while (curCmdLen > 0)
2637 {
2638 if (!decDevId(1))
2639 return 0;
2640
2641 if (cmd.source == SatDevSIM && cmd.dest == SatDevSpeaker)
2642 break; /* success */
2643
2644 TRACE_ERROR("illegal device combination");
2645 if (curCR)
2646 {
2647 satResponse(SatResUnknownData);
2648 return 0;
2649 }
2650 partialCompr = 1;
2651 }
2652
2653 cmd.c.tone.alpha.len = 0; /* default settings */
2654 cmd.c.tone.alpha.code = 0;
2655 cmd.c.tone.alpha.text = 0;
2656 cmd.c.tone.tone = 0;
2657 cmd.c.tone.durUnit = 0;
2658 cmd.c.tone.durValue = 0;
2659
2660 if (!decAlpha(&cmd.c.tone.alpha,0))
2661 return 0;
2662 if (!decTone(0))
2663 return 0;
2664 if (!decDuration(&cmd.c.tone.durUnit,0))
2665 return 0;
2666
2667 return MfwSatPlayTone;
2668 }
2669
2670
2671 /*
2672 +--------------------------------------------------------------------+
2673 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2674 | STATE : code ROUTINE : decSetMenu |
2675 +--------------------------------------------------------------------+
2676
2677 PURPOSE : decode command: setup menu
2678
2679 */
2680
2681 static U32 decSetMenu (void)
2682 {
2683 SatItem *ip;
2684 S16 oldLen;
2685 U8 nItems;
2686
2687 TRACE_FUNCTION("decSetMenu()");
2688
2689 while (curCmdLen > 0)
2690 {
2691 if (!decDevId(1))
2692 return 0;
2693
2694 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
2695 break; /* success */
2696
2697 TRACE_ERROR("illegal device combination");
2698 if (curCR)
2699 {
2700 satResponse(SatResUnknownData);
2701 return 0;
2702 }
2703 partialCompr = 1;
2704 }
2705 cmd.c.menu.nItems = 0;
2706 if (!decAlpha(&cmd.c.menu.header,1))
2707 return 0;
2708
2709 oldLen = curCmdLen;
2710 ip = cmd.c.menu.items;
2711 if (!decItem(ip,1))
2712 return 0;
2713 nItems = 0; /* number of menu items */
2714
2715 while (oldLen != curCmdLen) /* really decoded something */
2716 {
2717 nItems++;
2718 oldLen = curCmdLen;
2719 ip++;
2720 if (!decItem(ip,0))
2721 return 0;
2722 }
2723
2724 if (!decNextAction(cmd.c.menu.items,nItems,0))
2725 return 0;
2726
2727 if (!decIconId(&cmd.c.menu.header.icon,0))
2728 return 0;
2729
2730 if (!decItemIcons(&cmd.c.menu,cmd.c.menu.items,nItems,0))
2731 return 0;
2732
2733 cmd.c.menu.nItems = nItems;
2734
2735 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
2736 #ifdef FF_MMI_SAT_ICON
2737 /* Check if the icon data is present in the Alpha id & needs to be read*/
2738 if (cmd.c.menu.header.icon.qual != 0xFF)
2739 {
2740 /* Initialise the icon data members*/
2741 cmd.c.menu.header.iconInfo.width = 0;
2742 cmd.c.menu.header.iconInfo.height = 0;
2743 cmd.c.menu.header.iconInfo.dst = NULL;
2744 simReadIconData(cmd.c.menu.header.icon.id);
2745 }
2746
2747 /* We have to read theicons present for each menu item now.
2748 We safely assume that the icons for each menu item is the same.
2749 Since the SAT Icon display is only for demo, we are not checking
2750 if separate icons has to be read for each item.
2751 */
2752 if (cmd.c.menu.itemIconQual != 0xFF)
2753 {
2754 /* Initialise the icon data members*/
2755 cmd.c.menu.items[0].iconInfo.width = 0;
2756 cmd.c.menu.items[0].iconInfo.height = 0;
2757 cmd.c.menu.items[0].iconInfo.dst = NULL;
2758 }
2759 #endif
2760
2761 return MfwSatSetupMenu;
2762 }
2763
2764
2765 /*
2766 +--------------------------------------------------------------------+
2767 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2768 | STATE : code ROUTINE : decSelItem |
2769 +--------------------------------------------------------------------+
2770
2771 PURPOSE : decode command: select item
2772
2773 */
2774
2775 static U32 decSelItem (void)
2776 {
2777 SatItem *ip;
2778 S16 oldLen;
2779 U8 nItems;
2780
2781 TRACE_FUNCTION("decSelItem()");
2782
2783 while (curCmdLen > 0)
2784 {
2785 if (!decDevId(1))
2786 return 0;
2787
2788 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
2789 break; /* success */
2790
2791 TRACE_ERROR("illegal device combination");
2792 if (curCR)
2793 {
2794 satResponse(SatResUnknownData);
2795 return 0;
2796 }
2797 partialCompr = 1;
2798 }
2799 cmd.c.menu.nItems = 0;
2800
2801 cmd.c.menu.header.code = 0; /* set default values */
2802 cmd.c.menu.header.len = 0;
2803 cmd.c.menu.header.text = 0;
2804 if (!decAlpha(&cmd.c.menu.header,0))
2805 return 0;
2806
2807 oldLen = curCmdLen;
2808 ip = cmd.c.menu.items;
2809 if (!decItem(ip,1))
2810 return 0;
2811 nItems = 0; /* number of menu items */
2812
2813 while (oldLen != curCmdLen) /* really decoded something */
2814 {
2815 nItems++;
2816 oldLen = curCmdLen;
2817 ip++;
2818 if (!decItem(ip,0))
2819 return 0;
2820 }
2821
2822 if (!decNextAction(cmd.c.menu.items,nItems,0))
2823 return 0;
2824
2825 if (!decDefItem(cmd.c.menu.items,nItems,0))
2826 return 0;
2827
2828 if (!decIconId(&cmd.c.menu.header.icon,0))
2829 return 0;
2830
2831 if (!decItemIcons(&cmd.c.menu,cmd.c.menu.items,nItems,0))
2832 return 0;
2833
2834 cmd.c.menu.nItems = nItems;
2835
2836 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
2837 #ifdef FF_MMI_SAT_ICON
2838 /* Check if the icon data is present in the Alpha id & needs to be read*/
2839 if (cmd.c.menu.header.icon.qual != 0xFF)
2840 {
2841 /* Initialise the icon data members*/
2842 cmd.c.menu.header.iconInfo.width = 0;
2843 cmd.c.menu.header.iconInfo.height = 0;
2844 cmd.c.menu.header.iconInfo.dst = NULL;
2845 simReadIconData(cmd.c.menu.header.icon.id);
2846 }
2847
2848 /* We have to read theicons present for each menu item now.
2849 We safely assume that the icons for each menu item is the same.
2850 Since the SAT Icon display is only for demo, we are not checking
2851 if separate icons has to be read for each item.
2852 */
2853 if (cmd.c.menu.itemIconQual != 0xFF)
2854 {
2855 /* Initialise the icon data members*/
2856 cmd.c.menu.items[0].iconInfo.width = 0;
2857 cmd.c.menu.items[0].iconInfo.height = 0;
2858 cmd.c.menu.items[0].iconInfo.dst = NULL;
2859 }
2860 #endif
2861
2862 return MfwSatSelectItem;
2863 }
2864
2865
2866 /*
2867 +--------------------------------------------------------------------+
2868 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2869 | STATE : code ROUTINE : decSndSMS |
2870 +--------------------------------------------------------------------+
2871
2872 PURPOSE : decode command: send SMS
2873
2874 */
2875
2876 static U32 decSndSMS (void)
2877 {
2878 TRACE_FUNCTION("decSndSMS()");
2879
2880 while (curCmdLen > 0)
2881 {
2882 if (!decDevId(1))
2883 return 0;
2884
2885 if (cmd.source == SatDevSIM && cmd.dest == SatDevNet)
2886 break; /* success */
2887
2888 TRACE_ERROR("illegal device combination");
2889 if (curCR)
2890 {
2891 satResponse(SatResUnknownData);
2892 return 0;
2893 }
2894 partialCompr = 1;
2895 }
2896
2897 cmd.c.sms.info.code = 0; /* set default values */
2898 cmd.c.sms.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
2899 cmd.c.sms.info.text = 0;
2900 if (!decAlpha(&cmd.c.sms.info,0))
2901 return 0;
2902
2903 cmd.c.sms.addr.ton = 0; /* set default values */
2904 cmd.c.sms.addr.len = 0;
2905 cmd.c.sms.addr.number = 0;
2906 if (!decAddrSS(&cmd.c.sms.addr,0x06,0)) /* address (SS string) */
2907 return 0;
2908
2909 if (!decSMS(&cmd.c.sms.sms,1))
2910 return 0;
2911
2912 if (!decIconId(&cmd.c.sms.info.icon,0))
2913 return 0;
2914
2915 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2916 #ifdef FF_MMI_SAT_ICON
2917 /* Check if the icon data is present & needs to be read*/
2918 if (cmd.c.sms.info.icon.qual != 0xFF)
2919 {
2920 /* Initialise the icon data members*/
2921 cmd.c.sms.info.iconInfo.width = 0;
2922 cmd.c.sms.info.iconInfo.height = 0;
2923 cmd.c.sms.info.iconInfo.dst = NULL;
2924 simReadIconData(cmd.c.sms.info.icon.id);
2925 }
2926 #endif
2927 return MfwSatSendSMS;
2928 }
2929
2930
2931 /*
2932 +--------------------------------------------------------------------+
2933 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2934 | STATE : code ROUTINE : decSndSS |
2935 +--------------------------------------------------------------------+
2936
2937 PURPOSE : decode command: send SS
2938
2939 */
2940
2941 static U32 decSndSS (void)
2942 {
2943 TRACE_FUNCTION("decSndSS()");
2944
2945 while (curCmdLen > 0)
2946 {
2947 if (!decDevId(1))
2948 return 0;
2949
2950 if (cmd.source == SatDevSIM && cmd.dest == SatDevNet)
2951 break; /* success */
2952
2953 TRACE_ERROR("illegal device combination");
2954 if (curCR)
2955 {
2956 satResponse(SatResUnknownData);
2957 return 0;
2958 }
2959 partialCompr = 1;
2960 }
2961
2962 cmd.c.ss.info.code = 0; /* set default values */
2963 cmd.c.ss.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
2964 cmd.c.ss.info.text = 0;
2965 if (!decAlpha(&cmd.c.ss.info,0))
2966 return 0;
2967
2968 if (!decAddrSS(&cmd.c.ss.ss,0x09,1)) /* SS string (== address) */
2969 return 0;
2970
2971 if (!decIconId(&cmd.c.ss.info.icon,0))
2972 return 0;
2973
2974 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
2975 #ifdef FF_MMI_SAT_ICON
2976 /* Check if the icon data is present & needs to be read*/
2977 if (cmd.c.ss.info.icon.qual != 0xFF)
2978 {
2979 /* Initialise the icon data members*/
2980 cmd.c.ss.info.iconInfo.width = 0;
2981 cmd.c.ss.info.iconInfo.height = 0;
2982 cmd.c.ss.info.iconInfo.dst = NULL;
2983 simReadIconData(cmd.c.ss.info.icon.id);
2984 }
2985 #endif
2986 return MfwSatSendSS;
2987 }
2988
2989
2990 /*
2991 +--------------------------------------------------------------------+
2992 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
2993 | STATE : code ROUTINE : decSndUSSD |
2994 +--------------------------------------------------------------------+
2995
2996 PURPOSE : decode command: send USSD
2997
2998 */
2999
3000 static U32 decSndUSSD (void)
3001 {
3002 TRACE_FUNCTION("decSndUSSD()");
3003
3004 while (curCmdLen > 0)
3005 {
3006 if (!decDevId(1))
3007 return 0;
3008
3009 if (cmd.source == SatDevSIM && cmd.dest == SatDevNet)
3010 break; /* success */
3011
3012 TRACE_ERROR("illegal device combination");
3013 if (curCR)
3014 {
3015 satResponse(SatResUnknownData);
3016 return 0;
3017 }
3018 partialCompr = 1;
3019 }
3020
3021 cmd.c.ss.info.code = 0; /* set default values */
3022 cmd.c.ss.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3023 cmd.c.ss.info.text = 0;
3024 if (!decAlpha(&cmd.c.ss.info,0))
3025 return 0;
3026
3027 if (!decAddrSS(&cmd.c.ss.ss,0x0A,1)) /* USSD string */
3028 return 0;
3029
3030 if (!decIconId(&cmd.c.ss.info.icon,0))
3031 return 0;
3032
3033 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
3034 #ifdef FF_MMI_SAT_ICON
3035 /* Check if the icon data is present & needs to be read*/
3036 if (cmd.c.ss.info.icon.qual != 0xFF)
3037 {
3038 /* Initialise the icon data members*/
3039 cmd.c.ss.info.iconInfo.width = 0;
3040 cmd.c.ss.info.iconInfo.height = 0;
3041 cmd.c.ss.info.iconInfo.dst = NULL;
3042 simReadIconData(cmd.c.ss.info.icon.id);
3043 }
3044 #endif
3045 return MfwSatSendUSSD;
3046 }
3047
3048
3049 /*
3050 +--------------------------------------------------------------------+
3051 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3052 | STATE : code ROUTINE : decCall |
3053 +--------------------------------------------------------------------+
3054
3055 PURPOSE : decode command: setup call
3056
3057 */
3058
3059 static U32 decCall (void)
3060 {
3061 TRACE_FUNCTION("decCall()");
3062
3063 while (curCmdLen > 0)
3064 {
3065 if (!decDevId(1))
3066 return 0;
3067
3068 if (cmd.source == SatDevSIM && cmd.dest == SatDevNet)
3069 break; /* success */
3070
3071 TRACE_ERROR("illegal device combination");
3072 if (curCR)
3073 {
3074 satResponse(SatResUnknownData);
3075 return 0;
3076 }
3077 partialCompr = 1;
3078 }
3079
3080 cmd.c.call.info.code = 0; /* set default values */
3081 cmd.c.call.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3082 cmd.c.call.info.text = 0;
3083
3084 cmd.c.call.info2.code = 0; /* set default values */
3085 cmd.c.call.info2.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3086 cmd.c.call.info2.text = 0;
3087
3088 if (!decAlpha(&cmd.c.call.info,0))
3089 return 0;
3090
3091 if (!decAddrSS(&cmd.c.call.addr,0x06,1)) /* address (SS string) */
3092 return 0;
3093
3094 cmd.c.call.bc.len = 0; /* set default values */
3095 cmd.c.call.bc.data = 0;
3096 if (!decData(&cmd.c.call.bc,0x07,0)) /* bearer capabilities */
3097 return 0;
3098
3099 cmd.c.call.sa.len = 0; /* set default values */
3100 cmd.c.call.sa.data = 0;
3101 if (!decData(&cmd.c.call.sa,0x08,0)) /* subaddress */
3102 return 0;
3103
3104 cmd.c.call.durUnit = 0; /* set default values */
3105 cmd.c.call.durValue = 0;
3106 if (!decDuration(&cmd.c.call.durUnit,0)) /* redial timing */
3107 return 0;
3108
3109 if (!decIconId(&cmd.c.call.info.icon,0)) /* icon for info 1 */
3110 return 0;
3111
3112 if (!decAlpha(&cmd.c.call.info2,0)) /* call setup info (2) */
3113 return 0;
3114
3115 if (!decIconId(&cmd.c.call.info2.icon,0)) /* icon for info 2 */
3116 return 0;
3117 //Sudha.V x0035544, feb 06, 2006 DR:OMAPS00061467
3118 #ifdef FF_MMI_SAT_ICON
3119 /* Check if the icon data is present for alpha identifier 1 & needs to be read*/
3120 if (cmd.c.call.info.icon.qual != 0xFF)
3121 {
3122 /* Since we have two icons present, if second Alpha id is present,
3123 set the isAlphaIdIconPresent to TRUE explicitly since the second Alpha icon will
3124 reset this flag if not present & we wont enter the icon decoder*/
3125 isAlphaIdIconPresent = TRUE;
3126 /* Initialise the icon data members*/
3127 cmd.c.call.info.iconInfo.width = 0;
3128 cmd.c.call.info.iconInfo.height = 0;
3129 cmd.c.call.info.iconInfo.dst = NULL;
3130 simReadIconData(cmd.c.call.info.icon.id);
3131 }
3132 /* Check if the icon data is present for alpha identifier 2 & needs to be read*/
3133 //No need to read icon data for alpha id2 from sim again as it is same as that of alpha id1
3134 if (cmd.c.call.info2.icon.qual != 0xFF)
3135 {
3136 // Initialise the icon data members
3137 cmd.c.call.info2.iconInfo.width = 0;
3138 cmd.c.call.info2.iconInfo.height = 0;
3139 cmd.c.call.info2.iconInfo.dst = NULL;
3140 }
3141 #endif
3142
3143 return MfwSatCall;
3144 }
3145
3146
3147 /*
3148 +--------------------------------------------------------------------+
3149 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3150 | STATE : code ROUTINE : decExecAT |
3151 +--------------------------------------------------------------------+
3152
3153 PURPOSE : decode command: run AT command
3154
3155 */
3156
3157 static U32 decExecAT (void)
3158 {
3159 TRACE_FUNCTION("decExecAT()");
3160
3161 while (curCmdLen > 0)
3162 {
3163 if (!decDevId(1))
3164 return 0;
3165
3166 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
3167 break; /* success */
3168
3169 TRACE_ERROR("illegal device combination");
3170 if (curCR)
3171 {
3172 satResponse(SatResUnknownData);
3173 return 0;
3174 }
3175 partialCompr = 1;
3176 }
3177
3178 cmd.c.cmd.info.code = 0; /* set default values */
3179 cmd.c.cmd.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3180 cmd.c.cmd.info.text = 0;
3181 if (!decAlpha(&cmd.c.cmd.info,0))
3182 return 0;
3183
3184 cmd.c.cmd.cmd.len = 0; /* set default values */
3185 cmd.c.cmd.cmd.data = 0;
3186 if (!decData(&cmd.c.cmd.cmd,0x28,1)) /* AT command string */
3187 return 0;
3188
3189 if (!decIconId(&cmd.c.cmd.info.icon,0)) /* icon for info */
3190 return 0;
3191
3192 return MfwSatExecAT;
3193 }
3194
3195
3196 /*
3197 +--------------------------------------------------------------------+
3198 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3199 | STATE : code ROUTINE : decSndDTMF |
3200 +--------------------------------------------------------------------+
3201
3202 PURPOSE : decode command: send DTMF
3203
3204 */
3205
3206 static U32 decSndDTMF (void)
3207 {
3208 TRACE_FUNCTION("decSndDTMF()");
3209
3210 while (curCmdLen > 0)
3211 {
3212 if (!decDevId(1))
3213 return 0;
3214
3215 if (cmd.source == SatDevSIM && cmd.dest == SatDevNet)
3216 break; /* success */
3217
3218 TRACE_ERROR("illegal device combination");
3219 if (curCR)
3220 {
3221 satResponse(SatResUnknownData);
3222 return 0;
3223 }
3224 partialCompr = 1;
3225 }
3226
3227 cmd.c.cmd.info.code = 0; /* set default values */
3228 cmd.c.cmd.info.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3229 cmd.c.cmd.info.text = 0;
3230 if (!decAlpha(&cmd.c.cmd.info,0))
3231 return 0;
3232
3233 cmd.c.cmd.cmd.len = 0; /* set default values */
3234 cmd.c.cmd.cmd.data = 0;
3235 if (!decData(&cmd.c.cmd.cmd,0x2C,1)) /* DTMF string */
3236 return 0;
3237
3238 if (!decIconId(&cmd.c.cmd.info.icon,0)) /* icon for info */
3239 return 0;
3240
3241 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
3242 #ifdef FF_MMI_SAT_ICON
3243 /* Check if the icon data is present & needs to be read*/
3244 if (cmd.c.cmd.info.icon.qual != 0xFF)
3245 {
3246 /* Initialise the icon data members*/
3247 cmd.c.cmd.info.iconInfo.width = 0;
3248 cmd.c.cmd.info.iconInfo.height = 0;
3249 cmd.c.cmd.info.iconInfo.dst = NULL;
3250 simReadIconData(cmd.c.cmd.info.icon.id);
3251 }
3252 #endif
3253 return MfwSatSendDTMF;
3254 }
3255
3256
3257 /*
3258 +--------------------------------------------------------------------+
3259 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3260 | STATE : code ROUTINE : decCcRes |
3261 +--------------------------------------------------------------------+
3262
3263 PURPOSE : decode Call Control result
3264
3265 */
3266
3267 static U32 decCcRes (void)
3268 {
3269 TRACE_FUNCTION("decCcRes()");
3270
3271 cmd.c.ccres.addr.ton = 0; /* set default values *//*a0393213 warnings removal - -1 changed to 0 for all items*/
3272 cmd.c.ccres.addr.len = 0;
3273 cmd.c.ccres.addr.number = 0;
3274 cmd.c.ccres.addr2.ton = 0; /* set on SMS result */
3275 cmd.c.ccres.addr2.len = 0;
3276 cmd.c.ccres.addr2.number = 0;
3277
3278 if (!decAddrSS(&cmd.c.ccres.addr,0x06,0)) /* address */
3279 return 0;
3280
3281 if (curTag == 0x06) /* was an address */
3282 {
3283 if (!decAddrSS(&cmd.c.ccres.addr2,0x06,0)) /* try another */
3284 return 0;
3285 if (curTag == 0x06) /* hit: have SMS result */
3286 {
3287 cmd.c.ccres.info.code = 0; /* get alpha id *//*a0393213 warnings removal - -1 changed to 0 for all items*/
3288 cmd.c.ccres.info.len = 0;
3289 cmd.c.ccres.info.text = 0;
3290 if (!decAlpha(&cmd.c.ccres.info,0))
3291 return 0;
3292
3293 return MfwSatCcRes;
3294 }
3295 }
3296 else
3297 {
3298 if (curTag == 0x09) /* not an address */
3299 if (!decAddrSS(&cmd.c.ccres.addr,0x09,0)) /* try SS */
3300 return 0;
3301 if (curTag == 0x0a) /* not an SS string */
3302 if (!decAddrSS(&cmd.c.ccres.addr,0x0a,0)) /* try USSD */
3303 return 0;
3304 }
3305
3306 cmd.c.ccres.bc.len = 0; /* set default values */ /*a0393213 warnings removal - -1 changed to 0 for all items*/
3307 cmd.c.ccres.bc.data = 0;
3308 if (!decData(&cmd.c.ccres.bc,0x07,0)) /* bearer capabilities */
3309 return 0;
3310
3311 cmd.c.ccres.sa.len = 0; /* set default values *//*a0393213 warnings removal - -1 changed to 0 for all items*/
3312 cmd.c.ccres.sa.data = 0;
3313 if (!decData(&cmd.c.ccres.sa,0x08,0)) /* subaddress */
3314 return 0;
3315
3316 cmd.c.ccres.info.code = 0; /* set default values *//*a0393213 warnings removal - -1 changed to 0 for all items*/
3317 cmd.c.ccres.info.len = 0;
3318 cmd.c.ccres.info.text = 0;
3319 if (!decAlpha(&cmd.c.ccres.info,0)) /* alpha information */
3320 return 0;
3321
3322 cmd.c.ccres.bcRepInd = 0; /* set default values */
3323 if (decByte(&cmd.c.ccres.bcRepInd,0x2a,0)<2) /* BC repeat ind. */
3324 return MfwSatCcRes;
3325
3326 cmd.c.ccres.bc2.len = 0; /* set default values *//*a0393213 warnings removal - -1 changed to 0 for all items*/
3327 cmd.c.ccres.bc2.data = 0;
3328 if (!decData(&cmd.c.ccres.bc2,0x07,0)) /* bearer 2 capabilities */
3329 return 0;
3330
3331 return MfwSatCcRes;
3332 }
3333
3334
3335 /*
3336 +--------------------------------------------------------------------+
3337 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3338 | STATE : code ROUTINE : decRefresh |
3339 +--------------------------------------------------------------------+
3340
3341 PURPOSE : decode command: refresh
3342
3343 */
3344
3345 static U32 decRefresh (void)
3346 {
3347 TRACE_FUNCTION("decRefresh()");
3348
3349 while (curCmdLen > 0)
3350 {
3351 if (!decDevId(1))
3352 return 0;
3353
3354 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
3355 break; /* success */
3356
3357 TRACE_ERROR("illegal device combination");
3358 if (curCR)
3359 {
3360 satResponse(SatResUnknownData);
3361 return 0;
3362 }
3363 partialCompr = 1;
3364 }
3365
3366 cmd.c.files.len = 0; /* set default values */
3367 cmd.c.files.data = 0;
3368 if (!decData(&cmd.c.files,0x12,0)) /* refresh file list */
3369 return 0;
3370
3371 //ES!! do real refresh here...
3372
3373 return MfwSatRefresh;
3374 }
3375
3376
3377 /*
3378 +--------------------------------------------------------------------+
3379 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3380 | STATE : code ROUTINE : decSetEvents |
3381 +--------------------------------------------------------------------+
3382
3383 PURPOSE : decode command: setup event list
3384
3385 */
3386
3387 static U32 decSetEvents (void)
3388 {
3389 U8 *ep;
3390 U8 res;
3391 U8 sat_res[2];
3392
3393 TRACE_FUNCTION("decSetEvents()");
3394
3395 while (curCmdLen > 0)
3396 {
3397 if (!decDevId(1))
3398 return 0;
3399
3400 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
3401 break; /* success */
3402
3403 TRACE_ERROR("illegal device combination");
3404 if (curCR)
3405 {
3406 satResponse(SatResUnknownData);
3407 return 0;
3408 }
3409 partialCompr = 1;
3410 }
3411
3412 cmd.c.events.len = 0; /* default: remove list */
3413 cmd.c.events.elem[0] = 0;
3414 eventList =0;
3415 res = decTLV(0x19,1,"Event List");
3416
3417 if (res > 1)
3418 {
3419 ep = &cmd.c.events.elem[0];
3420 while (curLen--)
3421 {
3422 switch (*curVal)
3423 {
3424 case SatEvtUserAction:
3425 if (eventList & SatEvtUserActionActivated)
3426 {
3427 /*
3428 ** CQ 16435 : This can only have happend if this event is listed more than one
3429 ** which is invalid and causes a reject!
3430 */
3431 eventList = 0;
3432 satResponse(SatResImpossible);
3433 return 0;
3434 }
3435 else
3436 {
3437 eventList|= SatEvtUserActionActivated;
3438 *ep |= *curVal; /* event list element */
3439 cmd.c.events.len++; /* number of events */
3440 }
3441 break;
3442
3443 case SatEvtIdleScreen:
3444 if (eventList & SatEvtIdleScreenActivated)
3445 {
3446 /*
3447 ** CQ 16435 : This can only have happend if this event is listed more than one
3448 ** which is invalid and causes a reject!
3449 */
3450 eventList = 0;
3451 satResponse(SatResImpossible);
3452 return 0;
3453 }
3454 else
3455 {
3456 eventList|= SatEvtIdleScreenActivated;
3457 *ep |= *curVal; /* event list element */
3458 cmd.c.events.len++; /* number of events */
3459 }
3460 break;
3461
3462 /* ACI-SPR-18200: - this event is not completely implemented
3463 "Not supported" stated in TERMINAL PROFILE */
3464 #if 0
3465 case SatEvtBrowserTermination:
3466 if (eventList & SatEvtBrowserTerminateActivated)
3467 {
3468 /*
3469 ** CQ 16435 : This can only have happend if this event is listed more than one
3470 ** which is invalid and causes a reject!
3471 */
3472 eventList = 0;
3473 satResponse(SatResImpossible);
3474 return 0;
3475 }
3476 else
3477 {
3478 eventList|= SatEvtBrowserTerminateActivated;
3479 *ep |= *curVal; /* event list element */
3480 cmd.c.events.len++; /* number of events */
3481 }
3482 break;
3483 #endif
3484 #ifdef FF_MMI_R99_SAT_LANG
3485 case SatEvtLangSelection: /*OMAPS00070661 (SAT-Lang sel) R.Prabakar(a0393213)*/
3486 if (eventList & SatEvtLangSelectActivated)
3487 {
3488 /*
3489 ** CQ 16435 : This can only have happend if this event is listed more than one
3490 ** which is invalid and causes a reject!
3491 */
3492 eventList = 0;
3493 satResponse(SatResImpossible);
3494 return 0;
3495 }
3496 else
3497 {
3498 eventList|= SatEvtLangSelectActivated;
3499 *ep |= *curVal; /* event list element */
3500 cmd.c.events.len++; /* number of events */
3501 }
3502 break;
3503 #endif
3504 default:
3505 /* CQ16435 : If there is an unsupported event, then the entire list fails,
3506 ** reset the eventList to zero and return the response "Beyond ME Capabilities"
3507 */
3508 eventList = 0;
3509 satResponse(SatResImpossible);
3510 return 0;
3511 }
3512 curVal++;
3513 }
3514
3515 sat_res[0] = SatResSuccess; /*Terminal response always sent if there are elements */
3516 sat_res[1] = SatResAiNoCause; /* even if they are not MMI */
3517 TRACE_EVENT_P1("MFW event list %x",eventList);
3518 satDone(&cmd, (U8*)&sat_res, sizeof(sat_res));
3519 }
3520 else
3521 {
3522 satResponse(SatResUnknownData);
3523 return 0; /* no event list found */
3524 }
3525 return MfwSatSetEvents;
3526 }
3527
3528
3529 /*
3530 +--------------------------------------------------------------------+
3531 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3532 | STATE : code ROUTINE : decIdleText |
3533 +--------------------------------------------------------------------+
3534
3535 PURPOSE : decode command: setup idle mode text
3536
3537 */
3538
3539 static U32 decIdleText (void)
3540 {
3541 TRACE_FUNCTION("decIdleText()");
3542
3543 while (curCmdLen > 0)
3544 {
3545 if (!decDevId(1))
3546 return 0;
3547
3548 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
3549 break; /* success */
3550
3551 TRACE_ERROR("illegal device combination");
3552 if (curCR)
3553 {
3554 satResponse(SatResUnknownData);
3555 return 0;
3556 }
3557 partialCompr = 1;
3558 }
3559 if (!decText(&cmd.c.text,0x0D,1))
3560 return 0;
3561
3562 if (!decIconId(&cmd.c.text.icon,0))
3563 return 0;
3564
3565 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
3566 #ifdef FF_MMI_SAT_ICON
3567 /* Check if the icon data is present & needs to be read*/
3568 if (cmd.c.text.icon.qual != 0xFF)
3569 {
3570 /* Initialise the icon data members*/
3571 cmd.c.text.iconInfo.width = 0;
3572 cmd.c.text.iconInfo.height = 0;
3573 cmd.c.text.iconInfo.dst = NULL;
3574 simReadIconData(cmd.c.text.icon.id);
3575 }
3576 #endif
3577 return MfwSatIdleText;
3578 }
3579
3580 /*
3581 +--------------------------------------------------------------------+
3582 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3583 | STATE : code ROUTINE : decOpenChannel |
3584 +--------------------------------------------------------------------+
3585
3586 PURPOSE : decode command: open channel
3587
3588 */
3589
3590 static U32 decOpenChannel (void)
3591 {
3592 SatAddress addr;
3593 SatData subaddr;
3594
3595 TRACE_FUNCTION("decOpenChannel()");
3596
3597 while (curCmdLen > 0)
3598 {
3599 if (!decDevId(1))
3600 return 0;
3601
3602 if (cmd.source == SatDevSIM && cmd.dest == SatDevME)
3603 break; /* success */
3604
3605 TRACE_ERROR("illegal device combination");
3606 if (curCR)
3607 {
3608 satResponse(SatResUnknownData);
3609 return 0;
3610 }
3611 partialCompr = 1;
3612 }
3613
3614 /* Decode alpha idenitifier if present */
3615 cmd.c.open.alpha_id.code = 0; /* set default values */
3616 cmd.c.open.alpha_id.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3617 cmd.c.open.alpha_id.text = 0;
3618 if (!decAlpha(&cmd.c.open.alpha_id,0))
3619 return 0;
3620
3621 /* Decode icon identifier if present */
3622 if (!decIconId(&cmd.c.open.alpha_id.icon,0))
3623 return 0;
3624
3625 /* Decode address if present */
3626 /* If address is present then channel type is CSD */
3627 addr.ton = 0; /* set default values */
3628 addr.len = 0;
3629 addr.number = 0;
3630 if (!decAddrSS(&addr,0x06,0))
3631 return 0;
3632
3633 /* Decode subaddress if present */
3634 subaddr.len = 0;
3635 subaddr.data = 0;
3636 if (!decData(&subaddr,0x08,0))
3637 return 0;
3638
3639 /* Decode duration 1 if present */
3640 cmd.c.open.dur1Unit = 0; /* set default values */
3641 cmd.c.open.dur1Value = 0;
3642 if (!decDuration(&cmd.c.open.dur1Unit,0)) /* redial timing */
3643 return 0;
3644
3645 /* Decode duration 2 if present */
3646 cmd.c.open.dur2Unit = 0; /* set default values */
3647 cmd.c.open.dur2Value = 0;
3648 if (!decDuration(&cmd.c.open.dur2Unit,0)) /* redial timing */
3649 return 0;
3650
3651 return MfwSatOpenChannel;
3652
3653 }
3654
3655 /*
3656 +--------------------------------------------------------------------+
3657 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3658 | STATE : code ROUTINE : decCloseChannel |
3659 +--------------------------------------------------------------------+
3660
3661 PURPOSE : decode command: close channel
3662
3663 */
3664
3665 static U32 decCloseChannel (void)
3666 {
3667
3668 /*a0393213 compiler warnings removal - removed alpha_res*/
3669
3670 TRACE_FUNCTION("decCloseChannel()");
3671
3672 while (curCmdLen > 0)
3673 {
3674 if (!decDevId(1))
3675 return 0;
3676
3677 /* SPR#2321 - DS - Compare with correct SAT Class E device identities */
3678 if ( (cmd.source == SatDevSIM && cmd.dest == SatDevCh1) ||
3679 (cmd.source == SatDevSIM && cmd.dest == SatDevCh2) ||
3680 (cmd.source == SatDevSIM && cmd.dest == SatDevCh3) ||
3681 (cmd.source == SatDevSIM && cmd.dest == SatDevCh4) ||
3682 (cmd.source == SatDevSIM && cmd.dest == SatDevCh5) ||
3683 (cmd.source == SatDevSIM && cmd.dest == SatDevCh6) ||
3684 (cmd.source == SatDevSIM && cmd.dest == SatDevCh7) )
3685 break; /* success */
3686
3687 TRACE_ERROR("illegal device combination");
3688 if (curCR)
3689 {
3690 satResponse(SatResUnknownData);
3691 return 0;
3692 }
3693 partialCompr = 1;
3694 }
3695
3696 /* Decode alpha identifier if present */
3697 cmd.c.close.alpha_id.code = 0; /* set default values */
3698 cmd.c.close.alpha_id.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3699 cmd.c.close.alpha_id.text = 0;
3700
3701 if (!decAlpha(&cmd.c.close.alpha_id,0))
3702 return 0;
3703
3704 /* Decode icon identifier if present */
3705 if (!decIconId(&cmd.c.close.alpha_id.icon,0))
3706 return 0;
3707
3708 return MfwSatCloseChannel;
3709
3710 }
3711
3712 /*
3713 +--------------------------------------------------------------------+
3714 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3715 | STATE : code ROUTINE : decSendData |
3716 +--------------------------------------------------------------------+
3717
3718 PURPOSE : decode command: send data
3719
3720 */
3721
3722 static U32 decSendData (void)
3723 {
3724 TRACE_FUNCTION("decSendData()");
3725
3726 while (curCmdLen > 0)
3727 {
3728 if (!decDevId(1))
3729 return 0;
3730
3731 /* SPR#2321 - DS - Compare with correct SAT Class E device identities */
3732 if ( (cmd.source == SatDevSIM && cmd.dest == SatDevCh1) ||
3733 (cmd.source == SatDevSIM && cmd.dest == SatDevCh2) ||
3734 (cmd.source == SatDevSIM && cmd.dest == SatDevCh3) ||
3735 (cmd.source == SatDevSIM && cmd.dest == SatDevCh4) ||
3736 (cmd.source == SatDevSIM && cmd.dest == SatDevCh5) ||
3737 (cmd.source == SatDevSIM && cmd.dest == SatDevCh6) ||
3738 (cmd.source == SatDevSIM && cmd.dest == SatDevCh7) )
3739 break; /* success */
3740
3741 TRACE_ERROR("illegal device combination");
3742 if (curCR)
3743 {
3744 satResponse(SatResUnknownData);
3745 return 0;
3746 }
3747 partialCompr = 1;
3748 }
3749
3750 /* Decode alpha identifier if present */
3751 cmd.c.send.alpha_id.code = 0; /* set default values */
3752 cmd.c.send.alpha_id.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3753 cmd.c.send.alpha_id.text = 0;
3754
3755 if (!decAlpha(&cmd.c.send.alpha_id,0))
3756 return 0;
3757
3758 /* Decode icon identifier if present */
3759 if (!decIconId(&cmd.c.send.alpha_id.icon,0))
3760 return 0;
3761
3762 return MfwSatSendData;
3763
3764 }
3765
3766 /*
3767 +--------------------------------------------------------------------+
3768 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3769 | STATE : code ROUTINE : decRecvData |
3770 +--------------------------------------------------------------------+
3771
3772 PURPOSE : decode command: receive data
3773
3774 */
3775
3776 static U32 decRecvData (void)
3777 {
3778 TRACE_FUNCTION("decRecvData()");
3779
3780 while (curCmdLen > 0)
3781 {
3782 if (!decDevId(1))
3783 return 0;
3784
3785 /* SPR#2321 - DS - Compare with correct SAT Class E device identities */
3786 if ( (cmd.source == SatDevSIM && cmd.dest == SatDevCh1) ||
3787 (cmd.source == SatDevSIM && cmd.dest == SatDevCh2) ||
3788 (cmd.source == SatDevSIM && cmd.dest == SatDevCh3) ||
3789 (cmd.source == SatDevSIM && cmd.dest == SatDevCh4) ||
3790 (cmd.source == SatDevSIM && cmd.dest == SatDevCh5) ||
3791 (cmd.source == SatDevSIM && cmd.dest == SatDevCh6) ||
3792 (cmd.source == SatDevSIM && cmd.dest == SatDevCh7) )
3793 break; /* success */
3794
3795 TRACE_ERROR("illegal device combination");
3796 if (curCR)
3797 {
3798 satResponse(SatResUnknownData);
3799 return 0;
3800 }
3801 partialCompr = 1;
3802 }
3803
3804 /* Decode alpha identifier if present */
3805 cmd.c.receive.alpha_id.code = 0; /* set default values */
3806 cmd.c.receive.alpha_id.len = 0; /* optional info if absent *//*a0393213 warnings removal - -1 changed to 0*/
3807 cmd.c.receive.alpha_id.text = 0;
3808
3809 if (!decAlpha(&cmd.c.send.alpha_id,0))
3810 return 0;
3811
3812 /* Decode icon identifier if present */
3813 if (!decIconId(&cmd.c.receive.alpha_id.icon,0))
3814 return 0;
3815
3816 return MfwSatReceiveData;
3817
3818 }
3819
3820
3821 /*
3822 +--------------------------------------------------------------------+
3823 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3824 | STATE : code ROUTINE : cmdDecode |
3825 +--------------------------------------------------------------------+
3826
3827 PURPOSE : command specific decoding
3828
3829 */
3830
3831 static void cmdDecode (void)
3832 {
3833 U32 evt = 0;
3834 // T_SIM_ACCESS_PARAM sim_read_param;
3835
3836 TRACE_FUNCTION("cmdDecode()");
3837
3838 switch (cmd.type)
3839 {
3840 case SatCmdDispText: evt = decDispText(); break;
3841 case SatCmdGetKey: evt = decGetKey(); break;
3842 case SatCmdGetString: evt = decGetString(); break;
3843 case SatCmdPlayTone: evt = decPlayTone(); break;
3844 case SatCmdSetMenu: evt = decSetMenu(); break;
3845 case SatCmdSelItem: evt = decSelItem(); break;
3846 case SatCmdSndSMS: evt = decSndSMS(); break;
3847 case SatCmdSndSS: evt = decSndSS(); break;
3848 case SatCmdSndUSSD: evt = decSndUSSD(); break;
3849 case SatCmdCall: evt = decCall(); break;
3850 case SatCmdRefresh: evt = decRefresh(); break;
3851 case SatCmdEvtList: evt = decSetEvents(); break;
3852 case SatCmdIdleText: evt = decIdleText(); break;
3853 case SatCmdExecAT: evt = decExecAT(); break;
3854 case SatCmdSndDTMF: evt = decSndDTMF(); break;
3855 #if defined(FF_WAP)
3856 case SatCmdLaunchBrowser: break;
3857 #endif
3858
3859 /* SPR#1786 - DS - SAT Class E */
3860 case SatCmdOpenChannel: evt = decOpenChannel(); break;
3861 case SatCmdCloseChannel: evt = decCloseChannel(); break;
3862 case SatCmdSendData: evt = decSendData(); break;
3863 case SatCmdReceiveData: evt = decRecvData(); break;
3864
3865 case SatCmdEOS: evt = MfwSatSessionEnd; break;
3866 #ifdef FF_MMI_R99_SAT_LANG
3867 case SatCmdLangNotify: evt = decLangNotify(); break; /*OMAPS00070661 (SAT-Lang notify & Local info) R.Prabakar(a0393213)*/
3868 case SatCmdLocalInf: evt = MfwSatLocalInfo; break;
3869 #endif
3870 default:
3871 TRACE_ERROR("unknown command");
3872 satResponse(SatResUnknownType);
3873 return;
3874 }
3875
3876 if (evt == MfwSatOpenChannel)
3877 {
3878 /* SPR#2321 - DS - Store command details so rAT_PercentSATA
3879 * can send the correct command details for Open Channel.
3880 */
3881 sat_cmd_saved = (SatCmd*)mfwAlloc(sizeof(SatCmd));
3882
3883 if (sat_cmd_saved != NULL)
3884 {
3885 TRACE_EVENT("Save Open Channel command details");
3886 memcpy(sat_cmd_saved, &cmd, sizeof(cmd));
3887 }
3888
3889 /* Event is sent from rAT_PercentSATA */
3890
3891 return;
3892 }
3893 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
3894 #ifdef FF_MMI_SAT_ICON
3895 curSATCmd = evt; /* Keep a current copy of the command */
3896
3897 if (evt && !isAlphaIdIconPresent)
3898 satSignal(evt,&cmd);
3899 #else
3900 if (evt)
3901 satSignal(evt,&cmd);
3902 #endif
3903
3904 return;
3905 }
3906
3907
3908 /*
3909 +--------------------------------------------------------------------+
3910 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
3911 | STATE : code ROUTINE : rAT_PercentSATI |
3912 +--------------------------------------------------------------------+
3913
3914 PURPOSE : called by ACI for SIM Toolkit command
3915
3916 */
3917
3918 void rAT_PercentSATI (S16 len, U8 *sc)
3919 {
3920 U8 tl;
3921
3922 TRACE_FUNCTION("rAT_PercentSATI()");
3923 if (len <= 0) /* empty command? */
3924 {
3925 cmd.number = 0; /* virtual command */
3926 cmd.type = SatCmdEOS; /* terminate session */
3927 cmd.qual = 0;
3928 cmd.source = SatDevSIM;
3929 cmd.dest = SatDevME;
3930 cmdDecode();
3931 return;
3932 }
3933
3934 if (!sc || *sc != 0xD0)
3935 { /* no proactive SIM command */
3936 TRACE_ERROR("no SAT command"); /* ignore message */
3937 return;
3938 }
3939
3940 curCmd = sc;
3941 curCmdLen = len;
3942 curData = (U8 *) &cmd + sizeof(SatCmd);/* end of command buffer */
3943 *(curData - 1) = 0x07;
3944
3945 tl = getTLValue(sc);
3946 if (!tl) /* length error */
3947 return; /* ignore message */
3948
3949 curCmd += tl;
3950 curCmdLen -= tl;
3951 if (curCmdLen < curLen) /* not enough data */
3952 {
3953 TRACE_ERROR("not enough data");
3954 satResponse(SatResUnknownData); /* not understood by ME */
3955 return;
3956 }
3957 if (curCmdLen > curLen) /* more data than needed: */
3958 curCmdLen = curLen; /* ignore the rest */
3959
3960 partialCompr = 0; /* partial comprehen. flag */
3961 while (curCmdLen > 0)
3962 {
3963 tl = getTLValue(curCmd);
3964 if (!tl)
3965 return;
3966 curCmd += tl;
3967 curCmdLen -= tl;
3968 if (curTag == 0x01) /* command details */
3969 {
3970 cmd.number = *(curCmd+0); /* transaction number */
3971 cmd.type = *(curCmd+1); /* command ID */
3972 cmd.qual = *(curCmd+2); /* command qualifier */
3973 if (cmd.number == 0x00 || cmd.number == 0xFF)
3974 {
3975 TRACE_ERROR("invalid command number");
3976 satResponse(SatResUnknownData);
3977 }
3978 /*SPR#2121 - DS - Copy command specific details into global buffer defCmdDetails */
3979 memcpy(defCmdDetails, curCmd-2, 5);
3980
3981 curCmd += curLen;
3982 curCmdLen -= curLen; /* length of value bytes */
3983 cmdDecode(); /* do specific decoding */
3984 return;
3985 }
3986 TRACE_ERROR("no command details");
3987 if (curCR)
3988 {
3989 satResponse(SatResUnknownData);
3990 return;
3991 }
3992 curCmd += curLen;
3993 curCmdLen -= curLen;
3994 partialCompr = 1;
3995 }
3996 satResponse(SatResNoValues);
3997 }
3998
3999
4000 /*
4001 +--------------------------------------------------------------------+
4002 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4003 | STATE : code ROUTINE : rAT_PercentSATN |
4004 +--------------------------------------------------------------------+
4005
4006 PURPOSE : Notification by ACI on notifications for SAT commands
4007
4008 */
4009
4010 /* BEGIN ADD: : Req ID: : 31-Mar-2005*/
4011 #ifndef NEPTUNE_BOARD
4012 /* END ADD: : Req ID: : 31-Mar-2005*/
4013 void rAT_PercentSATN (S16 len, U8 *sc, T_ACI_SATN_CNTRL_TYPE cntrl_type)
4014 /* BEGIN ADD: : Req ID: : 31-Mar-2005*/
4015 #else
4016 void rAT_PercentSATN ( SHORT len,UBYTE *sc)
4017 #endif
4018 /* END ADD: : Req ID: : 31-Mar-2005*/
4019 {
4020 U8 tl;
4021 U32 evt = 0;
4022
4023 TRACE_FUNCTION("rAT_PercentSATN()");
4024
4025 if (len <= 0 || !sc) /* empty command? */
4026 {
4027 TRACE_ERROR("empty SATN!");
4028 #if 0
4029 // ES!! simulate CC result: not modified ??
4030 sc = (U8*) &evt; /* temporary misuse... */
4031 len = 2;
4032 #else
4033 // ES!! or ignore it ??
4034 return;
4035 #endif
4036 }
4037 if (*sc == 0xD0)
4038 {
4039 satNoResponse = 1;
4040 rAT_PercentSATI(len,sc); /* normal processing */
4041 satNoResponse = 0;
4042 return;
4043 }
4044
4045 curCmd = sc;
4046 curCmdLen = len;
4047 curData = (U8 *) &cmd + sizeof(SatCmd);/* end of command buffer */
4048
4049 switch (*sc)
4050 {
4051 case 0x00: /* CC: allowed, not mod. */
4052 case 0x01: /* CC: not allowed */
4053 case 0x02: /* CC: allowed, modified */
4054 partialCompr = 0; /* partial comprehen. flag */
4055 cmd.c.ccres.result = *sc;
4056 tl = getTLValue(sc);
4057 if (!tl) /* length error */
4058 return; /* ignore message */
4059 curCmd += tl;
4060 curCmdLen -= tl;
4061 if (curCmdLen < curLen) /* not enough data */
4062 {
4063 TRACE_ERROR("SATN: not enough data (ignored).");
4064 return;
4065 }
4066 if (curCmdLen > curLen) /* more data than needed: */
4067 curCmdLen = curLen; /* ignore the rest */
4068 evt = decCcRes();
4069 if (evt)
4070 satSignal(evt,&cmd);
4071 break;
4072 case 0x81:
4073 TRACE_EVENT("SATN: ACI terminal response (ignored).");
4074 break;
4075 default:
4076 TRACE_EVENT("SATN: unknown header (ignored).");
4077 break;
4078 }
4079 }
4080
4081
4082 /*
4083 +--------------------------------------------------------------------+
4084 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4085 | STATE : code ROUTINE : rAT_PercentSATA |
4086 +--------------------------------------------------------------------+
4087
4088 PURPOSE : Alert indication by ACI for SAT commands
4089
4090 */
4091 #if defined (TI_PS_FF_SATE) || defined (FF_SAT_E)
4092 void rAT_PercentSATA (S16 cId, S32 rdlTimeout_ms,T_ACI_SATA_ADD *addParm)
4093 #else
4094 void rAT_PercentSATA (S16 cId, S32 rdlTimeout_ms)
4095 #endif /* TI_PS_FF_SATE */
4096 {
4097 TRACE_FUNCTION("rAT_PercentSATA()");
4098
4099 TRACE_EVENT_P1("Redial Time %d",rdlTimeout_ms);
4100
4101 /* Store call details */
4102 cmd.c.ccres.redialTime = rdlTimeout_ms;
4103 cmd.c.ccres.callId = cId;
4104
4105 if (rdlTimeout_ms > 0) /* Check timeout value is valid */
4106 {
4107 cm_set_redial(CM_REDIAL_AUTO);
4108 }
4109 #if defined (TI_PS_FF_SATE) || defined (FF_SAT_E)
4110 /* No Channel information available, therefore treat as normal Voice call */
4111 if (addParm == NULL)
4112 {
4113 #endif /* TI_PS_FF_SATE */
4114 //x0035544 Mar 11, 2006. DR:OMAPS00061467
4115 //unless SAT_SETUP_CALL event is executed, dont send MfwSatCcAlert event to BMI
4116 #ifdef FF_MMI_SAT_ICON
4117 if(isAlphaIdIconPresent )
4118 {
4119 setupCall_Executed = TRUE;
4120 }
4121 else
4122 satSignal(MfwSatCcAlert,&cmd);
4123 #else
4124 satSignal(MfwSatCcAlert,&cmd);
4125 #endif
4126 return;
4127
4128 #if defined (TI_PS_FF_SATE) || defined (FF_SAT_E)
4129 }
4130 else /* Store channel information in command structure */
4131 {
4132 cmd.c.open.channel_type = (T_MFW_SAT_CHN)addParm->chnType;
4133 cmd.c.open.establishment_type = (T_MFW_SAT_EST)addParm->chnEst;
4134 }
4135
4136 /* Determine Channel type and send approriate event to BMI */
4137 switch ((T_MFW_SAT_CHN)addParm->chnType)/*a0393213 lint warnings removal - type casting done*/
4138 {
4139 case MFW_SAT_CHN_NONE:
4140 case MFW_SAT_CHN_VOICE:
4141 satSignal(MfwSatCcAlert,&cmd);
4142 break;
4143 case MFW_SAT_CHN_CSD:
4144 case MFW_SAT_CHN_GPRS:
4145
4146 /* SPR#2321 - DS - Copy the saved Open Channel details to cmd in case a Call
4147 * Control result command was received (therefore overwriting the Open Channel
4148 * data) between the original MfwSatOpenChannel command and this alert indication
4149 */
4150 if (sat_cmd_saved != NULL)
4151 {
4152 TRACE_EVENT("Copy the saved Open Channel details to the cmd structure");
4153 memcpy(&cmd, sat_cmd_saved, sizeof(SatCmd)); /* SPR#2340 - DS - Copy full structure */
4154
4155 /* Deallocate saved Open Channel command details */
4156 if (sat_cmd_saved)
4157 {
4158 TRACE_EVENT("Deallocate sat_cmd_saved");
4159 mfwFree((U8*)sat_cmd_saved, sizeof(SatCmd));
4160 sat_cmd_saved = NULL;
4161 }
4162 }
4163 TRACE_EVENT("satSignal(MfwSatOpenChannel, &cmd)");
4164 satSignal(MfwSatOpenChannel, &cmd);
4165 break;
4166 default:
4167 TRACE_ERROR("Error with SATA channle type!");
4168 break;
4169 }
4170 #endif /* TI_PS_FF_SATE */
4171 }
4172
4173
4174 /*
4175 +--------------------------------------------------------------------+
4176 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4177 | STATE : code ROUTINE : rAT_PercentSATE |
4178 +--------------------------------------------------------------------+
4179
4180 PURPOSE : called by ACI on response for Envelope commands
4181
4182 */
4183
4184 void rAT_PercentSATE (S16 len, U8 *res)
4185 {
4186 TRACE_FUNCTION("rAT_PercentSATE()"); //ES!! FOR WHAT ??
4187 }
4188
4189
4190 /*
4191 +--------------------------------------------------------------------+
4192 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4193 | STATE : code ROUTINE : rAT_PercentSATBROW |
4194 +--------------------------------------------------------------------+
4195
4196 PURPOSE : called by ACI when the SAT Browser command arrives.
4197
4198 */
4199
4200 #if defined(FF_WAP)
4201
4202 void rAT_PercentSATBROW (T_LAUNCH_BROWSER *browser_command) //To be change to T_LAUNCH_BROWSER
4203 {
4204 int i;
4205 T_prov_file_ref* current_prov_file;
4206
4207 TRACE_FUNCTION("rAT_PercentSATBROW()");
4208
4209 cmd.c.browser.identity = browser_command->browser_id.browser;
4210 cmd.c.browser.url = (U8*) browser_command->url.url_value;
4211 cmd.c.browser.n_bearer = browser_command->c_bearer;
4212 cmd.c.browser.bearer = (U8*)browser_command->bearer;
4213 cmd.c.browser.n_prov_file_ref = browser_command->c_prov_file_ref;
4214 for (i=0;(i<browser_command->c_prov_file_ref) && (i<MFW_MAX_PFP_ELEM);i++)
4215 {
4216 current_prov_file = browser_command->prov_file_ref;
4217 cmd.c.browser.prov_file_ref[i].prov_file_id_len = current_prov_file->c_prov_file_id;
4218 cmd.c.browser.prov_file_ref[i].prov_file_id = (U8*)current_prov_file->prov_file_id;
4219 current_prov_file++;
4220 }
4221 cmd.c.browser.text_string.icon.qual = browser_command->icon.icon_qu;
4222 cmd.c.browser.text_string.icon.id = browser_command->icon.icon_id;
4223 /* Copy the text string into the cmd buffer */
4224 {
4225 U8 *provPointer;
4226 provPointer = (U8 *) &cmd + sizeof(SatCmd);/* end of command buffer */
4227 provPointer -= browser_command->text.c_text_str; /*Substract length of the text */
4228 memcpy(provPointer,browser_command->text.text_str,browser_command->text.c_text_str);/*Copies text*/
4229 cmd.c.browser.text_string.text = (U16) (provPointer - (U8*)&cmd.c.browser.text_string);/*Stores the offset */
4230 cmd.c.browser.text_string.len = browser_command->text.c_text_str;
4231 cmd.c.browser.text_string.code = browser_command->text.dcs;
4232 }
4233 /* Copy the alpha id */
4234 cmd.c.browser.alpha_len = browser_command->c_alpha_id;
4235 cmd.c.browser.alpha_id = (U8*)browser_command->alpha_id;
4236
4237
4238 satSignal(MfwSatLaunchBrowser, &cmd); /*Send the event to MMI */
4239
4240
4241 }
4242
4243 #endif
4244
4245 // Aug 31, 2005 REF: CRR 33619 x0021334
4246 // Description: RE: Notification of SATK File Change
4247 // Solution: Added stub function 'rAT_PercentSIMEF()'
4248 /*
4249 +--------------------------------------------------------------------+
4250 | PROJECT : MMI-Framework MODULE : MFW_SAT |
4251 | STATE : code ROUTINE : rAT_PercentSIMEF |
4252 +--------------------------------------------------------------------+
4253
4254 PURPOSE : handles rAT_PercentSIMEF call back
4255 */
4256 void rAT_PercentSIMEF (T_SIM_FILE_UPDATE_IND *sim_file_update_ind)
4257 {
4258 TRACE_FUNCTION ("rAT_PercentSIMEF()");
4259 }
4260
4261 /*
4262 +--------------------------------------------------------------------+
4263 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4264 | STATE : code ROUTINE : satAccept |
4265 +--------------------------------------------------------------------+
4266
4267 PURPOSE : accept SIM initiated connection
4268
4269 */
4270
4271 void satAccept (void)
4272 {
4273 T_ACI_RETURN res;
4274
4275 TRACE_FUNCTION("satAccept()");
4276
4277 mfwSatMoAccepted = 1;
4278 res = sAT_A(CMD_SRC_LCL);
4279 if (res != AT_EXCT && res != AT_CMPL)
4280 {
4281 TRACE_ERROR("satAccept() error");
4282 mfwSatMoAccepted = 0;
4283 }
4284
4285 return;
4286 }
4287
4288
4289 /*
4290 +--------------------------------------------------------------------+
4291 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4292 | STATE : code ROUTINE : satReject |
4293 +--------------------------------------------------------------------+
4294
4295 PURPOSE : reject SIM initiated connection
4296
4297 */
4298
4299 void satReject (void)
4300 {
4301 T_ACI_RETURN res;
4302
4303 TRACE_FUNCTION("satReject()");
4304
4305 res = sAT_H(CMD_SRC_LCL);
4306 if (res != AT_EXCT && res != AT_CMPL)
4307 TRACE_ERROR("satReject() error");
4308
4309 return;
4310 }
4311
4312
4313 /*
4314 +--------------------------------------------------------------------+
4315 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4316 | STATE : code ROUTINE : satDisc |
4317 +--------------------------------------------------------------------+
4318
4319 PURPOSE : disconnect SIM initiated connection
4320
4321 */
4322
4323 void satDisc (void)
4324 {
4325 T_ACI_RETURN res;
4326
4327 TRACE_FUNCTION("satDisc()");
4328
4329 res = sAT_Abort(CMD_SRC_LCL,AT_CMD_A);
4330 if (res != AT_EXCT && res != AT_CMPL)
4331 TRACE_ERROR("satDisc() error");
4332
4333 return;
4334 }
4335
4336 /*
4337 +--------------------------------------------------------------------+
4338 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4339 | STATE : code ROUTINE : satChangeNotify |
4340 +--------------------------------------------------------------------+
4341
4342 PURPOSE : File change notification
4343
4344 */
4345 #ifdef FF_2TO1_PS
4346 BOOL satChangeNotify ( int ref, T_SIM_FILE_UPDATE_IND *updateInd)
4347 {
4348 int i;
4349 int cnt;
4350 UBYTE f = 0;
4351 U32 evt = 0;
4352
4353 TRACE_FUNCTION ("satChangeNotify ()");
4354
4355
4356 //send a notification to the MMI as well
4357 #ifdef OLD_MFW_SAT_REFRESH
4358 evt = decRefresh(); /* JVJ. This is not sending the proper information!!!!*/
4359 satSignal(evt, &cmd);
4360 #endif
4361
4362
4363
4364 memset ( &udNotify, 0, sizeof(udNotify));
4365 /***************************Go-lite Optimization changes Start***********************/
4366 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
4367 TRACE_EVENT_P5("file_num: %d, files: %x %x %x %x", updateInd->val_nr,
4368 updateInd->file_info[0].datafield, updateInd->file_info[1].datafield,
4369 updateInd->file_info[2].datafield, updateInd->file_info[3].datafield);
4370 /***************************Go-lite Optimization changes END***********************/
4371 fuRef = ref;
4372 cnt = 0;
4373 for (i = 0; i < (int)updateInd->val_nr; i++)
4374 {
4375 if (updateInd->file_info[i].datafield EQ SIM_GID1 OR
4376 updateInd->file_info[i].datafield EQ SIM_GID2 OR
4377 updateInd->file_info[i].datafield EQ SIM_CPHS_CINF OR
4378 updateInd->file_info[i].datafield EQ SIM_SST OR
4379 updateInd->file_info[i].datafield EQ SIM_SMS OR
4380 updateInd->file_info[i].datafield EQ SIM_SPN OR
4381 updateInd->file_info[i].datafield EQ SIM_LP )
4382 {
4383 if (cnt < MFW_MAX_NT_SIZE)
4384 {
4385 udNotify.fields[cnt] = updateInd->file_info[i].datafield;
4386 cnt++;
4387 if (updateInd->file_info[i].datafield EQ SIM_SMS) // bugfix for SIM refresh
4388 sms_busy_ind(); /* When SMS fields will be updated, MFW sends SMS BUSY event to MMI */
4389 }
4390 }
4391 }
4392 udNotify.count = cnt;
4393
4394 if (!cnt)
4395 {
4396 if (fuRef >= 0)
4397 fuRef = -1;
4398 return TRUE;
4399 }
4400
4401 for ( i=0; i < (int)udNotify.count; i++)
4402 {
4403 if ( udNotify.fields[i] EQ SIM_SST )
4404 f = 1;
4405 }
4406
4407 if (udNotify.count)
4408 {
4409 if (f)
4410 {
4411 f = 0;
4412 sim_sat_file_update(SIM_SST);
4413 }
4414 else
4415 satUpdateFiles(FALSE, 0);
4416 }
4417
4418 return FALSE;
4419 }
4420 #else
4421 BOOL satChangeNotify ( int ref, T_SIM_FILE_UPDATE_IND *updateInd)
4422 {
4423 int i;
4424 int cnt;
4425 UBYTE f = 0;
4426 #if defined(OLD_MFW_SAT_REFRESH)
4427 U32 evt = 0;
4428 #endif
4429
4430 TRACE_FUNCTION ("satChangeNotify ()");
4431
4432
4433 //send a notification to the MMI as well
4434 #ifdef OLD_MFW_SAT_REFRESH
4435 evt = decRefresh(); /* JVJ. This is not sending the proper information!!!!*/
4436 satSignal(evt, &cmd);
4437 #endif
4438
4439
4440
4441 memset ( &udNotify, 0, sizeof(udNotify));
4442 /***************************Go-lite Optimization changes Start***********************/
4443 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
4444
4445 // x0047685 Due to R99 SIM Interface changes, file_id[i] has been
4446 // replaced by file_info[i].datafield
4447 TRACE_EVENT_P5("file_num: %d, files: %x %x %x %x", updateInd->val_nr,
4448 updateInd->file_info[0].datafield, updateInd->file_info[1].datafield,
4449 updateInd->file_info[2].datafield, updateInd->file_info[3].datafield);
4450 /***************************Go-lite Optimization changes END***********************/
4451
4452
4453
4454 fuRef = ref;
4455 cnt = 0;
4456 for (i = 0; i < (int)updateInd->val_nr; i++)
4457 {
4458 if (updateInd->file_info[i].datafield EQ SIM_GID1 OR
4459 updateInd->file_info[i].datafield EQ SIM_GID2 OR
4460 updateInd->file_info[i].datafield EQ SIM_CPHS_CINF OR
4461 updateInd->file_info[i].datafield EQ SIM_SST OR
4462 updateInd->file_info[i].datafield EQ SIM_SMS OR
4463 updateInd->file_info[i].datafield EQ SIM_SPN OR
4464 updateInd->file_info[i].datafield EQ SIM_LP
4465 )
4466 {
4467 if (cnt < MFW_MAX_NT_SIZE)
4468 {
4469 udNotify.fields[cnt] = updateInd->file_info[i].datafield;
4470 cnt++;
4471 if (updateInd->file_info[i].datafield EQ SIM_SMS) // bugfix for SIM refresh
4472 sms_busy_ind(); /* When SMS fields will be updated, MFW sends SMS BUSY event to MMI */
4473 }
4474 }
4475 }
4476
4477 udNotify.count = cnt;
4478
4479 if (!cnt)
4480 {
4481 if (fuRef >= 0)
4482 fuRef = -1;
4483 return TRUE;
4484 }
4485
4486 for ( i=0; i < (int)udNotify.count; i++)
4487 {
4488 if ( udNotify.fields[i] EQ SIM_SST )
4489 f = 1;
4490 }
4491
4492 if (udNotify.count)
4493 {
4494 if (f)
4495 {
4496 f = 0;
4497 sim_sat_file_update(SIM_SST);
4498 }
4499 else
4500 satUpdateFiles(FALSE, 0);
4501 }
4502
4503 return FALSE;
4504 }
4505
4506
4507 #endif
4508
4509 /*
4510 +--------------------------------------------------------------------+
4511 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4512 | STATE : code ROUTINE : satUpdateFiles |
4513 +--------------------------------------------------------------------+
4514
4515 PURPOSE : Update changed files
4516 updated = TRUE, dataId field is updated
4517 updated = FALSE, no field is updated
4518
4519 */
4520
4521 void satUpdateFiles ( U8 updated, USHORT dataId )
4522 {
4523 int i;
4524
4525 TRACE_FUNCTION("satUpdateFiles()");
4526
4527 /* remove the updated file from list */
4528 if (updated)
4529 {
4530 for (i=0; i < MFW_MAX_NT_SIZE; i++)
4531 {
4532 if (udNotify.fields[i] EQ dataId)
4533 {
4534 udNotify.count--;
4535 udNotify.fields[i] = 0;
4536 }
4537 }
4538 }
4539
4540 if (!udNotify.count)
4541 {
4542 if (fuRef >= 0)
4543 {
4544 psaSAT_FUConfirm (fuRef, SIM_FU_SUCCESS);
4545 fuRef = -1;
4546 }
4547 return;
4548 }
4549
4550 /* update the next file */
4551 for ( i=0; i < MFW_MAX_NT_SIZE; i++)
4552 {
4553 if ( udNotify.fields[i] )
4554 {
4555 switch ( udNotify.fields[i] )
4556 {
4557 case SIM_GID1:
4558 sim_sat_file_update( SIM_GID1 );
4559 return;
4560 case SIM_GID2:
4561 sim_sat_file_update( SIM_GID2 );
4562 return;
4563 case SIM_CPHS_CINF:
4564 cphs_sat_file_update( SIM_CPHS_CINF );
4565 return;
4566 case SIM_SMS:
4567 sms_sat_file_update( SIM_SMS );
4568 return;
4569 case SIM_SPN:
4570 nm_sat_file_update( SIM_SPN );
4571 return;
4572 case SIM_LP:
4573 mfwSATLPRefresh = TRUE;
4574 sim_sat_file_update( SIM_LP );
4575 return;
4576 default:
4577 break;
4578 }
4579 }
4580 }
4581 }
4582
4583 /*
4584 +--------------------------------------------------------------------+
4585 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4586 | STATE : code ROUTINE : satRefreshNotification |
4587 +--------------------------------------------------------------------+
4588
4589 PURPOSE : File change notification start and refresh confirmatio
4590
4591 */
4592
4593 BOOL satRefreshNotification ( int ref, T_SIM_FILE_UPDATE_IND *updateInd)
4594 {
4595 U32 evt=0;
4596
4597 TRACE_FUNCTION("satRefreshNotification");
4598
4599 if (ref<0) /*File update indication arrives from ACI */
4600 { /* MMI has to be notified once */
4601
4602 /*
4603 * x0047685 Due to R99 SIM Interface changes, file_id[i] has been
4604 * replaced by file_info[i].datafield.
4605 * Also removed FF_2TO1_PS flag, since in both cases we need to
4606 * access EF using file_info and not file_id.
4607 */
4608 /*a0393213 OMAPS00116309 Data type of 'files' changed from U16* to T_file_info*
4609 because of R99 change in ACI*/
4610 cmd.c.refFiles.files = updateInd->file_info;
4611 cmd.c.refFiles.files_nr = updateInd->val_nr;
4612 cmd.c.refFiles.status = ref;
4613 if (updateInd->val_nr)
4614 evt = MfwSatRefresh;
4615 if (evt)
4616 satSignal(evt, &cmd);
4617 if (fu_aborted)
4618 {
4619 fu_aborted = FALSE;
4620 return FALSE;
4621 }
4622 }
4623 else
4624 {
4625 /*a0393213 OMAPS00116309 Data type of 'files' changed from U16* to T_file_info*
4626 because of R99 change in ACI*/
4627 cmd.c.refFiles.files = updateInd->file_info;
4628 cmd.c.refFiles.files_nr = updateInd->val_nr;
4629 cmd.c.refFiles.status = ref;
4630 if (updateInd->val_nr)
4631 evt = MfwSatDataRefreshed;
4632 if (evt)
4633 satSignal(evt, &cmd);
4634 }
4635 return TRUE;
4636 }
4637
4638
4639
4640
4641 /*
4642 +--------------------------------------------------------------------+
4643 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4644 | STATE : code ROUTINE : satRefreshAbort |
4645 +--------------------------------------------------------------------+
4646
4647 PURPOSE : MMI aborts the file update notification. It should answer the event MfwSatRefresh
4648 */
4649
4650 void satRefreshAbort()
4651 {
4652 fu_aborted = TRUE;
4653 }
4654
4655 /*
4656 +--------------------------------------------------------------------+
4657 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4658 | STATE : code ROUTINE : satBrowserTerminated |
4659 +--------------------------------------------------------------------+
4660
4661 PURPOSE : downloads the Browser termination event to the SAT.
4662
4663 Cause can be,
4664
4665 SatBrowserTerminCauseUser 0x00
4666 SatBrowserTerminCauseError 0x01
4667
4668 SPR#2121 - DS - Dynamically allocate memory for Terminal Response.
4669
4670 */
4671
4672 #if defined(FF_WAP)
4673
4674 MfwRes satBrowserTerminated(U8 cause)
4675 {
4676 S16 ti = 0;
4677 U8* trmResponse = NULL;
4678
4679 TRACE_FUNCTION("satBrowserTerminated");
4680
4681 /* Allocate memory for Terminal Response buffer */
4682 trmResponse = (U8*)mfwAlloc(TRM_RSP_LEN);
4683
4684 if (trmResponse == NULL)
4685 {
4686 /* Memory allocation failed */
4687 TRACE_ERROR("ERROR: Failed to allocate memory for TR buffer");
4688 return MfwResNoMem;
4689 }
4690
4691 trmResponse[ti++] = 0xD6; /* event download tag */
4692 trmResponse[ti++] = 0; /* length (filled later) */
4693 trmResponse[ti++] = 0x99; /* --event list-- */
4694 trmResponse[ti++] = 0x01; /* length */
4695 trmResponse[ti++] = SatEvtBrowserTermination; /* actual event */
4696 trmResponse[ti++] = 0x82; /* --device identities-- */
4697 trmResponse[ti++] = 0x02; /* length */
4698 trmResponse[ti++] = SatDevME; /* source */
4699 trmResponse[ti++] = 0x81; /* destination: SIM */
4700 trmResponse[ti++] = 0x34; /* Browser Termination Cause tag */
4701 trmResponse[ti++] = 0x01; /* Browser Termination length*/
4702 trmResponse[ti++] = cause; /* termination cause */
4703 trmResponse[1] = ti - 2; /* length of event download */
4704
4705 sAT_PercentSATE(CMD_SRC_LCL,ti,trmResponse);
4706
4707 /* Deallocate memory used for Terminal Response buffer */
4708 if (trmResponse != NULL)
4709 {
4710 mfwFree(trmResponse, TRM_RSP_LEN);
4711 trmResponse = NULL;
4712 }
4713
4714 return MfwResOk;
4715
4716 }
4717
4718 #endif
4719
4720 /*
4721 +--------------------------------------------------------------------+
4722 | PROJECT : MMI-Framework (8417) MODULE : MFW_SAT |
4723 | STATE : code ROUTINE : sate_error |
4724 +--------------------------------------------------------------------+
4725
4726 PURPOSE : Handles errors returned from SAT.
4727
4728 SPR#2321 - DS - Function created.
4729
4730 */
4731 void sate_error(T_ACI_CME_ERR error)
4732 {
4733 TRACE_FUNCTION("sate_error()");
4734
4735 TRACE_EVENT_P1("SATE Error: %d", error);
4736
4737 if (error == CME_ERR_SimSatBusy)
4738 {
4739 /* Close any open connections */
4740 satDisc();
4741
4742 /* Send "temporary failure" terminal response so SIM can restart the busy SAT Application */
4743 satResponse(SatResBusyME);
4744
4745 /* Send event to BMI so user can be informed of error */
4746 satSignal(MfwSatErrBusy, (void*)error);
4747 }
4748 }
4749
4750 // Jun 16, 2005 REF: CRR 31543 x0021334
4751
4752 /*
4753 +--------------------------------------------------------------------+
4754 | PROJECT : MMI-Framework MODULE : MFW_SAT |
4755 | STATE : code ROUTINE : satHangup |
4756 +--------------------------------------------------------------------+
4757
4758 PURPOSE : Handles Hang up key event during USSD session.
4759
4760 */
4761 T_MFW_SS_RETURN satHangup (T_ACI_CMD_SRC sId)
4762 {
4763 T_ACI_RETURN result;
4764
4765 TRACE_FUNCTION("satHangup()");
4766
4767 result = sAT_end_ussd(sId); // end the USSD session
4768 return ((result EQ AT_CMPL) ? MFW_SS_OK : MFW_SS_FAIL);
4769 }