comparison g23m/condat/ms/src/mfw/mfw_sat.c @ 0:509db1a7b7b8

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