FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/aci_bat_dti.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 #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ | |
23 #include "aci_cmh.h" /* prototypes of sAT_,qAT_,tAT_ */ | |
24 #include "ati_cmd.h" | |
25 #include "aci_cmd.h" | |
26 #include "dti.h" /* functionality of the dti library */ | |
27 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
28 #include "aci_bat.h" | |
29 #include "cmh_dti.h" | |
30 #include "dti_conn_mng.h" | |
31 #include "dti_cntrl_mng.h" | |
32 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
33 #include "aci_bat_err.h" /*prototypes of err functions for BAT*/ | |
34 | |
35 | |
36 /*==== VARIABLE====================================================*/ | |
37 | |
38 static const T_CAP_NAME aci_bat_cap_name[] = | |
39 { | |
40 {"CMD", DEV_CPBLTY_CMD }, | |
41 {"SER", DEV_CPBLTY_SER }, | |
42 {"PKT", DEV_CPBLTY_PKT }, | |
43 {"CMD,SER", DEV_CPBLTY_CMD_SER }, | |
44 {"CMD,PKT", DEV_CPBLTY_CMD_PKT }, | |
45 {"PKT,SER", DEV_CPBLTY_PKT_SER }, | |
46 {"CMD,PKT,SER", DEV_CPBLTY_CMD_PKT_SER}, | |
47 {"", DEV_CPBLTY_NONE} | |
48 }; | |
49 | |
50 /*==============================================================*/ | |
51 | |
52 | |
53 /* | |
54 +--------------------------------------------------------------------+ | |
55 | PROJECT : GSM-F&D (8411) MODULE : | | |
56 | STATE : code ROUTINE : map_dti_cpblty | | |
57 +--------------------------------------------------------------------+ | |
58 | |
59 PURPOSE : help function to map the capability values of | |
60 DTI_CPBLTY_xxx to enum value of T_CAP_ID. | |
61 With the enum value we get the capability string in ati_cap_name[] | |
62 For DTI_CPBLTY_xxx see SAP document AAA.doc chapter Capability | |
63 Dor T_CAP_ID see cmh_dti.h | |
64 */ | |
65 LOCAL T_CAP_ID aci_bat_map_dti_cpblty (UBYTE dti_cpblty) | |
66 { | |
67 switch (dti_cpblty) | |
68 { | |
69 case (DTI_CPBLTY_NO): | |
70 return (DEV_CPBLTY_NONE); | |
71 | |
72 case (DTI_CPBLTY_CMD): | |
73 return (DEV_CPBLTY_CMD); | |
74 | |
75 case (DTI_CPBLTY_SER): | |
76 return (DEV_CPBLTY_SER); | |
77 | |
78 case (DTI_CPBLTY_PKT): | |
79 return (DEV_CPBLTY_PKT); | |
80 | |
81 case (DTI_CPBLTY_CMD + DTI_CPBLTY_SER): | |
82 return (DEV_CPBLTY_CMD_SER); | |
83 | |
84 case (DTI_CPBLTY_CMD + DTI_CPBLTY_PKT): | |
85 return (DEV_CPBLTY_CMD_PKT); | |
86 | |
87 case (DTI_CPBLTY_PKT + DTI_CPBLTY_SER): | |
88 return (DEV_CPBLTY_PKT_SER); | |
89 | |
90 case (DTI_CPBLTY_CMD + DTI_CPBLTY_PKT + DTI_CPBLTY_SER): | |
91 return (DEV_CPBLTY_CMD_PKT_SER); | |
92 | |
93 default: | |
94 { | |
95 TRACE_EVENT_P1("aci_bat_map_dti_cpblty():[ERR] unknown capability value = %d",dti_cpblty); | |
96 return (DEV_CPBLTY_NONE); | |
97 } | |
98 } | |
99 } | |
100 | |
101 | |
102 | |
103 /* | |
104 +--------------------------------------------------------------------+ | |
105 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
106 | STATE : code ROUTINE : sBAT_PercentDATA | | |
107 +--------------------------------------------------------------------+ | |
108 | |
109 PURPOSE : | |
110 */ | |
111 GLOBAL T_ACI_BAT_RSLT sBAT_PercentDATA (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
112 T_BAT_cmd_send *cmd) | |
113 { | |
114 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
115 CHAR des_dev_name[MAX_SMS_ADDR_DIG]; /* destination device name */ | |
116 CHAR src_dev_name[MAX_SMS_ADDR_DIG]; /* source device name */ | |
117 CHAR dev_cap[MAX_SMS_ADDR_DIG]; /* device capability */ | |
118 CHAR* p_des_dev_name; | |
119 CHAR* p_src_dev_name; | |
120 CHAR* p_dev_cap; | |
121 UBYTE red_mode ; /* redirection mode */ | |
122 UBYTE cid = BAT_PARAMETER_NOT_PRESENT; /* context cid */ | |
123 U8 des_dev_no ; /* destination device number */ | |
124 SHORT des_sub_no = BAT_PARAMETER_NOT_PRESENT; /* destination sub number */ | |
125 U8 src_dev_no ; /* source device number */ | |
126 SHORT src_sub_no = BAT_PARAMETER_NOT_PRESENT; /* source sub number */ | |
127 | |
128 TRACE_FUNCTION ("sBAT_PercentDATA()"); | |
129 | |
130 red_mode = cmd->params.ptr_set_percent_data->mode; | |
131 des_dev_no = cmd->params.ptr_set_percent_data->des_dev_no; | |
132 des_sub_no = cmd->params.ptr_set_percent_data->des_sub_no; | |
133 src_dev_no = cmd->params.ptr_set_percent_data->src_dev_no; | |
134 src_sub_no = cmd->params.ptr_set_percent_data->src_sub_no; | |
135 cid = cmd->params.ptr_set_percent_data->cid; | |
136 | |
137 src_dev_name[0]='\0'; | |
138 des_dev_name[0]='\0'; | |
139 dev_cap[0]='\0'; | |
140 p_des_dev_name = des_dev_name; | |
141 p_src_dev_name = src_dev_name; | |
142 p_dev_cap = dev_cap; | |
143 | |
144 switch(cmd->params.ptr_set_percent_data->des_dev_name) | |
145 { | |
146 case (BAT_DEV_NAME_UART): | |
147 { | |
148 p_des_dev_name = "UART"; | |
149 break; | |
150 } | |
151 case (BAT_DEV_NAME_RIV): | |
152 { | |
153 p_des_dev_name = "RIV"; | |
154 break; | |
155 } | |
156 case (BAT_DEV_NAME_PKTIO): | |
157 { | |
158 p_des_dev_name = "PKTIO"; | |
159 break; | |
160 } | |
161 case (BAT_DEV_NAME_PSI): | |
162 { | |
163 p_des_dev_name = "PSI"; | |
164 break; | |
165 } | |
166 } | |
167 | |
168 switch(cmd->params.ptr_set_percent_data->src_dev_name) | |
169 { | |
170 case (BAT_DEV_NAME_UART): | |
171 { | |
172 p_src_dev_name = "UART"; | |
173 break; | |
174 } | |
175 case (BAT_DEV_NAME_RIV): | |
176 { | |
177 p_src_dev_name = "RIV"; | |
178 break; | |
179 } | |
180 case (BAT_DEV_NAME_PKTIO): | |
181 { | |
182 p_src_dev_name = "PKTIO"; | |
183 break; | |
184 } | |
185 case (BAT_DEV_NAME_PSI): | |
186 { | |
187 p_src_dev_name = "PSI"; | |
188 break; | |
189 } | |
190 } | |
191 | |
192 switch(cmd->params.ptr_set_percent_data->capability) | |
193 { | |
194 case(BAT_CAP_CMD): | |
195 { | |
196 p_dev_cap = "CMD"; | |
197 break; | |
198 } | |
199 case(BAT_CAP_SER): | |
200 { | |
201 p_dev_cap = "SER"; | |
202 break; | |
203 } | |
204 case(BAT_CAP_CMD + BAT_CAP_SER ): | |
205 { | |
206 p_dev_cap = "CMD,SER"; | |
207 break; | |
208 } | |
209 case(BAT_CAP_PKT): | |
210 { | |
211 p_dev_cap = "PKT"; | |
212 break; | |
213 } | |
214 case(BAT_CAP_CMD + BAT_CAP_PKT): | |
215 { | |
216 p_dev_cap = "CMD_PKT"; | |
217 break; | |
218 } | |
219 case(BAT_CAP_SER + BAT_CAP_PKT): | |
220 { | |
221 p_dev_cap = "SER_PKT"; | |
222 break; | |
223 } | |
224 case(BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT): | |
225 { | |
226 p_dev_cap = "CMD_SER_PKT"; | |
227 break; | |
228 } | |
229 } | |
230 ret = sAT_PercentDATA ((T_ACI_CMD_SRC)src_infos_psi->srcId, red_mode, | |
231 p_des_dev_name, des_dev_no, (UBYTE)des_sub_no, p_dev_cap, | |
232 p_src_dev_name, src_dev_no, (UBYTE)src_sub_no, cid); | |
233 return(ret); | |
234 } | |
235 | |
236 /* | |
237 +--------------------------------------------------------------------+ | |
238 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
239 | STATE : code ROUTINE : qBAT_PercentDATA | | |
240 +--------------------------------------------------------------------+ | |
241 | |
242 PURPOSE : | |
243 */ | |
244 GLOBAL T_ACI_BAT_RSLT qBAT_PercentDATA (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
245 T_BAT_cmd_send *cmd) | |
246 { | |
247 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
248 UBYTE mode ; | |
249 UBYTE cid = BAT_PDP_CID_NOT_PRESENT; | |
250 T_DINF_PARAM des_param; /* des_dev_name, des_dev_no, des_sub_no, des_cap */ | |
251 T_DINF_PARAM src_param; /* src_dev_name, src_dev_no, src_sub_no, pdp_cid */ | |
252 T_CAP_ID capability = DEV_CPBLTY_NONE; | |
253 T_BAT_cmd_response resp; | |
254 T_BAT_res_que_percent_data que_data_buffer; | |
255 | |
256 TRACE_FUNCTION ("qBAT_PercentDATA()"); | |
257 resp.ctrl_response = BAT_RES_QUE_PERCENT_DATA; | |
258 resp.response.ptr_que_percent_data = &que_data_buffer; | |
259 | |
260 des_param.dev_id = NOT_PRESENT_8BIT; /* in case of there is no redirection at all */ | |
261 des_param.capability = 0xAA; /* init with a value which makes never sense */ | |
262 while ((ret = qAT_PercentDATA (src_infos_psi->srcId, &mode, &cid, &des_param, &src_param)) EQ ACI_BAT_CMPL) | |
263 { | |
264 T_DTI_ENTITY_ID des_id = dti_entity_name[des_param.dev_id].id; | |
265 T_DTI_ENTITY_ID src_id = dti_entity_name[src_param.dev_id].id; | |
266 | |
267 capability = aci_bat_map_dti_cpblty (des_param.capability); | |
268 /* | |
269 * unfortunately in custom.h for PKTIO is defined "PKT" (Frame handles up to 4 chars only) | |
270 * but for the device name we want to emit "PKTIO" to distinguish from capability "PKT" | |
271 */ | |
272 | |
273 #ifdef GPRS | |
274 if (des_param.dev_id EQ DTI_ENTITY_PKTIO) | |
275 { | |
276 des_id = DTI_ENTITY_PKTIO; | |
277 } | |
278 | |
279 if (src_param.dev_id EQ DTI_ENTITY_PKTIO) | |
280 { | |
281 src_id = DTI_ENTITY_PKTIO; | |
282 } | |
283 #endif | |
284 | |
285 switch(des_id) | |
286 { | |
287 case (DTI_ENTITY_UART): | |
288 { | |
289 resp.response.ptr_que_percent_data->des_dev_name = BAT_DEV_NAME_UART; | |
290 break; | |
291 } | |
292 #ifdef GPRS | |
293 case (DTI_ENTITY_PKTIO): | |
294 { | |
295 resp.response.ptr_que_percent_data->des_dev_name = BAT_DEV_NAME_PKTIO; | |
296 break; | |
297 } | |
298 #endif | |
299 case (DTI_ENTITY_PSI): | |
300 { | |
301 resp.response.ptr_que_percent_data->des_dev_name = BAT_DEV_NAME_PSI; | |
302 break; | |
303 } | |
304 default: | |
305 { | |
306 TRACE_ERROR("ERROR: Undefined dev name type encoutered"); | |
307 break; | |
308 } | |
309 } | |
310 switch(src_id) | |
311 { | |
312 case (DTI_ENTITY_UART): | |
313 { | |
314 resp.response.ptr_que_percent_data->src_dev_name = BAT_DEV_NAME_UART; | |
315 break; | |
316 } | |
317 #ifdef GPRS | |
318 case (DTI_ENTITY_PKTIO): | |
319 { | |
320 resp.response.ptr_que_percent_data->src_dev_name = BAT_DEV_NAME_PKTIO; | |
321 break; | |
322 } | |
323 #endif | |
324 case (DTI_ENTITY_PSI): | |
325 { | |
326 resp.response.ptr_que_percent_data->src_dev_name = BAT_DEV_NAME_PSI; | |
327 break; | |
328 } | |
329 default: | |
330 { | |
331 TRACE_ERROR("ERROR: Undefined dev name type encoutered"); | |
332 break; | |
333 } | |
334 } | |
335 switch(aci_bat_cap_name[capability].id) | |
336 { | |
337 case (DEV_CPBLTY_CMD): | |
338 { | |
339 resp.response.ptr_que_percent_data->capability = BAT_CAP_CMD; | |
340 break; | |
341 } | |
342 case (DEV_CPBLTY_SER): | |
343 { | |
344 resp.response.ptr_que_percent_data->capability = BAT_CAP_SER; | |
345 break; | |
346 } | |
347 case (DEV_CPBLTY_CMD_SER): | |
348 { | |
349 resp.response.ptr_que_percent_data->capability = BAT_CAP_CMD + BAT_CAP_SER; | |
350 break; | |
351 } | |
352 case (DEV_CPBLTY_PKT): | |
353 { | |
354 resp.response.ptr_que_percent_data->capability = BAT_CAP_PKT; | |
355 break; | |
356 } | |
357 case (DEV_CPBLTY_CMD_PKT): | |
358 { | |
359 resp.response.ptr_que_percent_data->capability = BAT_CAP_CMD + BAT_CAP_PKT; | |
360 break; | |
361 } | |
362 case (DEV_CPBLTY_PKT_SER): | |
363 { | |
364 resp.response.ptr_que_percent_data->capability = BAT_CAP_SER + BAT_CAP_PKT; | |
365 break; | |
366 } | |
367 case (DEV_CPBLTY_CMD_PKT_SER): | |
368 { | |
369 resp.response.ptr_que_percent_data->capability = BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT; | |
370 break; | |
371 } | |
372 } | |
373 resp.response.ptr_que_percent_data->des_dev_no = des_param.dev_no; | |
374 resp.response.ptr_que_percent_data->des_sub_no = des_param.sub_no; | |
375 resp.response.ptr_que_percent_data->src_dev_no = src_param.dev_no; | |
376 resp.response.ptr_que_percent_data->src_sub_no = src_param.sub_no; | |
377 resp.response.ptr_que_percent_data->cid = cid; | |
378 resp.response.ptr_que_percent_data->mode = mode; | |
379 | |
380 aci_bat_send(src_infos_psi,&resp); | |
381 } | |
382 return(ret); | |
383 } | |
384 | |
385 /* | |
386 +--------------------------------------------------------------------+ | |
387 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
388 | STATE : code ROUTINE : sBAT_PercentDINF | | |
389 +--------------------------------------------------------------------+ | |
390 | |
391 PURPOSE : | |
392 */ | |
393 GLOBAL T_ACI_BAT_RSLT sBAT_PercentDINF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
394 T_BAT_cmd_send *cmd) | |
395 { | |
396 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
397 UBYTE mode ; /* DINF */ | |
398 T_DINF_PARAM device_para; | |
399 T_CAP_ID capability = DEV_CPBLTY_NONE; | |
400 T_CAP_ID cur_cap = DEV_CPBLTY_NONE; | |
401 T_BAT_cmd_response resp; | |
402 T_BAT_res_set_percent_dinf que_dinf_buffer; | |
403 | |
404 TRACE_FUNCTION ("sBAT_PercentDINF()"); | |
405 | |
406 mode = cmd->params.ptr_set_percent_dinf->mode; | |
407 resp.ctrl_response = BAT_RES_SET_PERCENT_DINF; | |
408 resp.response.ptr_set_percent_dinf = &que_dinf_buffer; | |
409 | |
410 switch(mode) | |
411 { | |
412 case (BAT_P_DINF_MODE_CURRENT): | |
413 { | |
414 /* | |
415 * we want to get the piece of information, which belongs to the srcId | |
416 */ | |
417 ret = sAT_PercentDINF (src_infos_psi->srcId, mode, &device_para); | |
418 if ((ret EQ ACI_BAT_CMPL) AND (device_para.src_id EQ src_infos_psi->srcId)) | |
419 { | |
420 capability = aci_bat_map_dti_cpblty (device_para.capability); | |
421 cur_cap = aci_bat_map_dti_cpblty (device_para.cur_cap); | |
422 resp.response.ptr_set_percent_dinf->dev_no = device_para.dev_no; | |
423 resp.response.ptr_set_percent_dinf->sub_no = device_para.sub_no; | |
424 resp.response.ptr_set_percent_dinf->src_id = mode; | |
425 | |
426 switch(dti_entity_name[device_para.dev_id].id) | |
427 { | |
428 case (DTI_ENTITY_UART): | |
429 { | |
430 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_UART; | |
431 break; | |
432 } | |
433 #ifdef GPRS | |
434 case (DTI_ENTITY_PKTIO): | |
435 { | |
436 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_PKTIO; | |
437 break; | |
438 } | |
439 #endif | |
440 case (DTI_ENTITY_PSI): | |
441 { | |
442 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_PSI; | |
443 break; | |
444 } | |
445 default: | |
446 { | |
447 TRACE_ERROR("ERROR: Undefined dev name type encoutered"); | |
448 break; | |
449 } | |
450 } | |
451 switch(aci_bat_cap_name[cur_cap].id) | |
452 { | |
453 case (DEV_CPBLTY_CMD): | |
454 { | |
455 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD; | |
456 break; | |
457 } | |
458 case (DEV_CPBLTY_SER): | |
459 { | |
460 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_SER; | |
461 break; | |
462 } | |
463 case (DEV_CPBLTY_CMD_SER): | |
464 { | |
465 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_SER; | |
466 break; | |
467 } | |
468 case (DEV_CPBLTY_PKT): | |
469 { | |
470 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_PKT; | |
471 break; | |
472 } | |
473 case (DEV_CPBLTY_CMD_PKT): | |
474 { | |
475 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_PKT; | |
476 break; | |
477 } | |
478 case (DEV_CPBLTY_PKT_SER): | |
479 { | |
480 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_SER + BAT_CAP_PKT; | |
481 break; | |
482 } | |
483 case (DEV_CPBLTY_CMD_PKT_SER): | |
484 { | |
485 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT; | |
486 break; | |
487 } | |
488 } | |
489 switch(aci_bat_cap_name[capability].id) | |
490 { | |
491 case (DEV_CPBLTY_CMD): | |
492 { | |
493 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD; | |
494 break; | |
495 } | |
496 case (DEV_CPBLTY_SER): | |
497 { | |
498 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_SER; | |
499 break; | |
500 } | |
501 case (DEV_CPBLTY_CMD_SER): | |
502 { | |
503 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_SER; | |
504 break; | |
505 } | |
506 case (DEV_CPBLTY_PKT): | |
507 { | |
508 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_PKT; | |
509 break; | |
510 } | |
511 case (DEV_CPBLTY_CMD_PKT): | |
512 { | |
513 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_PKT; | |
514 break; | |
515 } | |
516 case (DEV_CPBLTY_PKT_SER): | |
517 { | |
518 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_SER + BAT_CAP_PKT; | |
519 break; | |
520 } | |
521 case (DEV_CPBLTY_CMD_PKT_SER): | |
522 { | |
523 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT; | |
524 break; | |
525 } | |
526 } | |
527 | |
528 aci_bat_send(src_infos_psi,&resp); | |
529 return (ACI_BAT_CMPL); | |
530 } | |
531 else | |
532 { | |
533 break; /* an error */ | |
534 } | |
535 } | |
536 case (BAT_P_DINF_MODE_ALL): | |
537 { | |
538 device_para.capability = 0xAA; /* init with a value which makes never sense, but is valuable for debug */ | |
539 /* | |
540 * we want to get the pieces of information to all devices | |
541 */ | |
542 while ((ret = sAT_PercentDINF (src_infos_psi->srcId, mode, &device_para)) EQ ACI_BAT_CMPL) | |
543 { | |
544 if (device_para.src_id EQ src_infos_psi->srcId) | |
545 { | |
546 mode = BAT_P_DINF_MODE_CURRENT ; /* this is the current channel, so temporarily set mode */ | |
547 } | |
548 else | |
549 { | |
550 mode = BAT_P_DINF_MODE_ALL; /* other channel */ | |
551 } | |
552 | |
553 capability = aci_bat_map_dti_cpblty (device_para.capability); | |
554 cur_cap = aci_bat_map_dti_cpblty (device_para.cur_cap); | |
555 | |
556 resp.response.ptr_set_percent_dinf->dev_no = device_para.dev_no; | |
557 resp.response.ptr_set_percent_dinf->sub_no = device_para.sub_no; | |
558 resp.response.ptr_set_percent_dinf->src_id = mode; | |
559 | |
560 switch(dti_entity_name[device_para.dev_id].id) | |
561 { | |
562 case (DTI_ENTITY_UART): | |
563 { | |
564 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_UART; | |
565 break; | |
566 } | |
567 #ifdef GPRS | |
568 case (DTI_ENTITY_PKTIO): | |
569 { | |
570 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_PKTIO; | |
571 break; | |
572 } | |
573 #endif | |
574 case (DTI_ENTITY_PSI): | |
575 { | |
576 resp.response.ptr_set_percent_dinf->dev_name = BAT_DEV_NAME_PSI; | |
577 break; | |
578 } | |
579 default: | |
580 { | |
581 TRACE_ERROR("ERROR: Undefined dev name type encoutered"); | |
582 break; | |
583 } | |
584 } | |
585 switch(aci_bat_cap_name[cur_cap].id) | |
586 { | |
587 case (DEV_CPBLTY_CMD): | |
588 { | |
589 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD; | |
590 break; | |
591 } | |
592 case (DEV_CPBLTY_SER): | |
593 { | |
594 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_SER; | |
595 break; | |
596 } | |
597 case (DEV_CPBLTY_CMD_SER): | |
598 { | |
599 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_SER; | |
600 break; | |
601 } | |
602 case (DEV_CPBLTY_PKT): | |
603 { | |
604 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_PKT; | |
605 break; | |
606 } | |
607 case (DEV_CPBLTY_CMD_PKT): | |
608 { | |
609 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_PKT; | |
610 break; | |
611 } | |
612 case (DEV_CPBLTY_PKT_SER): | |
613 { | |
614 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_SER + BAT_CAP_PKT; | |
615 break; | |
616 } | |
617 case (DEV_CPBLTY_CMD_PKT_SER): | |
618 { | |
619 resp.response.ptr_set_percent_dinf->cur_cap = BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT; | |
620 break; | |
621 } | |
622 } | |
623 switch(aci_bat_cap_name[capability].id) | |
624 { | |
625 case (DEV_CPBLTY_CMD): | |
626 { | |
627 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD; | |
628 break; | |
629 } | |
630 case (DEV_CPBLTY_SER): | |
631 { | |
632 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_SER; | |
633 break; | |
634 } | |
635 case (DEV_CPBLTY_CMD_SER): | |
636 { | |
637 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_SER; | |
638 break; | |
639 } | |
640 case (DEV_CPBLTY_PKT): | |
641 { | |
642 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_PKT; | |
643 break; | |
644 } | |
645 case (DEV_CPBLTY_CMD_PKT): | |
646 { | |
647 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_PKT; | |
648 break; | |
649 } | |
650 case (DEV_CPBLTY_PKT_SER): | |
651 { | |
652 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_SER + BAT_CAP_PKT; | |
653 break; | |
654 } | |
655 case (DEV_CPBLTY_CMD_PKT_SER): | |
656 { | |
657 resp.response.ptr_set_percent_dinf->cap = BAT_CAP_CMD + BAT_CAP_SER + BAT_CAP_PKT; | |
658 break; | |
659 } | |
660 } | |
661 aci_bat_send(src_infos_psi,&resp); | |
662 mode = SHOW_ALL_CHAN_INF; /* reset to show all channels */ | |
663 } | |
664 /* | |
665 * when sAT_PercentDINF reached the end it returns with AT_FAIL, but check capability as sentinel | |
666 */ | |
667 if (device_para.capability EQ DEV_CPBLTY_NONE) | |
668 { | |
669 /* | |
670 * DEV_CPBLTY_NONE is the sentinel, that there are no further devices | |
671 */ | |
672 return (ACI_BAT_CMPL); | |
673 } | |
674 break; /* an error */ | |
675 } | |
676 default: | |
677 { | |
678 break; /* an error */ | |
679 } | |
680 } | |
681 return (ACI_BAT_FAIL); | |
682 } | |
683 |