comparison gsm-fw/g23m-aci/aci/cmh_mmr.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children b93cee08a2e1
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_MMR
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 which are responsible
18 | for the responses of the protocol stack adapter for
19 | mobility management.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef CMH_MMR_C
24 #define CMH_MMR_C
25 #endif
26
27 #include "aci_all.h"
28
29 /*==== INCLUDES ===================================================*/
30
31 #include "aci_cmh.h"
32 #include "ati_cmd.h"
33 #include "aci_cmd.h"
34 #include "aci_mem.h"
35
36 #ifdef FAX_AND_DATA
37 #include "aci_fd.h"
38 #endif /* of #ifdef FAX_AND_DATA */
39
40 #include "aci.h"
41 #include "psa.h"
42 #include "psa_mm.h"
43 #include "psa_sim.h"
44 #include "cmh.h"
45 #include "cmh_mm.h"
46
47 #ifdef DTI
48 #include "dti.h" /* functionality of the dti library */
49 #include "dti_conn_mng.h"
50 #include "dti_cntrl_mng.h"
51 #endif
52
53 #include "cmh_sim.h"
54
55 #ifdef GPRS
56 #include "gaci.h"
57 #include "gaci_cmh.h"
58 #include "psa_gmm.h"
59 #include "cmh_gmm.h"
60 #endif
61
62 /*==== CONSTANTS ==================================================*/
63
64
65 /*==== TYPES ======================================================*/
66
67
68 /*==== EXPORT =====================================================*/
69
70
71 /*==== VARIABLES ==================================================*/
72
73 /*==== FUNCTIONS ==================================================*/
74 LOCAL void cmhMM_Registration_AutoMode( T_ACI_AT_CMD at_cmd_id );
75 /*
76 +-------------------------------------------------------------------+
77 | PROJECT : GSM-PS (6147) MODULE : CMH_MMR |
78 | ROUTINE : cmhMM_Registered |
79 +-------------------------------------------------------------------+
80
81 PURPOSE : ME is registered to the network
82
83 */
84
85 GLOBAL SHORT cmhMM_Registered ( void )
86 {
87 SHORT mncCur, mccCur; /* holds mnc and mcc of current PLMN */
88 UBYTE cmdBuf; /* buffers current command */
89
90 TRACE_FUNCTION ("cmhMM_Registered()");
91
92 /*
93 *-------------------------------------------------------------------
94 * check for command context
95 *-------------------------------------------------------------------
96 */
97 switch( mmEntStat.curCmd )
98 {
99 case( AT_CMD_NONE ):
100 case( AT_CMD_COPS ):
101 case (AT_CMD_P_COPS):
102 case( AT_CMD_NRG ):
103
104 /* check for home PLMN or roaming */
105 if( mmShrdPrm.usedPLMN.v_plmn EQ VLD_PLMN )
106 {
107 cmhMM_CnvrtPLMN2INT( mmShrdPrm.usedPLMN.mcc,
108 mmShrdPrm.usedPLMN.mnc,
109 &mccCur, &mncCur );
110
111 /* Store the new PLMN and the IMSI in the FFS */
112 if (!cmhMM_OperatorStoreInFFS(mmShrdPrm.usedPLMN.mcc,
113 mmShrdPrm.usedPLMN.mnc,
114 simShrdPrm.imsi.field))
115 TRACE_EVENT("Could not write PLMN and IMSI in FFS");
116
117
118 if( cmhSIM_plmn_is_hplmn (mccCur, mncCur))
119 {
120 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Reg);
121 }
122 else
123 {
124 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Roam);
125 }
126 }
127
128 if( mmEntStat.curCmd NEQ AT_CMD_NONE )
129 {
130 #if defined (GPRS) AND defined (DTI)
131 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
132 #else
133 /* restore former registration mode */
134 psaMM_SetRegMode ( mmShrdPrm.regMode );
135 #endif
136
137 cmdBuf = mmEntStat.curCmd;
138 mmEntStat.curCmd = AT_CMD_NONE;
139
140 /* From the flight mode if the user registers directly
141 change the variable to full functionality. */
142 if (CFUNfun NEQ CFUN_FUN_Full)
143 {
144 CFUNfun = CFUN_FUN_Full;
145 }
146
147 R_AT( RAT_OK, mmEntStat.entOwn )
148 ( cmdBuf );
149
150 /* log result */
151 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, (T_ACI_AT_CMD)cmdBuf,
152 -1, BS_SPEED_NotPresent ,CME_ERR_NotPresent );
153 }
154 break;
155 }
156
157 return 0;
158 }
159
160 /*
161 +-------------------------------------------------------------------+
162 | PROJECT : GSM-PS (6147) MODULE : CMH_MMR |
163 | ROUTINE : cmhMM_Deregistered |
164 +-------------------------------------------------------------------+
165
166 PURPOSE : ME is deregistered from network
167
168 */
169
170 GLOBAL SHORT cmhMM_Deregistered ( void )
171 {
172 T_ACI_RETURN ret;
173
174 TRACE_FUNCTION ("cmhMM_Deregistered()");
175
176 /*
177 *-------------------------------------------------------------------
178 * check for command context
179 *-------------------------------------------------------------------
180 */
181 switch( mmEntStat.curCmd )
182 {
183 case( AT_CMD_NONE ):
184 /*
185 *----------------------------------------------------------------
186 * process event if no command was invoked
187 *----------------------------------------------------------------
188 */
189 switch( mmShrdPrm.deregCs )
190 {
191 case( NREG_LIMITED_SERVICE ):
192 case( NREG_NO_SERVICE ):
193
194 if (mmShrdPrm.regModeAutoBack)
195 {
196 /*
197 * Fallback to automatic mode is allowed, fallback.
198 * If MM is not in full service and the registration mode
199 * is switched from manual to automatic,
200 * MM starts a network search immediately.
201 */
202 mmShrdPrm.regModeBeforeAbort = mmShrdPrm.regMode;
203 mmShrdPrm.regMode = MODE_AUTO;
204 mmShrdPrm.regModeAutoBack = FALSE;
205 #if defined (GPRS) AND defined (DTI)
206 psaG_MM_CMD_SET_REGMD ( MODE_AUTO );
207 #else
208 psaMM_SetRegMode (MODE_AUTO);
209 #endif
210 }
211
212 cmhMM_Ntfy_NtwRegistrationStatus(cmhMM_GetNregCREGStat());
213 break;
214 }
215 break;
216
217 case( AT_CMD_CFUN ):
218 /*
219 *----------------------------------------------------------------
220 * process event for +CFUN command
221 *----------------------------------------------------------------
222 */
223 mmEntStat.curCmd = AT_CMD_NONE;
224
225 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_NoSearch);
226
227 if (simEntStat.curCmd NEQ AT_CMD_CFUN) /* Has SIM already finished flushing of LDN entries? */
228 {
229 R_AT( RAT_OK, mmEntStat.entOwn )
230 ( AT_CMD_CFUN );
231
232 /* log result */
233 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, AT_CMD_CFUN, -1,
234 BS_SPEED_NotPresent,CME_ERR_NotPresent );
235 }
236
237 break;
238
239 case( AT_CMD_BAND ):
240 /*
241 *----------------------------------------------------------------
242 * process event for %BAND command
243 *----------------------------------------------------------------
244 */
245 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_NoSearch);
246
247 /* switch back to full functionnality */
248 ret = sAT_PlusCFUN( mmEntStat.entOwn,
249 CFUN_FUN_Full,
250 CFUN_RST_NotPresent );
251
252
253 /* SPR#919 - SH - fix advised by CLB */
254 mmEntStat.curCmd = AT_CMD_NONE;
255 simEntStat.curCmd = AT_CMD_NONE;
256 /* end SH */
257
258 if( ret EQ AT_CMPL )
259 {
260 R_AT( RAT_OK, mmEntStat.entOwn )
261 (AT_CMD_BAND);
262 }
263 else
264 {
265 TRACE_EVENT_P1
266 ("Fatal Error in sAT_PlusCFUN switching on !!!, ret_type: %d", ret);
267 R_AT( RAT_CME, mmEntStat.entOwn )
268 ( AT_CMD_BAND, CME_ERR_Unknown );
269
270 }
271 /*SPR#919 - SH - fix advised by CLB
272 mmEntStat.curCmd = AT_CMD_NONE;
273 simEntStat.curCmd = AT_CMD_NONE;
274 */
275 break;
276
277 case( AT_CMD_COPS ):
278 case( AT_CMD_P_COPS):
279 /*
280 *----------------------------------------------------------------
281 * process event for +COPS command
282 *----------------------------------------------------------------
283 */
284 switch( mmShrdPrm.COPSmode )
285 {
286 case( COPS_MOD_Auto ):
287 case( COPS_MOD_Man ):
288
289 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Denied);
290
291 /* If the current running command is AT+COPS=?, we should not do the below
292 actions. pnn_read_cnt will be valid when AT+COPS=? is running. */
293 if (mmShrdPrm.pnn_read_cnt EQ 0)
294 {
295 mmEntStat.curCmd = AT_CMD_NONE;
296 #if defined (GPRS) AND defined (DTI)
297 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
298 #else
299 /* restore former registration mode */
300 psaMM_SetRegMode ( mmShrdPrm.regMode);
301 #endif
302
303 R_AT( RAT_CME, mmEntStat.entOwn )
304 ( mmEntStat.curCmd, cmhMM_GetNregCMEStat() );
305
306 /* log result */
307 cmh_logRslt ( mmEntStat.entOwn, RAT_CME, AT_CMD_COPS, -1, BS_SPEED_NotPresent ,
308 cmhMM_GetNregCMEStat() );
309 }
310 break;
311 case( COPS_MOD_Dereg ):
312
313 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_NoSearch);
314
315 R_AT( RAT_OK, mmEntStat.entOwn )
316 ( mmEntStat.curCmd );
317
318 /* log result */
319 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, mmEntStat.curCmd, -1,
320 BS_SPEED_NotPresent,CME_ERR_NotPresent );
321
322 mmEntStat.curCmd = AT_CMD_NONE;
323 break;
324
325 case( COPS_MOD_SetOnly ):
326
327 cmhMM_Ntfy_NtwRegistrationStatus(cmhMM_GetNregCREGStat());
328 break;
329
330 case( COPS_MOD_Both ):
331
332 /* Implements Measure 87 */
333 cmhMM_Registration_AutoMode( mmEntStat.curCmd );
334 break;
335 }
336 break;
337
338 case( AT_CMD_NRG ):
339 /*
340 *----------------------------------------------------------------
341 * process event for %NRG command
342 *----------------------------------------------------------------
343 */
344 switch( cmhPrm[mmEntStat.entOwn].mmCmdPrm.NRGsrvMode )
345 {
346 case( NRG_SVMD_Full ):
347
348 switch( cmhPrm[mmEntStat.entOwn].mmCmdPrm.NRGregMode )
349 {
350 case( NRG_RGMD_Auto ):
351 case( NRG_RGMD_Manual ):
352
353 mmEntStat.curCmd = AT_CMD_NONE;
354
355 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Denied);
356
357 #if defined (GPRS) AND defined (DTI)
358 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
359 #else
360 /* restore former registration mode */
361 psaMM_SetRegMode ( mmShrdPrm.regMode );
362 #endif
363
364 R_AT( RAT_CME, mmEntStat.entOwn )
365 ( AT_CMD_NRG, cmhMM_GetNregCMEStat());
366
367 /* log result */
368 cmh_logRslt ( mmEntStat.entOwn, RAT_CME, AT_CMD_NRG, -1,
369 BS_SPEED_NotPresent ,cmhMM_GetNregCMEStat() );
370 break;
371
372 case( NRG_RGMD_Both ):
373
374 /* Implements Measure 87 */
375 cmhMM_Registration_AutoMode( AT_CMD_NRG );
376
377 break;
378 }
379 break;
380
381 case( NRG_SVMD_Limited ):
382
383 /* pending registration request */
384 if( regReqPnd EQ TRUE )
385 {
386 mmShrdPrm.regMode = MODE_AUTO;
387
388 #if defined (GPRS) AND defined (DTI)
389 (void)psaG_MM_CMD_REG (); /* register to network */
390 #else
391 (void)psaMM_Registrate (); /* register to network */
392 #endif
393
394 regReqPnd = FALSE;
395 break;
396 }
397
398 if( mmShrdPrm.regStat EQ RS_LMTD_SRV )
399 {
400 mmEntStat.curCmd = AT_CMD_NONE;
401
402 cmhMM_Ntfy_NtwRegistrationStatus(cmhMM_GetNregCREGStat());
403
404 R_AT( RAT_OK, mmEntStat.entOwn )
405 ( AT_CMD_NRG );
406
407 /* log result */
408 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, AT_CMD_NRG, -1,
409 BS_SPEED_NotPresent, CME_ERR_NotPresent );
410 }
411 else
412 {
413 mmEntStat.curCmd = AT_CMD_NONE;
414
415 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Denied);
416
417 #if defined (GPRS) AND defined (DTI)
418 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
419 #else
420 /* restore former registration mode */
421 psaMM_SetRegMode ( mmShrdPrm.regMode );
422 #endif
423
424 R_AT( RAT_CME, mmEntStat.entOwn )
425 ( AT_CMD_NRG, cmhMM_GetNregCMEStat() );
426
427 /* log result */
428 cmh_logRslt ( mmEntStat.entOwn, RAT_CME, AT_CMD_NRG, -1,
429 BS_SPEED_NotPresent ,cmhMM_GetNregCMEStat() );
430 }
431 break;
432
433 case( NRG_SVMD_NoSrv ):
434
435 mmEntStat.curCmd = AT_CMD_NONE;
436
437 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_NoSearch);
438
439 R_AT( RAT_OK, mmEntStat.entOwn )
440 ( AT_CMD_NRG );
441
442 /* log result */
443 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, AT_CMD_NRG, -1,
444 BS_SPEED_NotPresent,CME_ERR_NotPresent );
445 break;
446
447 case( NRG_SVMD_SetRegModeOnly ):
448
449 cmhMM_Ntfy_NtwRegistrationStatus(cmhMM_GetNregCREGStat());
450 break;
451
452 }
453 break;
454 }
455
456 return 0;
457 }
458
459 /*
460 +-------------------------------------------------------------------+
461 | PROJECT : GSM-PS (6147) MODULE : CMH_MMR |
462 | ROUTINE : cmhMM_NetworkLst |
463 +-------------------------------------------------------------------+
464
465 PURPOSE : List of networks available
466
467 */
468
469 GLOBAL SHORT cmhMM_NetworkLst ( void )
470 {
471 /*
472 * We need a structure which has to fit into one not too big partition.
473 * sizeof (T_OP_NAME) = 36 (35 characters plus one alignment byte)
474 * with MAX_LONG_OPER_LEN = 26 and MAX_SHRT_OPER_LEN = 9
475 * => sizeof (T_OP_NAME) * MAX_OPER = 432
476 * => This fits into one of the 432er partitions of which we have some.
477 */
478 typedef struct
479 {
480 char longNamBuf[MAX_LONG_OPER_LEN]; /* buffer long name */
481 char shrtNamBuf[MAX_SHRT_OPER_LEN]; /* buffer short name*/
482 } T_OP_NAME;
483
484 T_OP_NAME * op_name = NULL; /* Holds operator names */
485 T_OPER_ENTRY plmnDesc; /* PLMN description */
486 T_ACI_COPS_OPDESC * operLst = NULL; /* operator list T_ACI_COPS_LST */
487 SHORT lstIdx; /* holds list idx */
488 SHORT mcc, mnc; /* holds converted mnc and mcc */
489 BOOL found; /* Result of cmhMM_FindXXX() */
490 T_ACI_AT_CMD bufCmd;
491
492 TRACE_FUNCTION ("cmhMM_NetworkLst()");
493
494 /*
495 *-------------------------------------------------------------------
496 * check for command context
497 *-------------------------------------------------------------------
498 */
499 switch( mmEntStat.curCmd )
500 {
501 case( AT_CMD_COPS ):
502 case (AT_CMD_P_COPS):
503
504 ACI_MALLOC (op_name, sizeof (T_OP_NAME) * MAX_OPER);
505 ACI_MALLOC (operLst, sizeof (T_ACI_COPS_OPDESC) * MAX_OPER);
506
507 /*
508 *---------------------------------------------------------------
509 * for every entry of the PLMN list
510 *---------------------------------------------------------------
511 */
512 for( lstIdx = 0; lstIdx < MAX_OPER AND lstIdx < MAX_PLMN_ID; lstIdx++ )
513 {
514 /*
515 *-------------------------------------------------------------
516 * if last entry of PLMN list, close oper list and return
517 *-------------------------------------------------------------
518 */
519 if( mmShrdPrm.PLMNLst[lstIdx].v_plmn EQ INVLD_PLMN )
520 {
521 operLst[lstIdx].status = COPS_STAT_NotPresent;
522 operLst[lstIdx].longOper = NULL;
523 operLst[lstIdx].shortOper = NULL;
524 operLst[lstIdx].numOper[0]= '\0';
525 break;
526 }
527
528 /*
529 *-------------------------------------------------------------
530 * find PLMN description
531 *-------------------------------------------------------------
532 */
533 cmhMM_CnvrtPLMN2INT( mmShrdPrm.PLMNLst[lstIdx].mcc,
534 mmShrdPrm.PLMNLst[lstIdx].mnc,
535 &mcc, &mnc );
536
537 found = cmhMM_FindPLMN (&plmnDesc, mcc, mnc, mmShrdPrm.LACLst[lstIdx], TRUE);
538
539 if (!found) /* no description found */
540 {
541 operLst[lstIdx].longOper = "";
542 operLst[lstIdx].shortOper = "";
543 }
544 else
545 {
546 /* Copy strings into dynamic buffer so that they don't get lost */
547 memcpy (op_name[lstIdx].longNamBuf, plmnDesc.longName, MAX_LONG_OPER_LEN);
548 memcpy (op_name[lstIdx].shrtNamBuf, plmnDesc.shrtName, MAX_SHRT_OPER_LEN);
549
550 /* EONS PLMN name conding scheme and source flag */
551 operLst[lstIdx].pnn = plmnDesc.pnn;
552 operLst[lstIdx].longOper = op_name[lstIdx].longNamBuf;
553 operLst[lstIdx].long_len = plmnDesc.long_len;
554 operLst[lstIdx].long_ext_dcs = plmnDesc.long_ext_dcs;
555 operLst[lstIdx].shortOper = op_name[lstIdx].shrtNamBuf;
556 operLst[lstIdx].shrt_len = plmnDesc.shrt_len;
557 operLst[lstIdx].shrt_ext_dcs = plmnDesc.shrt_ext_dcs;
558 }
559
560 /*
561 *-------------------------------------------------------------
562 * build numeric representation
563 *-------------------------------------------------------------
564 */
565 /* Implements Measure#32: Row 987 & 986 */
566 cmhMM_mcc_mnc_print(&(operLst[lstIdx].numOper[0]), mcc, mnc);
567
568 /*
569 *-------------------------------------------------------------
570 * set PLMN status
571 *-------------------------------------------------------------
572 */
573 if (mmShrdPrm.PLMNLst[lstIdx].v_plmn EQ mmShrdPrm.usedPLMN.v_plmn AND
574 memcmp (mmShrdPrm.PLMNLst[lstIdx].mcc,
575 mmShrdPrm.usedPLMN.mcc,
576 SIZE_MCC) EQ 0 AND
577 memcmp (mmShrdPrm.PLMNLst[lstIdx].mnc,
578 mmShrdPrm.usedPLMN.mnc, SIZE_MNC) EQ 0)
579 {
580 operLst[lstIdx].status = COPS_STAT_Current;
581 }
582 else
583 {
584 switch( mmShrdPrm.FRBLst[lstIdx] )
585 {
586 case( FORB_PLMN_NOT_INCLUDED ):
587 operLst[lstIdx].status = COPS_STAT_Available;
588 break;
589 case( 1 /*FORB_PLMN_INCLUDED*/ ):
590 operLst[lstIdx].status = COPS_STAT_Forbidden;
591 break;
592 default:
593 operLst[lstIdx].status = COPS_STAT_Unknown;
594 break;
595 }
596 }
597 }
598
599 #if defined (GPRS) AND defined (DTI)
600 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
601 #else
602 /* restore former registration mode */
603 psaMM_SetRegMode ( mmShrdPrm.regMode );
604 #endif
605 bufCmd = mmEntStat.curCmd;
606 mmEntStat.curCmd = AT_CMD_NONE;
607 if(bufCmd EQ AT_CMD_COPS)
608 {
609 R_AT( RAT_COPS, mmEntStat.entOwn )
610 ( --lstIdx, &operLst[0]);
611 }
612 else
613 {
614 R_AT( RAT_P_COPS, mmEntStat.entOwn )
615 ( --lstIdx, &operLst[0]);
616 }
617 R_AT( RAT_OK, mmEntStat.entOwn )
618 ( mmEntStat.curCmd );
619
620 /* log result */
621 cmh_logRslt ( mmEntStat.entOwn, RAT_OK, mmEntStat.curCmd , -1,
622 BS_SPEED_NotPresent,CME_ERR_NotPresent );
623
624 ACI_MFREE (op_name);
625 ACI_MFREE (operLst);
626
627 break;
628 }
629
630 return 0;
631 }
632
633 /*
634 +-------------------------------------------------------------------+
635 | PROJECT : GSM-PS (6147) MODULE : CMH_MMR |
636 | ROUTINE : cmhMM_SelNetwork |
637 +-------------------------------------------------------------------+
638
639 PURPOSE : Select a network, cause for failure from MM is passed as parameter
640 to report appropriate error.
641 */
642
643 GLOBAL SHORT cmhMM_SelNetwork ( USHORT cause )
644 {
645 TRACE_FUNCTION ("cmhMM_SelNetwork()");
646
647 switch( mmEntStat.curCmd )
648 {
649 case( AT_CMD_COPS ):
650
651 #if defined (GPRS) AND defined (DTI)
652 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode ); /* restore former registration mode*/
653 #else
654 /* restore former registration mode */
655 psaMM_SetRegMode ( mmShrdPrm.regMode );
656 #endif
657
658 switch(cause)
659 {
660 case MMCS_SIM_REMOVED:
661 /* If the SIM is not inserted or if the SIM requires a PIN, more meaningful error
662 * codes are returned*/
663 if ( (cmhSIM_GetSIMError(mmEntStat.entOwn, mmEntStat.curCmd)) NEQ AT_CMPL)
664 {
665 R_AT( RAT_CME, mmEntStat.entOwn ) ( mmEntStat.curCmd , CME_ERR_NotPresent);
666 }
667 break;
668
669 case MMCS_PLMN_NOT_IDLE_MODE:
670 R_AT( RAT_CME, mmEntStat.entOwn ) ( mmEntStat.curCmd , CME_ERR_AbortedByNetwork );
671 break;
672
673 default:
674 R_AT( RAT_CME, mmEntStat.entOwn ) ( mmEntStat.curCmd , CME_ERR_NotPresent);
675 break;
676 }
677
678 /* log result */
679 cmh_logRslt ( mmEntStat.entOwn, RAT_CME, mmEntStat.curCmd , -1,
680 BS_SPEED_NotPresent, CME_ERR_NotPresent );
681
682 mmEntStat.curCmd = AT_CMD_NONE;
683
684 break;
685 }
686
687 return 0;
688 }
689
690
691 /*
692 +-------------------------------------------------------------------+
693 | PROJECT : GSM-PS (6147) MODULE : CMH_MMR |
694 | ROUTINE : cmhMM_CipheringInd |
695 +-------------------------------------------------------------------+
696
697 PURPOSE : ciphering indication received
698
699 */
700
701 GLOBAL SHORT cmhMM_CipheringInd ( UBYTE ciph )
702 {
703 SHORT idx; /* holds index counter */
704
705 TRACE_FUNCTION ("cmhMM_CipheringInd()");
706
707 if (simShrdPrm.ciSIMEnabled NEQ TRUE)
708 {
709 return 1;
710 }
711
712 for (idx = 0; idx < CMD_SRC_MAX; idx++)
713 {
714 /*
715 *-----------------------------------------------------------------
716 * new message indication
717 *-----------------------------------------------------------------
718 */
719 #ifndef GPRS
720 #define CIPH_NA 2
721 #endif
722 R_AT(RAT_P_CPRI,(T_ACI_CMD_SRC)idx) ( ciph, CIPH_NA );
723 }
724 return 0;
725 }
726
727 /* Implements Measure 87 */
728 /*
729 +------------------------------------------------------------------------------
730 | Function : cmhMM_Registration_AutoMode
731 +------------------------------------------------------------------------------
732 | Purpose : This Function will try to register into network in
733 | automatic mode.
734 |
735 | Parameters : void
736 |
737 | Return : void
738 +------------------------------------------------------------------------------
739 */
740
741 LOCAL void cmhMM_Registration_AutoMode( T_ACI_AT_CMD at_cmd_id )
742 {
743 TRACE_FUNCTION ("cmhMM_Registration_AutoMode()");
744
745 if ( mmShrdPrm.regModeAutoBack )
746 {
747 /*
748 * Tried register to network in manual mode. Attempt failed.
749 * Now trying to register into network in automatic mode.
750 */
751
752 mmShrdPrm.regModeBeforeAbort = mmShrdPrm.regMode;
753 mmShrdPrm.regMode = MODE_AUTO;
754 mmShrdPrm.regModeAutoBack = FALSE;
755
756 #if defined (GPRS) AND defined (DTI)
757 if( psaG_MM_CMD_REG ( ) EQ 0 )
758 #else
759 if( psaMM_Registrate () EQ 0 )
760 #endif
761 {
762 return;
763 }
764
765 }
766 else
767 {
768
769 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Denied);
770
771 /* If fallback to automatic mode is allowed, fall back */
772 if ( at_cmd_id EQ AT_CMD_NRG )
773 {
774 if (mmShrdPrm.regModeAutoBack)
775 {
776 mmShrdPrm.regModeBeforeAbort = mmShrdPrm.regMode;
777 mmShrdPrm.regModeAutoBack = FALSE;
778 mmShrdPrm.regMode = MODE_AUTO;
779 }
780 }
781
782 #if defined (GPRS) AND defined (DTI)
783 /* restore former registration mode*/
784 psaG_MM_CMD_SET_REGMD ( mmShrdPrm.regMode );
785 #else
786 /* restore former registration mode or set new one */
787 psaMM_SetRegMode ( mmShrdPrm.regMode );
788 #endif
789 }
790
791 mmEntStat.curCmd = AT_CMD_NONE;
792
793 R_AT( RAT_CME, mmEntStat.entOwn )
794 ( at_cmd_id, cmhMM_GetNregCMEStat());
795
796 /* log result */
797 cmh_logRslt ( mmEntStat.entOwn, RAT_CME, mmEntStat.curCmd, -1,
798 BS_SPEED_NotPresent,cmhMM_GetNregCMEStat() );
799
800 }
801
802
803 /*==== EOF ========================================================*/
804