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