comparison g23m-aci/aci/cmh_mmq.c @ 0:75a11d740a02

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