FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/cmh_mms.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_MMS | |
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 provides the set functions related to the | |
18 | protocol stack adapter for mobility management. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_MMS_C | |
23 #define CMH_MMS_C | |
24 #endif | |
25 | |
26 #include "config.h" | |
27 #include "fixedconf.h" | |
28 #include "condat-features.h" | |
29 #include "aci_conf.h" | |
30 | |
31 #include "aci_all.h" | |
32 | |
33 /*==== INCLUDES ===================================================*/ | |
34 #include "aci_cmh.h" | |
35 | |
36 #include "rtc.h" | |
37 | |
38 #ifdef DTI | |
39 #include "dti.h" /* functionality of the dti library */ | |
40 #include "dti_conn_mng.h" | |
41 #endif | |
42 | |
43 #include "aci_mem.h" | |
44 | |
45 #ifdef FAX_AND_DATA | |
46 /* #include "aci_fd.h" */ | |
47 #endif /* of #ifdef FAX_AND_DATA */ | |
48 | |
49 #include "psa.h" | |
50 #include "psa_sim.h" | |
51 #include "psa_mm.h" | |
52 #include "cmh.h" | |
53 #include "cmh_sim.h" | |
54 #include "cmh_mm.h" | |
55 | |
56 #include "psa_cc.h" | |
57 #include "cmh_cc.h" | |
58 | |
59 #ifdef GPRS | |
60 #include "gaci.h" | |
61 #include "gaci_cmh.h" | |
62 #include "psa_gmm.h" | |
63 #include "cmh_gmm.h" | |
64 #endif | |
65 | |
66 #ifndef _SIMULATION_ | |
67 /***************************/ | |
68 /* TEMPORARY until NVM */ | |
69 /* just to get FFs !!!! */ | |
70 #ifndef GPRS | |
71 #define DONT_LET_FFSH_DEF_GPRS | |
72 #endif | |
73 | |
74 #include "../../services/ffs/ffs.h" | |
75 | |
76 #include "rx.h" | |
77 | |
78 #include "rtc.h" | |
79 | |
80 #ifdef FF_TIMEZONE | |
81 #include "rv/rv_general.h" | |
82 #include "rtc/rtc_tz.h" | |
83 #endif | |
84 | |
85 /* check whether latter has defined GPRS !!! */ | |
86 #ifdef DONT_LET_FFSH_DEF_GPRS | |
87 #undef GPRS | |
88 #endif | |
89 | |
90 #undef DONT_LET_FFSH_DEF_GPRS | |
91 /***************************/ | |
92 #endif /* _SIMULATION_ */ | |
93 | |
94 | |
95 /*==== CONSTANTS ==================================================*/ | |
96 | |
97 /*==== EXPORT =====================================================*/ | |
98 | |
99 /*==== VARIABLES ==================================================*/ | |
100 | |
101 /*==== FUNCTIONS ==================================================*/ | |
102 EXTERN void wake_up_rr (void); | |
103 | |
104 #ifdef TI_PS_FF_AT_P_CMD_CTREG | |
105 EXTERN BOOL cl_shrd_set_treg_val(T_TREG *treg); | |
106 #endif /* TI_PS_FF_AT_P_CMD_CTREG */ | |
107 | |
108 #ifndef _SIMULATION_ | |
109 LOCAL void rx_Cb (drv_SignalID_Type *signal_params); | |
110 LOCAL UCHAR rx_sequence_Cb (void* arg); | |
111 #endif /* _SIMULATION_ */ | |
112 | |
113 | |
114 /* | |
115 +--------------------------------------------------------------------+ | |
116 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
117 | STATE : code ROUTINE : sAT_PercentBAND | | |
118 +--------------------------------------------------------------------+ | |
119 | |
120 PURPOSE : This is the functional counterpart to the %BAND AT command | |
121 which is responsible for configuring the way the mobile | |
122 deals with multiband. | |
123 | |
124 <bandMode>: band switch mode. | |
125 <bandType>: band selection by user: coded in bitfield as following. | |
126 Bit set to 1 if band is set, 0 otherwise... | |
127 | |
128 BITS: | 5 | 4 | 3 | 2 | 1 | | |
129 | GSM850 | E_GSM | GSM1900 | GSM1800 | GSM900 | | |
130 */ | |
131 | |
132 GLOBAL T_ACI_RETURN sAT_PercentBAND(T_ACI_CMD_SRC srcId, | |
133 T_ACI_BAND_MODE bandMode, | |
134 UBYTE bandType) | |
135 { | |
136 UBYTE ManufacturerBands; | |
137 UBYTE ubyte_dummy; | |
138 | |
139 TRACE_FUNCTION("sAT_PercentBAND()"); | |
140 | |
141 /* check command source */ | |
142 if(!cmh_IsVldCmdSrc (srcId)) | |
143 { | |
144 return( AT_FAIL ); | |
145 } | |
146 | |
147 /* Check Parameter bandMode */ | |
148 switch( bandMode ) | |
149 { | |
150 case( BAND_MODE_Auto ): | |
151 bandType = 0x00; /* scan all */ | |
152 break; | |
153 | |
154 case( BAND_MODE_Manual ): | |
155 /* Check Parameter bandType */ | |
156 if(cmhMM_getBandSettings(&ubyte_dummy, &ManufacturerBands)) | |
157 { | |
158 TRACE_FUNCTION("cmhMM_getBandSettings: data reading from FFS successful"); | |
159 } | |
160 else | |
161 { | |
162 TRACE_FUNCTION("cmhMM_getBandSettings: data reading from FFS failed"); | |
163 } | |
164 | |
165 | |
166 if( !cmhMM_isBandAllowed(bandType, ManufacturerBands) ) | |
167 { | |
168 TRACE_EVENT_P1("Band combination %d is not supported by this hardware", bandType); | |
169 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
170 return( AT_FAIL ); | |
171 } | |
172 break; | |
173 | |
174 default: | |
175 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
176 return( AT_FAIL ); | |
177 } | |
178 | |
179 if( !cmhMM_writeSetBand(bandType) ) | |
180 return(AT_FAIL); | |
181 | |
182 /* switch off radio */ | |
183 if( CFUNfun EQ CFUN_FUN_Full ) | |
184 { | |
185 /* if mobile is on, proceed a soft switch off | |
186 and then switch back on */ | |
187 mmEntStat.curCmd = AT_CMD_BAND; | |
188 | |
189 return( sAT_PlusCFUN( srcId, | |
190 CFUN_FUN_Disable_TX_RX_RF, | |
191 CFUN_RST_NotPresent) ); | |
192 } | |
193 else | |
194 { | |
195 /* new configuration has been written to Flash and that's it ! */ | |
196 return( AT_CMPL); | |
197 } | |
198 } | |
199 | |
200 /* | |
201 +--------------------------------------------------------------------+ | |
202 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
203 | STATE : code ROUTINE : sAT_PlusCOPS | | |
204 +--------------------------------------------------------------------+ | |
205 | |
206 PURPOSE : This is the functional counterpart to the +COPS AT command | |
207 which is responsible for selection and deselection of an | |
208 network operator. | |
209 | |
210 <mode>: registration mode. | |
211 <format>: format of operator selection | |
212 <oper>: operator string | |
213 */ | |
214 | |
215 GLOBAL T_ACI_RETURN sAT_PlusCOPS ( T_ACI_CMD_SRC srcId, | |
216 T_ACI_COPS_MOD mode, | |
217 T_ACI_COPS_FRMT format, | |
218 CHAR * oper ) | |
219 { | |
220 return(sat_Plus_Percent_COPS(srcId, | |
221 mode, | |
222 format, | |
223 oper, | |
224 AT_CMD_COPS)); | |
225 } | |
226 | |
227 | |
228 /* | |
229 +--------------------------------------------------------------------+ | |
230 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
231 | STATE : code ROUTINE : sAT_PercentCOPS | | |
232 +--------------------------------------------------------------------+ | |
233 | |
234 PURPOSE : This is the functional counterpart to the %COPS AT command | |
235 which is responsible for selection and deselection of an | |
236 network operator. %COPS will add, in principle, | |
237 the following functionality to the standard AT command +COPS: | |
238 | |
239 -Possibility to query the "service status" in which the phone is currently registered; | |
240 the possible values will be "full service", "limited service" or "no service". | |
241 -Possibility to select the "last registered" operator using %COPS=1. | |
242 | |
243 | |
244 <mode>: registration mode. | |
245 <format>: format of operator selection | |
246 <oper>: operator string | |
247 */ | |
248 | |
249 GLOBAL T_ACI_RETURN sAT_PercentCOPS ( T_ACI_CMD_SRC srcId, | |
250 T_ACI_COPS_MOD mode, | |
251 T_ACI_COPS_FRMT format, | |
252 CHAR * oper ) | |
253 { | |
254 return(sat_Plus_Percent_COPS(srcId, | |
255 mode, | |
256 format, | |
257 oper, | |
258 AT_CMD_P_COPS)); | |
259 } | |
260 | |
261 #ifdef TI_PS_FF_AT_CMD_WS46 | |
262 /* | |
263 +--------------------------------------------------------------------+ | |
264 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
265 | STATE : code ROUTINE : sAT_PlusWS46 | | |
266 +--------------------------------------------------------------------+ | |
267 | |
268 PURPOSE : This is the functional counterpart to the +WS46 AT | |
269 command which is responsible to select wireless network. | |
270 | |
271 <mode>: network mode. | |
272 */ | |
273 | |
274 GLOBAL T_ACI_RETURN sAT_PlusWS46 (T_ACI_CMD_SRC srcId, | |
275 T_ACI_WS46_MOD mode ) | |
276 { | |
277 | |
278 TRACE_FUNCTION ("sAT_PlusWS46()"); | |
279 | |
280 /* | |
281 *------------------------------------------------------------------- | |
282 * process the value parameter | |
283 *------------------------------------------------------------------- | |
284 */ | |
285 if( mode NEQ ACI_NumParmNotPresent ) | |
286 { | |
287 if( mode NEQ WS46_MOD_Gsm ) | |
288 { | |
289 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
290 return( AT_FAIL ); | |
291 } | |
292 } | |
293 | |
294 return( AT_CMPL ); | |
295 } | |
296 #endif /* TI_PS_FF_AT_CMD_WS46 */ | |
297 | |
298 | |
299 /* | |
300 +--------------------------------------------------------------------+ | |
301 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
302 | STATE : code ROUTINE : tAT_PercentALS | | |
303 +--------------------------------------------------------------------+ | |
304 | |
305 PURPOSE : This is the functional counterpart to the %ALS AT command | |
306 which is responsible for testing if ALS mode is present. | |
307 (always if an E-Plus Sim-card is detected or the if the CSP | |
308 field is present on the inserted Sim-card and enables | |
309 ALS mode). | |
310 | |
311 | |
312 */ | |
313 GLOBAL T_ACI_RETURN tAT_PercentALS ( T_ACI_CMD_SRC srcId, T_ACI_ALS_MOD *ALSmode ) | |
314 | |
315 { | |
316 TRACE_FUNCTION ("tAT_PercentALS()"); | |
317 | |
318 if( !cmh_IsVldCmdSrc( srcId ) ) | |
319 { | |
320 return( AT_FAIL ); | |
321 } | |
322 | |
323 #if defined(FF_BAT) && defined(_SIMULATION_) | |
324 /* test command %ALS is not used anymore by BAT.lib, change CMD MODE only for host tests */ | |
325 if(aci_cmd_src_mode_get(srcId) EQ CMD_MODE_BAT) | |
326 { | |
327 aci_cmd_src_mode_set((UBYTE)srcId, CMD_MODE_ATI); | |
328 } | |
329 #endif /* FF_BAT && _SIMULATION_ */ | |
330 | |
331 /* E-Plus SIM-Card inserted (mcc=0x262, mnc=0x03) ? */ | |
332 if (cmhSIM_plmn_is_hplmn(0x262, 0x03F)) | |
333 { | |
334 *ALSmode = (T_ACI_ALS_MOD)(ALS_MOD_SPEECH | ALS_MOD_AUX_SPEECH); | |
335 return (AT_CMPL); | |
336 } | |
337 | |
338 simEntStat.curCmd = AT_CMD_ALS; | |
339 simShrdPrm.owner = (T_OWN)srcId; | |
340 simEntStat.entOwn = srcId; | |
341 | |
342 ccShrdPrm.als_cmd = ALS_CMD_TEST; | |
343 *ALSmode = ALS_MOD_NOTPRESENT; | |
344 | |
345 cmhCC_checkALS_Support(); | |
346 return (AT_EXCT); | |
347 } | |
348 | |
349 | |
350 | |
351 /* | |
352 +--------------------------------------------------------------------+ | |
353 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
354 | STATE : code ROUTINE : sAT_PercentNRG | | |
355 +--------------------------------------------------------------------+ | |
356 | |
357 PURPOSE : This is the functional counterpart to the %NRG AT command | |
358 which is responsible for the setting of registration mode | |
359 and service mode. | |
360 | |
361 <regMode>: registration mode. | |
362 <srvMode>: service mode. | |
363 */ | |
364 | |
365 GLOBAL T_ACI_RETURN sAT_PercentNRG( T_ACI_CMD_SRC srcId, | |
366 T_ACI_NRG_RGMD regMode, | |
367 T_ACI_NRG_SVMD srvMode, | |
368 T_ACI_NRG_FRMT oprFrmt, | |
369 CHAR *opr) | |
370 { | |
371 T_MM_CMD_PRM * pMMCmdPrm; /* points to MM command parameters */ | |
372 | |
373 | |
374 TRACE_FUNCTION ("sAT_PercentNRG()"); | |
375 | |
376 | |
377 pMMCmdPrm = &cmhPrm[srcId].mmCmdPrm; | |
378 | |
379 | |
380 /* | |
381 *------------------------------------------------------------------- | |
382 * check MM entity status | |
383 *------------------------------------------------------------------- | |
384 */ | |
385 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
386 | |
387 return( AT_BUSY ); | |
388 | |
389 | |
390 | |
391 | |
392 /* | |
393 *------------------------------------------------------------------- | |
394 * process the oprFrmt,svrMode and regMode parameters | |
395 *------------------------------------------------------------------- | |
396 */ | |
397 switch( oprFrmt ) | |
398 { | |
399 case( NRG_FRMT_NotPresent ): | |
400 oprFrmt = pMMCmdPrm -> NRGoprFrmt; | |
401 break; | |
402 case( NRG_FRMT_Long ): | |
403 case( NRG_FRMT_Short ): | |
404 case( NRG_FRMT_Numeric ): | |
405 break; | |
406 default: | |
407 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
408 return( AT_FAIL ); | |
409 } | |
410 | |
411 if( srvMode EQ NRG_SVMD_NotPresent ) | |
412 srvMode=(T_ACI_NRG_SVMD)pMMCmdPrm->NRGregMode; | |
413 | |
414 if( regMode EQ NRG_RGMD_NotPresent ) | |
415 regMode=pMMCmdPrm->NRGregMode; | |
416 | |
417 | |
418 | |
419 /* Set the value of the current command executed */ | |
420 mmEntStat.curCmd = AT_CMD_NRG; | |
421 | |
422 | |
423 return cmhMM_OperatorSelect(srcId,regMode,srvMode,oprFrmt,opr); | |
424 } | |
425 | |
426 /* | |
427 +--------------------------------------------------------------------+ | |
428 | PROJECT : ACI/MMI MODULE : CMH_MMS | | |
429 | STATE : code ROUTINE : sAT_PercentCSQ | | |
430 +--------------------------------------------------------------------+ | |
431 | |
432 PURPOSE : This is the function for Signal Quality | |
433 Param: | |
434 srcId: command ID; | |
435 CSQmode: enable(1) or disable(0) CSQ | |
436 | |
437 Shen,Chao | |
438 Juni.13th, 2003 | |
439 */ | |
440 | |
441 GLOBAL T_ACI_RETURN sAT_PercentCSQ( T_ACI_CMD_SRC srcId, | |
442 T_ACI_CSQ_MODE CSQmode) | |
443 { | |
444 | |
445 T_MM_CMD_PRM * pMMCmdPrm; /* points to MM command parameters */ | |
446 | |
447 if( !cmh_IsVldCmdSrc( srcId ) ) | |
448 { | |
449 return( AT_FAIL ); | |
450 } | |
451 | |
452 pMMCmdPrm = &cmhPrm[srcId].mmCmdPrm; | |
453 | |
454 switch(CSQmode) | |
455 { | |
456 case( CSQ_Enable): | |
457 { | |
458 if ( pMMCmdPrm->CSQworkStat EQ CSQ_Enable ) | |
459 { | |
460 TRACE_EVENT("CSQ is already enabled"); | |
461 } | |
462 else | |
463 { | |
464 cmhPrm[srcId].mmCmdPrm.CSQworkStat = CSQ_Enable; | |
465 if( (pMMCmdPrm->sIndicationParam.sMmCINDSettings.sCindSignalParam <= CIND_SIGNAL_INDICATOR_LVL0) AND | |
466 (pMMCmdPrm->sIndicationParam.sMmCMERSettings.sCmerIndParam NEQ CMER_INDICATOR_2) ) | |
467 { /* rx_Init() not yet called from CIND service */ | |
468 #ifndef _SIMULATION_ | |
469 rx_Init(rx_Cb); | |
470 #endif /* _SIMULATION_ */ | |
471 } | |
472 } | |
473 break; | |
474 } | |
475 | |
476 case(CSQ_Disable): | |
477 { | |
478 if ( pMMCmdPrm->CSQworkStat EQ CSQ_Enable ) | |
479 { | |
480 cmhPrm[srcId].mmCmdPrm.CSQworkStat = CSQ_Disable; | |
481 if( (pMMCmdPrm->sIndicationParam.sMmCINDSettings.sCindSignalParam <= CIND_SIGNAL_INDICATOR_LVL0) && | |
482 (pMMCmdPrm->sIndicationParam.sMmCMERSettings.sCmerIndParam NEQ CMER_INDICATOR_2) ) | |
483 { /* CIND service inactive -> no more reading the signal strength necessary */ | |
484 #ifndef _SIMULATION_ | |
485 rx_Init(NULL); | |
486 #endif /* _SIMULATION_ */ | |
487 } | |
488 } | |
489 break; | |
490 } | |
491 default: | |
492 return(AT_FAIL); | |
493 } | |
494 return( AT_CMPL); | |
495 } | |
496 | |
497 | |
498 /* | |
499 +--------------------------------------------------------------------+ | |
500 | PROJECT : ACI/MMI MODULE : CMH_MMS | | |
501 | STATE : code ROUTINE : sAT_Plus CIND | | |
502 +--------------------------------------------------------------------+ | |
503 | |
504 PURPOSE : This is the function to setup the indications toward | |
505 terminal | |
506 */ | |
507 | |
508 GLOBAL T_ACI_RETURN sAT_PlusCIND( T_ACI_CMD_SRC srcId, | |
509 T_ACI_CIND_SIGNAL_TYPE sCindSgnalSettings, | |
510 T_ACI_CIND_SMSFULL_TYPE sCindSmsFullSettings ) | |
511 { | |
512 T_ACI_MM_CIND_VAL_TYPE *pMMCindPrm; | |
513 T_ACI_MM_CMER_VAL_TYPE *pMMCmerPrm; | |
514 T_ACI_CIND_SIGNAL_TYPE sOldSignalSetting; | |
515 | |
516 TRACE_EVENT( "sAT_PlusCIND()" ); | |
517 | |
518 if( !cmh_IsVldCmdSrc( srcId ) ) | |
519 { | |
520 return( AT_FAIL ); | |
521 } | |
522 | |
523 pMMCindPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCINDSettings); | |
524 pMMCmerPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCMERSettings); | |
525 | |
526 if( sCindSgnalSettings EQ CIND_SIGNAL_INDICATOR_INVALID OR | |
527 sCindSmsFullSettings EQ CIND_SMSFULL_INDICATOR_INVALID ) | |
528 { | |
529 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
530 return( AT_FAIL ); | |
531 } | |
532 | |
533 sOldSignalSetting = pMMCindPrm->sCindSignalParam; | |
534 pMMCindPrm->sCindSignalParam = sCindSgnalSettings; | |
535 pMMCindPrm->sCindSmsFullParam = sCindSmsFullSettings; | |
536 | |
537 /* ----------------- signal strength setting part ------------------------ */ | |
538 if( sOldSignalSetting <= CIND_SIGNAL_INDICATOR_LVL0 ) | |
539 { /* the old (previews) signal setting is off */ | |
540 if( (sCindSgnalSettings > CIND_SIGNAL_INDICATOR_LVL0) AND | |
541 (cmhPrm[srcId].mmCmdPrm.CSQworkStat EQ CSQ_Disable) AND | |
542 (pMMCmerPrm->sCmerIndParam NEQ CMER_INDICATOR_2) ) | |
543 { /* greather LVL0 --> rx_Init must be initialize... */ | |
544 #ifndef _SIMULATION_ | |
545 rx_Init(rx_Cb); | |
546 #endif /* _SIMULATION_ */ | |
547 } | |
548 } | |
549 else | |
550 { /* the old (previews) signal setting is on */ | |
551 if( (sCindSgnalSettings EQ CIND_SIGNAL_INDICATOR_LVL0) AND | |
552 (cmhPrm[srcId].mmCmdPrm.CSQworkStat EQ CSQ_Disable) AND | |
553 (pMMCmerPrm->sCmerIndParam NEQ CMER_INDICATOR_2) ) | |
554 { /* LVL0 --> rx_Init must be reset... */ | |
555 #ifndef _SIMULATION_ | |
556 rx_Init(NULL); | |
557 #endif /* _SIMULATION_ */ | |
558 } | |
559 } | |
560 return(AT_CMPL); | |
561 } | |
562 | |
563 /* | |
564 +--------------------------------------------------------------------+ | |
565 | PROJECT : ACI/MMI MODULE : CMH_MMS | | |
566 | STATE : code ROUTINE : sAT_Plus CMER | | |
567 +--------------------------------------------------------------------+ | |
568 | |
569 PURPOSE : This is the function to setup the buffer control for the | |
570 indications toward terminal equipment | |
571 */ | |
572 | |
573 GLOBAL T_ACI_RETURN sAT_PlusCMER( T_ACI_CMD_SRC srcId, | |
574 T_ACI_CMER_MODE_TYPE sCmerModeSettings, | |
575 T_ACI_CMER_IND_TYPE sCmerIndicationSettings, | |
576 T_ACI_CMER_BFR_TYPE sCmerBfrSettings ) | |
577 { | |
578 T_ACI_MM_CMER_VAL_TYPE *pMMCmerPrm; | |
579 T_ACI_MM_CIND_VAL_TYPE *pMMCindPrm; | |
580 T_ACI_CMER_IND_TYPE sOldCmerIndSetting; | |
581 | |
582 TRACE_EVENT( "sAT_PlusCMER()" ); | |
583 | |
584 if( !cmh_IsVldCmdSrc( srcId ) ) | |
585 { | |
586 return( AT_FAIL ); | |
587 } | |
588 | |
589 pMMCmerPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCMERSettings); | |
590 pMMCindPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCINDSettings); | |
591 | |
592 sOldCmerIndSetting = pMMCmerPrm->sCmerIndParam; | |
593 if( sCmerModeSettings NEQ CMER_MODE_INVALID ) | |
594 { | |
595 pMMCmerPrm->sCmerModeParam = sCmerModeSettings; | |
596 } | |
597 if( sCmerIndicationSettings NEQ CMER_INDICATOR_INVALID ) | |
598 { | |
599 pMMCmerPrm->sCmerIndParam = sCmerIndicationSettings; | |
600 } | |
601 if( sCmerBfrSettings NEQ CMER_BFR_INVALID ) | |
602 { | |
603 pMMCmerPrm->sCmerBfrParam = sCmerBfrSettings; | |
604 } | |
605 | |
606 /* ---------------- maybe switch on all indication settings ------------- */ | |
607 if( sOldCmerIndSetting NEQ CMER_INDICATOR_2 ) | |
608 { /* the old (previews) indicator setting is 'off' */ | |
609 if( (sCmerIndicationSettings EQ CMER_INDICATOR_2) AND | |
610 (cmhPrm[srcId].mmCmdPrm.CSQworkStat EQ CSQ_Disable) AND | |
611 (pMMCindPrm->sCindSignalParam <= CIND_SIGNAL_INDICATOR_LVL0) ) | |
612 { /* all indications must be show --> rx_Init must be initialize... */ | |
613 #ifndef _SIMULATION_ | |
614 rx_Init(rx_Cb); | |
615 #endif /* _SIMULATION_ */ | |
616 } | |
617 } | |
618 else | |
619 { /* the old (previews) signal setting is on */ | |
620 if( (sCmerIndicationSettings NEQ CMER_INDICATOR_2) AND | |
621 (cmhPrm[srcId].mmCmdPrm.CSQworkStat EQ CSQ_Disable) AND | |
622 (pMMCindPrm->sCindSignalParam <= CIND_SIGNAL_INDICATOR_LVL0) ) | |
623 { /* LVL0 --> rx_Init must be reset... */ | |
624 #ifndef _SIMULATION_ | |
625 rx_Init(NULL); | |
626 #endif /* _SIMULATION_ */ | |
627 } | |
628 } | |
629 | |
630 return(AT_CMPL); | |
631 } | |
632 | |
633 | |
634 /* | |
635 +--------------------------------------------------------------------+ | |
636 | PROJECT : ACI/MMI MODULE : CMH_MMS | | |
637 | STATE : code ROUTINE : sAT_PercentCSQ | | |
638 +--------------------------------------------------------------------+ | |
639 | |
640 PURPOSE : This is the callback function for Signal Quality | |
641 Param: | |
642 signal_params callback function name | |
643 | |
644 Shen,Chao | |
645 Juni.13th, 2003 | |
646 */ | |
647 | |
648 #ifndef _SIMULATION_ | |
649 LOCAL void rx_Cb (drv_SignalID_Type *signal_params) | |
650 { | |
651 rx_Status_Type *para = NULL; | |
652 | |
653 TRACE_EVENT("rx_Cb()"); | |
654 | |
655 ACI_MALLOC(para,sizeof(rx_Status_Type)); | |
656 | |
657 para->actLevel = ((rx_Status_Type *) signal_params->UserData)->actLevel; | |
658 para->gsmLevel = ((rx_Status_Type *) signal_params->UserData)->gsmLevel; | |
659 para->rxQuality = ((rx_Status_Type *) signal_params->UserData)->rxQuality; | |
660 #ifdef FF_PS_RSSI | |
661 para->min_access_level = ((rx_Status_Type *) signal_params->UserData)->min_access_level; | |
662 #endif | |
663 | |
664 if (!cmh_set_delayed_call (rx_sequence_Cb, (void *)para)) | |
665 { | |
666 /* Implements Measure#32: Row 990 */ | |
667 TRACE_EVENT("Error, can not set the delayed resequence callback for AT_CMD_CSQ"); | |
668 ACI_MFREE(para); | |
669 return ; | |
670 } | |
671 | |
672 TRACE_EVENT("delayed requence call back requested: 100 ms"); | |
673 cmh_start_delayed_call (20); | |
674 | |
675 return; | |
676 | |
677 } | |
678 #endif /* _SIMULATION_ */ | |
679 | |
680 /* | |
681 +--------------------------------------------------------------------+ | |
682 | PROJECT : ACI/MMI MODULE : CMH_MMS | | |
683 | STATE : code ROUTINE : sAT_PercentCSQ | | |
684 +--------------------------------------------------------------------+ | |
685 | |
686 PURPOSE : This is the delayed callback function for Signal Quality | |
687 Shen,Chao | |
688 Juni.13th, 2003 | |
689 */ | |
690 #ifndef _SIMULATION_ | |
691 LOCAL UCHAR rx_sequence_Cb (void* arg) | |
692 { | |
693 int i; | |
694 UBYTE rssi; | |
695 UBYTE ber; | |
696 #ifdef FF_PS_RSSI | |
697 UBYTE min_access_level; | |
698 #endif | |
699 T_ACI_CIND_SIGNAL_TYPE sSignalStrength; | |
700 T_ACI_MM_CIND_VAL_TYPE sIndValues; | |
701 | |
702 struct rx_Status_Type* tmp_p = (struct rx_Status_Type*) arg; | |
703 | |
704 TRACE_EVENT("rx_sequence_Cb()"); | |
705 | |
706 sIndValues.sCindSmsFullParam = CIND_SMSFULL_INDICATOR_INVALID; | |
707 | |
708 if ( tmp_p->gsmLevel EQ 0xFF OR tmp_p->gsmLevel EQ 0 ) | |
709 { | |
710 rssi = ACI_RSSI_FAULT; | |
711 sSignalStrength = CIND_SIGNAL_INDICATOR_LVL0; | |
712 } | |
713 else if ( tmp_p->gsmLevel > 59 ) | |
714 { | |
715 rssi = 31; | |
716 } | |
717 else | |
718 { | |
719 rssi = ( tmp_p->gsmLevel / 2 ) + 2; | |
720 } | |
721 | |
722 if ( tmp_p->rxQuality EQ RX_QUAL_UNAVAILABLE ) | |
723 { | |
724 ber = ACI_BER_FAULT; | |
725 } | |
726 else | |
727 { | |
728 ber = tmp_p->rxQuality; | |
729 } | |
730 | |
731 #ifdef FF_PS_RSSI | |
732 if ( tmp_p->min_access_level EQ RX_ACCE_UNAVAILABLE) | |
733 { | |
734 min_access_level = ACI_MIN_RXLEV_FAULT; | |
735 } | |
736 else | |
737 { | |
738 min_access_level = tmp_p->min_access_level; | |
739 } | |
740 #endif | |
741 | |
742 for( i = CMD_SRC_LCL; i < CMD_SRC_MAX; i++) | |
743 { | |
744 if (cmhPrm[i].mmCmdPrm.CSQworkStat EQ CSQ_Enable) | |
745 { | |
746 #ifdef FF_PS_RSSI | |
747 R_AT (RAT_CSQ, (T_ACI_CMD_SRC)i) (rssi, ber, tmp_p->actLevel, min_access_level); | |
748 #else | |
749 R_AT (RAT_CSQ, (T_ACI_CMD_SRC)i) (rssi,ber,tmp_p->actLevel); | |
750 #endif | |
751 } | |
752 /* ==================== process the service of +CIEV ========================== */ | |
753 sSignalStrength = CIND_SIGNAL_INDICATOR_LVL0; | |
754 if( tmp_p->gsmLevel >= 11 ) { sSignalStrength = CIND_SIGNAL_INDICATOR_LVL1; }; | |
755 if( tmp_p->gsmLevel >= 21 ) { sSignalStrength = CIND_SIGNAL_INDICATOR_LVL2; }; | |
756 if( tmp_p->gsmLevel >= 32 ) { sSignalStrength = CIND_SIGNAL_INDICATOR_LVL3; }; | |
757 if( tmp_p->gsmLevel >= 42 ) { sSignalStrength = CIND_SIGNAL_INDICATOR_LVL4; }; | |
758 if( tmp_p->gsmLevel >= 52 ) { sSignalStrength = CIND_SIGNAL_INDICATOR_LVL5; }; | |
759 sIndValues.sCindSignalParam = sSignalStrength; | |
760 sIndValues.sCindSmsFullParam = CIND_SMSFULL_INDICATOR_INVALID; | |
761 if( ((cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCINDSettings.sCindSignalParam > CIND_SIGNAL_INDICATOR_LVL0) AND | |
762 (cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCINDSettings.sCindSignalParam >= sIndValues.sCindSignalParam) AND | |
763 (cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings.sCmerIndParam EQ CMER_INDICATOR_2)) OR | |
764 ((cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCINDSettings.sCindSignalParam < sIndValues.sCindSignalParam) AND | |
765 (cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings.sCmerIndParam EQ CMER_INDICATOR_1)) ) | |
766 { | |
767 TRACE_EVENT("send +CIEV"); | |
768 R_AT (RAT_CIEV, (T_ACI_CMD_SRC)i) ( sIndValues, cmhPrm[i].mmCmdPrm.sIndicationParam.sMmCMERSettings ); | |
769 } | |
770 } | |
771 | |
772 if (!cmh_set_delayed_call (NULL, NULL)) | |
773 { /* reset this callback pointer -> will be set again via rx_Cb */ | |
774 /* Implements Measure#32: Row 991 */ | |
775 TRACE_EVENT("Can not reset the delayed resequence callback for AT_CMD_CSQ"); | |
776 return FALSE; | |
777 } | |
778 ACI_MFREE(tmp_p); | |
779 | |
780 return TRUE; | |
781 } | |
782 #endif /* _SIMULATION_ */ | |
783 | |
784 /* | |
785 +--------------------------------------------------------------------+ | |
786 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
787 | STATE : code ROUTINE : sAT_PercentCHPL | | |
788 +--------------------------------------------------------------------+ | |
789 | |
790 PURPOSE : This is the functional counterpart to the %CHPL AT command | |
791 which will return the list of entries in EF_HPLMNwAcT. | |
792 | |
793 <mode>: registration mode. | |
794 <format>: format of operator selection | |
795 <oper>: operator string | |
796 */ | |
797 | |
798 GLOBAL T_ACI_RETURN sAT_PercentCHPL ( T_ACI_CMD_SRC srcId, | |
799 T_ACI_OPER_NTRY *oper ) | |
800 { | |
801 T_OPER_ENTRY plmnDesc; | |
802 BOOL found; | |
803 SHORT mccBuf; | |
804 SHORT mncBuf; | |
805 | |
806 TRACE_FUNCTION ("sAT_PercentCHPL()"); | |
807 | |
808 /* | |
809 *------------------------------------------------------------------- | |
810 * check whether SIM is ready | |
811 *------------------------------------------------------------------- | |
812 */ | |
813 if (!cmhSIM_CheckSimStatus ()) | |
814 { | |
815 return AT_FAIL; | |
816 } | |
817 | |
818 /* | |
819 *------------------------------------------------------------------- | |
820 * check command source | |
821 *------------------------------------------------------------------- | |
822 */ | |
823 if(!cmh_IsVldCmdSrc (srcId)) | |
824 { | |
825 TRACE_EVENT_P1("sAT_PercentCHPL(): Invalid source: %d", srcId); | |
826 return( AT_FAIL ); | |
827 } | |
828 if(!cmhMM_GetActingHPLMN(&mccBuf, &mncBuf))/* Enhancement Acting HPLMN*/ | |
829 { | |
830 cmhSIM_GetHomePLMN (&mccBuf, &mncBuf); | |
831 } | |
832 | |
833 found = cmhMM_FindPLMN (&plmnDesc, mccBuf, mncBuf, NOT_PRESENT_16BIT, FALSE); | |
834 if (!found) | |
835 { | |
836 TRACE_EVENT_P2("sAT_PercentCHPL(): MCC/MN not found in database (0x%X, 0x%X", mccBuf, mncBuf); | |
837 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal); | |
838 return( AT_FAIL ); | |
839 } | |
840 | |
841 strcpy (oper->longName, plmnDesc.longName); | |
842 strcpy (oper->shrtName, plmnDesc.shrtName); | |
843 oper->mcc = plmnDesc.mcc; | |
844 oper->mnc = plmnDesc.mnc; | |
845 oper->pnn = plmnDesc.pnn; | |
846 oper->long_len = plmnDesc.long_len; | |
847 oper->shrt_len = plmnDesc.shrt_len; | |
848 | |
849 return (AT_CMPL); | |
850 } | |
851 | |
852 /* | |
853 +--------------------------------------------------------------------+ | |
854 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
855 | STATE : code ROUTINE : sAT_PlusCTZR | | |
856 +--------------------------------------------------------------------+ | |
857 | |
858 PURPOSE : This is the functional counterpart to the +CTZR AT command | |
859 which will set the status of CTZRmode, indicating whether time | |
860 zone change rep[orting is enabled or disabled. | |
861 | |
862 <on/off>: Indicates whether time zone reporting is enabled or disabled. | |
863 */ | |
864 | |
865 GLOBAL T_ACI_RETURN sAT_PlusCTZR ( T_ACI_CMD_SRC srcId, | |
866 T_ACI_CTZR_MODE mode) | |
867 { | |
868 TRACE_FUNCTION ("sAT_PlusCTZR()"); | |
869 | |
870 /* | |
871 *------------------------------------------------------------------- | |
872 * check command source | |
873 *------------------------------------------------------------------- | |
874 */ | |
875 if(!cmh_IsVldCmdSrc (srcId)) | |
876 { | |
877 TRACE_EVENT_P1("sAT_PlusCTZR(): Invalid source: %d", srcId); | |
878 return( AT_FAIL ); | |
879 } | |
880 | |
881 /* | |
882 *------------------------------------------------------------------- | |
883 * process the mode parameter | |
884 *------------------------------------------------------------------- | |
885 */ | |
886 switch (mode) | |
887 { | |
888 case CTZR_MODE_OFF: | |
889 case CTZR_MODE_ON: | |
890 cmhPrm[srcId].mmCmdPrm.CTZRMode = mode; | |
891 break; | |
892 | |
893 default: | |
894 TRACE_EVENT_P1("sAT_PlusCTZR(): Invalid mode: %d", mode); | |
895 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
896 return( AT_FAIL ); | |
897 } | |
898 | |
899 return( AT_CMPL ); | |
900 } | |
901 | |
902 | |
903 /* | |
904 +--------------------------------------------------------------------+ | |
905 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
906 | STATE : code ROUTINE : sAT_PlusCTZU | | |
907 +--------------------------------------------------------------------+ | |
908 | |
909 PURPOSE : This is the functional counterpart to the +CTZU AT command | |
910 which will set the status of CTZUmode, indicating whether automatic time | |
911 zone update is enabled or disabled. | |
912 | |
913 <on/off>: Indicates whether automatic time zone update is enabled or disabled. | |
914 */ | |
915 | |
916 GLOBAL T_ACI_RETURN sAT_PlusCTZU ( T_ACI_CMD_SRC srcId, | |
917 T_ACI_CTZU_MODE mode) | |
918 { | |
919 TRACE_FUNCTION ("sAT_PlusCTZU()"); | |
920 | |
921 /* | |
922 *------------------------------------------------------------------- | |
923 * check command source | |
924 *------------------------------------------------------------------- | |
925 */ | |
926 if(!cmh_IsVldCmdSrc (srcId)) | |
927 { | |
928 TRACE_EVENT_P1("sAT_PlusCTZU(): Invalid source: %d", srcId); | |
929 return( AT_FAIL ); | |
930 } | |
931 | |
932 /* | |
933 *------------------------------------------------------------------- | |
934 * process the mode parameter | |
935 *------------------------------------------------------------------- | |
936 */ | |
937 switch (mode) | |
938 { | |
939 case CTZU_MODE_OFF: | |
940 case CTZU_MODE_ON: | |
941 cmhPrm[srcId].mmCmdPrm.CTZUMode = mode; | |
942 break; | |
943 | |
944 default: | |
945 TRACE_EVENT_P1("sAT_PlusCTZU(): Invalid mode: %d", mode); | |
946 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
947 return( AT_FAIL ); | |
948 } | |
949 | |
950 return( AT_CMPL ); | |
951 } | |
952 | |
953 | |
954 /* | |
955 +--------------------------------------------------------------------+ | |
956 | PROJECT : MODULE : CMH_MMS | | |
957 | STATE : code ROUTINE : sAT_PlusCCLK | | |
958 +--------------------------------------------------------------------+ | |
959 | |
960 PURPOSE : This is the functional counterpart to the +CCLK AT command | |
961 which will set the real time clock of the ME | |
962 */ | |
963 | |
964 GLOBAL T_ACI_RETURN sAT_PlusCCLK ( T_ACI_CMD_SRC srcId, | |
965 T_ACI_RTC_DATE *date_s, | |
966 T_ACI_RTC_TIME *time_s, | |
967 int timeZone | |
968 ) | |
969 { | |
970 #ifndef _SIMULATION_ | |
971 UBYTE ret; | |
972 #endif /* _SIMULATION_ */ | |
973 | |
974 TRACE_FUNCTION ("sAT_PlusCCLK()"); | |
975 | |
976 /* | |
977 *------------------------------------------------------------------- | |
978 * check command source | |
979 *------------------------------------------------------------------- | |
980 */ | |
981 if(!cmh_IsVldCmdSrc (srcId)) | |
982 { | |
983 TRACE_EVENT_P1("sAT_PlusCCLK(): Invalid source: %d", srcId); | |
984 return( AT_FAIL ); | |
985 } | |
986 | |
987 /* | |
988 *------------------------------------------------------------------- | |
989 * Set the time in the RTC | |
990 *------------------------------------------------------------------- | |
991 */ | |
992 #ifndef _SIMULATION_ | |
993 ret = rtc_set_time_date( (T_RTC_DATE *) date_s, (T_RTC_TIME *) time_s); | |
994 | |
995 switch (ret) | |
996 { | |
997 case 0: /* RVF_OK. Date and time set ok*/ | |
998 #ifndef FF_TIMEZONE | |
999 return( AT_CMPL ); | |
1000 #else /* FF_TIMEZONE */ | |
1001 ret = RTC_SetCurrentTZ((T_RTC_TZ)timeZone); /* Set current timezone now time and date are set.*/ | |
1002 switch (ret) | |
1003 { | |
1004 case 0: /* RVF_OK. RTC current TZ set ok*/ | |
1005 return( AT_CMPL ); | |
1006 | |
1007 default: | |
1008 TRACE_EVENT_P1("sAT_PlusCCLK(): ERROR1: %d", ret); /* RTC setting failed */ | |
1009 return( AT_FAIL ); | |
1010 } | |
1011 #endif /* FF_TIMEZONE */ | |
1012 | |
1013 default: /* RVF_NOT_READY or RVF_INTERNAL ERROR or RVF_INVALID_PARAMETER */ | |
1014 TRACE_EVENT_P1("sAT_PlusCCLK(): ERROR2: %d", ret); /* Date and time setting failed */ | |
1015 return( AT_FAIL ); | |
1016 } | |
1017 #else /* _SIMULATION_ */ | |
1018 return( AT_CMPL ); | |
1019 #endif /* _SIMULATION_ */ | |
1020 | |
1021 } | |
1022 | |
1023 /* | |
1024 +--------------------------------------------------------------------+ | |
1025 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
1026 | STATE : code ROUTINE : sAT_PercentCTZV | | |
1027 +--------------------------------------------------------------------+ | |
1028 | |
1029 PURPOSE : This is the functional counterpart to the %CTZV AT command | |
1030 which will set the status of PCTZVmode, indicating whether time and date report | |
1031 is enabled or disabled. | |
1032 | |
1033 <on/off>: Indicates whether time and date report is enabled or disabled. | |
1034 */ | |
1035 | |
1036 GLOBAL T_ACI_RETURN sAT_PercentCTZV ( T_ACI_CMD_SRC srcId, | |
1037 T_ACI_PCTZV_MODE mode) | |
1038 { | |
1039 TRACE_FUNCTION ("sAT_PercentCTZV()"); | |
1040 | |
1041 /* | |
1042 *------------------------------------------------------------------- | |
1043 * check command source | |
1044 *------------------------------------------------------------------- | |
1045 */ | |
1046 if(!cmh_IsVldCmdSrc (srcId)) | |
1047 { | |
1048 TRACE_EVENT_P1("sAT_PercentCTZV(): Invalid source: %d", srcId); | |
1049 return( AT_FAIL ); | |
1050 } | |
1051 | |
1052 /* | |
1053 *------------------------------------------------------------------- | |
1054 * process the mode parameter | |
1055 *------------------------------------------------------------------- | |
1056 */ | |
1057 switch (mode) | |
1058 { | |
1059 case PCTZV_MODE_OFF: | |
1060 case PCTZV_MODE_ON: | |
1061 cmhPrm[srcId].mmCmdPrm.PCTZVMode = mode; | |
1062 break; | |
1063 | |
1064 default: | |
1065 TRACE_EVENT_P1("sAT_PercentCTZV(): Invalid mode: %d", mode); | |
1066 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1067 return( AT_FAIL ); | |
1068 } | |
1069 | |
1070 return( AT_CMPL ); | |
1071 } | |
1072 | |
1073 | |
1074 /* | |
1075 +--------------------------------------------------------------------+ | |
1076 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
1077 | STATE : code ROUTINE : sAT_PercentCNIV | | |
1078 +--------------------------------------------------------------------+ | |
1079 | |
1080 PURPOSE : This is the functional counterpart to the %CNIV AT command | |
1081 which will set the status of CNIVmode, indicating whether time and date report | |
1082 is enabled or disabled. | |
1083 | |
1084 <on/off>: Indicates whether time and date report is enabled or disabled. | |
1085 */ | |
1086 | |
1087 GLOBAL T_ACI_RETURN sAT_PercentCNIV ( T_ACI_CMD_SRC srcId, | |
1088 T_ACI_CNIV_MODE mode) | |
1089 { | |
1090 TRACE_FUNCTION ("sAT_PercentCNIV()"); | |
1091 | |
1092 /* | |
1093 *------------------------------------------------------------------- | |
1094 * check command source | |
1095 *------------------------------------------------------------------- | |
1096 */ | |
1097 if(!cmh_IsVldCmdSrc (srcId)) | |
1098 { | |
1099 TRACE_EVENT_P1("sAT_PercentCNIV(): Invalid source: %d", srcId); | |
1100 return( AT_FAIL ); | |
1101 } | |
1102 | |
1103 /* | |
1104 *------------------------------------------------------------------- | |
1105 * process the mode parameter | |
1106 *------------------------------------------------------------------- | |
1107 */ | |
1108 switch (mode) | |
1109 { | |
1110 case CNIV_MODE_OFF: | |
1111 case CNIV_MODE_ON: | |
1112 cmhPrm[srcId].mmCmdPrm.CNIVMode = mode; | |
1113 break; | |
1114 | |
1115 default: | |
1116 TRACE_EVENT_P1("sAT_PercentCNIV(): Invalid mode: %d", mode); | |
1117 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1118 return( AT_FAIL ); | |
1119 } | |
1120 | |
1121 return( AT_CMPL ); | |
1122 } | |
1123 | |
1124 /* | |
1125 +--------------------------------------------------------------------+ | |
1126 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
1127 | STATE : code ROUTINE : sAT_PercentCWUP | | |
1128 +--------------------------------------------------------------------+ | |
1129 | |
1130 PURPOSE : This is the functional counterpart to the +CWUP AT command | |
1131 which will force RR to trigger a power campaign. | |
1132 | |
1133 */ | |
1134 | |
1135 GLOBAL T_ACI_RETURN sAT_PercentCWUP ( T_ACI_CMD_SRC srcId, T_ACI_CWUP_TYPE type ) | |
1136 { | |
1137 TRACE_FUNCTION ("sAT_PercentCWUP()"); | |
1138 | |
1139 /* | |
1140 *------------------------------------------------------------------- | |
1141 * check command source | |
1142 *------------------------------------------------------------------- | |
1143 */ | |
1144 if(!cmh_IsVldCmdSrc (srcId)) | |
1145 { | |
1146 TRACE_EVENT_P1("sAT_PercentCWUP(): Invalid source: %d", srcId); | |
1147 return( AT_FAIL ); | |
1148 } | |
1149 | |
1150 /* | |
1151 *------------------------------------------------------------------- | |
1152 * check entity status | |
1153 *------------------------------------------------------------------- | |
1154 */ | |
1155 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
1156 { | |
1157 TRACE_EVENT("sAT_PercentCWUP(): MM is busy"); | |
1158 return( AT_BUSY ); | |
1159 } | |
1160 | |
1161 wake_up_rr(); | |
1162 | |
1163 return( AT_CMPL ); | |
1164 } | |
1165 | |
1166 /* | |
1167 +--------------------------------------------------------------------+ | |
1168 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
1169 | STATE : code ROUTINE : sAT_PlusCOPS | | |
1170 +--------------------------------------------------------------------+ | |
1171 | |
1172 PURPOSE : This function encapsulates the functionality of +COPS and %COPS command | |
1173 | |
1174 <srcId>: Source Id | |
1175 <mode>: registration mode. | |
1176 <format>: format of operator selection | |
1177 <oper>: operator string | |
1178 <cmd>: command | |
1179 */ | |
1180 | |
1181 GLOBAL T_ACI_RETURN sat_Plus_Percent_COPS ( T_ACI_CMD_SRC srcId, | |
1182 T_ACI_COPS_MOD mode, | |
1183 T_ACI_COPS_FRMT format, | |
1184 CHAR * oper, | |
1185 T_ACI_AT_CMD cmd) | |
1186 { | |
1187 T_MM_CMD_PRM * pMMCmdPrm; /* points to MM command parameters */ | |
1188 | |
1189 T_ACI_NRG_RGMD regMode; /*NRG Registration mode */ | |
1190 T_ACI_NRG_FRMT regFormat; | |
1191 T_ACI_NRG_SVMD svrMode; | |
1192 | |
1193 TRACE_FUNCTION ("sat_Plus_Percent_COPS()"); | |
1194 | |
1195 pMMCmdPrm = &cmhPrm[srcId].mmCmdPrm; | |
1196 mmShrdPrm.COPSmodeBeforeAbort = mmShrdPrm.COPSmode; | |
1197 | |
1198 /* | |
1199 * check MM entity status | |
1200 */ | |
1201 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
1202 return( AT_BUSY ); | |
1203 | |
1204 /* | |
1205 *convert format to NRG type and set the COPS format value. | |
1206 */ | |
1207 | |
1208 if( format EQ COPS_FRMT_NotPresent ) | |
1209 format = pMMCmdPrm -> COPSfrmt; | |
1210 | |
1211 switch( format ) | |
1212 { | |
1213 case( COPS_FRMT_NotPresent): | |
1214 regFormat = NRG_FRMT_NotPresent; | |
1215 break; | |
1216 case( COPS_FRMT_Numeric ): | |
1217 regFormat =NRG_FRMT_Numeric ; | |
1218 break; | |
1219 case( COPS_FRMT_Short): | |
1220 regFormat = NRG_FRMT_Short; | |
1221 break; | |
1222 case( COPS_FRMT_Long): | |
1223 regFormat = NRG_FRMT_Long; | |
1224 break; | |
1225 default: | |
1226 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1227 return( AT_FAIL ); | |
1228 } | |
1229 | |
1230 pMMCmdPrm -> COPSfrmt = format; | |
1231 | |
1232 /* | |
1233 * The function cmhMM_OperatorSelect() is using the NRG types. Therefore the following conversion is required. | |
1234 * Also the appropiate value for Service Mode, required by cmhMM_OperatorSelect(), is set. | |
1235 */ | |
1236 | |
1237 if( mode EQ COPS_MOD_NotPresent ) | |
1238 mode = mmShrdPrm.COPSmode; | |
1239 | |
1240 switch( mode ) | |
1241 { | |
1242 case( COPS_MOD_NotPresent ): | |
1243 regMode = NRG_RGMD_NotPresent; | |
1244 svrMode = NRG_SVMD_NotPresent; | |
1245 break; | |
1246 case( COPS_MOD_Auto ): | |
1247 regMode =NRG_RGMD_Auto ; | |
1248 svrMode = NRG_SVMD_Full; /* Only Full Service makes sense for Automatic Mode */ | |
1249 break; | |
1250 case( COPS_MOD_Man): | |
1251 regMode = NRG_RGMD_Manual; | |
1252 svrMode = NRG_SVMD_Full; /* Only Full Service makes sense for Manual Mode */ | |
1253 break; | |
1254 case( COPS_MOD_Dereg): | |
1255 regMode = NRG_RGMD_Dereg; | |
1256 svrMode = NRG_SVMD_Limited; | |
1257 break; | |
1258 case( COPS_MOD_Both ): | |
1259 regMode = NRG_RGMD_Both; | |
1260 svrMode = NRG_SVMD_Full; /* Only Full Service makes sense for the Both Mode */ | |
1261 break; | |
1262 case(COPS_MOD_SetOnly): /*This mode can be fully handled in this function */ | |
1263 /* DO NOT SET mmShrdPrm.COPSmode !!! */ | |
1264 pMMCmdPrm -> COPSfrmt = format; | |
1265 return AT_CMPL; | |
1266 default: | |
1267 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1268 return( AT_FAIL ); | |
1269 } | |
1270 | |
1271 mmShrdPrm.COPSmode = mode; | |
1272 | |
1273 /*Set the value of the current command executed */ | |
1274 mmEntStat.curCmd = cmd; | |
1275 | |
1276 return cmhMM_OperatorSelect(srcId,regMode,svrMode,regFormat,oper); | |
1277 } | |
1278 | |
1279 #ifdef TI_PS_FF_AT_P_CMD_CTREG | |
1280 /* | |
1281 +--------------------------------------------------------------------+ | |
1282 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS | | |
1283 | STATE : code ROUTINE : sAT_PercentCTREG | | |
1284 +--------------------------------------------------------------------+ | |
1285 | |
1286 PURPOSE : This is the functional counterpart to the %CTREG AT command | |
1287 which will update the two tables present in common shared | |
1288 location. | |
1289 | |
1290 */ | |
1291 | |
1292 GLOBAL T_ACI_RETURN sAT_PercentCTREG ( T_ACI_CMD_SRC srcId, T_TREG *treg ) | |
1293 { | |
1294 BOOL ret; | |
1295 | |
1296 TRACE_FUNCTION ("sAT_PercentCTREG()"); | |
1297 | |
1298 /* | |
1299 *------------------------------------------------------------------- | |
1300 * check command source | |
1301 *------------------------------------------------------------------- | |
1302 */ | |
1303 if(!cmh_IsVldCmdSrc (srcId)) | |
1304 { | |
1305 TRACE_EVENT_P1("sAT_PercentCTREG(): Invalid source: %d", srcId); | |
1306 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1307 return( AT_FAIL ); | |
1308 } | |
1309 | |
1310 ret = cl_shrd_set_treg_val(treg); | |
1311 | |
1312 if(ret EQ TRUE) | |
1313 { | |
1314 return( AT_CMPL ); | |
1315 } | |
1316 return(AT_FAIL); | |
1317 } | |
1318 #endif /* TI_PS_FF_AT_P_CMD_CTREG */ | |
1319 | |
1320 /*==== EOF ========================================================*/ |