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