FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/cmh_mmt.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_MMT | |
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 test functions related to the | |
18 | protocol stack adapter for mobility management. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_MMT_C | |
23 #define CMH_MMT_C | |
24 #endif | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 #include "aci_cmh.h" | |
30 | |
31 | |
32 #ifdef FAX_AND_DATA | |
33 #include "aci_fd.h" | |
34 #endif /* of #ifdef FAX_AND_DATA */ | |
35 | |
36 #include "psa.h" | |
37 #include "psa_mm.h" | |
38 #include "cmh.h" | |
39 #include "cmh_mm.h" | |
40 | |
41 | |
42 #ifdef GPRS | |
43 #ifdef DTI | |
44 #include "dti_conn_mng.h" | |
45 #endif | |
46 #include "gaci.h" | |
47 #include "gaci_cmh.h" | |
48 #include "psa_gmm.h" | |
49 #include "cmh_gmm.h" | |
50 #endif | |
51 | |
52 /*==== CONSTANTS ==================================================*/ | |
53 | |
54 /*==== EXPORT =====================================================*/ | |
55 | |
56 /*==== VARIABLES ==================================================*/ | |
57 | |
58 /*==== FUNCTIONS ==================================================*/ | |
59 LOCAL T_ACI_RETURN get_available_network_list ( T_ACI_CMD_SRC srcId, | |
60 T_ACI_AT_CMD cmd, | |
61 SHORT startIdx, | |
62 SHORT * lastIdx, | |
63 T_ACI_COPS_OPDESC * operLst); | |
64 | |
65 /* | |
66 +--------------------------------------------------------------------+ | |
67 | PROJECT : GSM-PS (6147) MODULE : CMH_MMQ | | |
68 | STATE : code ROUTINE : qAT_PercentBAND | | |
69 +--------------------------------------------------------------------+ | |
70 | |
71 PURPOSE : This is the functional counterpart to the %BAND=? AT command | |
72 which returns the current multiband configuration. | |
73 | |
74 <MaxBandMode>: highest value of supported band switch modes. | |
75 <AllowedBands>: bitfield of supported bands (manufacturer defined). | |
76 */ | |
77 | |
78 GLOBAL T_ACI_RETURN tAT_PercentBAND(T_ACI_CMD_SRC srcId, | |
79 T_ACI_BAND_MODE *MaxBandMode, | |
80 UBYTE *AllowedBands) | |
81 { | |
82 UBYTE dummy; | |
83 | |
84 TRACE_FUNCTION ("tAT_PercentBAND()"); | |
85 | |
86 /* check command source */ | |
87 if(!cmh_IsVldCmdSrc (srcId)) | |
88 { | |
89 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
90 return( AT_FAIL ); | |
91 } | |
92 | |
93 /* process MaxBandMode parameter */ | |
94 if(MaxBandMode NEQ NULL) | |
95 { | |
96 *MaxBandMode = BAND_MODE_Manual; /* it is currently the highest value for BandMode */ | |
97 } | |
98 | |
99 /* process BandTypeList parameter */ | |
100 if( AllowedBands NEQ NULL ) | |
101 { | |
102 cmhMM_getBandSettings(&dummy, AllowedBands); | |
103 } | |
104 return( AT_CMPL ); | |
105 } | |
106 | |
107 | |
108 /* | |
109 +--------------------------------------------------------------------+ | |
110 | PROJECT : GSM-PS (6147) MODULE : CMH_MMT | | |
111 | STATE : code ROUTINE : tAT_PlusCOPS | | |
112 +--------------------------------------------------------------------+ | |
113 | |
114 PURPOSE : This is the functional counterpart to the +COPS=? AT command | |
115 which is responsible to test for all available network | |
116 operators. | |
117 | |
118 <startIdx>: Start index for reading the list. | |
119 Must be zero. | |
120 <lastIdx> : Last index buffers the last read index of the list. | |
121 Not used, maintained for compatibility reasons. | |
122 <operLst> : List buffer to copy MAX_OPER entries into. | |
123 Not used, maintained for compatibility reasons. | |
124 | |
125 */ | |
126 | |
127 GLOBAL T_ACI_RETURN tAT_PlusCOPS ( T_ACI_CMD_SRC srcId, | |
128 SHORT startIdx, | |
129 SHORT * lastIdx, | |
130 T_ACI_COPS_OPDESC * operLst) | |
131 { | |
132 | |
133 TRACE_FUNCTION ("tAT_PlusCOPS()"); | |
134 | |
135 /* | |
136 *------------------------------------------------------------------- | |
137 * check command source | |
138 *------------------------------------------------------------------- | |
139 */ | |
140 if(!cmh_IsVldCmdSrc (srcId)) | |
141 { | |
142 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
143 return( AT_FAIL ); | |
144 } | |
145 | |
146 /* | |
147 *------------------------------------------------------------------- | |
148 * check entity status | |
149 *------------------------------------------------------------------- | |
150 */ | |
151 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
152 | |
153 return( AT_BUSY ); | |
154 | |
155 /* | |
156 *------------------------------------------------------------------- | |
157 * process the start index parameter in case of a network search | |
158 *------------------------------------------------------------------- | |
159 */ | |
160 | |
161 return(get_available_network_list(srcId, AT_CMD_COPS, startIdx, lastIdx, operLst)); | |
162 | |
163 } | |
164 | |
165 /* | |
166 +--------------------------------------------------------------------+ | |
167 | PROJECT : GSM-PS (6147) MODULE : CMH_MMT | | |
168 | STATE : code ROUTINE : tAT_PercentNRG | | |
169 +--------------------------------------------------------------------+ | |
170 | |
171 PURPOSE : This is the functional counterpart to the %NRG=? | |
172 */ | |
173 | |
174 GLOBAL T_ACI_RETURN tAT_PercentNRG ( T_ACI_CMD_SRC srcId, T_ACI_NRG *NRG_options) | |
175 { | |
176 | |
177 TRACE_FUNCTION ("tAT_PercentNRG()"); | |
178 | |
179 /* | |
180 *------------------------------------------------------------------- | |
181 * check command source | |
182 *------------------------------------------------------------------- | |
183 */ | |
184 if(!cmh_IsVldCmdSrc (srcId)) | |
185 { | |
186 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
187 return( AT_FAIL ); | |
188 } | |
189 | |
190 /* | |
191 *------------------------------------------------------------------- | |
192 * check entity status | |
193 *------------------------------------------------------------------- | |
194 */ | |
195 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
196 { | |
197 TRACE_EVENT("mmEntStat.curCmd NEQ AT_CMD_NONE"); | |
198 return( AT_BUSY ); | |
199 } | |
200 /* | |
201 * The response depends upon the value of the PLMN Mode bit. | |
202 */ | |
203 | |
204 NRG_options->reg_mode = NRG_REG_NotPresent; | |
205 NRG_options->srv_mode = NRG_SRV_NotPresent; | |
206 NRG_options->opr_frmt = NRG_OPR_NotPresent; | |
207 | |
208 NRG_options->srv_mode = (NRG_options->srv_mode | NRG_SRV_Full | NRG_SRV_Limited | NRG_SRV_NoSrv | NRG_SRV_SetRegModeOnly); | |
209 NRG_options->opr_frmt = (NRG_options->opr_frmt | NRG_OPR_Long | NRG_OPR_Short | NRG_OPR_Numeric); | |
210 NRG_options->reg_mode = (NRG_options->reg_mode | NRG_REG_Auto); | |
211 | |
212 if(cmhSIM_isplmnmodebit_set()) | |
213 { | |
214 NRG_options->reg_mode = (NRG_options->reg_mode | NRG_REG_Manual | NRG_REG_Both); | |
215 } | |
216 | |
217 return(AT_CMPL); | |
218 | |
219 } | |
220 | |
221 /* | |
222 +--------------------------------------------------------------------+ | |
223 | PROJECT : GSM-PS (6147) MODULE : CMH_MMT | | |
224 | STATE : code ROUTINE : tAT_PercentCOPS | | |
225 +--------------------------------------------------------------------+ | |
226 | |
227 PURPOSE : This is the functional counterpart to the %COPS=? AT command | |
228 which is responsible to test for all available network | |
229 operators. | |
230 | |
231 <startIdx>: start index for reading the list. | |
232 <lastIdx> : last index buffers the last read index of the | |
233 list | |
234 <operLst> : list buffer to copy MAX_OPER entries into. | |
235 */ | |
236 | |
237 GLOBAL T_ACI_RETURN tAT_PercentCOPS ( T_ACI_CMD_SRC srcId, | |
238 SHORT startIdx, | |
239 SHORT * lastIdx, | |
240 T_ACI_COPS_OPDESC * operLst) | |
241 { | |
242 | |
243 TRACE_FUNCTION ("tAT_PercentCOPS()"); | |
244 | |
245 /* | |
246 *------------------------------------------------------------------- | |
247 * check command source | |
248 *------------------------------------------------------------------- | |
249 */ | |
250 if(!cmh_IsVldCmdSrc (srcId)) | |
251 { | |
252 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
253 return( AT_FAIL ); | |
254 } | |
255 | |
256 /* | |
257 *------------------------------------------------------------------- | |
258 * check entity status | |
259 *------------------------------------------------------------------- | |
260 */ | |
261 if( mmEntStat.curCmd NEQ AT_CMD_NONE ) | |
262 | |
263 return( AT_BUSY ); | |
264 | |
265 /* | |
266 *------------------------------------------------------------------- | |
267 * process the start index parameter in case of a network search | |
268 *------------------------------------------------------------------- | |
269 */ | |
270 | |
271 return(get_available_network_list(srcId, AT_CMD_P_COPS, startIdx, lastIdx, operLst)); | |
272 | |
273 } | |
274 | |
275 | |
276 /* | |
277 +--------------------------------------------------------------------+ | |
278 | PROJECT : GSM-PS (6147) MODULE : CMH_MMT | | |
279 | STATE : code ROUTINE : get_available_network_list| | |
280 +--------------------------------------------------------------------+ | |
281 | |
282 PURPOSE : This is common function for +COPS and %COPS test functions. | |
283 */ | |
284 | |
285 LOCAL T_ACI_RETURN get_available_network_list ( T_ACI_CMD_SRC srcId, | |
286 T_ACI_AT_CMD cmd, | |
287 SHORT startIdx, | |
288 SHORT * lastIdx, | |
289 T_ACI_COPS_OPDESC * operLst) | |
290 { | |
291 UBYTE lstIdx; /* holds list index */ | |
292 SHORT mcc, mnc; /* holds converted mnc and mcc */ | |
293 T_ACI_RETURN retCd; /* holds return code */ | |
294 | |
295 TRACE_FUNCTION ("get_available_network_list()"); | |
296 | |
297 /* | |
298 *------------------------------------------------------------------- | |
299 * process the start index parameter in case of a network search | |
300 *------------------------------------------------------------------- | |
301 */ | |
302 if(!cmhSIM_isplmnmodebit_set()) | |
303 { | |
304 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
305 return( AT_FAIL ); | |
306 } | |
307 | |
308 if( startIdx EQ 0 ) | |
309 { | |
310 mmEntStat.curCmd = cmd; | |
311 mmEntStat.entOwn = mmShrdPrm.owner = srcId; | |
312 | |
313 #if defined (GPRS) AND defined (DTI) | |
314 if( psaG_MM_CMD_NET_SRCH ( ) < 0 ) /* search for network */ | |
315 #else | |
316 if( psaMM_NetSrch () < 0 ) /* search for network */ | |
317 #endif | |
318 { | |
319 TRACE_EVENT( "FATAL RETURN psaMM_NetSrch in COPS" ); | |
320 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
321 return( AT_FAIL ); | |
322 } | |
323 | |
324 retCd = AT_EXCT; | |
325 } | |
326 else | |
327 { | |
328 /* | |
329 * For g23m, it makes no sense to support a startIdx different from zero | |
330 * as MM only delivers GMMREG_MAX_PLMN_ID PLMNs which is identical to | |
331 * MAX_PLMN_ID. So the MMI already gets all the desired information | |
332 * by the callback rAT_PlusCOPS(). | |
333 * For other programs like Neptune this maybe different, this is for | |
334 * further study. | |
335 */ | |
336 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
337 return( AT_FAIL ); | |
338 } | |
339 | |
340 /* | |
341 *------------------------------------------------------------------- | |
342 * log command execution | |
343 *------------------------------------------------------------------- | |
344 */ | |
345 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
346 { | |
347 T_ACI_CLOG cmdLog; /* holds logging info */ | |
348 cmdLog.atCmd = cmd; | |
349 cmdLog.cmdType = CLOG_TYPE_Test; | |
350 cmdLog.retCode = retCd; | |
351 cmdLog.cId = ACI_NumParmNotPresent; | |
352 cmdLog.sId = ACI_NumParmNotPresent; | |
353 cmdLog.cmdPrm.tCOPS.srcId = srcId; | |
354 cmdLog.cmdPrm.tCOPS.startIdx = startIdx; | |
355 cmdLog.cmdPrm.tCOPS.lastIdx = lastIdx; | |
356 cmdLog.cmdPrm.tCOPS.operLst = operLst; | |
357 | |
358 rAT_PercentCLOG( &cmdLog ); | |
359 } | |
360 #endif | |
361 return( retCd ); | |
362 } | |
363 | |
364 /*==== EOF ========================================================*/ |