FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/aci_bat_gprs.c @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Sep 2016 00:29:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:c41a534f33c6 | 3:93999a60b835 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ACI_BAT | |
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 BAT wrapper modul is ... | |
18 | | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifdef GPRS | |
23 | |
24 #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ | |
25 #include "aci_cmh.h" /* prototypes of sAT_,qAT_,tAT_ */ | |
26 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
27 #include "ati_cmd.h" | |
28 #include "aci_cmd.h" | |
29 #include "gaci_cmh.h" | |
30 #include "aci_bat.h" | |
31 #include "aci_mem.h" | |
32 | |
33 extern BOOL cmhSM_isContextActive( void ); | |
34 extern void ipaddr_to_string(ULONG ipaddr, char *ipaddr_string); | |
35 extern T_ATI_RSLT setatPercentCGPCO_HEX (USHORT cid, | |
36 UBYTE *pco_hex_string, USHORT len); | |
37 extern T_ATI_RSLT setatPercentCGPCO_ASCII (UBYTE srcId, USHORT cid, | |
38 UBYTE *pco_ascii_string, USHORT len); | |
39 | |
40 | |
41 #define MAGIC_EMPTY_APN "\x0ff" | |
42 /* | |
43 +--------------------------------------------------------------------+ | |
44 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
45 | STATE : code ROUTINE : sBAT_PlusCGDCONT | | |
46 +--------------------------------------------------------------------+ | |
47 | |
48 PURPOSE : | |
49 */ | |
50 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGDCONT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
51 T_BAT_cmd_send *cmd) | |
52 { | |
53 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
54 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ; | |
55 T_GPRS_CONT_REC inputCtxt; | |
56 | |
57 TRACE_FUNCTION ("sBAT_PlusCGDCONT()"); | |
58 | |
59 memset(inputCtxt.apn,0,sizeof(T_GPRS_CONT_REC)); | |
60 | |
61 cid = cmd->params.ptr_set_plus_cgdcont->cid; | |
62 | |
63 if (cid EQ BAT_PDP_CID_NOT_PRESENT ) | |
64 { | |
65 cid = GPRS_CID_OMITTED ; | |
66 } | |
67 | |
68 if(cmd->params.ptr_set_plus_cgdcont->pdp_type EQ BAT_PDP_TYPE_IPV4) | |
69 { | |
70 strcpy(inputCtxt.pdp_type, "ip"); | |
71 } | |
72 | |
73 if(cmd->params.ptr_set_plus_cgdcont->v_apn) | |
74 { | |
75 memcpy(inputCtxt.apn,cmd->params.ptr_set_plus_cgdcont->apn,cmd->params.ptr_set_plus_cgdcont->c_apn); | |
76 } | |
77 | |
78 if(cmd->params.ptr_set_plus_cgdcont->v_pdp_addr) | |
79 { | |
80 memcpy(inputCtxt.pdp_addr,cmd->params.ptr_set_plus_cgdcont->pdp_addr,cmd->params.ptr_set_plus_cgdcont->c_pdp_addr); | |
81 } | |
82 | |
83 inputCtxt.d_comp = cmd->params.ptr_set_plus_cgdcont->d_comp; | |
84 inputCtxt.h_comp = cmd->params.ptr_set_plus_cgdcont->h_comp; | |
85 | |
86 ret = sAT_PlusCGDCONT (src_infos_psi->srcId, (SHORT)cid ,&inputCtxt); | |
87 return(ret); | |
88 } | |
89 | |
90 /* | |
91 +--------------------------------------------------------------------+ | |
92 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
93 | STATE : code ROUTINE : qBAT_PlusCGDCONT | | |
94 +--------------------------------------------------------------------+ | |
95 | |
96 PURPOSE : | |
97 */ | |
98 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGDCONT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
99 T_BAT_cmd_send *cmd) | |
100 { | |
101 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
102 T_BAT_cmd_response resp; | |
103 T_BAT_res_que_plus_cgdcont que_cgdcont_buffer; | |
104 T_GPRS_CONT_REC defCtxts[MAX_CID_PLUS_EINS]; | |
105 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
106 int i ; | |
107 | |
108 TRACE_FUNCTION ("qBAT_PlusCGDCONT()"); | |
109 resp.ctrl_response = BAT_RES_QUE_PLUS_CGDCONT; | |
110 resp.response.ptr_que_plus_cgdcont = &que_cgdcont_buffer; | |
111 | |
112 ret = qAT_PlusCGDCONT (src_infos_psi->srcId, &defCtxts, cid_array); | |
113 | |
114 if (ret EQ AT_CMPL) | |
115 { | |
116 for ( i = 0; i < MAX_CID && cid_array[i] NEQ INVALID_CID; i++ ) | |
117 { | |
118 resp.response.ptr_que_plus_cgdcont->cid = cid_array[i]; | |
119 if(!(utl_strcasecmp((const char *)defCtxts[i].pdp_type, (const char *)"ip"))) | |
120 resp.response.ptr_que_plus_cgdcont->pdp_type = BAT_PDP_TYPE_IPV4; | |
121 else | |
122 resp.response.ptr_que_plus_cgdcont->pdp_type = BAT_PDP_TYPE_NOT_PRESENT; | |
123 | |
124 resp.response.ptr_que_plus_cgdcont->c_apn = strlen(defCtxts[i].apn); | |
125 memcpy(resp.response.ptr_que_plus_cgdcont->apn,defCtxts[i].apn,strlen(defCtxts[i].apn)); | |
126 resp.response.ptr_que_plus_cgdcont->c_pdp_addr = strlen(defCtxts[i].pdp_addr); | |
127 memcpy(resp.response.ptr_que_plus_cgdcont->pdp_addr,defCtxts[i].pdp_addr,strlen(defCtxts[i].pdp_addr)); | |
128 resp.response.ptr_que_plus_cgdcont->d_comp = defCtxts[i].d_comp; | |
129 resp.response.ptr_que_plus_cgdcont->h_comp = defCtxts[i].h_comp; | |
130 aci_bat_send(src_infos_psi,&resp); | |
131 } | |
132 return ACI_BAT_CMPL; | |
133 } | |
134 | |
135 return(ret); | |
136 } | |
137 | |
138 /* | |
139 +--------------------------------------------------------------------+ | |
140 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
141 | STATE : code ROUTINE : sBAT_PlusCGQREQ | | |
142 +--------------------------------------------------------------------+ | |
143 | |
144 PURPOSE : | |
145 */ | |
146 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
147 T_BAT_cmd_send *cmd) | |
148 { | |
149 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
150 T_QOS input_qos = { ( UBYTE ) GPRS_QOS_OMITTED }; | |
151 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ; | |
152 | |
153 TRACE_FUNCTION ("sBAT_PlusCGQREQ()"); | |
154 | |
155 cid = cmd->params.ptr_set_plus_cgqreq->cid; | |
156 if (cid EQ BAT_PDP_CID_NOT_PRESENT ) | |
157 { | |
158 cid = GPRS_CID_OMITTED ; | |
159 } | |
160 input_qos.preced = cmd->params.ptr_set_plus_cgqreq->precedence; | |
161 input_qos.delay = cmd->params.ptr_set_plus_cgqreq->delay; | |
162 input_qos.relclass = cmd->params.ptr_set_plus_cgqreq->reliability; | |
163 input_qos.peak = cmd->params.ptr_set_plus_cgqreq->peak; | |
164 input_qos.mean = cmd->params.ptr_set_plus_cgqreq->mean; | |
165 | |
166 if (input_qos.preced EQ BAT_PRECEDENCE_NOT_PRESENT) | |
167 { | |
168 input_qos.preced = GPRS_QOS_OMITTED ; | |
169 } | |
170 if (input_qos.delay EQ BAT_DELAY_NOT_PRESENT) | |
171 { | |
172 input_qos.delay = GPRS_QOS_OMITTED ; | |
173 } | |
174 if (input_qos.relclass EQ BAT_RELIABILITY_NOT_PRESENT) | |
175 { | |
176 input_qos.relclass = GPRS_QOS_OMITTED ; | |
177 } | |
178 if (input_qos.peak EQ BAT_PEAK_NOT_PRESENT) | |
179 { | |
180 input_qos.peak= GPRS_QOS_OMITTED ; | |
181 } | |
182 if (input_qos.mean EQ BAT_MEAN_NOT_PRESENT) | |
183 { | |
184 input_qos.mean = GPRS_QOS_OMITTED ; | |
185 } | |
186 ret = sAT_PlusCGQREQ (src_infos_psi->srcId, (SHORT)cid ,&input_qos); | |
187 return(ret); | |
188 } | |
189 | |
190 /* | |
191 +--------------------------------------------------------------------+ | |
192 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
193 | STATE : code ROUTINE : qBAT_PlusCGQREQ | | |
194 +--------------------------------------------------------------------+ | |
195 | |
196 PURPOSE : | |
197 */ | |
198 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
199 T_BAT_cmd_send *cmd) | |
200 { | |
201 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
202 T_QOS *pdef_qos[MAX_CID_PLUS_EINS]; | |
203 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
204 int i = 0; | |
205 T_BAT_cmd_response resp; | |
206 T_BAT_res_que_plus_cgqreq que_cgqreq_buffer; | |
207 | |
208 TRACE_FUNCTION ("qBAT_PlusCGQREQ()"); | |
209 resp.ctrl_response = BAT_RES_QUE_PLUS_CGQREQ; | |
210 resp.response.ptr_que_plus_cgqreq = &que_cgqreq_buffer; | |
211 | |
212 ret=qAT_PlusCGQREQ (src_infos_psi->srcId, pdef_qos, cid_array); | |
213 if (ret EQ AT_CMPL) | |
214 { | |
215 for ( i = 0; i < MAX_CID && pdef_qos[i]; i++ ) | |
216 { | |
217 resp.response.ptr_que_plus_cgqreq->cid = ((cid_array[i] == INVALID_CID) ? | |
218 BAT_PDP_CID_NOT_PRESENT : cid_array[i]); | |
219 resp.response.ptr_que_plus_cgqreq->precedence = pdef_qos[i]->preced ; | |
220 resp.response.ptr_que_plus_cgqreq->delay = pdef_qos[i]->delay ; | |
221 resp.response.ptr_que_plus_cgqreq->reliability= pdef_qos[i]->relclass ; | |
222 resp.response.ptr_que_plus_cgqreq->peak = pdef_qos[i]->peak ; | |
223 resp.response.ptr_que_plus_cgqreq->mean = pdef_qos[i]->mean ; | |
224 aci_bat_send(src_infos_psi,&resp); | |
225 } | |
226 return ACI_BAT_CMPL; | |
227 } | |
228 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
229 return (ACI_BAT_FAIL); | |
230 } | |
231 | |
232 /* | |
233 +--------------------------------------------------------------------+ | |
234 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
235 | STATE : code ROUTINE : sBAT_PlusCGQMIN | | |
236 +--------------------------------------------------------------------+ | |
237 | |
238 PURPOSE : | |
239 */ | |
240 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
241 T_BAT_cmd_send *cmd) | |
242 { | |
243 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
244 T_QOS input_qos = { ( UBYTE ) GPRS_QOS_OMITTED }; | |
245 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ; | |
246 | |
247 TRACE_FUNCTION ("sBAT_PlusCGQMIN()"); | |
248 cid = cmd->params.ptr_set_plus_cgqmin->cid; | |
249 if (cid EQ BAT_PDP_CID_NOT_PRESENT ) | |
250 { | |
251 cid = GPRS_CID_OMITTED ; | |
252 } | |
253 input_qos.preced = cmd->params.ptr_set_plus_cgqmin->precedence; | |
254 input_qos.delay = cmd->params.ptr_set_plus_cgqmin->delay; | |
255 input_qos.relclass = cmd->params.ptr_set_plus_cgqmin->reliability; | |
256 input_qos.peak = cmd->params.ptr_set_plus_cgqmin->peak; | |
257 input_qos.mean = cmd->params.ptr_set_plus_cgqmin->mean; | |
258 | |
259 if (input_qos.preced EQ BAT_PRECEDENCE_NOT_PRESENT) | |
260 { | |
261 input_qos.preced = GPRS_QOS_OMITTED ; | |
262 } | |
263 if (input_qos.delay EQ BAT_DELAY_NOT_PRESENT) | |
264 { | |
265 input_qos.delay = GPRS_QOS_OMITTED ; | |
266 } | |
267 if (input_qos.relclass EQ BAT_RELIABILITY_NOT_PRESENT) | |
268 { | |
269 input_qos.relclass = GPRS_QOS_OMITTED ; | |
270 } | |
271 if (input_qos.peak EQ BAT_PEAK_NOT_PRESENT) | |
272 { | |
273 input_qos.peak= GPRS_QOS_OMITTED ; | |
274 } | |
275 if (input_qos.mean EQ BAT_MEAN_NOT_PRESENT) | |
276 { | |
277 input_qos.mean = GPRS_QOS_OMITTED ; | |
278 } | |
279 ret = sAT_PlusCGQMIN (src_infos_psi->srcId, (SHORT)cid ,&input_qos); | |
280 return(ret); | |
281 } | |
282 | |
283 /* | |
284 +--------------------------------------------------------------------+ | |
285 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
286 | STATE : code ROUTINE : qBAT_PlusCGQMIN | | |
287 +--------------------------------------------------------------------+ | |
288 | |
289 PURPOSE : | |
290 */ | |
291 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
292 T_BAT_cmd_send *cmd) | |
293 { | |
294 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
295 T_BAT_cmd_response resp; | |
296 T_BAT_res_que_plus_cgqmin que_cgqmin_buffer; | |
297 T_QOS *pdef_qos[MAX_CID_PLUS_EINS]; | |
298 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
299 int i = 0; | |
300 | |
301 TRACE_FUNCTION ("qBAT_PlusCGQMIN()"); | |
302 resp.ctrl_response = BAT_RES_QUE_PLUS_CGQMIN; | |
303 resp.response.ptr_que_plus_cgqmin = &que_cgqmin_buffer; | |
304 ret=qAT_PlusCGQMIN (src_infos_psi->srcId, pdef_qos, cid_array); | |
305 if (ret EQ AT_CMPL) | |
306 { | |
307 for ( i = 0; i < MAX_CID && pdef_qos[i]; i++ ) | |
308 { | |
309 resp.response.ptr_que_plus_cgqmin->cid = (cid_array[i] == INVALID_CID) ? | |
310 BAT_PDP_CID_NOT_PRESENT : cid_array[i] ; | |
311 resp.response.ptr_que_plus_cgqmin->precedence = pdef_qos[i]->preced; | |
312 resp.response.ptr_que_plus_cgqmin->delay = pdef_qos[i]->delay ; | |
313 resp.response.ptr_que_plus_cgqmin->reliability= pdef_qos[i]->relclass ; | |
314 resp.response.ptr_que_plus_cgqmin->peak = pdef_qos[i]->peak ; | |
315 resp.response.ptr_que_plus_cgqmin->mean = pdef_qos[i]->mean ; | |
316 aci_bat_send(src_infos_psi,&resp); | |
317 } | |
318 } | |
319 return (ret); | |
320 } | |
321 | |
322 /* | |
323 +--------------------------------------------------------------------+ | |
324 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
325 | STATE : code ROUTINE : sBAT_PlusCGATT | | |
326 +--------------------------------------------------------------------+ | |
327 | |
328 PURPOSE : | |
329 */ | |
330 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGATT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
331 T_BAT_cmd_send *cmd) | |
332 { | |
333 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
334 T_CGATT_STATE state = CGATT_STATE_OMITTED; | |
335 | |
336 TRACE_FUNCTION ("sBAT_PlusCGATT()"); | |
337 | |
338 state = cmd->params.ptr_set_plus_cgatt->state; | |
339 ret = sAT_PlusCGATT ( src_infos_psi->srcId, state ); | |
340 return(ret); | |
341 } | |
342 | |
343 /* | |
344 +--------------------------------------------------------------------+ | |
345 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
346 | STATE : code ROUTINE : qBAT_PlusCGATT | | |
347 +--------------------------------------------------------------------+ | |
348 | |
349 PURPOSE : | |
350 */ | |
351 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGATT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
352 T_BAT_cmd_send *cmd) | |
353 { | |
354 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
355 T_BAT_cmd_response resp; | |
356 T_BAT_res_que_plus_cgatt que_cgatt_buffer; | |
357 T_CGATT_STATE state = CGATT_STATE_OMITTED; | |
358 | |
359 TRACE_FUNCTION ("qBAT_PlusCGATT()"); | |
360 resp.ctrl_response = BAT_RES_QUE_PLUS_CGATT; | |
361 resp.response.ptr_que_plus_cgatt = &que_cgatt_buffer; | |
362 | |
363 ret = qAT_PlusCGATT(src_infos_psi->srcId, &state); | |
364 if (ret EQ AT_CMPL) | |
365 { | |
366 resp.response.ptr_que_plus_cgatt->state = state; | |
367 aci_bat_send(src_infos_psi,&resp); | |
368 return ACI_BAT_CMPL; | |
369 } | |
370 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
371 return (ACI_BAT_FAIL); | |
372 } | |
373 | |
374 /* | |
375 +--------------------------------------------------------------------+ | |
376 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
377 | STATE : code ROUTINE : sBAT_PlusCGCLASS | | |
378 +--------------------------------------------------------------------+ | |
379 | |
380 PURPOSE : | |
381 */ | |
382 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
383 T_BAT_cmd_send *cmd) | |
384 { | |
385 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
386 T_CGCLASS_CLASS m_class = CGCLASS_CLASS_OMITTED; | |
387 | |
388 TRACE_FUNCTION ("sBAT_PlusCGCLASS()"); | |
389 | |
390 m_class = (T_CGCLASS_CLASS)cmd->params.ptr_set_plus_cgclass->mobile_class; | |
391 | |
392 if (m_class EQ CGCLASS_CLASS_OMITTED) | |
393 { | |
394 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); | |
395 return (ACI_BAT_FAIL); | |
396 } | |
397 ret = sAT_PlusCGCLASS ( src_infos_psi->srcId, m_class ); | |
398 return(ret); | |
399 } | |
400 | |
401 /* | |
402 +--------------------------------------------------------------------+ | |
403 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
404 | STATE : code ROUTINE : qBAT_PlusCGCLASS | | |
405 +--------------------------------------------------------------------+ | |
406 | |
407 PURPOSE : | |
408 */ | |
409 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
410 T_BAT_cmd_send *cmd) | |
411 { | |
412 T_ACI_BAT_RSLT ret; | |
413 T_CGCLASS_CLASS m_class; | |
414 | |
415 TRACE_FUNCTION ("qBAT_PlusCGCLASS()"); | |
416 | |
417 ret=qAT_PlusCGCLASS(src_infos_psi->srcId,&m_class); | |
418 | |
419 /* | |
420 * If the query completes, send the response now. | |
421 */ | |
422 if (ret==ACI_BAT_CMPL) | |
423 { | |
424 T_BAT_cmd_response resp; | |
425 T_BAT_res_que_plus_cgclass cgclass_data; | |
426 | |
427 resp.ctrl_response=BAT_RES_QUE_PLUS_CGCLASS; | |
428 resp.response.ptr_que_plus_cgclass=&cgclass_data; | |
429 | |
430 /* | |
431 * This relies on T_BAT_mobile_class and T_CGCLASS_CLASS | |
432 * being identical. | |
433 */ | |
434 resp.response.ptr_que_plus_cgclass->mobile_class=(T_BAT_mobile_class)m_class; | |
435 | |
436 aci_bat_send(src_infos_psi,&resp); | |
437 return ACI_BAT_CMPL; | |
438 } | |
439 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
440 return (ACI_BAT_FAIL); | |
441 } | |
442 | |
443 /* | |
444 +--------------------------------------------------------------------+ | |
445 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
446 | STATE : code ROUTINE : sBAT_PlusCGACT | | |
447 +--------------------------------------------------------------------+ | |
448 | |
449 PURPOSE : | |
450 */ | |
451 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGACT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
452 T_BAT_cmd_send *cmd) | |
453 { | |
454 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
455 T_CGACT_STATE state = CGACT_STATE_OMITTED; | |
456 SHORT count = 0; | |
457 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
458 | |
459 TRACE_FUNCTION ("sBAT_PlusCGACT()"); | |
460 | |
461 state = cmd->params.ptr_set_plus_cgact->state; | |
462 if(cmd->params.ptr_set_plus_cgact->c_cid == 0) | |
463 cid_array[0] = INVALID_CID; | |
464 for(count=0;count<cmd->params.ptr_set_plus_cgact->c_cid;count++) | |
465 { | |
466 cid_array[count] = (cmd->params.ptr_set_plus_cgact->cid[count] EQ BAT_PDP_CID_NOT_PRESENT) | |
467 ? INVALID_CID : cmd->params.ptr_set_plus_cgact->cid[count]; | |
468 } | |
469 if(count > 0) | |
470 cid_array[count]= INVALID_CID; | |
471 ret = sAT_PlusCGACT ( src_infos_psi->srcId, state, cid_array ); | |
472 return(ret); | |
473 } | |
474 | |
475 /* | |
476 +--------------------------------------------------------------------+ | |
477 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
478 | STATE : code ROUTINE : qBAT_PlusCGACT | | |
479 +--------------------------------------------------------------------+ | |
480 | |
481 PURPOSE : | |
482 */ | |
483 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGACT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
484 T_BAT_cmd_send *cmd) | |
485 { | |
486 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
487 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
488 SHORT count = 0; | |
489 BOOL states[MAX_CID_PLUS_EINS]; | |
490 T_BAT_cmd_response resp; | |
491 T_BAT_res_que_plus_cgact que_cgact_buffer; | |
492 | |
493 TRACE_FUNCTION ("qBAT_PlusCGACT()"); | |
494 resp.ctrl_response = BAT_RES_QUE_PLUS_CGACT; | |
495 resp.response.ptr_que_plus_cgact = &que_cgact_buffer; | |
496 | |
497 ret=qAT_PlusCGACT(src_infos_psi->srcId, states, cid_array); | |
498 if(ret EQ AT_CMPL) | |
499 { | |
500 for ( count = 0; count < MAX_CID && cid_array[count] NEQ INVALID_CID; count++ ) | |
501 { | |
502 resp.response.ptr_que_plus_cgact->state = states[count]; | |
503 resp.response.ptr_que_plus_cgact->cid = cid_array[count]; | |
504 aci_bat_send(src_infos_psi,&resp); | |
505 } | |
506 return(ret); | |
507 } | |
508 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
509 return (ACI_BAT_FAIL); | |
510 } | |
511 | |
512 /* | |
513 +--------------------------------------------------------------------+ | |
514 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
515 | STATE : code ROUTINE : sBAT_PlusCGDATA | | |
516 +--------------------------------------------------------------------+ | |
517 | |
518 PURPOSE : | |
519 */ | |
520 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGDATA (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
521 T_BAT_cmd_send *cmd) | |
522 { | |
523 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
524 char L2P[MAX_L2P_LENGTH] = ""; | |
525 SHORT cid_array[MAX_CID_PLUS_EINS] = { GPRS_CID_OMITTED }; | |
526 | |
527 TRACE_FUNCTION ("sBAT_PlusCGDATA()"); | |
528 | |
529 if(cmd->params.ptr_set_plus_cgdata->v_l2p) | |
530 { | |
531 memcpy(L2P,cmd->params.ptr_set_plus_cgdata->l2p,cmd->params.ptr_set_plus_cgdata->c_l2p); | |
532 } | |
533 else | |
534 { | |
535 L2P[0] = 0; | |
536 } | |
537 | |
538 if(cmd->params.ptr_set_plus_cgdata->v_cid) | |
539 { | |
540 memcpy(cid_array,cmd->params.ptr_set_plus_cgdata->cid,2*cmd->params.ptr_set_plus_cgdata->c_cid); | |
541 cid_array[cmd->params.ptr_set_plus_cgdata->c_cid] = INVALID_CID; | |
542 } | |
543 ret = sAT_PlusCGDATA (src_infos_psi->srcId, L2P, cid_array ); | |
544 return(ret); | |
545 } | |
546 | |
547 /* | |
548 +--------------------------------------------------------------------+ | |
549 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
550 | STATE : code ROUTINE : sBAT_PlusCGPADDR | | |
551 +--------------------------------------------------------------------+ | |
552 | |
553 PURPOSE : | |
554 */ | |
555 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGPADDR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
556 T_BAT_cmd_send *cmd) | |
557 { | |
558 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
559 T_PDP_ADDRESS pdp_addresses[MAX_CID]; | |
560 SHORT count = 0; | |
561 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
562 T_BAT_cmd_set_plus_cgpaddr *cgpaddr; | |
563 | |
564 TRACE_FUNCTION ("sBAT_PlusCGPADDR()"); | |
565 | |
566 /* | |
567 * Get a pointer to the CGPADDR data for convenience. | |
568 */ | |
569 cgpaddr=cmd->params.ptr_set_plus_cgpaddr; | |
570 | |
571 if (cgpaddr->c_cid) | |
572 { | |
573 for (count=0;((count<(MAX_CID_PLUS_EINS-1)) && (count<cgpaddr->c_cid));count++) | |
574 cid_array[count]=(SHORT)cgpaddr->cid[count]; | |
575 | |
576 cid_array[count]=INVALID_CID; | |
577 } | |
578 else | |
579 { | |
580 cid_array[0]=GPRS_CID_OMITTED; | |
581 } | |
582 | |
583 ret = (T_ACI_BAT_RSLT)sAT_PlusCGPADDR(src_infos_psi->srcId, cid_array, pdp_addresses ); | |
584 | |
585 if (ret==ACI_BAT_CMPL) | |
586 { | |
587 T_BAT_cmd_response resp; | |
588 T_BAT_res_set_plus_cgpaddr cgpaddr_data; | |
589 UBYTE len; | |
590 | |
591 resp.ctrl_response=BAT_RES_SET_PLUS_CGPADDR; | |
592 resp.response.ptr_set_plus_cgpaddr=&cgpaddr_data; | |
593 | |
594 for (count=0;count<BAT_MAX_PDP_CID;count++) | |
595 { | |
596 if (cid_array[count]==INVALID_CID) | |
597 break; | |
598 | |
599 cgpaddr_data.cid=(T_BAT_pdp_cid)cid_array[count]; | |
600 | |
601 len=strlen(pdp_addresses[count]); | |
602 | |
603 if (len>BAT_MAX_PDP_ADD) | |
604 len=BAT_MAX_PDP_ADD; | |
605 | |
606 memcpy(cgpaddr_data.pdp_addr,pdp_addresses[count],len); | |
607 cgpaddr_data.c_pdp_addr=(U8)len; | |
608 | |
609 aci_bat_send(src_infos_psi,&resp); | |
610 } | |
611 } | |
612 | |
613 return(ret); | |
614 } | |
615 | |
616 /* | |
617 +--------------------------------------------------------------------+ | |
618 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
619 | STATE : code ROUTINE : sBAT_PlusCGANS | | |
620 +--------------------------------------------------------------------+ | |
621 | |
622 PURPOSE : | |
623 */ | |
624 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGANS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
625 T_BAT_cmd_send *cmd) | |
626 { | |
627 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
628 char L2P[MAX_L2P_LENGTH] = "" ; | |
629 SHORT cid = GPRS_CID_OMITTED, response = -1 ; | |
630 | |
631 TRACE_FUNCTION ("sBAT_PlusCGANS()"); | |
632 | |
633 response = cmd->params.ptr_set_plus_cgans->response; | |
634 if(cmd->params.ptr_set_plus_cgans->v_l2p) | |
635 { | |
636 memcpy(L2P,cmd->params.ptr_set_plus_cgans->l2p,cmd->params.ptr_set_plus_cgans->c_l2p); | |
637 } | |
638 else | |
639 { | |
640 L2P[0] = 0; | |
641 } | |
642 | |
643 cid = cmd->params.ptr_set_plus_cgans->cid; | |
644 if (cid EQ BAT_PDP_CID_NOT_PRESENT ) | |
645 { | |
646 cid = GPRS_CID_OMITTED ; | |
647 } | |
648 ret = sAT_PlusCGANS ( src_infos_psi->srcId, response, L2P, cid ); | |
649 return(ret); | |
650 } | |
651 | |
652 /* | |
653 +--------------------------------------------------------------------+ | |
654 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
655 | STATE : code ROUTINE : qBAT_PlusCGREG | | |
656 +--------------------------------------------------------------------+ | |
657 | |
658 PURPOSE : | |
659 */ | |
660 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGREG (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
661 T_BAT_cmd_send *cmd) | |
662 { | |
663 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
664 T_CGREG_STAT stat; | |
665 USHORT lac, cid; | |
666 | |
667 TRACE_FUNCTION ("qBAT_PlusCGREG()"); | |
668 | |
669 ret=(T_ACI_BAT_RSLT)qAT_PlusCGREG(src_infos_psi->srcId, &stat, &lac, &cid); | |
670 | |
671 if (ret==ACI_BAT_CMPL) | |
672 { | |
673 T_BAT_cmd_response resp; | |
674 T_BAT_res_que_plus_cgreg que_cgreg_buffer; | |
675 | |
676 resp.ctrl_response = BAT_RES_QUE_PLUS_CGREG; | |
677 resp.response.ptr_que_plus_cgreg = &que_cgreg_buffer; | |
678 | |
679 resp.response.ptr_que_plus_cgreg->stat = stat; | |
680 resp.response.ptr_que_plus_cgreg->lac = lac; | |
681 resp.response.ptr_que_plus_cgreg->ci = cid; | |
682 aci_bat_send(src_infos_psi,&resp); | |
683 } | |
684 | |
685 return(ret); | |
686 } | |
687 | |
688 /* | |
689 +--------------------------------------------------------------------+ | |
690 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
691 | STATE : code ROUTINE : qBAT_PercentCGREG | | |
692 +--------------------------------------------------------------------+ | |
693 | |
694 PURPOSE : | |
695 */ | |
696 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGREG (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
697 T_BAT_cmd_send *cmd) | |
698 { | |
699 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
700 T_P_CGREG_STAT stat; | |
701 USHORT lac, cid; | |
702 | |
703 TRACE_FUNCTION ("qBAT_PercentCGREG()"); | |
704 ret=(T_ACI_BAT_RSLT)qAT_PercentCGREG(src_infos_psi->srcId, &stat, &lac, &cid); | |
705 | |
706 if (ret==ACI_BAT_CMPL) | |
707 { | |
708 T_BAT_cmd_response resp; | |
709 T_BAT_res_que_percent_cgreg que_cgreg_buffer; | |
710 | |
711 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGREG; | |
712 resp.response.ptr_que_percent_cgreg = &que_cgreg_buffer; | |
713 | |
714 resp.response.ptr_que_percent_cgreg->stat = stat; | |
715 resp.response.ptr_que_percent_cgreg->lac = lac; | |
716 resp.response.ptr_que_percent_cgreg->ci = cid; | |
717 resp.response.ptr_que_percent_cgreg->state = (cmhSM_isContextActive() ? BAT_P_CGREG_STATE_STAT_1 | |
718 : BAT_P_CGREG_STATE_STAT_0 ); | |
719 aci_bat_send(src_infos_psi,&resp); | |
720 } | |
721 | |
722 return(ret); | |
723 } | |
724 | |
725 /* | |
726 +--------------------------------------------------------------------+ | |
727 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
728 | STATE : code ROUTINE : tBAT_PlusCGPADDR | | |
729 +--------------------------------------------------------------------+ | |
730 | |
731 PURPOSE : | |
732 */ | |
733 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCGPADDR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
734 T_BAT_cmd_send *cmd) | |
735 { | |
736 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
737 U8 count = 0; | |
738 SHORT cid_array[MAX_CID_PLUS_EINS]; | |
739 int pos = 0; | |
740 T_BAT_cmd_response resp; | |
741 T_BAT_res_tst_plus_cgpaddr tst_cgpaddr_buffer; | |
742 | |
743 TRACE_FUNCTION ("tBAT_PlusCGPADDR()"); | |
744 | |
745 ret = tAT_PlusCGPADDR ( src_infos_psi->srcId, cid_array ); | |
746 resp.ctrl_response = BAT_RES_TST_PLUS_CGPADDR; | |
747 resp.response.ptr_tst_plus_cgpaddr = &tst_cgpaddr_buffer; | |
748 if (ret EQ ACI_BAT_CMPL) | |
749 { | |
750 while ( cid_array[count] NEQ INVALID_CID ) | |
751 { | |
752 resp.response.ptr_tst_plus_cgpaddr->cid[count]=cid_array[count]; | |
753 count ++; | |
754 } | |
755 if(count == 0) | |
756 resp.response.ptr_tst_plus_cgpaddr->cid[0] = BAT_PDP_CID_NOT_PRESENT; | |
757 | |
758 resp.response.ptr_tst_plus_cgpaddr->c_cid = count; | |
759 aci_bat_send(src_infos_psi,&resp); | |
760 return(ACI_BAT_CMPL); | |
761 } | |
762 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
763 return(ACI_BAT_FAIL); | |
764 } | |
765 | |
766 /* | |
767 +--------------------------------------------------------------------+ | |
768 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
769 | STATE : code ROUTINE : sBAT_PlusCGSMS | | |
770 +--------------------------------------------------------------------+ | |
771 | |
772 PURPOSE : | |
773 */ | |
774 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGSMS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
775 T_BAT_cmd_send *cmd) | |
776 { | |
777 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
778 T_CGSMS_SERVICE service = CGSMS_SERVICE_OMITTED; | |
779 | |
780 TRACE_FUNCTION ("sBAT_PlusCGSMS()"); | |
781 | |
782 service = cmd->params.ptr_set_plus_cgsms->service; | |
783 ret = sAT_PlusCGSMS ( src_infos_psi->srcId, service ); | |
784 return(ret); | |
785 } | |
786 | |
787 /* | |
788 +--------------------------------------------------------------------+ | |
789 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
790 | STATE : code ROUTINE : qBAT_PlusCGSMS | | |
791 +--------------------------------------------------------------------+ | |
792 | |
793 PURPOSE : | |
794 */ | |
795 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGSMS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
796 T_BAT_cmd_send *cmd) | |
797 { | |
798 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
799 T_BAT_cmd_response resp; | |
800 T_BAT_res_que_plus_cgsms que_cgsms_buffer; | |
801 T_CGSMS_SERVICE service = CGSMS_SERVICE_OMITTED; | |
802 | |
803 TRACE_FUNCTION ("qBAT_PlusCGSMS()"); | |
804 | |
805 ret = qAT_PlusCGSMS(src_infos_psi->srcId, &service); | |
806 resp.ctrl_response = BAT_RES_QUE_PLUS_CGSMS; | |
807 resp.response.ptr_que_plus_cgsms = &que_cgsms_buffer; | |
808 if(ret EQ ACI_BAT_CMPL) | |
809 { | |
810 resp.response.ptr_que_plus_cgsms->service = service; | |
811 aci_bat_send(src_infos_psi,&resp); | |
812 return ret; | |
813 } | |
814 else | |
815 { | |
816 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
817 return (ACI_BAT_FAIL); | |
818 } | |
819 } | |
820 | |
821 /* | |
822 +--------------------------------------------------------------------+ | |
823 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
824 | STATE : code ROUTINE : sBAT_PercentCGAATT | | |
825 +--------------------------------------------------------------------+ | |
826 | |
827 PURPOSE : | |
828 */ | |
829 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGAATT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
830 T_BAT_cmd_send *cmd) | |
831 { | |
832 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
833 T_BAT_percent_cgaatt_att_m att_m; | |
834 T_BAT_percent_cgaatt_det_m det_m; | |
835 | |
836 TRACE_FUNCTION ("sBAT_PercentCGAATT()"); | |
837 | |
838 att_m = cmd->params.ptr_set_percent_cgaatt->att_m; | |
839 det_m = cmd->params.ptr_set_percent_cgaatt->det_m; | |
840 ret = sAT_PercentCGAATT ( src_infos_psi->srcId, att_m, det_m ); | |
841 return(ret); | |
842 } | |
843 | |
844 /* | |
845 +--------------------------------------------------------------------+ | |
846 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
847 | STATE : code ROUTINE : qBAT_PercentCGAATT | | |
848 +--------------------------------------------------------------------+ | |
849 | |
850 PURPOSE : | |
851 */ | |
852 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGAATT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
853 T_BAT_cmd_send *cmd) | |
854 { | |
855 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
856 T_BAT_percent_cgaatt_att_m att_m; | |
857 T_BAT_percent_cgaatt_det_m det_m; | |
858 | |
859 TRACE_FUNCTION ("qBAT_PercentCGAATT()"); | |
860 | |
861 ret = (T_ACI_BAT_RSLT)qAT_PercentCGAATT( | |
862 src_infos_psi->srcId, (T_CGAATT_ATTACH_MODE *)&att_m, (T_CGAATT_DETACH_MODE *)&det_m); | |
863 | |
864 if(ret==ACI_BAT_CMPL) | |
865 { | |
866 T_BAT_cmd_response resp; | |
867 T_BAT_res_que_percent_cgaatt que_cgaatt_buffer; | |
868 | |
869 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGAATT; | |
870 resp.response.ptr_que_percent_cgaatt = &que_cgaatt_buffer; | |
871 | |
872 resp.response.ptr_que_percent_cgaatt->att_m = att_m; | |
873 resp.response.ptr_que_percent_cgaatt->det_m = det_m; | |
874 aci_bat_send(src_infos_psi,&resp); | |
875 } | |
876 | |
877 return ret; | |
878 } | |
879 | |
880 /* | |
881 +--------------------------------------------------------------------+ | |
882 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
883 | STATE : code ROUTINE : sBAT_PercentSNCNT | | |
884 +--------------------------------------------------------------------+ | |
885 | |
886 PURPOSE : | |
887 */ | |
888 GLOBAL T_ACI_BAT_RSLT sBAT_PercentSNCNT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
889 T_BAT_cmd_send *cmd) | |
890 { | |
891 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
892 T_BAT_percent_sncnt_rst rst; | |
893 | |
894 TRACE_FUNCTION ("sBAT_PercentSNCNT()"); | |
895 /* what to do with rst? */ | |
896 rst = cmd->params.ptr_set_percent_sncnt->rst; | |
897 ret = sAT_PercentSNCNT( src_infos_psi->srcId, TRUE ); | |
898 return(ret); | |
899 } | |
900 | |
901 /* | |
902 +--------------------------------------------------------------------+ | |
903 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
904 | STATE : code ROUTINE : qBAT_PercentSNCNT | | |
905 +--------------------------------------------------------------------+ | |
906 | |
907 PURPOSE : | |
908 */ | |
909 GLOBAL T_ACI_BAT_RSLT qBAT_PercentSNCNT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
910 T_BAT_cmd_send *cmd) | |
911 { | |
912 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
913 | |
914 TRACE_FUNCTION ("qBAT_PercentSNCNT()"); | |
915 ret = sAT_PercentSNCNT( src_infos_psi->srcId, FALSE ); | |
916 return(ret); | |
917 } | |
918 | |
919 /* | |
920 +--------------------------------------------------------------------+ | |
921 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
922 | STATE : code ROUTINE : sBAT_PercentCGMM | | |
923 +--------------------------------------------------------------------+ | |
924 | |
925 PURPOSE : | |
926 */ | |
927 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGMM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
928 T_BAT_cmd_send *cmd) | |
929 { | |
930 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
931 UBYTE cipher_on , tlli_handling ; | |
932 | |
933 TRACE_FUNCTION ("sBAT_PercentCGMM()"); | |
934 | |
935 cipher_on = cmd->params.ptr_set_percent_cgmm->cipher_on; | |
936 tlli_handling = cmd->params.ptr_set_percent_cgmm->tlli_handling; | |
937 | |
938 ret = sAT_PercentCGMM( src_infos_psi->srcId, cipher_on, tlli_handling ); | |
939 return(ret); | |
940 } | |
941 | |
942 /* | |
943 +--------------------------------------------------------------------+ | |
944 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
945 | STATE : code ROUTINE : sBAT_PercentCGPCO | | |
946 +--------------------------------------------------------------------+ | |
947 | |
948 PURPOSE : | |
949 */ | |
950 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGPCO (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
951 T_BAT_cmd_send *cmd) | |
952 { | |
953 T_ATI_RSLT ret = ATI_FAIL; | |
954 USHORT cid = 0; | |
955 T_ACI_CGPCO_FORMAT format; | |
956 CHAR pco_string[BAT_MAX_CGPCO_PCO_LEN+1]; | |
957 T_ACI_CGPCO_MODE mode; | |
958 | |
959 TRACE_FUNCTION ("sBAT_PercentCGPCO()"); | |
960 | |
961 memset(pco_string,0,sizeof(pco_string)); | |
962 | |
963 mode = cmd->params.ptr_set_percent_cgpco->mode; | |
964 format = cmd->params.ptr_set_percent_cgpco->format; | |
965 | |
966 if (cmd->params.ptr_set_percent_cgpco->v_pco) | |
967 { | |
968 memcpy(pco_string,cmd->params.ptr_set_percent_cgpco->pco,cmd->params.ptr_set_percent_cgpco->c_pco); | |
969 } | |
970 cid = cmd->params.ptr_set_percent_cgpco->cid; | |
971 if(cid EQ BAT_PDP_CID_NOT_PRESENT) | |
972 { | |
973 cid = INVALID_CID ; | |
974 } | |
975 if (cid > MAX_CID) | |
976 { | |
977 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp); | |
978 return ACI_BAT_FAIL ; | |
979 } | |
980 | |
981 switch (mode) | |
982 { | |
983 case CGPCO_MODE_QUERY_PCO: | |
984 { | |
985 ULONG gateway,dns1,dns2; | |
986 char dns1_str[sizeof("255.255.255.255")]; | |
987 char dns2_str[sizeof("255.255.255.255")]; | |
988 char gatew_str[sizeof("255.255.255.255")]; | |
989 USHORT i; | |
990 | |
991 for (i=1;i<MAX_CID;i++) | |
992 { | |
993 if ((i==cid) || (cid==INVALID_CID)) | |
994 { | |
995 gateway=dns1=dns2=0; | |
996 | |
997 /* | |
998 * Ignore the return value of the ACI function, which is | |
999 * always AT_CMPL. | |
1000 */ | |
1001 qAT_PercentCGPCO(src_infos_psi->srcId,&gateway,&dns1,&dns2,i); | |
1002 | |
1003 if (dns1 || dns2 || gateway) | |
1004 { | |
1005 T_BAT_cmd_response resp; | |
1006 T_BAT_res_set_percent_cgpco cgpco; | |
1007 | |
1008 resp.ctrl_response=BAT_RES_SET_PERCENT_CGPCO; | |
1009 resp.response.ptr_set_percent_cgpco=&cgpco; | |
1010 | |
1011 ipaddr_to_string(dns1, dns1_str); | |
1012 ipaddr_to_string(dns2, dns2_str); | |
1013 ipaddr_to_string(gateway, gatew_str); | |
1014 | |
1015 cgpco.cid=(T_BAT_pdp_cid)i; | |
1016 | |
1017 sprintf((char *)cgpco.pco,"%s,%s,%s",dns1_str,dns2_str,gatew_str); | |
1018 cgpco.c_pco=strlen((char *)cgpco.pco); | |
1019 | |
1020 aci_bat_send(src_infos_psi,&resp); | |
1021 } | |
1022 } | |
1023 } | |
1024 } | |
1025 return (ACI_BAT_CMPL); | |
1026 | |
1027 case CGPCO_MODE_SET_PCO: | |
1028 { | |
1029 switch (format) | |
1030 { | |
1031 case CGPCO_FORMAT_HEX: | |
1032 ret = setatPercentCGPCO_HEX (cid, (UBYTE*)pco_string, (USHORT)strlen (pco_string)); | |
1033 break; | |
1034 case CGPCO_FORMAT_ASCII: | |
1035 ret = setatPercentCGPCO_ASCII (src_infos_psi->srcId, cid, (UBYTE*)pco_string, (USHORT)strlen (pco_string)); | |
1036 break; | |
1037 default: | |
1038 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp); | |
1039 break; | |
1040 } | |
1041 break; | |
1042 } | |
1043 default: | |
1044 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp); | |
1045 break; | |
1046 } | |
1047 | |
1048 /* | |
1049 * Convert the ATI return value into ACI/BAT format. | |
1050 */ | |
1051 switch (ret) | |
1052 { | |
1053 default: | |
1054 case ATI_FAIL: | |
1055 case ATI_FAIL_NO_OUTPUT: | |
1056 return(ACI_BAT_FAIL); | |
1057 | |
1058 case ATI_BUSY: | |
1059 return(ACI_BAT_BUSY); | |
1060 | |
1061 case ATI_EXCT: | |
1062 return(ACI_BAT_EXCT); | |
1063 | |
1064 case ATI_CMPL: | |
1065 case ATI_CMPL_NO_OUTPUT: | |
1066 return(ACI_BAT_CMPL); | |
1067 } | |
1068 } | |
1069 | |
1070 /* | |
1071 +--------------------------------------------------------------------+ | |
1072 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1073 | STATE : code ROUTINE : sBAT_PercentCGPPP | | |
1074 +--------------------------------------------------------------------+ | |
1075 | |
1076 PURPOSE : | |
1077 */ | |
1078 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGPPP (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1079 T_BAT_cmd_send *cmd) | |
1080 { | |
1081 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1082 T_ACI_PPP_PROT protocol; | |
1083 | |
1084 TRACE_FUNCTION ("sBAT_PercentCGPPP()"); | |
1085 | |
1086 protocol = cmd->params.ptr_set_percent_cgppp->protocol; | |
1087 ret = sAT_PercentCGPPP(src_infos_psi->srcId, protocol); | |
1088 return(ret); | |
1089 } | |
1090 | |
1091 /* | |
1092 +--------------------------------------------------------------------+ | |
1093 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1094 | STATE : code ROUTINE : qBAT_PercentCGPPP | | |
1095 +--------------------------------------------------------------------+ | |
1096 | |
1097 PURPOSE : | |
1098 */ | |
1099 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGPPP (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1100 T_BAT_cmd_send *cmd) | |
1101 { | |
1102 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1103 T_ACI_PPP_PROT protocol; | |
1104 T_BAT_cmd_response resp; | |
1105 T_BAT_res_que_percent_cgppp que_cgppp_buffer; | |
1106 | |
1107 TRACE_FUNCTION ("qBAT_PercentCGPPP()"); | |
1108 | |
1109 ret = qAT_PercentCGPPP(src_infos_psi->srcId, &protocol); | |
1110 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGPPP; | |
1111 resp.response.ptr_que_percent_cgppp = &que_cgppp_buffer; | |
1112 if( ret EQ ATI_FAIL) | |
1113 { | |
1114 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
1115 return (ACI_BAT_FAIL); | |
1116 } | |
1117 resp.response.ptr_que_percent_cgppp->protocol = protocol; | |
1118 aci_bat_send(src_infos_psi,&resp); | |
1119 return(ret); | |
1120 } | |
1121 | |
1122 /* | |
1123 +--------------------------------------------------------------------+ | |
1124 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1125 | STATE : code ROUTINE : sBAT_PercentCGCLASS | | |
1126 +--------------------------------------------------------------------+ | |
1127 | |
1128 PURPOSE : | |
1129 */ | |
1130 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1131 T_BAT_cmd_send *cmd) | |
1132 { | |
1133 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1134 T_PERCENT_CGCLASS m_class = PERCENT_CGCLASS_OMITTED; | |
1135 | |
1136 TRACE_FUNCTION ("sBAT_PercentCGCLASS()"); | |
1137 | |
1138 m_class=(T_PERCENT_CGCLASS)cmd->params.ptr_set_percent_cgclass->p_mobile_class; | |
1139 | |
1140 if (m_class EQ PERCENT_CGCLASS_OMITTED) | |
1141 { | |
1142 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow); | |
1143 return (ACI_BAT_FAIL); | |
1144 } | |
1145 ret = sAT_PercentCGCLASS ( src_infos_psi->srcId, m_class ); | |
1146 return(ret); | |
1147 } | |
1148 | |
1149 /* | |
1150 +--------------------------------------------------------------------+ | |
1151 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1152 | STATE : code ROUTINE : qBAT_PercentCGCLASS | | |
1153 +--------------------------------------------------------------------+ | |
1154 | |
1155 PURPOSE : | |
1156 */ | |
1157 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1158 T_BAT_cmd_send *cmd) | |
1159 { | |
1160 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
1161 T_PERCENT_CGCLASS m_class, currentClass; | |
1162 T_BAT_cmd_response resp; | |
1163 T_BAT_res_que_percent_cgclass que_cgclass_buffer; | |
1164 | |
1165 TRACE_FUNCTION ("qBAT_PercentCGCLASS()"); | |
1166 | |
1167 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGCLASS; | |
1168 resp.response.ptr_que_percent_cgclass = &que_cgclass_buffer; | |
1169 ret = qAT_PercentCGCLASS(src_infos_psi->srcId, &m_class, ¤tClass); | |
1170 if (ret EQ AT_CMPL) | |
1171 { | |
1172 resp.response.ptr_que_percent_cgclass->p_mobile_class = m_class; | |
1173 resp.response.ptr_que_percent_cgclass->current_mobile_class = currentClass; | |
1174 aci_bat_send(src_infos_psi,&resp); | |
1175 } | |
1176 return(ret); | |
1177 } | |
1178 | |
1179 #endif /* GPRS */ | |
1180 |