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