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