comparison src/aci2/aci/cmh_mmq.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_MMQ
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 query functions related to the
18 | protocol stack adapter for mobility management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_MMQ_C
23 #define CMH_MMQ_C
24 #endif
25
26 #include "aci_all.h"
27
28 /*==== INCLUDES ===================================================*/
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_cmd.h"
32 #include "aci.h"
33
34 #ifdef FAX_AND_DATA
35 #include "aci_fd.h"
36 #endif /* of #ifdef FAX_AND_DATA */
37
38 #include "pcm.h"
39 #include "psa.h"
40 #include "psa_mm.h"
41 #include "psa_util.h"
42 #include "cmh.h"
43 #include "cmh_mm.h"
44 #include "rx.h"
45
46 #include "rtc.h"
47
48 #ifdef FF_TIMEZONE
49 #include "rv/rv_general.h"
50 #include "rtc/rtc_tz.h"
51 #endif
52
53 #ifdef GPRS
54 #include "gaci_cmh.h"
55 #include "psa_gmm.h"
56 #endif
57
58 #ifndef _SIMULATION_
59 /******************************/
60 /* just to get FFS !!!! */
61 /* TEMPORARY until use of NVM */
62 #ifndef GPRS
63 #define DONT_LET_FFSH2_DEF_GPRS
64 #endif
65
66 #include "ffs/ffs.h"
67
68
69 /* check whether latter has defined GPRS !!! */
70 #ifdef DONT_LET_FFSH2_DEF_GPRS
71 #undef GPRS
72 #endif
73
74 #undef DONT_LET_FFSH2_DEF_GPRS
75 /***************************/
76 #endif /* _SIMULATION_ */
77
78
79 /*==== CONSTANTS ==================================================*/
80
81 /*==== EXPORT =====================================================*/
82
83 /*==== VARIABLES ==================================================*/
84 #if defined (GPRS) && defined (DTI)
85 EXTERN T_GMM_SHRD_PRM gmmShrdPrm;
86 #endif
87 EXTERN T_ONS_READ_STATE ONSReadStatus;
88 /*==== FUNCTIONS ==================================================*/
89
90 EXTERN BOOL cmhSIM_plmn_is_hplmn();
91
92 /*
93 +--------------------------------------------------------------------+
94 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
95 | STATE : code ROUTINE : qAT_PercentBAND |
96 +--------------------------------------------------------------------+
97
98 PURPOSE : This is the functional counterpart to the %BAND? AT command
99 which returns the current multiband configuration.
100
101 <bandMode>: band switch mode.
102 <bandType>: band selection.
103 */
104
105 GLOBAL T_ACI_RETURN qAT_PercentBAND(T_ACI_CMD_SRC srcId,
106 T_ACI_BAND_MODE *bandMode,
107 UBYTE *bandType)
108 {
109 UBYTE freq_bands, dummy;
110
111 TRACE_FUNCTION ("qAT_PercentBAND()");
112
113 /* check command source */
114 if(!cmh_IsVldCmdSrc (srcId))
115 {
116 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
117 return( AT_FAIL );
118 }
119
120 if( bandMode EQ NULL OR
121 bandType EQ NULL )
122 {
123 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
124 return( AT_FAIL );
125 }
126
127 cmhMM_getBandSettings( &freq_bands, &dummy );
128
129 if( freq_bands EQ 0x00 )
130 {
131 *bandType = 0x00; /* not really meanful here... */
132 *bandMode = BAND_MODE_Auto;
133 }
134 else
135 {
136 *bandType = freq_bands;
137 *bandMode = BAND_MODE_Manual;
138 }
139
140 return( AT_CMPL );
141 }
142
143 /*
144 +--------------------------------------------------------------------+
145 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
146 | STATE : code ROUTINE : qAT_PlusCOPS |
147 +--------------------------------------------------------------------+
148
149 PURPOSE : This is the functional counterpart to the +COPS? AT command
150 which returns the current setting of mode, format and
151 operator.
152
153 <mode>: registration mode.
154 <format>: format of operator
155 <oper>: operator string
156 */
157
158 GLOBAL T_ACI_RETURN qAT_PlusCOPS ( T_ACI_CMD_SRC srcId,
159 T_ACI_COPS_MOD * mode,
160 T_ACI_COPS_FRMT * format,
161 CHAR * oper )
162 {
163 T_MM_CMD_PRM * pMMCmdPrm; /* points to MM command parameters */
164
165 TRACE_FUNCTION ("qAT_PlusCOPS()");
166
167 /* check command source */
168 if(!cmh_IsVldCmdSrc (srcId))
169 {
170 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
171 return( AT_FAIL );
172 }
173
174 pMMCmdPrm = &cmhPrm[srcId].mmCmdPrm;
175
176 /* fill in parameters */
177 switch(mmShrdPrm.COPSmode)
178 {
179 case(COPS_MOD_Auto):
180 case(COPS_MOD_Man):
181 case(COPS_MOD_Dereg):
182 *mode = mmShrdPrm.COPSmode;
183 break;
184
185 /*case(COPS_MOD_SetOnly): mmShrdPrm.COPSmode can't have been
186 set with this value...*/
187 case(COPS_MOD_Both):
188 if(mmShrdPrm.regModeAutoBack)
189 {
190 *mode = COPS_MOD_Man;
191 }
192 else
193 *mode = COPS_MOD_Auto;
194
195 break;
196 default:
197 *mode = mmShrdPrm.regMode;
198 break;
199 }
200
201 *format = pMMCmdPrm -> COPSfrmt;
202 *oper = 0x0;
203
204 cmhMM_OperatorQuery(srcId,pMMCmdPrm -> COPSfrmt,oper);
205
206 TRACE_EVENT(oper);
207
208 return( AT_CMPL );
209 }
210
211
212 /*
213 +--------------------------------------------------------------------+
214 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
215 | STATE : code ROUTINE : qAT_PercentCOPS |
216 +--------------------------------------------------------------------+
217
218 PURPOSE : This is the functional counterpart to the +COPS? AT command
219 which returns the current setting of mode, format and
220 operator.
221
222 <mode>: registration mode.
223 <format>: format of operator
224 <oper>: operator string
225 */
226
227 GLOBAL T_ACI_RETURN qAT_PercentCOPS ( T_ACI_CMD_SRC srcId,
228 T_ACI_COPS_MOD * mode,
229 T_ACI_COPS_FRMT * format,
230 T_ACI_COPS_SVST * svrStatus,
231 CHAR * oper )
232 {
233 T_MM_CMD_PRM * pMMCmdPrm; /* points to MM command parameters */
234
235 TRACE_FUNCTION ("qAT_PercentCOPS()");
236
237 /* check command source */
238 if(!cmh_IsVldCmdSrc (srcId))
239 {
240 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
241 return( AT_FAIL );
242 }
243
244 pMMCmdPrm = &cmhPrm[srcId].mmCmdPrm;
245
246 /* fill in parameters */
247 switch(mmShrdPrm.COPSmode)
248 {
249 case(COPS_MOD_Auto):
250 case(COPS_MOD_Man):
251 case(COPS_MOD_Dereg):
252 *mode = mmShrdPrm.COPSmode;
253 break;
254
255 /*case(COPS_MOD_SetOnly): mmShrdPrm.COPSmode can't have been
256 set with this value...*/
257 case(COPS_MOD_Both):
258 if(mmShrdPrm.regModeAutoBack)
259 {
260 *mode = COPS_MOD_Man;
261 }
262 else
263 *mode = COPS_MOD_Auto;
264
265 break;
266 default:
267 *mode = mmShrdPrm.regMode;
268 break;
269 }
270
271 *format = pMMCmdPrm -> COPSfrmt;
272
273
274 switch( mmShrdPrm.regStat )
275 {
276 case( NO_VLD_RS ):
277 case( RS_NO_SRV ): *svrStatus = COPS_SVST_NoSrv; break;
278 case( RS_LMTD_SRV ): *svrStatus =COPS_SVST_Limited; break;
279 case( RS_FULL_SRV ): *svrStatus = COPS_SVST_Full; break;
280 default: *svrStatus = COPS_SVST_NotPresent; break;
281 }
282
283
284 *oper = 0x0;
285
286
287
288 cmhMM_OperatorQuery(srcId,pMMCmdPrm -> COPSfrmt,oper);
289
290 return( AT_CMPL );
291 }
292
293
294
295
296 /*
297 +--------------------------------------------------------------------+
298 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
299 | STATE : code ROUTINE : qAT_PlusCREG |
300 +--------------------------------------------------------------------+
301
302 PURPOSE : This is the functional counterpart to the +CREG? AT command
303 which returns the current setting of registration status.
304
305 <stat>: registration status.
306 <lac>: current lac.
307 <cid>: current cell id.
308 */
309
310 GLOBAL T_ACI_RETURN qAT_PlusCREG ( T_ACI_CMD_SRC srcId,
311 T_ACI_CREG_STAT *stat,
312 USHORT *lac,
313 USHORT *cid )
314 {
315
316 TRACE_FUNCTION ("qAT_PlusCREG()");
317
318 /*
319 *-------------------------------------------------------------------
320 * fill in parameters
321 *-------------------------------------------------------------------
322 */
323 *stat = mmShrdPrm.creg_status;
324 *lac = mmShrdPrm.lac;
325 *cid = mmShrdPrm.cid;
326
327 return( AT_CMPL );
328 }
329
330 /*
331 +--------------------------------------------------------------------+
332 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
333 | STATE : code ROUTINE : qAT_PercentCREG |
334 +--------------------------------------------------------------------+
335
336 PURPOSE : This is the functional counterpart to the +CREG? AT command
337 which returns the current setting of registration status.
338
339 <stat>: registration status.
340 <lac>: current lac.
341 <cid>: current cell id.
342 <gprs_ind>: if GPRS is available or not
343 */
344
345 GLOBAL T_ACI_RETURN qAT_PercentCREG ( T_ACI_CMD_SRC srcId,
346 T_ACI_CREG_STAT *stat,
347 USHORT *lac,
348 USHORT *cid,
349 T_ACI_P_CREG_GPRS_IND *gprs_ind )
350 {
351
352 TRACE_FUNCTION ("qAT_PercentCREG()");
353
354 qAT_PlusCREG (srcId, stat, lac, cid);
355
356 #if defined (GPRS) AND defined (DTI)
357 *gprs_ind = gmmShrdPrm.gprs_indicator;
358 #else
359 *gprs_ind = P_CREG_GPRS_Not_Supported; /* ACI-SPR-17218: use ACI type */
360 #endif /* GPRS */
361
362 return( AT_CMPL );
363 }
364
365
366 /*
367 +--------------------------------------------------------------------+
368 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
369 | STATE : code ROUTINE : qAT_PlusWS46 |
370 +--------------------------------------------------------------------+
371
372 PURPOSE : This is the functional counterpart to the +WS46? AT
373 command which returns the current setting wireless network
374 selection.
375
376 <mode>: network mode.
377 */
378
379 GLOBAL T_ACI_RETURN qAT_PlusWS46 (T_ACI_CMD_SRC srcId,
380 T_ACI_WS46_MOD * mode )
381 {
382
383 TRACE_FUNCTION ("qAT_PlusWS46()");
384
385 /*
386 *-------------------------------------------------------------------
387 * fill in parameters
388 *-------------------------------------------------------------------
389 */
390 *mode = WS46_MOD_Gsm;
391
392 return( AT_CMPL );
393 }
394
395 /*
396 +--------------------------------------------------------------------+
397 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
398 | STATE : code ROUTINE : qAT_PlusCOPN |
399 +--------------------------------------------------------------------+
400
401 PURPOSE : This is the functional counterpart to the +COPN AT
402 command which returns the current operator names stored in
403 ME.
404
405 <lstId>: list identifier.
406 <startIdx>: start index to read from.
407 <lastIdx>: buffer for index of last copied name.
408 <oprLstBuf>: buffer for operator names. length of MAX_OPER.
409 */
410
411 GLOBAL T_ACI_RETURN qAT_PlusCOPN ( T_ACI_CMD_SRC srcId,
412 T_ACI_COPN_LID lstId,
413 SHORT startIdx,
414 SHORT *lastIdx,
415 T_ACI_COPN_OPDESC *oprLstBuf)
416 {
417 USHORT idx; /* holds list idx */
418 EF_PLMN plmnBuf; /* buffer PCM entry */
419 USHORT maxRec; /* holds maximum records */
420 USHORT recNr; /* holds record number */
421 USHORT oprLstLen; /* holds fixed oper list length */
422 UBYTE retVal; /* holds return value */
423 UBYTE ver; /* holds version */
424 UBYTE len; /* holds operator name length */
425
426 TRACE_FUNCTION ("qAT_PlusCOPN()");
427
428 /*
429 *-------------------------------------------------------------------
430 * determine list identifier
431 *-------------------------------------------------------------------
432 */
433 switch( lstId )
434 {
435 /*
436 *-----------------------------------------------------------------
437 * for the list in permanent configuration memory
438 *-----------------------------------------------------------------
439 */
440 case( COPN_LID_Pcm ):
441
442 recNr = startIdx+1;
443 idx = 0;
444
445 do
446 {
447 retVal= pcm_ReadRecord( (UBYTE *) EF_PLMN_ID, recNr, SIZE_EF_PLMN,
448 (UBYTE *) &plmnBuf, &ver, &maxRec );
449
450 if( retVal EQ PCM_INVALID_SIZE OR retVal EQ PCM_INVALID_RECORD )
451 {
452 if( idx EQ 0 )
453 {
454 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx );
455 return( AT_FAIL );
456 }
457 break;
458 }
459
460 if( plmnBuf.mcc[0] NEQ 0xFF AND plmnBuf.mnc[0] NEQ 0xFF AND
461 plmnBuf.lngNam[0] NEQ 0xFF )
462 {
463 sprintf(oprLstBuf[idx].numOper, "%03X%02X",
464 ((plmnBuf.mcc[0]<<8) + plmnBuf.mcc[1]),
465 ((plmnBuf.mnc[0]<<8) + plmnBuf.mnc[1]));
466
467 for( len = 0;
468 len < SIZE_EF_PLMN_LONG AND plmnBuf.lngNam[len] NEQ 0xFF;
469 len++ )
470 ;
471
472 utl_cvtGsmIra( plmnBuf.lngNam, len,
473 (UBYTE*)oprLstBuf[idx].alphaOper,
474 MAX_ALPHA_OPER_LEN,
475 CSCS_DIR_GsmToIra );
476
477 oprLstBuf[idx].alphaOper[MINIMUM(len,MAX_ALPHA_OPER_LEN-1)] = 0x0;
478 idx++;
479 }
480
481 recNr++;
482 }
483 while( idx < MAX_OPER );
484
485 break;
486 /*
487 *-----------------------------------------------------------------
488 * for the list in constant memory
489 *-----------------------------------------------------------------
490 */
491 case( COPN_LID_Cnst ):
492
493 oprLstLen = cmhMM_GetOperLstLen();
494
495 if( startIdx >= oprLstLen )
496 {
497 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx );
498 return( AT_FAIL );
499 }
500
501 for( idx = 0, recNr = startIdx;
502 idx < MAX_OPER AND recNr < oprLstLen;
503 idx++, recNr++ )
504 {
505 if ((operListFixed[recNr].mnc & 0x00F) EQ 0xF)
506 {
507 /*lint -e{702} */
508 sprintf(oprLstBuf[idx].numOper, "%03X%02X",
509 operListFixed[recNr].mcc,
510 operListFixed[recNr].mnc >> 4);
511 }
512 else
513 {
514 sprintf(oprLstBuf[idx].numOper, "%03X%02X",
515 operListFixed[recNr].mcc,
516 operListFixed[recNr].mnc);
517 }
518
519 strncpy( oprLstBuf[idx].alphaOper, operListFixed[recNr].longName,
520 MAX_ALPHA_OPER_LEN-1 );
521
522 oprLstBuf[idx].alphaOper[MAX_ALPHA_OPER_LEN-1] = 0x0;
523 }
524 break;
525 /*
526 *-----------------------------------------------------------------
527 * unexpected list type
528 *-----------------------------------------------------------------
529 */
530 default:
531
532 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
533 return( AT_FAIL );
534 }
535
536 /*
537 *-------------------------------------------------------------------
538 * terminate list and set last index
539 *-------------------------------------------------------------------
540 */
541 if( idx < MAX_OPER )
542 {
543 oprLstBuf[idx].numOper[0] = 0x0;
544 oprLstBuf[idx].alphaOper[0] = 0x0;
545 }
546
547
548 *lastIdx = ( recNr NEQ 0 )?recNr-1:0;
549
550 return( AT_CMPL );
551 }
552
553 /*
554 +-------------------------------------------------------------------+
555 | NEW AT Command qAT_PercentCOPN |
556 | |
557 +-------------------------------------------------------------------+
558 */
559 /*The same function in EDGE should be remved from ACIA when EDGE is
560 merged to the UMTS*/
561
562 GLOBAL T_ACI_RETURN qAT_PercentCOPN( T_ACI_CMD_SRC srcId,
563 T_ACI_COPS_FRMT format,
564 CHAR *opr,
565 T_ACI_OPER_NTRY *oper_ntry)
566 {
567 T_ACI_RETURN retval = AT_FAIL;
568 T_OPER_ENTRY plmnDesc;
569 BOOL found;
570
571 if(format EQ COPS_FRMT_Numeric)
572 {
573 found = cmhMM_FindNumeric(&plmnDesc, opr);
574 }
575 else
576 {
577 found = cmhMM_FindName(&plmnDesc, opr, format);
578 }
579 if (found)
580 {
581 oper_ntry->mcc = plmnDesc.mcc;
582 oper_ntry->mnc = plmnDesc.mnc;
583 strncpy (oper_ntry->longName, plmnDesc.longName, sizeof(oper_ntry->longName));
584 oper_ntry->longName[sizeof(oper_ntry->longName) - 1] = '\0';
585 strncpy ((CHAR *)oper_ntry->shrtName, plmnDesc.shrtName, sizeof(oper_ntry->shrtName));
586 oper_ntry->shrtName[sizeof(oper_ntry->shrtName) - 1] = '\0';
587 oper_ntry->long_len = plmnDesc.long_len;
588 oper_ntry->shrt_len = plmnDesc.shrt_len;
589 if (plmnDesc.pnn)
590 {
591 oper_ntry->source = Read_EONS;
592 }
593 else if ((ONSReadStatus EQ ONS_READ_OVER) AND (cmhSIM_plmn_is_hplmn (plmnDesc.mcc, plmnDesc.mnc))
594 AND format EQ COPS_FRMT_Numeric)
595 {
596 oper_ntry->source = Read_CPHS;
597 }
598 else
599 {
600 oper_ntry->source = Read_ROM_TABLE;
601 }
602 }
603 else
604 {
605 oper_ntry->longName[0] = '\0';
606 oper_ntry->shrtName[0] = '\0';
607 oper_ntry->mcc = 0;
608 oper_ntry->mnc = 0;
609 oper_ntry->source = Read_INVALID;
610 }
611 return AT_CMPL;
612 }
613
614
615
616
617 /*
618 +--------------------------------------------------------------------+
619 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ |
620 | STATE : code ROUTINE : qAT_PercentNRG |
621 +--------------------------------------------------------------------+
622
623 PURPOSE : This is the functional counterpart to the %NRG? AT command
624 which returns the current setting of registration mode and
625 service mode and the current status of service.
626
627 <regMode>: registration mode.
628 <srvMode>: service mode.
629 <oprFrmt>: operator format.
630 <srvStat>: service status.
631 <oper> : operator
632 */
633
634 GLOBAL T_ACI_RETURN qAT_PercentNRG( T_ACI_CMD_SRC srcId,
635 T_ACI_NRG_RGMD *regMode,
636 T_ACI_NRG_SVMD *srvMode,
637 T_ACI_NRG_FRMT *oprFrmt,
638 T_ACI_NRG_SVMD *srvStat,
639 CHAR *oper)
640 {
641
642 T_ACI_COPS_FRMT copsFormat;
643
644
645 TRACE_FUNCTION ("qAT_PercentNRG()");
646
647 /*
648 *-------------------------------------------------------------------
649 * check command source
650 *-------------------------------------------------------------------
651 */
652 if(!cmh_IsVldCmdSrc (srcId))
653 {
654 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
655 return( AT_FAIL );
656 }
657
658 /*
659 *-------------------------------------------------------------------
660 * fill in parameters
661 *-------------------------------------------------------------------
662 */
663 switch( mmShrdPrm.regStat )
664 {
665 case( NO_VLD_RS ):
666 case( RS_NO_SRV ): *srvStat = NRG_SVMD_NoSrv; break;
667 case( RS_LMTD_SRV ): *srvStat = NRG_SVMD_Limited; break;
668 case( RS_FULL_SRV ): *srvStat = NRG_SVMD_Full; break;
669 default: *srvStat = NRG_SVMD_NotPresent; break;
670 }
671
672 *srvMode = cmhPrm[srcId].mmCmdPrm.NRGsrvMode;
673 *oprFrmt = cmhPrm[srcId].mmCmdPrm.NRGoprFrmt;
674 *oper = 0x0;
675
676 *regMode = cmhPrm[srcId].mmCmdPrm.NRGregMode;
677
678 switch( *oprFrmt )
679 {
680 case( NRG_FRMT_NotPresent ):
681 copsFormat = COPS_FRMT_NotPresent;
682 break;
683 case( NRG_FRMT_Numeric ):
684 copsFormat = COPS_FRMT_Numeric ;
685 break;
686 case( NRG_FRMT_Short):
687 copsFormat = COPS_FRMT_Short ;
688 break;
689 case( NRG_FRMT_Long):
690 copsFormat = COPS_FRMT_Long;
691 break;
692 default:
693 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
694 return( AT_FAIL );
695 }
696
697
698 cmhMM_OperatorQuery(srcId,copsFormat,oper);
699
700
701
702 return( AT_CMPL );
703 }
704
705 /*
706 +--------------------------------------------------------------------+
707 | PROJECT : ACI/MMI MODULE : CMH_MMS |
708 | STATE : code ROUTINE : qAT_PercentCSQ |
709 +--------------------------------------------------------------------+
710
711 PURPOSE : This is the function for Signal Quality query
712
713 Shen,Chao
714 Juni.13th, 2003
715 */
716
717 GLOBAL T_ACI_RETURN qAT_PercentCSQ( T_ACI_CMD_SRC srcId,
718 UBYTE *rssi,
719 UBYTE *ber,
720 UBYTE *actlevel)
721 {
722 rx_Status_Type rxStat;
723
724 TRACE_FUNCTION("qAT_PercentCSQ()");
725
726 if ( rx_GetStatus ( &rxStat ) NEQ DRV_OK )
727 {
728 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
729 return ATI_FAIL;
730 }
731 else
732 {
733 if ( rxStat.gsmLevel EQ 0xFF OR rxStat.gsmLevel EQ 0 )
734 {
735 *rssi = ACI_RSSI_FAULT;
736 }
737 else if ( rxStat.gsmLevel > 59 )
738 {
739 *rssi = 31;
740 }
741 else
742 {
743 *rssi = ( rxStat.gsmLevel / 2 ) + 2;
744 }
745
746 if ( rxStat.rxQuality EQ RX_QUAL_UNAVAILABLE )
747 {
748 *ber = ACI_BER_FAULT;
749 }
750 else
751 {
752 *ber = rxStat.rxQuality;
753 }
754
755 *actlevel = rxStat.actLevel;
756
757 return ATI_CMPL;
758 }
759 }
760
761 /*
762 +--------------------------------------------------------------------+
763 | PROJECT : ACI/MMI MODULE : CMH_MMS |
764 | STATE : code ROUTINE : qAT_PercentDBGINFO |
765 +--------------------------------------------------------------------+
766
767 PURPOSE : query free mem pool blocks.
768 */
769 GLOBAL T_ACI_RETURN qAT_PercentDBGINFO(T_ACI_CMD_SRC srcId,
770 ULONG param,
771 USHORT stor,
772 USHORT *free,
773 USHORT *alloc)
774 {
775 int ret=0;
776
777 TRACE_FUNCTION ("qAT_PercentDBGINFO()");
778 /*
779 *-----------------------------------------------------------------
780 * check command source
781 *-----------------------------------------------------------------
782 */
783 if( ! cmh_IsVldCmdSrc (srcId) )
784 {
785 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
786 return (AT_FAIL);
787 }
788
789 ret = vsi_m_status (hCommACI,
790 param,
791 (USHORT)stor,
792 free,
793 alloc );
794 if (ret EQ VSI_ERROR OR *free EQ 0)
795 {
796 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_MemFull );
797 return (ATI_FAIL);
798 }
799
800 return (ATI_CMPL);
801 }
802
803 /*
804 +--------------------------------------------------------------------+
805 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS |
806 | STATE : code ROUTINE : qAT_PlusCTZR |
807 +--------------------------------------------------------------------+
808
809 PURPOSE : This is the functional counterpart to the +CTZR AT command
810 which will query the status of CTZRmode, indicating whether time
811 zone change rep[orting is enabled or disabled.
812
813 <on/off>: Indicates whether time zone reporting is enabled or disabled.
814 */
815
816 GLOBAL T_ACI_RETURN qAT_PlusCTZR ( T_ACI_CMD_SRC srcId,
817 T_ACI_CTZR_MODE *mode)
818 {
819 TRACE_FUNCTION ("qAT_PlusCTZR()");
820
821 /*
822 *-------------------------------------------------------------------
823 * check command source
824 *-------------------------------------------------------------------
825 */
826 if(!cmh_IsVldCmdSrc (srcId))
827 {
828 TRACE_EVENT_P1("qAT_PlusCTZR(): Invalid source: %d", srcId);
829 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
830 return( AT_FAIL );
831 }
832
833 *mode = cmhPrm[srcId].mmCmdPrm.CTZRMode;
834
835 return( AT_CMPL );
836 }
837
838 /*
839 +--------------------------------------------------------------------+
840 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS |
841 | STATE : code ROUTINE : qAT_PlusCTZU |
842 +--------------------------------------------------------------------+
843
844 PURPOSE : This is the functional counterpart to the +CTZU AT command
845 which will query the status of CTZUmode, indicating whether time
846 zone automatic update is enabled or disabled.
847
848 <on/off>: Indicates whether time zone automatic update is enabled or disabled.
849 */
850
851 GLOBAL T_ACI_RETURN qAT_PlusCTZU ( T_ACI_CMD_SRC srcId,
852 T_ACI_CTZU_MODE *mode)
853 {
854 TRACE_FUNCTION ("qAT_PlusCTZU()");
855
856 /*
857 *-------------------------------------------------------------------
858 * check command source
859 *-------------------------------------------------------------------
860 */
861 if(!cmh_IsVldCmdSrc (srcId))
862 {
863 TRACE_EVENT_P1("qAT_PlusCTZU(): Invalid source: %d", srcId);
864 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
865 return( AT_FAIL );
866 }
867
868 *mode = cmhPrm[srcId].mmCmdPrm.CTZUMode;
869
870 return( AT_CMPL );
871 }
872
873 /*
874 +--------------------------------------------------------------------+
875 | PROJECT : MODULE : CMH_MMS |
876 | STATE : code ROUTINE : qAT_PlusCCLK |
877 +--------------------------------------------------------------------+
878
879 PURPOSE : This is the functional counterpart to the sAT_PlusCCLK command
880 which will query the status of the RTC in the MT, indicating what the time
881 is in the MT.
882 */
883 GLOBAL T_ACI_RETURN qAT_PlusCCLK ( T_ACI_CMD_SRC srcId,
884 T_ACI_RTC_DATE *date_s,
885 T_ACI_RTC_TIME *time_s,
886 int * timeZone
887 )
888 {
889 UBYTE ret;
890
891 TRACE_FUNCTION ("qAT_PlusCCLK()");
892 /*
893 *-------------------------------------------------------------------
894 * check command source
895 *-------------------------------------------------------------------
896 */
897 if(!cmh_IsVldCmdSrc (srcId))
898 {
899 TRACE_EVENT_P1("qAT_PlusCCLK(): Invalid source: %d", srcId);
900 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
901 return( AT_FAIL );
902 }
903
904 TRACE_EVENT("qAT_PlusCCLK(): get time and date " );
905 #ifndef _SIMULATION_
906 ret = rtc_get_time_date((T_RTC_DATE *) date_s, (T_RTC_TIME *) time_s);
907
908 switch (ret)
909 {
910 case 0: /* RVF_OK */
911 #ifdef FF_TIMEZONE
912 *timeZone = RTC_GetCurrentTZ(); /* Get current timezone now time and date are obtained.*/
913 TRACE_EVENT_P1("qAT_PlusCCLK(): timezone obatained: %d", *timeZone);
914 #endif /* FF_TIMEZONE */
915 return( AT_CMPL );
916 default:
917 TRACE_EVENT_P1("qAT_PlusCCLK(): ERROR: %d", ret); /* RVF_NOT_READY or RVF_INTERNAL ERROR */
918 return( AT_FAIL );
919 }
920 #else /* _SIMULATION_ */
921 /* Set return info for date time to: "04/08/17,13:31:04-10" */
922 date_s->year = 2004;
923 date_s->month = 8;
924 date_s->day = 17;
925
926 time_s->hour = 13;
927 time_s->minute = 31;
928 time_s->second = 4;
929
930 time_s->format = 0; /* RTC_TIME_FORMAT_24HOUR = 0 */
931 time_s->PM_flag = 0;
932 *timeZone = -10; /* Set timezone to -10 */
933 return( AT_CMPL );
934 #endif /* _SIMULATION_ */
935
936 }
937
938
939
940 /*
941 +--------------------------------------------------------------------+
942 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS |
943 | STATE : code ROUTINE : qAT_PercentCTZV |
944 +--------------------------------------------------------------------+
945
946 PURPOSE : This is the functional counterpart to the %CTZV AT command
947 which will query the status of PCTZVmode, indicating whether time
948 and date report is enabled or disabled.
949
950 <on/off>: Indicates whether time and date report is enabled or disabled.
951 */
952
953 GLOBAL T_ACI_RETURN qAT_PercentCTZV ( T_ACI_CMD_SRC srcId,
954 T_ACI_PCTZV_MODE *mode)
955 {
956 TRACE_FUNCTION ("qAT_PercentCTZV()");
957
958 /*
959 *-------------------------------------------------------------------
960 * check command source
961 *-------------------------------------------------------------------
962 */
963 if(!cmh_IsVldCmdSrc (srcId))
964 {
965 TRACE_EVENT_P1("qAT_PercentCTZV(): Invalid source: %d", srcId);
966 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
967 return( AT_FAIL );
968 }
969
970 *mode = cmhPrm[srcId].mmCmdPrm.PCTZVMode;
971
972 return( AT_CMPL );
973 }
974
975
976 /*
977 +--------------------------------------------------------------------+
978 | PROJECT : GSM-PS (6147) MODULE : CMH_MMS |
979 | STATE : code ROUTINE : qAT_PercentCNIV |
980 +--------------------------------------------------------------------+
981
982 PURPOSE : This is the functional counterpart to the %CNIV AT command
983 which will query the status of CNIVmode, indicating whether time
984 and date report is enabled or disabled.
985
986 <on/off>: Indicates whether time and date report is enabled or disabled.
987 */
988
989 GLOBAL T_ACI_RETURN qAT_PercentCNIV ( T_ACI_CMD_SRC srcId,
990 T_ACI_CNIV_MODE *mode)
991 {
992 TRACE_FUNCTION ("qAT_PercentCNIV()");
993
994 /*
995 *-------------------------------------------------------------------
996 * check command source
997 *-------------------------------------------------------------------
998 */
999 if(!cmh_IsVldCmdSrc (srcId))
1000 {
1001 TRACE_EVENT_P1("qAT_PercentCNIV(): Invalid source: %d", srcId);
1002 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1003 return( AT_FAIL );
1004 }
1005
1006 *mode = cmhPrm[srcId].mmCmdPrm.CNIVMode;
1007
1008 return( AT_CMPL );
1009 }
1010
1011 /*
1012 +--------------------------------------------------------------------+
1013 | PROJECT : ACI/MMI MODULE : CMH_MMS |
1014 | STATE : code ROUTINE : qAT_PlusCIND |
1015 +--------------------------------------------------------------------+
1016
1017 PURPOSE : This is the function for Signal Quality query
1018 */
1019
1020 GLOBAL T_ACI_RETURN qAT_PlusCIND ( T_ACI_CMD_SRC srcId,
1021 T_ACI_CIND_SIGNAL_TYPE *sCindSgnalSettings,
1022 T_ACI_CIND_SMSFULL_TYPE *sCindSmsFullSettings )
1023 {
1024 T_ACI_MM_CIND_VAL_TYPE *pMMCmdPrm;
1025
1026 TRACE_FUNCTION ("qAT_PlusCIND()");
1027
1028 if( !cmh_IsVldCmdSrc( srcId ) || (sCindSgnalSettings == NULL) || (sCindSmsFullSettings == NULL) )
1029 {
1030 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1031 return( AT_FAIL );
1032 }
1033
1034 pMMCmdPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCINDSettings);
1035
1036 *sCindSgnalSettings = pMMCmdPrm->sCindSignalParam;
1037 *sCindSmsFullSettings = pMMCmdPrm->sCindSmsFullParam;
1038
1039 return(AT_CMPL);
1040 }
1041
1042
1043 /*
1044 +--------------------------------------------------------------------+
1045 | PROJECT : ACI/MMI MODULE : CMH_MMS |
1046 | STATE : code ROUTINE : qAT_PlusCMER |
1047 +--------------------------------------------------------------------+
1048
1049 PURPOSE : This is the function for Signal Quality query
1050 */
1051
1052 GLOBAL T_ACI_RETURN qAT_PlusCMER ( T_ACI_CMD_SRC srcId,
1053 T_ACI_CMER_MODE_TYPE *sCmerModeSettings,
1054 T_ACI_CMER_IND_TYPE *sCmerIndicationSettings,
1055 T_ACI_CMER_BFR_TYPE *sCmerBfrSettings )
1056
1057 {
1058 T_ACI_MM_CMER_VAL_TYPE *pMMCmdPrm;
1059
1060 TRACE_FUNCTION ("qAT_PlusCMER()");
1061
1062 if( !cmh_IsVldCmdSrc( srcId ) || (sCmerModeSettings == NULL) ||
1063 (sCmerIndicationSettings == NULL) || (sCmerBfrSettings == NULL))
1064 {
1065 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1066 return( AT_FAIL );
1067 }
1068
1069 pMMCmdPrm = &(cmhPrm[srcId].mmCmdPrm.sIndicationParam.sMmCMERSettings);
1070
1071 *sCmerModeSettings = pMMCmdPrm->sCmerModeParam;
1072 *sCmerIndicationSettings = pMMCmdPrm->sCmerIndParam;
1073 *sCmerBfrSettings = pMMCmdPrm->sCmerBfrParam;
1074
1075 return(AT_CMPL);
1076 }
1077
1078 /*==== EOF ========================================================*/