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