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