FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/aci/cmh_gmmf.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module defines the functions used by the command | |
18 | handler for GPRS mobility management ( GMM ). | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #if defined (GPRS) && defined (DTI) | |
23 | |
24 #ifndef CMH_GMMF_C | |
25 #define CMH_GMMF_C | |
26 #endif | |
27 | |
28 #include "aci_all.h" | |
29 | |
30 /*==== INCLUDES ===================================================*/ | |
31 #include "dti.h" /* functionality of the dti library */ | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 #include "pcm.h" | |
36 | |
37 #include "dti_conn_mng.h" | |
38 | |
39 #include "aci.h" | |
40 #include "gaci.h" | |
41 #include "gaci_cmh.h" | |
42 #include "psa.h" | |
43 #include "psa_mm.h" | |
44 #include "psa_gmm.h" | |
45 #include "psa_sm.h" | |
46 #include "psa_gppp.h" | |
47 #include "psa_sim.h" | |
48 | |
49 #include "cmh.h" | |
50 #include "cmh_mm.h" | |
51 #include "cmh_gmm.h" | |
52 #include "cmh_sm.h" | |
53 #include "cmh_gppp.h" | |
54 #include "cmh_sim.h" | |
55 | |
56 #include "aci_ext_pers.h" | |
57 #include "aci_slock.h" | |
58 /*==== CONSTANTS ==================================================*/ | |
59 | |
60 /*==== TYPES ======================================================*/ | |
61 | |
62 /*==== EXPORT =====================================================*/ | |
63 | |
64 /*==== VARIABLES ==================================================*/ | |
65 static T_ATTACH_STATE attach_state; | |
66 static T_plmn _plmn; | |
67 | |
68 #ifdef SIM_PERS | |
69 EXTERN T_ACI_SLOCK_SHARED AciSLockShrd; | |
70 #endif | |
71 | |
72 LOCAL BOOL frstFlg = TRUE; /* flags first attempt */ | |
73 /*==== FUNCTIONS ==================================================*/ | |
74 | |
75 /* | |
76 +--------------------------------------------------------------------+ | |
77 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
78 | STATE : finished ROUTINE : cmhGMM_Init | | |
79 +--------------------------------------------------------------------+ | |
80 | |
81 PURPOSE : Fill variables for the own use with default values. | |
82 */ | |
83 GLOBAL void cmhGMM_Init (void) | |
84 { | |
85 gmmEntStat.curCmd = AT_CMD_NONE; | |
86 gmmEntStat.entOwn = OWN_NONE; | |
87 | |
88 frstFlg = TRUE; | |
89 cmhGMM_Set_state ( AS_MOBILE_OFF ); | |
90 _plmn.v_plmn = INVLD_PLMN; | |
91 | |
92 } | |
93 | |
94 /* | |
95 +--------------------------------------------------------------------+ | |
96 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
97 | STATE : finished ROUTINE : cmhGMM_Get_state | | |
98 +--------------------------------------------------------------------+ | |
99 | |
100 PURPOSE : Get state of attachment. | |
101 */ | |
102 GLOBAL T_ATTACH_STATE cmhGMM_Get_state ( void ) | |
103 { | |
104 | |
105 return attach_state; | |
106 | |
107 } | |
108 | |
109 /* | |
110 +--------------------------------------------------------------------+ | |
111 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
112 | STATE : finished ROUTINE : cmhGMM_Set_state | | |
113 +--------------------------------------------------------------------+ | |
114 | |
115 PURPOSE : Set state of attachment. | |
116 */ | |
117 GLOBAL void cmhGMM_Set_state ( T_ATTACH_STATE state ) | |
118 { | |
119 | |
120 if ( state > AS_INVALID_STATE && state <= AS_SUSPENTED ) | |
121 attach_state = state; | |
122 | |
123 } | |
124 | |
125 /* | |
126 +----------------------------------------------------------------------+ | |
127 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
128 | STATE : finished ROUTINE : cmhGMM_attach_if_necessary | | |
129 +----------------------------------------------------------------------+ | |
130 | |
131 PURPOSE : Set state of attachment. | |
132 */ | |
133 GLOBAL T_ACI_RETURN cmhGMM_attach_if_necessary ( T_ACI_CMD_SRC srcId, T_ACI_AT_CMD curCmd ) | |
134 { | |
135 UBYTE mobileClass = PERCENT_CGCLASS_MAX; | |
136 | |
137 if( AS_MOBILE_OFF EQ attach_state ) | |
138 { | |
139 return AT_FAIL; | |
140 } | |
141 | |
142 /* normal case: if mobile not GPRS attached */ | |
143 if ( AS_DETACHED EQ attach_state ) | |
144 { | |
145 mobileClass = gmmShrdPrm.mobile_class; | |
146 } | |
147 | |
148 /* case for NMOIII: if class BX -> BG requested */ | |
149 if( PERCENT_CGCLASS_BX EQ gaciMobileClass.current && | |
150 GMMREG_CLASS_BG NEQ gmmShrdPrm.mobile_class ) | |
151 { | |
152 mobileClass = GMMREG_CLASS_BG; | |
153 } | |
154 | |
155 if( PERCENT_CGCLASS_MAX NEQ mobileClass ) | |
156 { | |
157 gmmShrdPrm.last_attach_type = gmmShrdPrm.current_attach_type; | |
158 gmmEntStat.entOwn = srcId; | |
159 gmmEntStat.curCmd = curCmd; | |
160 | |
161 return cmhGMM_attach(mobileClass); | |
162 } | |
163 | |
164 return AT_CMPL; | |
165 } | |
166 | |
167 /* | |
168 +--------------------------------------------------------------------------+ | |
169 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
170 | STATE : finished ROUTINE : cmhGMM_inform_other_psa | | |
171 +--------------------------------------------------------------------------+ | |
172 | |
173 PURPOSE : inform other PSA's if a automatic attach is passed or failed | |
174 */ | |
175 GLOBAL SHORT cmhGMM_inform_other_psa ( SHORT state ) | |
176 { | |
177 /* possible commands */ | |
178 switch ( gmmEntStat.curCmd ) | |
179 { | |
180 case( AT_CMD_CGCLASS ): | |
181 case( AT_CMD_CGATT ): | |
182 default: | |
183 /* no information necessary */ | |
184 return 0; | |
185 case( AT_CMD_CGDATA ): | |
186 case( AT_CMD_CGACT ): | |
187 cmhSM_GprsAttached(state); | |
188 return 1; | |
189 } | |
190 | |
191 } | |
192 | |
193 /* | |
194 +--------------------------------------------------------------------------+ | |
195 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
196 | STATE : finished ROUTINE : cmhGMM_isClassCG | | |
197 +--------------------------------------------------------------------------+ | |
198 | |
199 PURPOSE : return true if the | |
200 */ | |
201 GLOBAL BOOL cmhGMM_isClassCG ( void ) | |
202 { | |
203 if (gmmShrdPrm.requested_mobile_class EQ GMMREG_CLASS_CG) | |
204 return TRUE; | |
205 | |
206 return FALSE; | |
207 } | |
208 | |
209 GLOBAL SHORT psaG_MM_CMD_REG ( void ) | |
210 { | |
211 UBYTE attach_type; | |
212 /* | |
213 * Set automatic registration mode in MM | |
214 */ | |
215 psaG_MM_CMD_SET_REGMD ( MODE_AUTO ); | |
216 | |
217 /* | |
218 *------------------------------------------------------------------- | |
219 * call the corresponding SAP subroutine | |
220 *------------------------------------------------------------------- | |
221 */ | |
222 if ( gmmShrdPrm.mobile_class NEQ GMMREG_CLASS_CG ) | |
223 { | |
224 gmmShrdPrm.requested_mobile_class = gmmShrdPrm.mobile_class; | |
225 | |
226 attach_type = cmhGMM_requested_attach_type(GMMU_AT_GSM, gmmShrdPrm.requested_mobile_class); | |
227 | |
228 /* OVK Set proper service mode dependent on Sim lock state */ | |
229 #ifdef SIM_PERS | |
230 if (AciSLockShrd.blocked EQ TRUE) | |
231 { | |
232 gmmShrdPrm.service_mode = SERVICE_MODE_LIMITED; | |
233 } | |
234 else | |
235 #endif | |
236 if ( simShrdPrm.imei_blocked EQ TRUE ) | |
237 { | |
238 gmmShrdPrm.service_mode = SERVICE_MODE_LIMITED; | |
239 } | |
240 else | |
241 { | |
242 gmmShrdPrm.service_mode = SERVICE_MODE_FULL; | |
243 } | |
244 | |
245 psaGMM_Attach( gmmShrdPrm.requested_mobile_class, | |
246 attach_type, | |
247 gmmShrdPrm.service_mode); | |
248 | |
249 frstFlg = FALSE; | |
250 } | |
251 else | |
252 { | |
253 PALLOC (mmr_nreg_ind, MMR_NREG_IND); | |
254 | |
255 mmr_nreg_ind->service = NREG_NO_SERVICE; | |
256 mmr_nreg_ind->search_running = SEARCH_NOT_RUNNING; | |
257 psa_mmr_nreg_ind(mmr_nreg_ind); | |
258 } | |
259 | |
260 | |
261 return 0; | |
262 } | |
263 | |
264 GLOBAL SHORT psaG_MM_CMD_DEREG ( UBYTE detach_type ) | |
265 { | |
266 /* | |
267 *------------------------------------------------------------------- | |
268 * process parameter | |
269 *------------------------------------------------------------------- | |
270 */ | |
271 frstFlg = TRUE; | |
272 | |
273 psaGMM_Detach( detach_type ); | |
274 | |
275 return 0; | |
276 } | |
277 | |
278 GLOBAL SHORT psaG_MM_CMD_NET_SRCH ( void ) | |
279 { | |
280 | |
281 /* | |
282 * Set manual registration mode in MM | |
283 */ | |
284 psaG_MM_CMD_SET_REGMD ( MODE_MAN ); | |
285 | |
286 /* | |
287 *------------------------------------------------------------------- | |
288 * process parameter | |
289 *------------------------------------------------------------------- | |
290 */ | |
291 if( frstFlg EQ TRUE | |
292 #ifdef FF_DUAL_SIM | |
293 AND CFUNfun EQ CFUN_FUN_Full | |
294 #endif /*FF_DUAL_SIM*/ | |
295 ) | |
296 { | |
297 gmmShrdPrm.requested_mobile_class = gmmShrdPrm.mobile_class; | |
298 | |
299 psaGMM_Attach( gmmShrdPrm.requested_mobile_class, | |
300 cmhGMM_requested_attach_type(GMMU_AT_GSM, gmmShrdPrm.requested_mobile_class), | |
301 SERVICE_MODE_FULL ); | |
302 | |
303 frstFlg = FALSE; | |
304 } | |
305 else | |
306 { | |
307 psaGMM_Net_Req(); | |
308 } | |
309 | |
310 return 0; | |
311 } | |
312 | |
313 GLOBAL SHORT psaG_MM_CMD_NET_SEL ( void ) | |
314 { | |
315 /* | |
316 *------------------------------------------------------------------- | |
317 * process parameter for both calls | |
318 *------------------------------------------------------------------- | |
319 */ | |
320 | |
321 /* | |
322 * Set manual registration mode in MM | |
323 */ | |
324 psaG_MM_CMD_SET_REGMD ( MODE_MAN ); | |
325 | |
326 /* | |
327 *------------------------------------------------------------------- | |
328 * process parameter | |
329 *------------------------------------------------------------------- | |
330 */ | |
331 gmmShrdPrm.requested_mobile_class = gmmShrdPrm.mobile_class; | |
332 | |
333 /* | |
334 *------------------------------------------------------------------- | |
335 * call the corresponding SAP subroutine | |
336 *------------------------------------------------------------------- | |
337 */ | |
338 psaGMM_Plmn_res( gmmShrdPrm.requested_mobile_class, | |
339 cmhGMM_requested_attach_type(GMMU_AT_GSM, gmmShrdPrm.requested_mobile_class), | |
340 &mmShrdPrm.slctPLMN ); | |
341 | |
342 frstFlg = FALSE; | |
343 | |
344 return 0; | |
345 } | |
346 | |
347 GLOBAL SHORT psaG_MM_CMD_SET_REGMD ( UBYTE mode ) | |
348 { | |
349 | |
350 /* | |
351 *------------------------------------------------------------------- | |
352 * process parameter | |
353 *------------------------------------------------------------------- | |
354 */ | |
355 switch (mode) | |
356 { | |
357 case MODE_AUTO: | |
358 psaGMM_Plmn_mode_req( GMMREG_NET_SEL_MODE_AUTO ); | |
359 break; | |
360 case MODE_MAN: | |
361 psaGMM_Plmn_mode_req( GMMREG_NET_SEL_MODE_MAN ); | |
362 break; | |
363 default: | |
364 return -1; | |
365 } | |
366 | |
367 /* | |
368 *------------------------------------------------------------------- | |
369 * call the corresponding SAP subroutine | |
370 *------------------------------------------------------------------- | |
371 */ | |
372 return 0; | |
373 } | |
374 | |
375 GLOBAL SHORT gprs_sim_inserted ( void ) | |
376 { | |
377 | |
378 /* OVK Set proper service mode dependent on Sim lock state */ | |
379 #ifdef SIM_PERS | |
380 if (AciSLockShrd.blocked EQ TRUE) | |
381 { | |
382 gmmShrdPrm.service_mode = SERVICE_MODE_LIMITED; | |
383 } | |
384 else | |
385 #endif | |
386 if ( simShrdPrm.imei_blocked EQ TRUE ) | |
387 { | |
388 gmmShrdPrm.service_mode = SERVICE_MODE_LIMITED; | |
389 } | |
390 else | |
391 { | |
392 gmmShrdPrm.service_mode = SERVICE_MODE_FULL; | |
393 } | |
394 gmmShrdPrm.mobile_class = default_mobile_class; | |
395 | |
396 cmhGMM_Set_state( AS_DETACHED ); | |
397 | |
398 return 0; | |
399 } | |
400 | |
401 GLOBAL T_ACI_RETURN cmhGMM_attach ( UBYTE mobile_class ) | |
402 { | |
403 | |
404 TRACE_FUNCTION ("cmhGMM_attach()"); | |
405 | |
406 if ( cmhGMM_Get_state() EQ AS_MOBILE_OFF ) | |
407 { | |
408 gmmEntStat.curCmd = AT_CMD_NONE; | |
409 gmmShrdPrm.requested_mobile_class = gmmShrdPrm.mobile_class = default_mobile_class = mobile_class; | |
410 | |
411 return AT_CMPL; | |
412 } | |
413 | |
414 gmmShrdPrm.requested_mobile_class = mobile_class; | |
415 gmmShrdPrm.last_attach_type = gmmShrdPrm.current_attach_type; | |
416 | |
417 gmmShrdPrm.requested_attach_type = cmhGMM_requested_attach_type(GMMU_AT_GPRS, gmmShrdPrm.requested_mobile_class); | |
418 | |
419 psaGMM_Attach( gmmShrdPrm.requested_mobile_class, | |
420 gmmShrdPrm.requested_attach_type, | |
421 gmmShrdPrm.service_mode); | |
422 | |
423 return AT_EXCT; | |
424 } | |
425 | |
426 /* | |
427 +--------------------------------------------------------------------------+ | |
428 | PROJECT : GPRS (8441) MODULE : CMH_GMM | | |
429 | STATE : finished ROUTINE : cmhGMM_allContextsDeactivated | | |
430 +--------------------------------------------------------------------------+ | |
431 | |
432 PURPOSE : For automatic detaching the mobile after context deactivation. | |
433 */ | |
434 GLOBAL void cmhGMM_allContextsDeactivated ( void ) | |
435 { | |
436 | |
437 TRACE_FUNCTION ("cmhGMM_allContextsDeactivated()"); | |
438 | |
439 /* case for NMOIII: if class BX -> BC requested */ | |
440 /* in this particular case an attach would be first sent just to inform | |
441 GMM of the class change. | |
442 It is OK if an attach_req is sent and then right after a detach_req. */ | |
443 if( PERCENT_CGCLASS_BX EQ gaciMobileClass.current && | |
444 GMMREG_CLASS_BC NEQ gmmShrdPrm.mobile_class ) | |
445 { | |
446 gmmShrdPrm.last_attach_type = gmmShrdPrm.current_attach_type; | |
447 | |
448 cmhGMM_attach((UBYTE)GMMREG_CLASS_BC); | |
449 } | |
450 | |
451 /* GPRS detach req will be sent only when the automatic detach mode is ON and | |
452 the curCmd of mmEntStat should not be equal to CFUN.If user uses CFUN to deregister | |
453 from the network or to switch the mobile to power off mode, though automatic detach | |
454 mode is ON it will not send one more gmmreg_detach_req. */ | |
455 if ( automatic_detach_mode EQ CGAATT_DETACH_MODE_ON AND mmEntStat.curCmd NEQ AT_CMD_CFUN) | |
456 { | |
457 psaGMM_Detach( GMMREG_DT_GPRS ); | |
458 } | |
459 } | |
460 | |
461 GLOBAL UBYTE cmhGMM_requested_attach_type ( T_GMM_USER usr, UBYTE m_class ) | |
462 { | |
463 UBYTE attach_type = GMMREG_AT_COMB; | |
464 | |
465 switch ( m_class ) | |
466 { | |
467 case GMMREG_CLASS_A: | |
468 case GMMREG_CLASS_B: | |
469 case GMMREG_CLASS_BG: | |
470 case GMMREG_CLASS_BC: | |
471 switch ( usr ) | |
472 { | |
473 case GMMU_AT_GSM: | |
474 if ( automatic_attach_mode NEQ CGAATT_ATTACH_MODE_AUTOMATIC AND | |
475 ( AS_DETACHED EQ attach_state OR AS_MOBILE_OFF EQ attach_state) ) | |
476 { | |
477 attach_type = GMMREG_AT_IMSI; | |
478 } | |
479 break; | |
480 case GMMU_AT_GPRS: | |
481 if ( mmShrdPrm.creg_status EQ CREG_STAT_NoSearch OR | |
482 mmShrdPrm.creg_status EQ CREG_STAT_Denied OR | |
483 mmShrdPrm.creg_status EQ CREG_STAT_Unknown OR | |
484 mmShrdPrm.creg_status EQ CREG_STAT_NotPresent) | |
485 { | |
486 attach_type = GMMREG_AT_GPRS; | |
487 } | |
488 break; | |
489 } | |
490 break; | |
491 case GMMREG_CLASS_CG: | |
492 attach_type = GMMREG_AT_GPRS; | |
493 break; | |
494 case GMMREG_CLASS_CC: | |
495 attach_type = GMMREG_AT_IMSI; | |
496 break; | |
497 } | |
498 | |
499 gmmShrdPrm.requested_attach_type = attach_type; | |
500 | |
501 return attach_type; | |
502 } | |
503 | |
504 GLOBAL UBYTE cmhGMM_translate_gmm_cause_to_nreg_cs ( USHORT cause ) | |
505 { | |
506 switch( cause ) | |
507 { | |
508 case GMMCS_POWER_OFF: | |
509 case GMMCS_NO_SERVICE: | |
510 return NREG_NO_SERVICE; | |
511 | |
512 /* ####!!!! Translated by GMM? */ | |
513 /* case RRCS_ABORT_CEL_SEL_FAIL: | |
514 return NREG_NO_SERVICE; */ | |
515 | |
516 case GMMCS_LIMITED_SERVICE: | |
517 return NREG_LIMITED_SERVICE; | |
518 | |
519 /* | |
520 * This catches all remaining GMM originated causes and | |
521 * all MM originated causes. | |
522 */ | |
523 default: | |
524 return NREG_LIMITED_SERVICE; | |
525 } | |
526 } | |
527 | |
528 /* | |
529 * COPS will be request an only GSM registration. | |
530 * If the ME is an only GPRS mobile, then it is impossible to request only GSM. | |
531 * This patch will be eliminate an error in this situation. | |
532 * | |
533 * brz, 02.07.01 | |
534 */ | |
535 GLOBAL BOOL cmhGMM_class_eq_CG ( void ) | |
536 { | |
537 | |
538 if ( gmmShrdPrm.mobile_class EQ GMMREG_CLASS_CG ) | |
539 { | |
540 /* | |
541 * If the mobile class is CG than the protocol stack | |
542 * will be attached automaticly. | |
543 * | |
544 * patch brz, 090701 | |
545 */ | |
546 /*if ( automatic_attach_mode EQ CGAATT_ATTACH_MODE_AUTOMATIC )*/ | |
547 { | |
548 gmmShrdPrm.requested_mobile_class = GMMREG_CLASS_CG; | |
549 | |
550 psaGMM_Attach( GMMREG_CLASS_CG, GMMREG_AT_GPRS, gmmShrdPrm.service_mode); | |
551 } | |
552 | |
553 return TRUE; | |
554 } | |
555 | |
556 return FALSE; | |
557 } | |
558 | |
559 /* | |
560 +---------------------------------------------------------------------------------+ | |
561 | PROJECT : GSM-PS (6147) MODULE : CMH_GMMF | | |
562 | ROUTINE : cmhGMM_send_NetworkRegistrationStatus | | |
563 +---------------------------------------------------------------------------------+ | |
564 | |
565 PURPOSE : report function | |
566 */ | |
567 GLOBAL void cmhGMM_send_NetworkRegistrationStatus( T_CGREG_STAT cgreg, T_P_CGREG_STAT p_cgreg ) | |
568 { | |
569 USHORT src; | |
570 | |
571 TRACE_FUNCTION("cmhGMM_send_NetworkRegistrationStatus"); | |
572 | |
573 /* +CGREG */ | |
574 gmmShrdPrm.cgreg_stat = cgreg; | |
575 | |
576 for( src = 0 ; src < CMD_SRC_MAX; src++ ) | |
577 { | |
578 R_AT( RAT_CGREG, src ) (cgreg, gmmShrdPrm.lac, gmmShrdPrm.cid); | |
579 } | |
580 | |
581 /* %CGREG */ | |
582 cmhGMM_send_percentNetworkRegistrationStatus( p_cgreg ); | |
583 } | |
584 | |
585 /* | |
586 +----------------------------------------------------------------------------------------+ | |
587 | PROJECT : GSM-PS (6147) MODULE : CMH_GMMF | | |
588 | ROUTINE : cmhGMM_send_percentNetworkRegistrationStatus | | |
589 +----------------------------------------------------------------------------------------+ | |
590 | |
591 PURPOSE : report function | |
592 */ | |
593 GLOBAL void cmhGMM_send_percentNetworkRegistrationStatus( T_P_CGREG_STAT p_cgreg ) | |
594 { | |
595 USHORT src; | |
596 BOOL bActiveContext = FALSE; | |
597 | |
598 TRACE_FUNCTION("cmhGMM_send_percentNetworkRegistrationStatus"); | |
599 | |
600 /* %CGREG */ | |
601 gmmShrdPrm.p_cgreg_stat = p_cgreg; | |
602 | |
603 bActiveContext = cmhSM_isContextActive(); | |
604 | |
605 for( src = 0 ; src < CMD_SRC_MAX; src++ ) | |
606 { | |
607 R_AT( RAT_P_CGREG, src ) (p_cgreg, gmmShrdPrm.lac, gmmShrdPrm.cid, bActiveContext ); | |
608 } | |
609 } | |
610 | |
611 /* | |
612 +---------------------------------------------------------------------------------+ | |
613 | PROJECT : GSM-PS (6147) MODULE : CMH_GMMF | | |
614 | ROUTINE : cmhGMM_setPLMN | | |
615 +---------------------------------------------------------------------------------+ | |
616 | |
617 PURPOSE : report function | |
618 */ | |
619 GLOBAL void cmhGMM_setPLMN(T_plmn *plmn) | |
620 { | |
621 memcpy(&_plmn, plmn, sizeof(T_plmn)); | |
622 } | |
623 | |
624 /* | |
625 +---------------------------------------------------------------------------------+ | |
626 | PROJECT : GSM-PS (6147) MODULE : CMH_GMMF | | |
627 | ROUTINE : cmhGMM_isPLMN_Home | | |
628 +---------------------------------------------------------------------------------+ | |
629 | |
630 PURPOSE : report function | |
631 */ | |
632 GLOBAL UBYTE cmhGMM_isPLMN_Home( void ) | |
633 { | |
634 SHORT mccCur, mncCur; /* holds MCC and MCC of current PLMN */ | |
635 | |
636 if ( _plmn.v_plmn EQ VLD_PLMN ) | |
637 { | |
638 cmhMM_CnvrtPLMN2INT( _plmn.mcc, | |
639 _plmn.mnc, | |
640 &mccCur, &mncCur ); | |
641 if (cmhSIM_plmn_is_hplmn (mccCur, mncCur)) | |
642 { | |
643 return 1; /* yes, it is */ | |
644 } | |
645 } | |
646 | |
647 return 0; /* no, it isn't */ | |
648 } | |
649 | |
650 GLOBAL T_ACI_RETURN cmhGMM_contextActivation( T_ACI_CMD_SRC srcId, T_ACI_AT_CMD curCmd ) | |
651 { | |
652 | |
653 /* case for NMOIII: if class BX -> BG requested */ | |
654 if( PERCENT_CGCLASS_BX EQ gaciMobileClass.current && | |
655 GMMREG_CLASS_BG NEQ gmmShrdPrm.mobile_class ) | |
656 { | |
657 gmmEntStat.entOwn = srcId; | |
658 gmmEntStat.curCmd = curCmd; | |
659 | |
660 gmmShrdPrm.last_attach_type = gmmShrdPrm.current_attach_type; | |
661 | |
662 return cmhGMM_attach((UBYTE)GMMREG_CLASS_BG); | |
663 } | |
664 | |
665 return AT_CMPL; | |
666 | |
667 } | |
668 | |
669 /* | |
670 +---------------------------------------------------------------------------------+ | |
671 | PROJECT : GSM-PS (6147) MODULE : CMH_GMMF | | |
672 | ROUTINE : cmhGMM_isPLMN_Valid | | |
673 +---------------------------------------------------------------------------------+ | |
674 | |
675 PURPOSE : Checks if _plmn contains a valid PLMN | |
676 */ | |
677 GLOBAL UBYTE cmhGMM_isPLMN_Valid (void) | |
678 { | |
679 if ( _plmn.v_plmn EQ VLD_PLMN ) | |
680 { | |
681 return 1; | |
682 } | |
683 return 0; | |
684 } | |
685 | |
686 #endif /* GPRS */ | |
687 /*==== EOF ========================================================*/ |