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