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

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_gprs.c $|
4 | $Author: KGT $Revision:: 1 $|
5 | CREATED: 13.02.2001 $Modtime:: 13.02.2001 |
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_GPRS
10
11 PURPOSE : This modul contains functions needed for the GPRS
12 management in MFW.
13
14 $History: Mfw_gprs.c
15
16 Feb 24, 2006 REF:DR OMAPS00068976 x0035544
17 Description: GPRS attach icon - MMI follow up issue of OMAPS00051034
18 solution: Added the function p_gprs_status() to querry the gprs status and to
19 store the status info in the structure variable stat.
20
21 $End
22 */
23
24 /* include necessary header files ----------------------------------*/
25
26 #ifndef NEW_FRAME
27 #error GPRS need NEW_FRAME
28 #endif /* NEW_FRAME */
29
30 #include <string.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33
34 #include "typedefs.h"
35 #include "mfw_mfw.h"
36 #include "vsi.h"
37 #include "custom.h"
38 #include "gsm.h"
39
40 #include "message.h"
41 #include "prim.h"
42 #include "aci_cmh.h" /* include types declared in ACI */
43
44 /* ADDED - 30-11-2005 */
45 #if (defined(FF_2TO1_PS) || (BOARD == 61))
46 #include "aci_all.h"
47 #include "ati_cmd.h"
48 #include "aci_cmd.h"
49 #include "aci.h"
50 #include "dti_conn_mng.h"
51 #include "dti_cntrl_mng.h"
52 #include "gaci.h"
53 #endif
54 /* END */
55 #include "aci_all.h"
56 #include "aci_cmh.h" /* include types declared in ACI */
57 #include "ati_cmd.h"
58 #include "aci_cmd.h"
59 #include "aci.h"
60 #include "dti_conn_mng.h"
61 #include "dti_cntrl_mng.h"
62 #include "gaci.h" /* include types declared in GACI */
63 #include "gaci_cmh.h" /* include types declared in GACI */
64 //#include "cus_aci.h"
65 #include "prim.h"
66 #ifndef PCM_2_FFS
67 #include "pcm.h"
68 #endif
69
70 #include "mfw_win.h"
71 #include "mfw_gprs.h"
72
73 /* Definition for Edge Icon display */
74 #ifdef NEPTUNE_BOARD
75 #define TEMP_STRING_SIZE 50
76 #endif
77
78 /* import of external globals --------------------------------------*/
79 EXTERN MfwHdr *current_mfw_elem;
80
81 /* definition of globals -------------------------------------------*/
82
83 /* definition of constants -----------------------------------------*/
84
85 /* definition of internal functions --------------------------------*/
86
87 static BOOL gprs_sign_exec ( T_MFW_HDR *cur_elem, T_MFW_EVENT event,
88 T_MFW_GPRS_PARA *para );
89
90 /*
91 +--------------------------------------------------------------------+
92 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
93 | STATE : code ROUTINE: gprs_init |
94 +--------------------------------------------------------------------+
95
96
97 PURPOSE : initialize for GPRS magangement
98
99 */
100 void gprs_init ( void )
101 {
102 TRACE_FUNCTION ("gprs_init()");
103
104 /*
105 * set callback for MFW commands
106 */
107 mfwCommand[MfwTypGprs] = (MfwCb) gprsCommand;
108 }
109
110
111 /*
112 +--------------------------------------------------------------------+
113 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
114 | STATE : code ROUTINE: gprs_exit |
115 +--------------------------------------------------------------------+
116
117
118 PURPOSE : finalize for GPRS magangement
119
120 */
121 void gprs_exit ( void )
122 {
123 TRACE_FUNCTION ("gprs_exit()");
124 }
125
126
127 /*
128 +--------------------------------------------------------------------+
129 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
130 | STATE : code ROUTINE: gprs_create |
131 +--------------------------------------------------------------------+
132
133
134 PURPOSE : create event for gprs management
135
136 PARAMETERS :
137
138 RETURNS :
139 */
140 T_MFW_HND gprs_create ( T_MFW_HND h,
141 T_MFW_EVENT event,
142 T_MFW_CB cbfunc )
143 {
144 T_MFW_HDR *hdr;
145 T_MFW_GPRS *gprs_data;
146
147 /*a0393213 compiler warnings removal - variables state ,cls, regState, lac, ci removed*/
148
149
150
151
152
153 MfwHdr *insert_status =0;
154
155 TRACE_FUNCTION ("gprs_create()");
156
157 hdr = (T_MFW_HDR *) mfwAlloc(sizeof (T_MFW_HDR));
158 gprs_data = (T_MFW_GPRS *) mfwAlloc(sizeof (T_MFW_GPRS));
159
160 if ( !hdr OR !gprs_data )
161 {
162 TRACE_ERROR("ERROR: gprs_create() Mem Alloc Failed.");
163
164 if(hdr)
165 mfwFree((U8*)hdr,sizeof(MfwHdr));
166
167 if(gprs_data)
168 mfwFree((U8*)gprs_data,sizeof(T_MFW_GPRS));
169
170 return FALSE;
171 }
172
173 /*
174 * initialisation of the handler
175 */
176 gprs_data->emask = event;
177 gprs_data->handler = cbfunc;
178
179 hdr->data = gprs_data; /* store gprs control block in node */
180 hdr->type = MfwTypGprs; /* store type of event handler */
181
182
183 /*
184 * initialisation of gprs data
185 */
186 gprs_data->data.numContexts = 0;
187
188 gprs_data->data.tclass = (T_CGCLASS_CLASS)NULL;
189 //x0035544 Feb 23, 2006 DR:OMAPS00068976
190 gprs_data->data.Reg_state.regState = (T_CGREG_STAT)NULL;
191 gprs_data->data.attached = (T_CGATT_STATE)NULL;
192
193 gprs_data->data.contexts =
194 (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT) * MAX_CID_PLUS_EINS);
195
196 /*
197 * installation of the handler
198 */
199 insert_status = mfwInsert((T_MFW_HDR *)h, hdr);
200
201 if(!insert_status)
202 {
203 TRACE_ERROR("ERROR: gprs_create() Failed to Install Handler. ");
204 mfwFree((U8*)hdr,sizeof(MfwHdr));
205 mfwFree((U8*)gprs_data,sizeof(T_MFW_GPRS));
206 return 0;
207 }
208 return insert_status;
209 }
210
211
212 /*
213 +--------------------------------------------------------------------+
214 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
215 | STATE : code ROUTINE: gprs_delete |
216 +--------------------------------------------------------------------+
217
218
219 PURPOSE : delete event for gprs management
220
221 PARAMETERS :
222
223 RETURNS :
224 MFW_RES_OK, on success
225 MFW_RES_ILL_HND, on failure
226 */
227 T_MFW_RES gprs_delete ( T_MFW_HND h )
228 {
229 T_MFW_GPRS *gprs_data;
230
231 TRACE_FUNCTION ("gprs_delete()");
232
233 if ( !h OR !((T_MFW_HDR *)h)->data )
234 return MFW_RES_ILL_HND;
235
236 /*
237 * deinstallation of the handler
238 */
239
240 //if ( !mfwRemove((T_MFW_HDR *)h) )
241 if ( !mfwRemove(h) )
242 return MFW_RES_ILL_HND;
243
244 gprs_data = ((T_MFW_HDR *) h)->data;
245
246 while ( gprs_data->data.numContexts )
247 {
248 mfwFree((U8 *)&(gprs_data->data.contexts[gprs_data->data.numContexts]),
249 sizeof(T_MFW_GPRS_CONTEXT));
250 gprs_data->data.numContexts--;
251 }
252 mfwFree((U8 *)&(gprs_data->data), sizeof(T_MFW_GPRS_DATA));
253 mfwFree((U8 *)(((T_MFW_HDR *) h)->data),sizeof(T_MFW_GPRS));
254 mfwFree((U8 *)h,sizeof(T_MFW_HDR));
255
256 return MFW_RES_OK;
257 }
258
259
260 /*
261 +--------------------------------------------------------------------+
262 | PROJECT : MMI-Framework (8417) MODULE : MFW_GPRS |
263 | STATE : code ROUTINE : gprsCommand |
264 +--------------------------------------------------------------------+
265
266 PURPOSE : handle mfw windows command
267
268 PARAMETERS :
269
270 Returns : 0, on failure
271 1, on success
272 */
273
274 int gprsCommand (U32 cmd, void *h)
275 {
276 switch ( cmd )
277 {
278 case MfwCmdDelete: /* delete me */
279 if ( !h )
280 return 0;
281 gprs_delete(h);
282 return 1;
283 default:
284 break;
285 }
286
287 return 0;
288 }
289
290
291 /*
292 +--------------------------------------------------------------------+
293 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
294 | STATE : code ROUTINE: gprs_signal |
295 +--------------------------------------------------------------------+
296
297 PURPOSE : send a event signal.
298
299 PARAMETERS :
300 event : current event
301 *para : pointer to the event parameters
302
303 */
304 void gprs_signal( T_MFW_EVENT event,
305 void *para)
306 {/*MC, SPR 1389, we have to enable the display whenever
307 we send an event up to the MMI*/
308 UBYTE temp = dspl_Enable(0);
309
310 TRACE_FUNCTION ("gprs_signal()");
311
312 if ( mfwSignallingMethod EQ 0 )
313 {
314 /*
315 * focus is on a window
316 */
317 if ( mfwFocus )
318 {
319 /*
320 * send event to sim management handler if available
321 */
322 if (gprs_sign_exec (mfwFocus, event, para))
323 { dspl_Enable(temp);/*MC, SPR 1389*/
324 return;
325 }
326 }
327
328 /*
329 * acutal focussed window is not available or has no
330 * network management registration handler, then search
331 * all nodes from the root.
332 */
333 if ( mfwRoot )
334 gprs_sign_exec (mfwRoot, event, para);
335 }
336 else
337 {
338 MfwHdr *h = 0;
339
340 /*
341 * Focus set, then start here
342 */
343 if ( mfwFocus )
344 h = mfwFocus;
345
346 /*
347 * Focus not set, then start at root
348 */
349 if ( !h )
350 h = mfwRoot;
351
352 /*
353 * while elements found
354 */
355 while ( h )
356 {
357 /*
358 * Signal consumed, then return
359 */
360 if ( gprs_sign_exec (h, event, para) )
361 { dspl_Enable(temp);/*MC, SPR 1389*/
362 return;
363 }
364
365 /*
366 * All windows tried inclusive root
367 */
368 if ( h == mfwRoot )
369 { dspl_Enable(temp);/*MC, SPR 1389*/
370 return;
371 }
372
373 /*
374 * get parent window
375 */
376 h = mfwParent(mfwParent(h));
377
378 /*
379 * look for next element
380 */
381 if ( h )
382 h = ((MfwWin * )(h->data))->elems;
383 }
384 gprs_sign_exec (mfwRoot, event, para);
385 }
386 dspl_Enable(temp);/*MC, SPR 1389*/
387
388 }
389
390
391 /*
392 +--------------------------------------------------------------------+
393 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
394 | STATE : code ROUTINE: gprs_sign_exec |
395 +--------------------------------------------------------------------+
396
397
398 PURPOSE : Handle a signal if GPRS management handler.
399
400 PARAMETERS :
401
402 RETURNS :
403 TRUE, if signal is processed
404 FALSE, if signal is not processed
405 */
406 BOOL gprs_sign_exec ( T_MFW_HDR *cur_elem,
407 T_MFW_EVENT event,
408 T_MFW_GPRS_PARA *para )
409 {
410 int i,j;
411 T_CGATT_STATE state;
412 #if(BOARD != 61)
413 T_PDP_CONTEXT tst_ctrc[PDP_CONTEXT_CID_MAX];
414 /* T_GPRS_CONT_REC tst_ctrc[MAX_CID_PLUS_EINS]; */
415 #endif
416 SHORT tst_cid;
417 USHORT lac;
418 USHORT ci;
419
420 TRACE_FUNCTION ("gprs_sign_exec()");
421
422 /*
423 * while event handler is available
424 */
425 while ( cur_elem )
426 {
427 /*
428 * if handler is GPRS management handler
429 */
430 if ( cur_elem->type EQ MfwTypGprs )
431 {
432 T_MFW_GPRS *gprs_data;
433 gprs_data = (T_MFW_GPRS *)cur_elem->data;
434
435 /*
436 * if event is expected by the call back function
437 */
438 if ( gprs_data->emask & event )
439 {
440 gprs_data->event = event;
441
442 switch ( event )
443 {
444 case E_MFW_GPRS_S_CNTXT:
445 /*
446 * Check if contexts is defined in ACI ( if too many context
447 * are defined, the new one will not be defined
448 */
449 #ifndef FF_2TO1_PS
450 qAT_PlusCGDCONT(CMD_SRC_LCL, tst_ctrc, &tst_cid);
451 #endif
452
453 if ( tst_cid >= gprs_data->data.numContexts + 1)
454 {
455
456 /*
457 * insert the new context
458 */
459 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts]), para,
460 sizeof (T_MFW_GPRS_CONTEXT));
461 gprs_data->data.numContexts++;
462 }
463 break;
464
465 case E_MFW_GPRS_S_ATT:
466 case E_MFW_GPRS_R_EREP_ATT:
467 /* SPR#1983 - SH -'attached' is now of correct type.
468 * Don't check if unchanged, as this rejects some cases
469 * where signal needs to be sent to BMI
470 */
471
472 gprs_data->data.attached = para->attached;
473
474 /*
475 * set all contexts to deactivated after detach
476 */
477 if ( gprs_data->data.attached == CGATT_STATE_DETACHED )
478 {
479 for ( i=0; i > gprs_data->data.numContexts; i++)
480 {
481 gprs_data->data.contexts[i].activated = CGACT_STATE_DEACTIVATED;
482 }
483 }
484 else
485 {
486 if (qAT_PlusCGCLASS(CMD_SRC_LCL, &gprs_data->data.tclass) == AT_FAIL )
487 {
488 TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGCLASS failed");
489 }
490 //x0035544 Feb 23, 2006 DR:OMAPS00068976
491 if (qAT_PercentCGREG(CMD_SRC_LCL, &gprs_data->data.Reg_state.p_reg_State, &lac, &ci) == AT_FAIL )
492 {
493 TRACE_EVENT("MFW_GPRS: Error. qAT_PercentCGREG failed");
494 }
495 }
496 break;
497
498 case E_MFW_GPRS_S_ACT:
499 /*
500 * search in the known context for the context ids given
501 * in the parameter
502 */
503 for ( i=0; i > gprs_data->data.numContexts; i++)
504 {
505 j=0;
506
507 do
508 {
509 /*
510 * set the new activation state for the found context id
511 */
512 if ( para->contextAct.ids[j] == gprs_data->data.contexts[i].id)
513 {
514 gprs_data->data.contexts[i].activated = para->contextAct.state;
515 }
516 }
517 while ( j < MAX_CID &&
518 (para->contextAct.ids[j] != gprs_data->data.contexts[i].id) );
519 }
520 break;
521
522 case E_MFW_GPRS_S_DATA:
523 /*
524 * if attached mode was detached, set mode to attached
525 */
526 if ( gprs_data->data.attached == CGATT_STATE_DETACHED )
527 {
528 gprs_data->data.attached = CGATT_STATE_ATTACHED;
529 }
530
531 /*
532 * search in the known context for the context ids given
533 * in the parameter
534 */
535 for ( i=0; i < gprs_data->data.numContexts; i++)
536 {
537 j=0;
538
539 do
540 {
541 /*
542 * if context id of parameter is known, set the activation state
543 * to activated when it was detached and copy L2P value
544 */
545 if ( para->contextL2P.ids[j] == gprs_data->data.contexts[i].id)
546 {
547 if ( gprs_data->data.contexts[j].activated == CGACT_STATE_DEACTIVATED )
548 {
549 gprs_data->data.contexts[j].activated = CGACT_STATE_ACTIVATED;
550 }
551
552 if (!(gprs_data->data.contexts[i].L2P) )
553 gprs_data->data.contexts[i].L2P =
554 (char *) mfwAlloc(sizeof(char) * strlen(para->contextL2P.L2P));
555
556 memcpy (gprs_data->data.contexts[i].L2P, para->contextL2P.L2P,
557 strlen( para->contextL2P.L2P ) * sizeof(char));
558 }
559 j++;
560 }
561 while ( j < MAX_CID &&
562 ( para->contextL2P.ids[j]!= gprs_data->data.contexts[i].id) );
563 }
564 break;
565
566 case E_MFW_GPRS_R_ACT:
567 case E_MFW_GPRS_R_DATA:
568 case E_MFW_GPRS_R_ANS:
569 gprs_data->data.link_id = para->link_id;
570 break;
571
572 case E_MFW_GPRS_S_QOS:
573 case E_MFW_GPRS_R_QOS:
574 for ( i=0; (i > gprs_data->data.numContexts) &&
575 (gprs_data->data.contexts[i].id == para->context.id); i++);
576
577 if (gprs_data->data.contexts[i].id == para->context.id)
578 memcpy (&(gprs_data->data.contexts[i].data.qos),
579 #ifdef FF_2TO1_PS
580 &(para->context.data.qos), sizeof(T_PS_qos));
581 #else
582 &(para->context.data.qos), sizeof(T_PS_qos));
583 #endif
584 else
585 TRACE_ERROR("context id not defined");
586 break;
587
588 case E_MFW_GPRS_S_QOS_MIN:
589 for ( i=0; (i > gprs_data->data.numContexts) &&
590 (gprs_data->data.contexts[i].id == para->context.id); i++);
591
592 if (gprs_data->data.contexts[i].id == para->context.id)
593 memcpy (&(gprs_data->data.contexts[i].data.min_qos),
594 #ifdef FF_2TO1_PS
595 &(para->context.data.min_qos), sizeof(T_PS_qos));
596 #else
597 &(para->context.data.min_qos), sizeof(T_PS_qos));
598 #endif
599 else
600 TRACE_ERROR("context id not defined");
601 break;
602
603 case E_MFW_GPRS_S_CLASS:
604 case E_MFW_GPRS_R_EREP_CLASS:
605 memcpy (&(gprs_data->data.tclass), &(para->tclass), sizeof (T_CGCLASS_CLASS));
606 break;
607
608 case E_MFW_GPRS_R_EREP_ACT:
609 /*
610 * search for context
611 */
612 /* SPR#2243 - SH - Changed 'para->context' to 'para->erepAct' */
613 for ( i=0; (i > gprs_data->data.numContexts) &&
614 (gprs_data->data.contexts[i].id == para->erepAct.cid); i++);
615
616 /*
617 * if context found, copy PDP address data to MFW data
618 */
619 /* SPR#2243 - SH - Changed 'para->context' to 'para->erepAct' */
620 if (gprs_data->data.contexts[i].id == para->erepAct.cid)
621 {
622 #ifdef FF_2TO1_PS
623 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_addr),
624 &para->erepAct.pdp_addr, sizeof(T_NAS_ip));
625 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_type),
626 &para->erepAct.pdp_type, sizeof(T_NAS_ip));
627 #else
628 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_addr),
629 &para->erepAct.pdp_addr, sizeof(T_NAS_ip));
630 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_type),
631 &para->erepAct.pdp_type, sizeof(T_PDP_TYPE));
632 #endif
633 gprs_data->data.contexts[i].activated = CGACT_STATE_ACTIVATED;
634 }
635 else
636 {
637 if (gprs_data->data.numContexts < MAX_CID )
638 {
639 #ifdef FF_2TO1_PS
640 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_addr),
641 &para->erepAct.pdp_addr, sizeof (T_NAS_ip));
642 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_type),
643 para->erepAct.pdp_type, sizeof (T_PDP_TYPE));
644 gprs_data->data.contexts[gprs_data->data.numContexts].id = (U8)para->erepAct.cid;
645 #else
646 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_addr), &para->erepAct.pdp_addr,
647 sizeof (T_NAS_ip));
648 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_type),para->erepAct.pdp_type,
649 sizeof (T_PDP_TYPE));
650 gprs_data->data.contexts[gprs_data->data.numContexts].id = para->erepAct.cid;
651 #endif
652 gprs_data->data.contexts[gprs_data->data.numContexts].activated = CGACT_STATE_ACTIVATED;
653 gprs_data->data.numContexts++;
654 }
655 else
656 TRACE_ERROR("MFW_GPRS: ERROR: Too many contexts!");
657 }
658 break;
659
660 /* SPR#2243 - SH - This is now a separate case from the above.
661 * Uses para->context throughout. */
662 case E_MFW_GPRS_S_PDPADDR:
663 /*
664 * search for context
665 */
666 for ( i=0; (i > gprs_data->data.numContexts) &&
667 (gprs_data->data.contexts[i].id == para->context.id); i++);
668
669 /*
670 * if context found, copy PDP address data to MFW data
671 */
672 if (gprs_data->data.contexts[i].id == para->context.id)
673 {
674 #ifdef FF_2TO1_PS
675 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_addr),
676 &para->context.data.attributes.pdp_addr, sizeof(T_NAS_ip));
677 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_type),
678 &para->context.data.attributes.pdp_type, sizeof(T_PDP_TYPE));
679 #else
680 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_addr),
681 &para->context.data.attributes.pdp_addr, sizeof(T_NAS_ip));
682 memcpy (&(gprs_data->data.contexts[i].data.attributes.pdp_type),
683 &para->context.data.attributes.pdp_type, sizeof(T_PDP_TYPE));
684 #endif
685 gprs_data->data.contexts[i].activated = para->context.activated;
686 }
687 else
688 {
689 if (gprs_data->data.numContexts < MAX_CID )
690 {
691 #ifdef FF_2TO1_PS
692 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_addr),
693 &para->context.data.attributes.pdp_addr, sizeof (T_NAS_ip));
694 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_type),
695 &para->context.data.attributes.pdp_type, sizeof (T_PDP_TYPE));
696 gprs_data->data.contexts[gprs_data->data.numContexts].id = para->context.data.cid;
697 #else
698 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_addr),
699 &para->context.data.attributes.pdp_addr, sizeof (T_NAS_ip));
700 memcpy (&(gprs_data->data.contexts[gprs_data->data.numContexts].data.attributes.pdp_type),
701 &para->context.data.attributes.pdp_type, sizeof (T_PDP_TYPE));
702 gprs_data->data.contexts[gprs_data->data.numContexts].id = para->context.id;
703 #endif
704 gprs_data->data.contexts[gprs_data->data.numContexts].activated = para->context.activated;
705 gprs_data->data.numContexts++;
706 }
707 else
708 TRACE_ERROR("MFW_GPRS: ERROR: Too many contexts!");
709 }
710 break;
711
712 case E_MFW_GPRS_R_EREP_DEACT:
713 /*
714 * search for context
715 */
716 for ( i=0; (i < gprs_data->data.numContexts) &&
717 (gprs_data->data.contexts[i].id != para->erepAct.cid); i++);
718
719 /*
720 * if context found, set mode to deactivated
721 */
722 if (gprs_data->data.contexts[i].id == para->erepAct.cid)
723 {
724 gprs_data->data.contexts[i].activated = CGACT_STATE_DEACTIVATED;
725 }
726 else
727 {
728 for ( i=0; (i < gprs_data->data.numContexts) &&
729 #ifdef FF_2TO1_PS
730 ( strcmp(gprs_data->data.contexts[i].data.attributes.pdp_type, para->erepAct.pdp_type) ||
731 strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_addr.ip_address.ipv4_addr.a4,
732 (const char *)&para->erepAct.pdp_addr.ip_address.ipv4_addr.a4) ); i++);
733
734 #else
735 ( strcmp(gprs_data->data.contexts[i].data.attributes.pdp_type, para->erepAct.pdp_type) ||
736 strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_addr.ip_address.ipv4_addr.a4
737 , (const char *)&para->erepAct.pdp_addr.ip_address.ipv4_addr.a4 )); i++);
738 #endif
739
740 /*
741 * if context found, set mode to deactivated
742 */
743 #ifdef FF_2TO1_PS
744 if (!strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_type, (const char *)&para->erepAct.pdp_type) &&
745 !strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_addr.ip_address.ipv4_addr.a4, (const char *)&para->erepAct.pdp_addr.ip_address.ipv4_addr.a4) )
746 #else
747 if (!strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_type, (const char *)&para->erepAct.pdp_type) &&
748 !strcmp((const char *)&gprs_data->data.contexts[i].data.attributes.pdp_addr.ip_address.ipv4_addr.a4, (const char *)&para->erepAct.pdp_addr.ip_address.ipv4_addr.a4) )
749 #endif
750 {
751 gprs_data->data.contexts[i].activated = CGACT_STATE_DEACTIVATED;
752 }
753 }
754
755 break;
756
757 case E_MFW_GPRS_S_AUTORESP:
758 gprs_data->data.autoResponse = para->mode;
759 break;
760
761 case E_MFW_GPRS_S_ANS:
762 break;
763
764 case E_MFW_GPRS_S_EREP:
765 /*
766 * copy new event reporting settings to MFW data
767 */
768 gprs_data->data.eventRep.mode = para->eventRep.mode;
769 gprs_data->data.eventRep.bfr = para->eventRep.bfr;
770 break;
771
772 case E_MFW_GPRS_R_EREP_RJ:
773 break;
774
775 case E_MFW_GPRS_R_REG:
776 /*
777 * copy new registration status to MFW data
778 */
779 /* SH - now with cell reselection data */
780 //x0035544 Feb 23, 2006 DR:OMAPS00068976
781 gprs_data->data.Reg_state.regState = para->cell.stat;
782 gprs_data->data.lac = para->cell.lac;
783 gprs_data->data.ci = para->cell.ci;
784
785 /*
786 * check if attachement state has changed
787 */
788 if (qAT_PlusCGATT(CMD_SRC_LCL, &state) != AT_FAIL )
789 gprs_data->data.attached = state;
790 else
791 TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGATT failed");
792 break;
793
794 case E_MFW_GPRS_S_SMSSERV:
795 /*
796 * copy new SMS service mode to MFW data
797 */
798 gprs_data->data.SMSService = para->service;
799 break;
800
801 case E_MFW_GPRS_COUNTER:
802 /* SPR#1574 - SH - Small change to ensure counter value copied correctly */
803 memcpy(&gprs_data->data.counter, &para->counter, sizeof(T_MFW_GPRS_COUNTER));
804 break;
805
806 case E_MFW_GPRS_OK:
807 case E_MFW_GPRS_ERROR:
808 case E_MFW_GPRS_CONNECT:
809 case E_MFW_GPRS_ERR_CONNECT:
810 break;
811
812
813 default:
814 /*
815 * an event has been used, which is not handled.
816 * perhaps an error?
817 */
818 TRACE_EVENT("mfw_gprs.gprs_sign_exec: unused event");
819 break;
820 }
821
822 /*
823 * if callback defined, call it
824 */
825 if ( gprs_data->handler )
826 {
827 current_mfw_elem = cur_elem;
828
829 if ( (*(gprs_data->handler))( gprs_data->event,
830 (void*)&gprs_data->data ) )
831 return TRUE;
832 }
833 }
834 }
835
836 /*
837 * look for next element
838 */
839 cur_elem = cur_elem->next;
840 }
841 return FALSE;
842 }
843
844
845 /*
846 +--------------------------------------------------------------------+
847 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
848 | STATE : code ROUTINE: gprs_ok |
849 +--------------------------------------------------------------------+
850
851 PURPOSE : success indication from ACI
852 (This function is called by rAT_OK)
853
854 PARAMETERS : AT command ID
855 */
856 void gprs_ok(T_ACI_AT_CMD cmdId)
857 {
858 TRACE_FUNCTION("mfw_gprs.gprs_ok");
859
860 gprs_signal(E_MFW_GPRS_OK, &cmdId);
861
862 return;
863 }
864
865
866 /*
867 +--------------------------------------------------------------------+
868 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
869 | STATE : code ROUTINE: gprs_error |
870 +--------------------------------------------------------------------+
871
872 PURPOSE : failure indication from ACI
873 (This function is called by rAT_PlusCME)
874
875 PARAMETERS : AT command ID
876 */
877 void gprs_error(T_ACI_AT_CMD cmdId, T_ACI_CME_ERR err)
878 {
879 TRACE_FUNCTION("mfw_gprs.gprs_error");
880
881 gprs_signal(E_MFW_GPRS_ERROR, &cmdId);
882
883 return;
884 }
885
886
887 /*
888 +--------------------------------------------------------------------+
889 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
890 | STATE : code ROUTINE: gprs_connect |
891 +--------------------------------------------------------------------+
892
893 PURPOSE : success indication from ACI for connection
894 (This function is called by rAT_CONNECT)
895 */
896 void gprs_connect(SHORT cId)
897 {
898 TRACE_FUNCTION("mfw_gprs.gprs_connect");
899
900 gprs_signal(E_MFW_GPRS_CONNECT, &cId);
901 return;
902 }
903
904
905 /*
906 +--------------------------------------------------------------------+
907 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
908 | STATE : code ROUTINE: gprs_err_connect |
909 +--------------------------------------------------------------------+
910
911 PURPOSE : error indication from ACI for connection
912 (This function is called by rAT_BUSY, rAT_NO_CARRIER,
913 rAT_NO_ANSWERE)
914
915 */
916 void gprs_err_connect(SHORT cId)
917 {
918 TRACE_FUNCTION("mfw_gprs.gprs_err_connect");
919
920 gprs_signal(E_MFW_GPRS_ERR_CONNECT, &cId);
921
922 return;
923 }
924
925
926
927 /*--------------------------------------------------------------------
928 MMI-MFW Interface Functions
929 --------------------------------------------------------------------*/
930
931 /*
932 +---------------------------------------------------------------------+
933 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
934 | STATE : code ROUTINE: gprs_definePDPContext|
935 +---------------------------------------------------------------------+
936
937
938 PURPOSE : Define PDP context. If the contexts for cid does not
939 exist in the contexts list, the new context will be
940 inserted in the contexts list.
941
942 PARAMETERS :
943 cid : context ID
944 *context: context data
945 */
946 #ifdef FF_2TO1_PS
947 T_MFW_RES gprs_definePDPContext(SHORT cid, T_PDP_CONTEXT *inputCtxt)
948 {
949 T_MFW_GPRS_CONTEXT *context;
950
951 TRACE_FUNCTION ("gprs_definePDPContext()");
952
953 /*
954 * ACI call
955 */
956 if (sAT_PlusCGDCONT(CMD_SRC_LCL, (U8)cid, inputCtxt) == AT_FAIL)
957 {
958 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGDCONT failed");
959 return MFW_RES_ERR;
960 }
961
962 /*
963 * insert context into MFW GPRS data
964 */
965 context = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
966
967 context->id = (U8)cid;
968 memcpy (&(context->data.attributes), inputCtxt, sizeof (T_GPRS_CONT_REC));
969 context->activated = CGACT_STATE_DEACTIVATED; /* not yet activated */
970
971 gprs_signal(E_MFW_GPRS_S_CNTXT, context);
972
973 mfwFree((void *) context, sizeof(T_MFW_GPRS_CONTEXT));
974
975 return MFW_RES_OK;
976 }
977 #else
978 T_MFW_RES gprs_definePDPContext(SHORT cid, T_PDP_CONTEXT *inputCtxt)
979 {
980 T_MFW_GPRS_CONTEXT *context;
981
982 TRACE_FUNCTION ("gprs_definePDPContext()");
983
984 /*
985 * ACI call
986 */
987 if (sAT_PlusCGDCONT(CMD_SRC_LCL, cid, inputCtxt) == AT_FAIL)
988 {
989 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGDCONT failed");
990 return MFW_RES_ERR;
991 }
992
993 /*
994 * insert context into MFW GPRS data
995 */
996 context = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
997
998 context->id = cid;
999 memcpy (&(context->data), inputCtxt, sizeof (T_GPRS_CONT_REC));
1000 context->activated = CGACT_STATE_DEACTIVATED; /* not yet activated */
1001
1002 gprs_signal(E_MFW_GPRS_S_CNTXT, context);
1003
1004 mfwFree((void *) context, sizeof(T_MFW_GPRS_CONTEXT));
1005
1006 return MFW_RES_OK;
1007 }
1008 #endif
1009
1010
1011
1012 /*
1013 +---------------------------------------------------------------------+
1014 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1015 | STATE : code ROUTINE: gprs_setQOS |
1016 +---------------------------------------------------------------------+
1017
1018
1019 PURPOSE : Set the Quality of Service Profile for the context
1020 specified by cid. The Quality of Service Profile is given
1021 in the pointer parameter qos.
1022
1023 PARAMETERS :
1024 cid : context ID
1025 *inputQos : quality of service data
1026 */
1027 #ifdef FF_2TO1_PS
1028 T_MFW_RES gprs_setQOS(SHORT cid ,T_PS_qos *inputQos)
1029 {
1030 T_MFW_GPRS_CONTEXT *cntxt;
1031
1032 TRACE_FUNCTION ("gprs_setQOS()");
1033
1034 /*
1035 * ACI call
1036 */
1037 if(sAT_PlusCGQREQ(CMD_SRC_LCL, (U8)cid, inputQos) == AT_FAIL)
1038 {
1039 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQREQ failed");
1040 return MFW_RES_ERR;
1041 }
1042
1043 /*
1044 * change qos data in MFW GPRS data
1045 */
1046 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1047
1048 cntxt->id = (U8)cid;
1049 memcpy (&(cntxt->data.qos), inputQos, sizeof (T_PS_qos));
1050
1051 gprs_signal(E_MFW_GPRS_S_QOS, cntxt);
1052
1053 return MFW_RES_OK;
1054 }
1055 #else
1056 T_MFW_RES gprs_setQOS(SHORT cid ,T_PS_qos *inputQos)
1057 {
1058 T_MFW_GPRS_CONTEXT *cntxt;
1059
1060 TRACE_FUNCTION ("gprs_setQOS()");
1061
1062 /*
1063 * ACI call
1064 */
1065 if(sAT_PlusCGQREQ(CMD_SRC_LCL, cid, inputQos) == AT_FAIL)
1066 {
1067 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQREQ failed");
1068 return MFW_RES_ERR;
1069 }
1070
1071 /*
1072 * change qos data in MFW GPRS data
1073 */
1074 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1075
1076 cntxt->id = cid;
1077 memcpy (&(cntxt->data.qos), inputQos, sizeof (T_PS_qos));
1078
1079 gprs_signal(E_MFW_GPRS_S_QOS, cntxt);
1080
1081 return MFW_RES_OK;
1082 }
1083 #endif
1084
1085
1086 /*
1087 +---------------------------------------------------------------------+
1088 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1089 | STATE : code ROUTINE: gprs_setQOSMin |
1090 +---------------------------------------------------------------------+
1091
1092
1093 PURPOSE : Set the minimum acceptable Quality of Service Profile for
1094 the context specified by cid.
1095
1096 PARAMETERS :
1097 cid : context ID
1098 *inputQos : quality of service data
1099 */
1100 #ifdef FF_2TO1_PS
1101 T_MFW_RES gprs_setQOSMin(SHORT cid ,T_PS_qos *inputQos)
1102 {
1103 T_MFW_GPRS_CONTEXT *cntxt;
1104
1105 TRACE_FUNCTION ("gprs_setQOSMin()");
1106
1107 /*
1108 * ACI call
1109 */
1110 if (sAT_PlusCGQMIN(CMD_SRC_LCL, (U8)cid, (T_PS_min_qos*)inputQos) == AT_FAIL)
1111 {
1112 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQMIN failed");
1113 return MFW_RES_ERR;
1114 }
1115
1116 /*
1117 * change mininum acceptable qos data in MFW GPRS data
1118 */
1119 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1120
1121 cntxt->id = (U8)cid;
1122 memcpy (&(cntxt->data.min_qos), inputQos, sizeof (T_PS_qos));
1123
1124 gprs_signal(E_MFW_GPRS_S_QOS_MIN, cntxt);
1125
1126 return MFW_RES_OK;
1127 }
1128 #else
1129 T_MFW_RES gprs_setQOSMin(SHORT cid ,T_PS_qos *inputQos)
1130 {
1131 T_MFW_GPRS_CONTEXT *cntxt;
1132
1133 TRACE_FUNCTION ("gprs_setQOSMin()");
1134
1135 /*
1136 * ACI call
1137 */
1138 if (sAT_PlusCGQMIN(CMD_SRC_LCL, (U8)cid, (T_PS_min_qos*)inputQos) == AT_FAIL)
1139 {
1140 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQMIN failed");
1141 return MFW_RES_ERR;
1142 }
1143
1144 /*
1145 * change mininum acceptable qos data in MFW GPRS data
1146 */
1147 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1148
1149 cntxt->id = cid;
1150 memcpy (&(cntxt->data.min_qos), inputQos, sizeof (T_PS_qos));
1151
1152 gprs_signal(E_MFW_GPRS_S_QOS_MIN, cntxt);
1153
1154 return MFW_RES_OK;
1155 }
1156 #endif
1157
1158
1159 /*
1160 +---------------------------------------------------------------------+
1161 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1162 | STATE : code ROUTINE: gprs_attach |
1163 +---------------------------------------------------------------------+
1164
1165
1166 PURPOSE : Attach to or detach from the GPRS Service. The parameter
1167 state indicates the state of GPRS attchement
1168
1169 PARAMETERS :
1170 state : attachement state ( 0 - detached, 1 - attached)
1171
1172 */
1173 T_MFW_RES gprs_attach(T_CGATT_STATE state)
1174 {
1175 T_ACI_RETURN result;
1176
1177 TRACE_FUNCTION ("gprs_attach()");
1178
1179 /*
1180 * ACI call
1181 * SPR#1574 - SH - Don't return fail for AT_CMPL result
1182 */
1183 result = sAT_PlusCGATT(CMD_SRC_LCL, state);
1184 if ( result!= AT_EXCT && result!=AT_CMPL)
1185 {
1186 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGATT failed");
1187 return MFW_RES_ERR;
1188 }
1189
1190 /*
1191 * change attachement state in MFW GPRS data
1192 */
1193 gprs_signal(E_MFW_GPRS_S_ATT, &state);
1194
1195
1196 return MFW_RES_OK;
1197 }
1198
1199
1200 /*
1201 +---------------------------------------------------------------------+
1202 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1203 | STATE : code ROUTINE: gprs_attach_abort |
1204 +---------------------------------------------------------------------+
1205
1206
1207 PURPOSE : Cancel attachment to or detachment from GPRS service
1208 SPR#1983 - SH - Added.
1209
1210 PARAMETERS : None.
1211
1212 */
1213 T_MFW_RES gprs_attach_abort(void)
1214 {
1215 T_ACI_RETURN result;
1216
1217 TRACE_EVENT("gprs_attach_abort()");
1218
1219 result = sAT_Abort(CMD_SRC_LCL, AT_CMD_CGATT);
1220
1221 if (result==AT_FAIL)
1222 return MFW_RES_ERR;
1223
1224 return MFW_RES_OK;
1225 }
1226
1227
1228 /*
1229 +----------------------------------------------------------------------+
1230 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1231 | STATE : code ROUTINE: gprs_contextActivation|
1232 +----------------------------------------------------------------------+
1233
1234
1235 PURPOSE : Activate or Deactivate PDP contexts. The parameter state
1236 indicates the state of GPRS activation.
1237 The parameter cids points to a list of contexts definitions.
1238 If the list is empty all contexts will be attached or
1239 detached. If the mobile is not attached before, a GPRS
1240 attach is first performed.
1241
1242 PARAMETERS :
1243 state : activation state ( 0 - deactivated, 1 - activated)
1244 cids : list of contexts
1245 */
1246 T_MFW_RES gprs_contextActivation(T_CGACT_STATE state, SHORT *cids)
1247 {
1248 T_MFW_GPRS_CNTXT_ACT *cntxtAct;
1249
1250 TRACE_FUNCTION ("gprs_contextActivation()");
1251
1252 /*
1253 * ACI call
1254 */
1255 #ifdef FF_2TO1_PS
1256 if (sAT_PlusCGACT(CMD_SRC_LCL, state, (U8 *)cids) == AT_FAIL)
1257 #else
1258 if (sAT_PlusCGACT(CMD_SRC_LCL, state, cids) == AT_FAIL)
1259 #endif
1260 {
1261 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGCACT failed");
1262 return MFW_RES_ERR;
1263 }
1264
1265
1266 /*
1267 * change context activation data in MFW GPRS data
1268 */
1269 cntxtAct = (T_MFW_GPRS_CNTXT_ACT *) mfwAlloc(sizeof(T_MFW_GPRS_CNTXT_ACT));
1270
1271 memcpy (&(cntxtAct->ids), cids, sizeof (SHORT));
1272 cntxtAct->state = state;
1273
1274 gprs_signal(E_MFW_GPRS_S_ACT, cntxtAct);
1275
1276 return MFW_RES_OK;
1277 }
1278
1279
1280 /*
1281 +---------------------------------------------------------------------+
1282 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1283 | STATE : code ROUTINE: gprs_setData |
1284 +---------------------------------------------------------------------+
1285
1286
1287 PURPOSE : Enter data state. Whatever actions are necessary to
1288 establish communication between the TE and the network
1289 will be performed (e.g. attach, context activate)
1290 PARAMETERS :
1291 L2P : Layer 2 protocoll
1292 cids : list of contexts
1293
1294 */
1295 #ifdef FF_2TO1_PS
1296 T_MFW_RES gprs_setData(char *L2P, SHORT *cids)
1297 {
1298 T_MFW_GPRS_CNTXT_L2P *cntxtL2P;
1299
1300 TRACE_FUNCTION ("gprs_setData()");
1301
1302 /*
1303 * ACI call
1304 */
1305 if (sAT_PlusCGDATA(CMD_SRC_LCL, L2P, (U8 *)cids) == AT_FAIL)
1306 {
1307 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGDATA failed");
1308 return MFW_RES_ERR;
1309 }
1310
1311
1312 /*
1313 * change attachement, activation and L2P data in MFW GPRS data
1314 */
1315 cntxtL2P = (T_MFW_GPRS_CNTXT_L2P *) mfwAlloc(sizeof(T_MFW_GPRS_CNTXT_L2P));
1316 cntxtL2P->L2P = (char *) mfwAlloc((U16)(sizeof(char) * strlen(L2P)));
1317 cntxtL2P->ids = (USHORT *) mfwAlloc(sizeof(SHORT) * MAX_CID);
1318
1319 memcpy (cntxtL2P->L2P, L2P, sizeof (CHAR) * strlen(L2P));
1320 memcpy (cntxtL2P->ids, cids, sizeof (SHORT));
1321
1322 gprs_signal(E_MFW_GPRS_S_DATA, cntxtL2P);
1323
1324 mfwFree( (U8 *) cntxtL2P->L2P, (U16)(sizeof(char) * strlen(L2P)));
1325 mfwFree( (U8 *) cntxtL2P->ids, (U16)(sizeof(SHORT) * MAX_CID));
1326
1327 return MFW_RES_OK;
1328 }
1329 #else
1330 T_MFW_RES gprs_setData(char *L2P, SHORT *cids)
1331 {
1332 T_MFW_GPRS_CNTXT_L2P *cntxtL2P;
1333
1334 TRACE_FUNCTION ("gprs_setData()");
1335
1336 /*
1337 * ACI call
1338 */
1339 if (sAT_PlusCGDATA(CMD_SRC_LCL, L2P, (U8 *)cids) == AT_FAIL)
1340 {
1341 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGDATA failed");
1342 return MFW_RES_ERR;
1343 }
1344
1345
1346 /*
1347 * change attachement, activation and L2P data in MFW GPRS data
1348 */
1349 cntxtL2P = (T_MFW_GPRS_CNTXT_L2P *) mfwAlloc(sizeof(T_MFW_GPRS_CNTXT_L2P));
1350 cntxtL2P->L2P = (char *) mfwAlloc(sizeof(char) * strlen(L2P));
1351 cntxtL2P->ids = (USHORT *) mfwAlloc(sizeof(SHORT) * MAX_CID);
1352
1353 memcpy (cntxtL2P->L2P, L2P, sizeof (CHAR) * strlen(L2P));
1354 memcpy (cntxtL2P->ids, cids, sizeof (SHORT));
1355
1356 gprs_signal(E_MFW_GPRS_S_DATA, cntxtL2P);
1357
1358 mfwFree( (void *) cntxtL2P->L2P, sizeof(char) * strlen(L2P));
1359 mfwFree( (void *) cntxtL2P->ids, sizeof(SHORT) * MAX_CID);
1360
1361 return MFW_RES_OK;
1362 }
1363 #endif
1364
1365
1366
1367 /*
1368 +-----------------------------------------------------------------------+
1369 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1370 | STATE : code ROUTINE: gprs_showPDPAddress |
1371 +-----------------------------------------------------------------------+
1372
1373
1374 PURPOSE : Show PDP address. The Function sets the pointer pdp_adress
1375 to a list of PDP addresses for the specified context
1376 identifiers in the parameter cids.
1377
1378 PARAMETERS :
1379 pdp_address: list of contexts
1380
1381 RETURNS:
1382 MFW_RES_OK: On success
1383 MFW_RES_ERR: On failure
1384 */
1385 #ifdef FF_2TO1_PS
1386 T_MFW_RES gprs_showPDPAddress(SHORT *cids, T_NAS_ip *pdp_address)
1387 {
1388 int i;
1389
1390 T_MFW_GPRS_CONTEXT *cntxt;
1391
1392 TRACE_FUNCTION ("gprs_showPDPAddress()");
1393
1394 /*
1395 * ACI call, get PDP addresses
1396 */
1397 if (sAT_PlusCGPADDR(CMD_SRC_LCL, (U8*)cids, pdp_address) == AT_FAIL)
1398 {
1399 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGPADDR failed");
1400 return MFW_RES_ERR;
1401 }
1402
1403
1404 /*
1405 * change PDP address data in MFW GPRS data
1406 */
1407 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1408
1409 for (i=0; i < MAX_CID; i++)
1410 {
1411 cntxt->id = (U8)cids[i];
1412 memcpy (&(cntxt->data.attributes.pdp_addr), &pdp_address[i], sizeof (T_NAS_ip));
1413
1414 gprs_signal(E_MFW_GPRS_S_PDPADDR, cntxt);
1415 }
1416
1417 return MFW_RES_OK;
1418 }
1419 #else
1420 T_MFW_RES gprs_showPDPAddress(SHORT *cids, T_NAS_ip *pdp_address)
1421 {
1422 int i;
1423
1424 T_MFW_GPRS_CONTEXT *cntxt;
1425
1426 TRACE_FUNCTION ("gprs_showPDPAddress()");
1427
1428 /*
1429 * ACI call, get PDP addresses
1430 */
1431 if (sAT_PlusCGPADDR(CMD_SRC_LCL, cids, pdp_address) == AT_FAIL)
1432 {
1433 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGPADDR failed");
1434 return MFW_RES_ERR;
1435 }
1436
1437
1438 /*
1439 * change PDP address data in MFW GPRS data
1440 */
1441 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
1442
1443 for (i=0; i < MAX_CID; i++)
1444 {
1445 cntxt->id = cids[i];
1446 memcpy (&(cntxt->data.attributes.pdp_addr), &pdp_address[i], sizeof (T_NAS_ip));
1447
1448 gprs_signal(E_MFW_GPRS_S_PDPADDR, cntxt);
1449 }
1450
1451 return MFW_RES_OK;
1452 }
1453 #endif
1454
1455
1456 /*
1457 +----------------------------------------------------------------------+
1458 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1459 | STATE : code ROUTINE: gprs_setAutoResponse |
1460 +----------------------------------------------------------------------+
1461
1462
1463 PURPOSE : Enable or Disable an automatic positive response to the
1464 receipt of Context Activation Requests from the network.
1465 The parameter mode indicates if the automatic response will
1466 be enabled or disabled.
1467
1468 PARAMETERS :
1469 mode : mode of auto response
1470 */
1471 T_MFW_RES gprs_setAutoResponse(T_CGAUTO_N mode)
1472 {
1473
1474 TRACE_FUNCTION ("gprs_setAutoResponse()");
1475
1476 /*
1477 * ACI call
1478 */
1479 if (sAT_PlusCGAUTO(CMD_SRC_LCL, mode) == AT_FAIL)
1480 {
1481 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGAUTO failed");
1482 return MFW_RES_ERR;
1483 }
1484
1485 /*
1486 * change auto response mode in MFW GPRS data
1487 */
1488 gprs_signal(E_MFW_GPRS_S_AUTORESP, &mode);
1489
1490 return MFW_RES_OK;
1491 }
1492
1493
1494 /*
1495 +----------------------------------------------------------------------+
1496 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1497 | STATE : code ROUTINE: gprs_ManualResponse |
1498 +----------------------------------------------------------------------+
1499
1500
1501 PURPOSE : This Function is for a manual response to network request
1502 for PDP context activation. The parameter response
1503 indicates if the request will be accepted or rejected.
1504 PARAMETERS :
1505 response : ( 0 - rejected, 1 - accepted)
1506 */
1507 T_MFW_RES gprs_ManualResponse(USHORT response, char *l2p, SHORT cid)
1508 {
1509 TRACE_FUNCTION ("gprs_ManualResponse()");
1510
1511 /*
1512 * send signal to current MFW element
1513 */
1514 gprs_signal(E_MFW_GPRS_S_ANS, &cid);
1515
1516 /*
1517 * ACI call
1518 */
1519 if (sAT_PlusCGANS(CMD_SRC_LCL, response, l2p, cid) == AT_FAIL)
1520 {
1521 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGANS failed");
1522 return MFW_RES_ERR;
1523 }
1524
1525 return MFW_RES_OK;
1526 }
1527
1528
1529 /*
1530 +----------------------------------------------------------------------+
1531 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1532 | STATE : code ROUTINE: gprs_setClass |
1533 +----------------------------------------------------------------------+
1534
1535
1536 PURPOSE : Set the mobile to operate according to a GPRS mobile class.
1537
1538 PARAMETERS :
1539 m_class : GPRS mobile class
1540 */
1541 T_MFW_RES gprs_setClass(T_CGCLASS_CLASS new_cls)
1542 {
1543 T_CGATT_STATE state;
1544
1545 TRACE_FUNCTION ("gprs_setClass()");
1546
1547 /*
1548 * ACI call
1549 */
1550 if (sAT_PlusCGCLASS(CMD_SRC_LCL, new_cls) == AT_FAIL)
1551 {
1552 TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGCLASS failed");
1553 return MFW_RES_ERR;
1554 }
1555
1556
1557 /*
1558 * change class data in MFW GPRS data
1559 */
1560 gprs_signal(E_MFW_GPRS_S_CLASS, &new_cls);
1561
1562
1563 /*
1564 * check if attachement mode has changed while class change
1565 */
1566 if (qAT_PlusCGATT(CMD_SRC_LCL, &state) != AT_FAIL )
1567 gprs_signal(E_MFW_GPRS_S_ATT, &state);
1568 else
1569 TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGATT failed");
1570
1571 return MFW_RES_OK;
1572 }
1573
1574
1575 /*
1576 +----------------------------------------------------------------------+
1577 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1578 | STATE : code ROUTINE: gprs_setEventReporting|
1579 +----------------------------------------------------------------------+
1580
1581
1582 PURPOSE : Enables or Disables the sending of certain events
1583 occuring in the GPRS ME or the network to the TE.
1584
1585 PARAMETERS :
1586 mode : mode to specifies if the event reporting will be
1587 enabled or disabled
1588 bfr : controls the effect on buffered events.
1589 */
1590 T_MFW_RES gprs_setEventReporting(T_CGEREP_MODE mode, T_CGEREP_BFR bfr)
1591 {
1592 T_MFW_GPRS_EVENTREP *eventRep;
1593
1594 TRACE_FUNCTION ("gprs_setEventReporting()");
1595
1596 /*
1597 * ACI call
1598 */
1599 if (sAT_PlusCGEREP(CMD_SRC_LCL, mode, bfr) == AT_FAIL)
1600 return MFW_RES_ERR;
1601
1602 /*
1603 * change event reporting data in MFW GPRS data
1604 */
1605 eventRep = (T_MFW_GPRS_EVENTREP *) mfwAlloc(sizeof(T_MFW_GPRS_EVENTREP));
1606
1607 eventRep->mode = mode;
1608 eventRep->bfr = bfr;
1609 gprs_signal(E_MFW_GPRS_S_EREP, eventRep);
1610
1611 return MFW_RES_OK;
1612 }
1613
1614
1615 /*
1616 +----------------------------------------------------------------------+
1617 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1618 | STATE : code ROUTINE: gprs_setServiceSMS |
1619 +----------------------------------------------------------------------+
1620
1621
1622 PURPOSE : The function specifies the service or service preference
1623 to be used for SMS.
1624
1625
1626 PARAMETERS :
1627 n : service to use for SMS ( 0 - GPRS, 1 - circuit switch,
1628 2 - GPRS preferred, 3 circuit switch preferred)
1629 */
1630
1631 T_MFW_RES gprs_setServiceSMS(T_CGSMS_SERVICE service)
1632 {
1633 TRACE_FUNCTION ("gprs_setServiceSMS()");
1634
1635 /*
1636 * ACI call
1637 */
1638 if (sAT_PlusCGSMS(CMD_SRC_LCL, service) == AT_FAIL)
1639 return MFW_RES_ERR;
1640
1641
1642 /*
1643 * change SMS service data in MFW GPRS data
1644 */
1645 gprs_signal(E_MFW_GPRS_S_SMSSERV, &service);
1646
1647 return MFW_RES_OK;
1648 }
1649
1650
1651 /*
1652 +----------------------------------------------------------------------+
1653 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1654 | STATE : code ROUTINE: gprs_getServiceSMS |
1655 +----------------------------------------------------------------------+
1656
1657
1658 PURPOSE : This function returns the service preference to be used for SMS.
1659
1660
1661 PARAMETERS :
1662 n : service to use for SMS ( 0 - GPRS, 1 - circuit switch,
1663 2 - GPRS preferred, 3 circuit switch preferred)
1664 */
1665
1666 T_CGSMS_SERVICE gprs_getServiceSMS(void)
1667 {
1668 T_CGSMS_SERVICE service;
1669
1670 if (qAT_PlusCGSMS(CMD_SRC_LCL, &service) != AT_FAIL )
1671 return service;
1672 else
1673 TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGCLASS failed");
1674 return CGSMS_SERVICE_INVALID;
1675 }
1676
1677
1678 /*
1679 +----------------------------------------------------------------------+
1680 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1681 | STATE : code ROUTINE: gprs_counter |
1682 +----------------------------------------------------------------------+
1683
1684
1685 PURPOSE : SPR#1450 - SH
1686
1687 Resets the data counter if reset_counter is TRUE.
1688 In either case, response returned in rAT_PercentSNCNT below.
1689 */
1690
1691 T_MFW_RES gprs_counter(BOOL reset_counter)
1692 {
1693 T_ACI_RETURN result;
1694 TRACE_FUNCTION("gprs_counter");
1695
1696 result = sAT_PercentSNCNT(CMD_SRC_LCL, reset_counter);
1697
1698 if (result!=AT_EXCT && result!=AT_CMPL)
1699 return MFW_RES_ERR;
1700
1701 if (result==AT_CMPL)
1702 return MfwResDone; /* No response expected */
1703
1704 return MFW_RES_OK;
1705 }
1706
1707
1708 /*
1709 +---------------------------------------------------------------------+
1710 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1711 | STATE : code ROUTINE: gprs_counter_abort |
1712 +---------------------------------------------------------------------+
1713
1714
1715 PURPOSE : Cancel request for data count
1716 SPR#1983 - SH - Added.
1717
1718 PARAMETERS : None.
1719
1720 */
1721
1722 T_MFW_RES gprs_counter_abort(void)
1723 {
1724 T_ACI_RETURN result;
1725
1726 result = sAT_Abort(CMD_SRC_LCL, AT_CMD_SNCNT);
1727
1728 if (result==AT_FAIL)
1729 return MFW_RES_ERR;
1730
1731 return MFW_RES_OK;
1732 }
1733
1734 #ifdef NEPTUNE_BOARD
1735 /* OMAP00074454 - 24-04-2006 */
1736 /* ===========================================================*/
1737 /**
1738 * mfw_gprs_edge_status () Returns the GPRS and EDGE connection established status value
1739 *
1740 * @param int *iStatus - Integer pointer through which the status is returned.
1741 *
1742 * @return integer - 0 - GSM ONLY, 1 - GPRS ONLY, 2 - EDGE ONLY
1743 *
1744 * @see
1745 */
1746 /* =========================================================== */
1747 int mfw_gprs_edge_status(int *iStatus)
1748 {
1749 /* Get the registered status */
1750 T_P_CGREG_STAT status = (T_P_CGREG_STAT)0;
1751 T_ACI_CREG_STAT stat = (T_ACI_CREG_STAT)0;
1752 USHORT lac = 0;
1753 USHORT cid = 0;
1754 U8 rat = 0;
1755 U8 gprs_ind = 0;
1756 /* char temp[TEMP_STRING_SIZE]; */
1757
1758
1759 /* Get the GPRS registered status */
1760 if (qAT_PercentCGREG(CMD_SRC_LCL, &status, &lac, &cid) == AT_FAIL )
1761 {
1762 TRACE_EVENT("MFW_GPRS: Error. qAT_PercentCGREG failed");
1763
1764 *iStatus = (int)0; /* GSM only */
1765 return 0; /* rat - returned as GSM only */
1766 }
1767
1768
1769
1770 /* Reassign lac and cid values */
1771 lac = 0;
1772 cid = 0;
1773
1774 /* To get the gprs_ind and rat */
1775 if(qAT_PercentCREG(CMD_SRC_LCL, &stat, &lac, &cid, &gprs_ind, &rat) NEQ AT_CMPL)
1776 {
1777 TRACE_EVENT("MFW_GPRS: Error. qAT_PercentCREG failed");
1778
1779 *iStatus = (int)status;
1780 return 0; /* rat - returned as GSM only */
1781 }
1782
1783 *iStatus = (int)status;
1784 return ((int)rat);
1785 }
1786 /* END */
1787 #endif
1788
1789
1790
1791 /*
1792 +----------------------------------------------------------------------+
1793 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1794 | STATE : code ROUTINE: gprs_status |
1795 +----------------------------------------------------------------------+
1796
1797
1798 PURPOSE : Returns the GPRS status value
1799 */
1800
1801 T_CGREG_STAT gprs_status()
1802 {
1803
1804 /*a0393213 compiler warnings removal - variable result removed*/
1805
1806 T_CGREG_STAT status = (T_CGREG_STAT)0;
1807 USHORT lac, ci;
1808
1809 TRACE_FUNCTION("gprs_status");
1810
1811 if (qAT_PlusCGREG(CMD_SRC_LCL, &status, &lac, &ci) == AT_FAIL )
1812 {
1813 TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGREG failed");
1814 }
1815
1816 return status;
1817 }
1818 //x0035544 Feb 23, 2006 DR:OMAPS00068976
1819 /*
1820 PURPOSE : Returns the GPRS status value
1821 */
1822 T_P_CGREG_STAT p_gprs_status()
1823 {
1824
1825 /*a0393213 compiler warnings removal - variable result removed*/
1826
1827 T_P_CGREG_STAT status = (T_P_CGREG_STAT)0;
1828 USHORT lac, ci;
1829
1830 TRACE_FUNCTION("p_gprs_status");
1831
1832 if (qAT_PercentCGREG(CMD_SRC_LCL, &status, &lac, &ci) == AT_FAIL )
1833 {
1834 TRACE_EVENT("MFW_GPRS: Error. qAT_PercentCGREG failed");
1835 }
1836
1837 return status;
1838 }
1839
1840
1841 /*--------------------------------------------------------------------
1842 ACI callback functions
1843 --------------------------------------------------------------------*/
1844
1845 /*
1846 +--------------------------------------------------------------------+
1847 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1848 | STATE : code ROUTINE: rAT_PlusCGACT |
1849 +--------------------------------------------------------------------+
1850
1851
1852 PURPOSE : The function rAt_PlusCGACT informs the application about
1853 the link identifier for the data transfer.
1854 ( ACI callback funtion )
1855
1856 PARAMETERS :
1857 link_id: Link identifier
1858
1859 */
1860 void rAT_PlusCGACT ( SHORT link_id )
1861 {
1862 TRACE_FUNCTION ("rAT_PlusCGACT()");
1863
1864 /*
1865 * send event and link id to the current mfw element
1866 */
1867 gprs_signal(E_MFW_GPRS_R_ACT, &link_id);
1868 }
1869
1870
1871 /*
1872 +--------------------------------------------------------------------+
1873 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1874 | STATE : code ROUTINE: rAT_PlusCGDATA |
1875 +--------------------------------------------------------------------+
1876
1877
1878 PURPOSE : The function rAt_PlusCGDATA informs the application about
1879 the link identifier for the data transfer after
1880 activation/deactivation (without connect).
1881 ( ACI callback funtion )
1882
1883 PARAMETERS :
1884 link_id: Link identifier
1885 */
1886 void rAT_PlusCGDATA ( SHORT link_id )
1887 {
1888 TRACE_FUNCTION ("rAT_PlusCGDATA()");
1889
1890 /*
1891 * send event and link id to the current mfw element
1892 */
1893 gprs_signal(E_MFW_GPRS_R_DATA, &link_id);
1894 }
1895
1896
1897 /*
1898 +--------------------------------------------------------------------+
1899 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1900 | STATE : code ROUTINE: rAT_PlusCGANS |
1901 +--------------------------------------------------------------------+
1902
1903
1904 PURPOSE : The function rAt_PlusCGANS informs the application about
1905 the link identifier for the data transfer. It is a
1906 manual reponse to a network request for PDP context
1907 activation (after request by +CRING or RING).
1908 ( ACI callback funtion )
1909
1910 PARAMETERS :
1911 link_id: Link identifier
1912 */
1913 void rAT_PlusCGANS ( SHORT link_id )
1914 {
1915 TRACE_FUNCTION ("rAT_PlusCGANS()");
1916
1917 /*
1918 * send event and link id to the current mfw element
1919 */
1920 gprs_signal(E_MFW_GPRS_R_ANS, &link_id);
1921 }
1922
1923
1924 /*
1925 +--------------------------------------------------------------------+
1926 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1927 | STATE : code ROUTINE: rAT_PlusCGEREP |
1928 +--------------------------------------------------------------------+
1929
1930
1931 PURPOSE : The function rAt_PlusCGEREP informs the application about
1932 GPRS events connect.
1933 ( ACI callback funtion )
1934
1935 PARAMETERS :
1936 event : GPRS event
1937 param : event parameter
1938
1939 */
1940 void rAT_PlusCGEREP ( T_CGEREP_EVENT event,
1941 T_CGEREP_EVENT_REP_PARAM *param )
1942 {
1943
1944 /*a0393213 compiler warnings removal - variable msg removed*/
1945
1946 T_CGATT_STATE state;
1947
1948 TRACE_FUNCTION ("rAT_PlusCGEREP()");
1949 TRACE_EVENT_P1("GPRS eventrep: %d", (short)event);
1950
1951 /*
1952 * send event and data to the current mfw element
1953 * SPR#2243 - SH - Use appropriate union fields in each gprs_signal.
1954 */
1955 switch ( event )
1956 {
1957 case CGEREP_EVENT_REJECT:
1958 gprs_signal(E_MFW_GPRS_R_EREP_RJ, &param->reject);
1959 break;
1960
1961 case CGEREP_EVENT_NW_DETACH:
1962 case CGEREP_EVENT_ME_DETACH:
1963 state = CGATT_STATE_DETACHED;
1964 gprs_signal(E_MFW_GPRS_R_EREP_ATT, &state);
1965 break;
1966
1967 case CGEREP_EVENT_NW_REACT:
1968 gprs_signal(E_MFW_GPRS_R_EREP_ACT, &param->act);
1969 break;
1970
1971 case CGEREP_EVENT_NW_DEACT:
1972 case CGEREP_EVENT_ME_DEACT:
1973 gprs_signal(E_MFW_GPRS_R_EREP_DEACT, &param->act);
1974 break;
1975
1976 case CGEREP_EVENT_NW_CLASS:
1977 case CGEREP_EVENT_ME_CLASS:
1978 gprs_signal(E_MFW_GPRS_R_EREP_CLASS, &param->mobile_class);
1979 break;
1980 }
1981 }
1982
1983 /*
1984 +--------------------------------------------------------------------+
1985 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
1986 | STATE : code ROUTINE : rAT_PercentCGEV |
1987 +--------------------------------------------------------------------+
1988
1989 PURPOSE : handles rAT_PercentCGEV call back
1990
1991 */
1992 GLOBAL void rAT_PercentCGEV (T_CGEREP_EVENT event, T_CGEREP_EVENT_REP_PARAM *param )
1993 {
1994 /*a0393213 compiler warnings removal - variable state removed*/
1995
1996 TRACE_FUNCTION ("rAT_PercentCGEV()");
1997 TRACE_EVENT_P1("GPRS eventrep: %d", (short)event);
1998
1999 /*
2000 * send event and data to the current mfw element
2001 */
2002 switch ( event )
2003 {
2004 case CGEREP_EVENT_REJECT:
2005 /* gprs_signal(E_MFW_GPRS_R_EREP_RJ, &param->reject); - Use a different event for %CGEV */
2006 break;
2007
2008 case CGEREP_EVENT_NW_DETACH:
2009 case CGEREP_EVENT_ME_DETACH:
2010
2011 /* gprs_signal(E_MFW_GPRS_R_EREP_ATT, &state); - Use a different event for %CGEV */
2012 break;
2013
2014 case CGEREP_EVENT_NW_REACT:
2015 /* gprs_signal(E_MFW_GPRS_R_EREP_ACT, &param->act); - Use a different event for %CGEV */
2016 break;
2017
2018 case CGEREP_EVENT_NW_DEACT:
2019 case CGEREP_EVENT_ME_DEACT:
2020 /* gprs_signal(E_MFW_GPRS_R_EREP_DEACT, &param->act); - Use a different event for %CGEV */
2021 break;
2022
2023 case CGEREP_EVENT_NW_CLASS:
2024 case CGEREP_EVENT_ME_CLASS:
2025 /* gprs_signal(E_MFW_GPRS_R_EREP_CLASS, &param->mobile_class); - Use a different event for %CGEV */
2026 break;
2027
2028 /* BEGIN ADD: Neptune Alignment*/
2029 #ifndef NEPTUNE_BOARD
2030 /* END ADD: Neptune Alignment */
2031 case CGEREP_EVENT_NW_ACT:
2032 case CGEREP_EVENT_ME_ACT:
2033 /*state = CGATT_STATE_ATTACHED;*/
2034 /* gprs_signal(E_MFW_GPRS_R_EREP_ATT, &state); - Use a different event for %CGEV */
2035 break;
2036 /* BEGIN ADD: Neptune Alignment*/
2037 #endif
2038 /* END ADD: Neptune Alignment */
2039
2040 }
2041 }
2042
2043
2044 /*
2045 +--------------------------------------------------------------------+
2046 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
2047 | STATE : code ROUTINE: rAT_PlusCGREG |
2048 +--------------------------------------------------------------------+
2049
2050
2051 PURPOSE : The function rAt_PlusCGREG informs the application about
2052 the GPRS registration status and location information.
2053 ( ACI callback funtion )
2054
2055 PARAMETERS :
2056 stat : indicates the current registration
2057 lac : two byte location area code
2058 ci : two byte cell ID
2059 */
2060 void rAT_PlusCGREG ( T_CGREG_STAT stat,
2061 USHORT lac,
2062 USHORT ci )
2063 {
2064 T_MFW_GPRS_CELL_STRUCT cell;
2065
2066 TRACE_FUNCTION ("rAT_PlusCGREG()");
2067 #ifndef WIN32
2068 TRACE_EVENT_P3("GPRS regState: %d, lac %X, ci %X", (short)stat, lac, ci);
2069 #endif
2070 /*
2071 * send signal for changed registry state to current
2072 * MFW element
2073 */
2074
2075 cell.stat = stat;
2076 cell.lac = lac;
2077 cell.ci = ci;
2078 gprs_signal(E_MFW_GPRS_R_REG, &cell);
2079 }
2080
2081
2082
2083 /*
2084 +--------------------------------------------------------------------+
2085 | PROJECT : GPRS (8441) MODULE : GACI_RET |
2086 | STATE : code ROUTINE : rAT_PercentCGREG |
2087 +--------------------------------------------------------------------+
2088
2089 PURPOSE : handles rAT_PercentCGREG call back
2090
2091 */
2092
2093 GLOBAL void rAT_PercentCGREG ( T_P_CGREG_STAT stat, USHORT lac, USHORT ci, BOOL bActiveContext )
2094
2095 {
2096
2097 T_MFW_GPRS_CELL_STRUCT_P cell;
2098
2099 TRACE_FUNCTION ("rAT_PercentCGREG()");
2100 #ifndef WIN32
2101 TRACE_EVENT_P3("GPRS regState: %d, lac %X, ci %X", (short)stat, lac, ci);
2102 #endif
2103 /*
2104 * send signal for changed registry state to current
2105 * MFW element
2106 */
2107 TRACE_EVENT_P3("State received in RAT-GPRS State: %d, lac %X, ci %X", (short)stat, lac, ci);
2108 cell.stat = stat;
2109 cell.lac = lac;
2110 cell.ci = ci;
2111 gprs_signal(E_MFW_GPRS_R_REG, &cell);
2112
2113 }
2114
2115
2116
2117 /*
2118 +--------------------------------------------------------------------+
2119 | PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
2120 | STATE : code ROUTINE: rAT_changedQOS |
2121 +--------------------------------------------------------------------+
2122
2123
2124 PURPOSE : The function rAt_changedQOS informs the application about
2125 changes for the Quality of Service Profiles.
2126 ( ACI callback funtion )
2127
2128 PARAMETERS :
2129 cid :
2130 *qos :
2131 */
2132 // ADDED - 1-11-2005
2133 #ifdef FF_2TO1_PS
2134 void rAT_changedQOS ( U8 cid,
2135 T_PS_qos *qos )
2136 {
2137 T_MFW_GPRS_CONTEXT *cntxt;
2138
2139 TRACE_FUNCTION ("rAT_changedQOS()");
2140
2141 /*
2142 * send signal for changed quality of service profile to current
2143 * MFW element
2144 */
2145 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
2146
2147 cntxt->id = cid;
2148 memcpy (&(cntxt->data.qos), qos, sizeof (T_PS_qos));
2149
2150 gprs_signal(E_MFW_GPRS_R_QOS, cntxt);
2151 }
2152
2153 #else
2154 void rAT_changedQOS ( SHORT cid,
2155 T_PS_qos *qos )
2156 {
2157 T_MFW_GPRS_CONTEXT *cntxt;
2158
2159 TRACE_FUNCTION ("rAT_changedQOS()");
2160
2161 /*
2162 * send signal for changed quality of service profile to current
2163 * MFW element
2164 */
2165 cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
2166
2167 cntxt->id = (U8)cid;
2168 memcpy (&(cntxt->data.qos), qos, sizeof (T_PS_qos));
2169
2170 gprs_signal(E_MFW_GPRS_R_QOS, cntxt);
2171 }
2172
2173 #endif
2174 // END - 1-11-2005
2175
2176 /*
2177 +--------------------------------------------------------------------+
2178 | PROJECT : GPRS (8441) MODULE : MFW_GPRS |
2179 | STATE : code ROUTINE : rAT_PercentSNCNT |
2180 +--------------------------------------------------------------------+
2181
2182 PURPOSE : handles rAT_PercentSNCNT call back
2183
2184 */
2185
2186 GLOBAL void rAT_PercentSNCNT ( UBYTE c_id,
2187 ULONG octets_uplink,
2188 ULONG octets_downlink,
2189 ULONG packets_uplink,
2190 ULONG packets_downlink )
2191 {
2192 T_MFW_GPRS_COUNTER counter;
2193
2194 TRACE_FUNCTION("rAT_PercentSNCNT()");
2195
2196 counter.octets_uplink = octets_uplink;
2197 counter.octets_downlink = octets_downlink;
2198 counter.packets_uplink = packets_uplink;
2199 counter.packets_downlink = packets_downlink;
2200
2201 gprs_signal(E_MFW_GPRS_COUNTER, &counter);
2202
2203 return;
2204 }