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