FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/aci/aci_bat_phb.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
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 "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
25 #include "aci_bat.h" | |
26 #include "ati_cmd.h" | |
27 #include "aci_cmd.h" | |
28 #include "aci_mem.h" /* MAKROS ACI_MALLOC, ACI_MFREE*/ | |
29 | |
30 | |
31 /* | |
32 +--------------------------------------------------------------------+ | |
33 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
34 | STATE : code ROUTINE : sBAT_PercentPBCF | | |
35 +--------------------------------------------------------------------+ | |
36 | |
37 PURPOSE : Select Phonebook Configuration. | |
38 */ | |
39 | |
40 GLOBAL T_ACI_BAT_RSLT sBAT_PercentPBCF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
41 T_BAT_cmd_send *cmd) | |
42 { | |
43 T_ACI_BAT_RSLT ret; | |
44 T_ACI_PBCF_LDN ldn = PBCF_LDN_NotPresent; | |
45 T_ACI_PBCF_LRN lrn = PBCF_LRN_NotPresent; | |
46 T_ACI_PBCF_LMN lmn = PBCF_LMN_NotPresent; | |
47 | |
48 TRACE_FUNCTION ("sBAT_PercentPBCF()"); | |
49 | |
50 ldn = (T_ACI_PBCF_LDN)cmd->params.ptr_set_percent_pbcf->ldn; | |
51 lrn = (T_ACI_PBCF_LRN)cmd->params.ptr_set_percent_pbcf->lrn; | |
52 lmn = (T_ACI_PBCF_LMN)cmd->params.ptr_set_percent_pbcf->lmn; | |
53 | |
54 /* | |
55 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
56 * assumed to be equivalent to T_ACI_RESULT. | |
57 */ | |
58 /* for BAT we use the old spec, which means the third param is not supported */ | |
59 ret = (T_ACI_BAT_RSLT)sAT_PercentPBCF(src_infos_psi->srcId, ldn, lrn, lmn); | |
60 | |
61 return(ret); | |
62 } | |
63 | |
64 /* | |
65 +--------------------------------------------------------------------+ | |
66 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
67 | STATE : code ROUTINE : qBAT_PlusCPBS | | |
68 +--------------------------------------------------------------------+ | |
69 | |
70 PURPOSE : | |
71 */ | |
72 GLOBAL T_ACI_BAT_RSLT qBAT_PercentPBCF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
73 T_BAT_cmd_send *cmd) | |
74 { | |
75 T_ACI_BAT_RSLT ret; | |
76 T_ACI_PBCF_LDN ldn = PBCF_LDN_NotPresent; | |
77 T_ACI_PBCF_LRN lrn = PBCF_LRN_NotPresent; | |
78 T_ACI_PBCF_LMN lmn = PBCF_LMN_NotPresent; | |
79 | |
80 TRACE_FUNCTION ("qBAT_PercentPBCF()"); | |
81 | |
82 /* | |
83 * Call the corresponding qAT function. T_ACI_BAT_RSLT is | |
84 * assumed to be equivalent to T_ACI_RESULT. | |
85 */ | |
86 ret=(T_ACI_BAT_RSLT)qAT_PercentPBCF(src_infos_psi->srcId, &ldn, &lrn, &lmn); | |
87 | |
88 /* | |
89 * If the query completes, send the response now. | |
90 */ | |
91 if (ret==ACI_BAT_CMPL) | |
92 { | |
93 T_BAT_cmd_response resp; | |
94 T_BAT_res_que_percent_pbcf pbcf_data; | |
95 | |
96 resp.ctrl_response=BAT_RES_QUE_PERCENT_PBCF; | |
97 resp.response.ptr_que_percent_pbcf = &pbcf_data; | |
98 | |
99 /* | |
100 * This relies on T_BAT_percent_pbcf_ldn being identical to | |
101 * T_ACI_PBCF_LDN and so forth for LRN and LMN. | |
102 */ | |
103 pbcf_data.ldn=(T_BAT_percent_pbcf_ldn)ldn; | |
104 pbcf_data.lrn=(T_BAT_percent_pbcf_ldn)lrn; | |
105 pbcf_data.lmn=(T_BAT_percent_pbcf_ldn)lmn; | |
106 | |
107 aci_bat_send(src_infos_psi,&resp); | |
108 } | |
109 | |
110 return(ret); | |
111 } | |
112 | |
113 /* | |
114 +--------------------------------------------------------------------+ | |
115 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
116 | STATE : code ROUTINE : sBAT_PlusCPBS | | |
117 +--------------------------------------------------------------------+ | |
118 | |
119 PURPOSE : Select phonebook memory storage. | |
120 */ | |
121 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
122 T_BAT_cmd_send *cmd) | |
123 { | |
124 T_ACI_BAT_RSLT ret; | |
125 T_ACI_PB_STOR stor; | |
126 | |
127 TRACE_FUNCTION ("sBAT_PlusCPBS()"); | |
128 | |
129 /* | |
130 * This relies on T_BAT_storage being identical to | |
131 * T_ACI_PB_STOR. | |
132 */ | |
133 stor=(T_ACI_PB_STOR)cmd->params.ptr_set_plus_cpbs->storage; | |
134 | |
135 /* | |
136 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
137 * assumed to be equivalent to T_ACI_RESULT. | |
138 */ | |
139 /* for BAT we use the old spec, which means the third param is not supported */ | |
140 ret=(T_ACI_BAT_RSLT)sAT_PlusCPBS(src_infos_psi->srcId,stor, NULL); | |
141 | |
142 return(ret); | |
143 } | |
144 | |
145 /* | |
146 +--------------------------------------------------------------------+ | |
147 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
148 | STATE : code ROUTINE : qBAT_PlusCPBS | | |
149 +--------------------------------------------------------------------+ | |
150 | |
151 PURPOSE : | |
152 */ | |
153 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCPBS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
154 T_BAT_cmd_send *cmd) | |
155 { | |
156 T_ACI_BAT_RSLT ret; | |
157 T_ACI_PB_STOR stor; | |
158 SHORT used; | |
159 SHORT total; | |
160 | |
161 TRACE_FUNCTION ("qBAT_PlusCPBS()"); | |
162 | |
163 /* | |
164 * Call the corresponding qAT function. T_ACI_BAT_RSLT is | |
165 * assumed to be equivalent to T_ACI_RESULT. | |
166 */ | |
167 ret=(T_ACI_BAT_RSLT)qAT_PlusCPBS(src_infos_psi->srcId,&stor,&used,&total); | |
168 | |
169 /* | |
170 * If the query completes, send the response now. | |
171 */ | |
172 if (ret==ACI_BAT_CMPL) | |
173 { | |
174 T_BAT_cmd_response resp; | |
175 T_BAT_res_que_plus_cpbs cpbs_data; | |
176 | |
177 resp.ctrl_response=BAT_RES_QUE_PLUS_CPBS; | |
178 resp.response.ptr_que_plus_cpbs=&cpbs_data; | |
179 | |
180 /* | |
181 * This relies on T_BAT_storage being identical to | |
182 * T_ACI_PB_STOR. | |
183 */ | |
184 cpbs_data.storage=(T_BAT_storage)stor; | |
185 | |
186 cpbs_data.total=(S16)total; | |
187 cpbs_data.used=(S16)used; | |
188 | |
189 aci_bat_send(src_infos_psi,&resp); | |
190 } | |
191 | |
192 return(ret); | |
193 } | |
194 | |
195 /* | |
196 +--------------------------------------------------------------------+ | |
197 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
198 | STATE : code ROUTINE : qBAT_PercentCPBS | | |
199 +--------------------------------------------------------------------+ | |
200 | |
201 PURPOSE : | |
202 */ | |
203 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCPBS (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
204 T_BAT_cmd_send *cmd) | |
205 { | |
206 T_ACI_BAT_RSLT ret; | |
207 T_ACI_PB_STOR stor; | |
208 SHORT used; | |
209 SHORT total; | |
210 SHORT first; | |
211 | |
212 TRACE_FUNCTION ("qBAT_PercentCPBS()"); | |
213 | |
214 /* | |
215 * Call the corresponding qAT function. T_ACI_BAT_RSLT is | |
216 * assumed to be equivalent to T_ACI_RESULT. | |
217 */ | |
218 ret=(T_ACI_BAT_RSLT)qAT_PercentCPBS(src_infos_psi->srcId,&stor,&used,&total,&first); | |
219 | |
220 /* | |
221 * If the query completes, send the response now. | |
222 */ | |
223 if (ret EQ ACI_BAT_CMPL) | |
224 { | |
225 T_BAT_cmd_response resp; | |
226 T_BAT_res_que_percent_cpbs cpbs_data; | |
227 | |
228 resp.ctrl_response=BAT_RES_QUE_PERCENT_CPBS; | |
229 resp.response.ptr_que_percent_cpbs=&cpbs_data; | |
230 | |
231 /* | |
232 * This relies on T_BAT_storage being identical to | |
233 * T_ACI_PB_STOR. | |
234 */ | |
235 cpbs_data.storage=(T_BAT_storage)stor; | |
236 | |
237 cpbs_data.total=(S16)total; | |
238 cpbs_data.used=(S16)used; | |
239 cpbs_data.first=(S16)first; | |
240 | |
241 aci_bat_send(src_infos_psi,&resp); | |
242 } | |
243 | |
244 return(ret); | |
245 } | |
246 | |
247 /* | |
248 +--------------------------------------------------------------------+ | |
249 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
250 | STATE : code ROUTINE : sBAT_PlusCPBW | | |
251 +--------------------------------------------------------------------+ | |
252 | |
253 PURPOSE : | |
254 */ | |
255 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBW (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
256 T_BAT_cmd_send *cmd) | |
257 { | |
258 T_ACI_BAT_RSLT ret; | |
259 SHORT index; | |
260 CHAR number[BAT_MAX_CPBW_NUMBER_LEN+1]; | |
261 CHAR *p_number; | |
262 T_ACI_TOA toa; | |
263 T_ACI_TOA *p_toa; | |
264 T_ACI_PB_TEXT text; | |
265 T_ACI_PB_TEXT *p_text; | |
266 T_ACI_VP_ABS dmy_date_time; | |
267 T_BAT_cmd_set_plus_cpbw *cpbw; | |
268 | |
269 TRACE_FUNCTION ("sBAT_PlusCPBW()"); | |
270 | |
271 /* | |
272 * Get a pointer to the CPBW structure for convenience. | |
273 */ | |
274 cpbw=cmd->params.ptr_set_plus_cpbw; | |
275 | |
276 index=(SHORT)cpbw->index; | |
277 | |
278 if (cpbw->v_number==TRUE) | |
279 { | |
280 /* | |
281 * The idea here is to get the 'number' parameter into a | |
282 * null terminated string, which is what sAT_PlusCPBW() expects, but | |
283 * is not guaranteed by BAT. | |
284 */ | |
285 memset(number,0,sizeof(number)); | |
286 memcpy(number,cpbw->number,cpbw->c_number); | |
287 p_number=number; | |
288 | |
289 /* | |
290 * BAT stores the type of address in a single value. | |
291 */ | |
292 if (cpbw->type!=-1) | |
293 { | |
294 toa=toa_demerge(cpbw->type); | |
295 p_toa=&toa; | |
296 } | |
297 else | |
298 { | |
299 p_toa=NULL; | |
300 } | |
301 } | |
302 else | |
303 { | |
304 p_number=NULL; | |
305 p_toa=NULL; | |
306 } | |
307 | |
308 /* | |
309 * Associated text | |
310 */ | |
311 if (cpbw->v_text==TRUE) | |
312 { | |
313 USHORT len; | |
314 | |
315 /* | |
316 * Convert from the currently selected character set into the | |
317 * SIM format. | |
318 */ | |
319 utl_chsetToSim( | |
320 (UBYTE *)cpbw->text, | |
321 (USHORT)cpbw->c_text, | |
322 (UBYTE *)text.data, | |
323 &len, | |
324 GSM_ALPHA_Def); | |
325 | |
326 /* | |
327 * Set the length. Note that we cannot do this by passing a | |
328 * reference to text.len into utl_chsetToSim() because it is | |
329 * the wrong type. | |
330 */ | |
331 text.len=(UBYTE)len; | |
332 | |
333 text.cs=CS_Sim; | |
334 | |
335 p_text=&text; | |
336 } | |
337 else | |
338 { | |
339 p_text=NULL; | |
340 } | |
341 | |
342 /* | |
343 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
344 * assumed to be equivalent to T_ACI_RESULT. | |
345 */ | |
346 ret=sAT_PlusCPBW( | |
347 src_infos_psi->srcId, | |
348 index, | |
349 p_number, | |
350 p_toa, | |
351 p_text, | |
352 &dmy_date_time); | |
353 | |
354 return(ret); | |
355 } | |
356 | |
357 /* | |
358 +--------------------------------------------------------------------+ | |
359 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
360 | STATE : code ROUTINE : tBAT_PlusCPBW | | |
361 +--------------------------------------------------------------------+ | |
362 | |
363 PURPOSE : | |
364 */ | |
365 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCPBW (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
366 T_BAT_cmd_send *cmd) | |
367 { | |
368 T_ACI_BAT_RSLT ret; | |
369 SHORT first; | |
370 SHORT last; | |
371 UBYTE nlength; | |
372 UBYTE tlength; | |
373 | |
374 TRACE_FUNCTION ("tBAT_PlusCPBW()"); | |
375 | |
376 /* | |
377 * Call the corresponding tAT function. T_ACI_BAT_RSLT is | |
378 * assumed to be equivalent to T_ACI_RESULT. | |
379 */ | |
380 ret=(T_ACI_BAT_RSLT)tAT_PlusCPBW(src_infos_psi->srcId,&first,&last,&nlength,&tlength); | |
381 | |
382 /* | |
383 * If the command completes, send the response now. | |
384 */ | |
385 if (ret==ACI_BAT_CMPL) | |
386 { | |
387 T_BAT_cmd_response resp; | |
388 T_BAT_res_tst_plus_cpbw cpbw_data; | |
389 | |
390 resp.ctrl_response=BAT_RES_TST_PLUS_CPBW; | |
391 resp.response.ptr_tst_plus_cpbw=&cpbw_data; | |
392 | |
393 cpbw_data.index1=(U8)first; | |
394 cpbw_data.index2=(U8)last; | |
395 cpbw_data.nlength=(S16)nlength; | |
396 cpbw_data.tlength=(S16)tlength; | |
397 | |
398 #pragma message(__TODO__"+CPBW types") | |
399 cpbw_data.c_types=0; | |
400 cpbw_data.types[0]=0; | |
401 | |
402 aci_bat_send(src_infos_psi,&resp); | |
403 } | |
404 | |
405 return(ret); | |
406 } | |
407 | |
408 /* | |
409 +--------------------------------------------------------------------+ | |
410 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
411 | STATE : code ROUTINE : sBAT_PlusCPBR | | |
412 +--------------------------------------------------------------------+ | |
413 | |
414 PURPOSE : Read phonebook entries. If the application wants to read | |
415 more than ACI_BAT_MAX_RESPONSES, then the responses are | |
416 sent block by block (one block = ACI_BAT_MAX_RESPONSES). | |
417 */ | |
418 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBR_CB (T_ACI_DTI_PRC_PSI *src_infos_psi) | |
419 { | |
420 T_BAT_cmd_send cmd; | |
421 T_BAT_cmd_set_plus_cpbr cpbr; | |
422 | |
423 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBR; | |
424 cmd.params.ptr_set_plus_cpbr = &cpbr; | |
425 | |
426 cpbr.index1 = (U8)src_infos_psi->index1; | |
427 cpbr.index2 = (S16)src_infos_psi->index2; | |
428 | |
429 return (sBAT_PlusCPBR(src_infos_psi, &cmd)); | |
430 } | |
431 | |
432 | |
433 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
434 T_BAT_cmd_send *cmd) | |
435 { | |
436 T_ACI_BAT_RSLT ret; | |
437 SHORT start_idx; | |
438 SHORT stop_idx; | |
439 SHORT last_idx = ACI_NumParmNotPresent; | |
440 T_ACI_PB_ENTR pb_lst[MAX_PB_ENTR]; | |
441 | |
442 TRACE_FUNCTION ("sBAT_PlusCPBR()"); | |
443 | |
444 /* define here the variables, which are passed as parameters to sAT_PlusCPBR */ | |
445 start_idx = (SHORT)cmd->params.ptr_set_plus_cpbr->index1; | |
446 stop_idx = (SHORT)cmd->params.ptr_set_plus_cpbr->index2; | |
447 | |
448 ret = (T_ACI_BAT_RSLT)sAT_PlusCPBR(src_infos_psi->srcId, start_idx, stop_idx, &last_idx, &pb_lst[0]); | |
449 if (ret EQ ACI_BAT_CMPL) | |
450 { | |
451 SHORT i; | |
452 T_BAT_cmd_response resp; | |
453 T_BAT_res_set_plus_cpbr cpbr_data; | |
454 | |
455 resp.ctrl_response = BAT_RES_SET_PLUS_CPBR; | |
456 resp.response.ptr_set_plus_cpbr = &cpbr_data; | |
457 | |
458 /* | |
459 * sAT_PlusCPBR() provides in pb_lst[] up to five entries (MAX_PB_ENTR) | |
460 */ | |
461 for (i = 0; ((i < MAX_PB_ENTR) AND (pb_lst[i].index NEQ ACI_NumParmNotPresent)); i++) | |
462 { | |
463 USHORT len_cvtd_text=0; | |
464 | |
465 cpbr_data.index = (U8)pb_lst[i].index; | |
466 | |
467 cpbr_data.c_number = strlen((CHAR*)pb_lst[i].number); | |
468 | |
469 cpbr_data.c_number = (cpbr_data.c_number > BAT_MAX_CPBR_NUMBER_LEN) | |
470 ? BAT_MAX_CPBR_NUMBER_LEN | |
471 : cpbr_data.c_number; | |
472 | |
473 strncpy((CHAR*)cpbr_data.number, pb_lst[i].number, cpbr_data.c_number+1); /* Include null terminator for Resp_.. () */ | |
474 | |
475 /* BAT stores the type of address in a single 8-bit value. */ | |
476 cpbr_data.type = toa_merge(pb_lst[i].type); | |
477 | |
478 /* | |
479 * Convert the data read from the SIM into the currently | |
480 * selected character set. | |
481 */ | |
482 utl_chsetFromSim( | |
483 (UBYTE *)pb_lst[i].text.data, | |
484 pb_lst[i].text.len, | |
485 (UBYTE *)cpbr_data.text, | |
486 BAT_MAX_CPBR_TEXT_LEN, | |
487 &len_cvtd_text, | |
488 GSM_ALPHA_Def); | |
489 | |
490 cpbr_data.c_text=(U8)len_cvtd_text; | |
491 | |
492 TRACE_EVENT_P2("sBAT_PlusCPBR(): index = %i c_text = %d", cpbr_data.index, cpbr_data.c_text); | |
493 | |
494 /* vsi_t_sleep (aci_handle, 500); */ | |
495 aci_bat_send(src_infos_psi,&resp); | |
496 } | |
497 /* remember updated start index and initial stop index for possible next block of entries to send to APP */ | |
498 src_infos_psi->index1 = last_idx + 1; | |
499 src_infos_psi->index2 = stop_idx; | |
500 } | |
501 else | |
502 { | |
503 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
504 return(ACI_BAT_FAIL); | |
505 } | |
506 | |
507 if (last_idx < stop_idx) | |
508 { | |
509 src_infos_psi->large_type = TRUE; | |
510 return (ACI_BAT_EXCT); | |
511 } | |
512 | |
513 src_infos_psi->large_type = FALSE; | |
514 return (ACI_BAT_CMPL); | |
515 } | |
516 | |
517 /* | |
518 +--------------------------------------------------------------------+ | |
519 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
520 | STATE : code ROUTINE : tBAT_PlusCPBR | | |
521 +--------------------------------------------------------------------+ | |
522 | |
523 PURPOSE : | |
524 */ | |
525 | |
526 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCPBR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
527 T_BAT_cmd_send *cmd) | |
528 { | |
529 T_ACI_BAT_RSLT ret=ACI_BAT_FAIL; | |
530 SHORT first; | |
531 SHORT last; | |
532 UBYTE nlength; | |
533 UBYTE tlength; | |
534 | |
535 TRACE_FUNCTION ("tBAT_PlusCPBR()"); | |
536 | |
537 /* | |
538 * Call the corresponding tAT function. T_ACI_BAT_RSLT is | |
539 * assumed to be equivalent to T_ACI_RESULT. | |
540 */ | |
541 ret=(T_ACI_BAT_RSLT)tAT_PlusCPBR(src_infos_psi->srcId,&first,&last,&nlength,&tlength); | |
542 | |
543 /* | |
544 * If the command completes, send the response now. | |
545 */ | |
546 if (ret==ACI_BAT_CMPL) | |
547 { | |
548 T_BAT_cmd_response resp; | |
549 T_BAT_res_tst_plus_cpbr cpbr_data; | |
550 | |
551 resp.ctrl_response=BAT_RES_TST_PLUS_CPBR; | |
552 resp.response.ptr_tst_plus_cpbr=&cpbr_data; | |
553 | |
554 cpbr_data.index_f=(U8)first; | |
555 cpbr_data.index_l=(U8)last; | |
556 cpbr_data.nlength=(S16)nlength; | |
557 cpbr_data.tlength=(S16)tlength; | |
558 | |
559 aci_bat_send(src_infos_psi,&resp); | |
560 } | |
561 | |
562 return(ret); | |
563 } | |
564 | |
565 /* | |
566 +--------------------------------------------------------------------+ | |
567 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
568 | STATE : code ROUTINE : sBAT_PlusCPBF | | |
569 +--------------------------------------------------------------------+ | |
570 | |
571 PURPOSE : | |
572 */ | |
573 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBF_CB (T_ACI_DTI_PRC_PSI *src_infos_psi) | |
574 { | |
575 T_BAT_cmd_send cmd; | |
576 T_BAT_cmd_set_plus_cpbf cpbf; | |
577 | |
578 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBF; | |
579 cmd.params.ptr_set_plus_cpbf = &cpbf; | |
580 | |
581 TRACE_FUNCTION ("sBAT_PlusCPBF_CB()"); | |
582 | |
583 /* restore search string if ongoing command */ | |
584 if ( src_infos_psi->search_str_ptr NEQ NULL ) | |
585 { | |
586 TRACE_EVENT("Restore search string"); | |
587 /* index 1 stores the length of the string in the case of cpbf */ | |
588 cpbf.c_findtext = (U8)src_infos_psi->index1; | |
589 memcpy(cpbf.findtext, src_infos_psi->search_str_ptr, BAT_MAX_CPBF_FIND_TEXT_LEN); | |
590 } | |
591 return (sBAT_PlusCPBF(src_infos_psi, &cmd)); | |
592 } | |
593 | |
594 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPBF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
595 T_BAT_cmd_send *cmd) | |
596 { | |
597 T_ACI_PB_TEXT pbtext; | |
598 USHORT len; | |
599 T_ACI_BAT_RSLT ret; | |
600 T_BAT_cmd_set_plus_cpbf *cpbf_cmd; | |
601 SHORT found = -1; | |
602 T_ACI_PB_ENTR pb[MAX_PB_ENTR]; | |
603 SHORT i; | |
604 T_ACI_CPBF_MOD search_mode; // replaced by global var | |
605 T_BAT_cmd_response resp; | |
606 T_BAT_res_set_plus_cpbf cpbf_rsp; | |
607 | |
608 TRACE_FUNCTION ("sBAT_PlusCPBF()"); | |
609 | |
610 resp.ctrl_response = BAT_RES_SET_PLUS_CPBF; | |
611 resp.response.ptr_set_plus_cpbf = &cpbf_rsp; | |
612 | |
613 /* | |
614 * Get a pointer to the CPBF data for convenience. | |
615 */ | |
616 cpbf_cmd = cmd->params.ptr_set_plus_cpbf; | |
617 | |
618 /* | |
619 * We may have to call sAT_PlusCPBF() more than once, if there are | |
620 * more than MAX_PB_ENTR entries found. The search mode is used | |
621 * to tell the ACI whether this is a new search or a continuation of | |
622 * the old one. | |
623 * If there has been a valid string pointer saved to the search_str_ptr | |
624 * the seek has to be continued. | |
625 */ | |
626 | |
627 if ((src_infos_psi->search_str_ptr NEQ NULL) | |
628 AND (strncmp(src_infos_psi->search_str_ptr, cpbf_cmd->findtext, cpbf_cmd->c_findtext) EQ 0)) | |
629 { | |
630 found = src_infos_psi->index2; /* recover number found*/ | |
631 search_mode = CPBF_MOD_NextSearch; | |
632 TRACE_EVENT_P1("Stored Search string: %s", src_infos_psi->search_str_ptr); | |
633 TRACE_EVENT_P1("Stored String length: %d", src_infos_psi->index1); | |
634 } | |
635 else | |
636 { | |
637 search_mode = CPBF_MOD_NewSearch; | |
638 } | |
639 | |
640 /* | |
641 * If the search string has zero length or is larger than the ACI function | |
642 * can handle then there's no point continuing. | |
643 * In fact there should be a differentiation between UCS2 and 8bit based coding schemes. | |
644 * Additionally it has to be considered that the string given within the BAT command is ACSII encoded. | |
645 */ | |
646 if (((ati_user_output_cfg[src_infos_psi->srcId].cscsChset EQ CSCS_CHSET_Ucs2) | |
647 && ((cpbf_cmd->c_findtext>BAT_MAX_CPBF_FIND_TEXT_LEN)||(cpbf_cmd->c_findtext<1)) ) | |
648 || | |
649 ((ati_user_output_cfg[src_infos_psi->srcId].cscsChset NEQ CSCS_CHSET_Ucs2) | |
650 && ((cpbf_cmd->c_findtext>MAX_PHB_NUM_LEN)||(cpbf_cmd->c_findtext<1)) ) ) | |
651 { | |
652 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
653 return(ACI_BAT_FAIL); | |
654 } | |
655 | |
656 TRACE_EVENT_P1("Search string: %s", cpbf_cmd->findtext); | |
657 TRACE_EVENT_P1("String length: %d", cpbf_cmd->c_findtext); | |
658 | |
659 utl_chsetToSim( | |
660 (UBYTE *)cpbf_cmd->findtext, | |
661 (USHORT)cpbf_cmd->c_findtext, | |
662 (UBYTE *)pbtext.data, | |
663 &len, | |
664 GSM_ALPHA_Def); | |
665 | |
666 if (len > MAX_PHB_NUM_LEN) | |
667 { | |
668 /* | |
669 * Shouldn't get here as that would mean that memory has been | |
670 * overwritten. Currently utl_chsetToSim() has no specific mechanism | |
671 * to prevent this. | |
672 */ | |
673 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_TxtToLong); | |
674 return(ACI_BAT_FAIL); | |
675 } | |
676 | |
677 pbtext.len = (UBYTE)len; | |
678 pbtext.cs = (T_ACI_CS)CS_Sim; | |
679 | |
680 | |
681 /* | |
682 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
683 * assumed to be equivalent to T_ACI_RESULT. | |
684 */ | |
685 | |
686 TRACE_EVENT_P1("search_mode: %d", search_mode); | |
687 TRACE_EVENT_P1("pbtext.data: %s", pbtext.data); | |
688 TRACE_EVENT_P1("pbtext.len: %d", pbtext.len); | |
689 | |
690 | |
691 /* found is not overwritten in the case of NEXT_SEARCH */ | |
692 ret=(T_ACI_BAT_RSLT)sAT_PlusCPBF( | |
693 src_infos_psi->srcId, | |
694 &pbtext, | |
695 search_mode, | |
696 &found, | |
697 pb); | |
698 | |
699 TRACE_EVENT_P1("sAT_PlusCPBF returns: %d", ret); | |
700 TRACE_EVENT_P1("-- found entries: %d", found); | |
701 | |
702 /* | |
703 * If the command fails, get out now. | |
704 */ | |
705 if (ret!=ACI_BAT_CMPL) | |
706 return(ret); | |
707 | |
708 /* | |
709 * We have received a list, however the BAT response only | |
710 * allows for single items. So we must send each one | |
711 * individually. | |
712 */ | |
713 for (i=0;((i<found) && (i<MAX_PB_ENTR));i++) | |
714 { | |
715 USHORT len_cvtd_text=0; | |
716 | |
717 cpbf_rsp.index=(U8)pb[i].index; | |
718 | |
719 TRACE_EVENT("send the found entry"); | |
720 strncpy((CHAR*)cpbf_rsp.number,pb[i].number,BAT_MAX_CPBF_NUMBER_LEN); | |
721 cpbf_rsp.c_number=strlen((CHAR*)cpbf_rsp.number); | |
722 | |
723 /* | |
724 * BAT stores the type of address in a single 8-bit value. | |
725 */ | |
726 cpbf_rsp.type=toa_merge(pb[i].type); | |
727 | |
728 /* | |
729 * Convert the data read from the SIM into the currently | |
730 * selected character set. | |
731 */ | |
732 utl_chsetFromSim( | |
733 (UBYTE *)pb[i].text.data, | |
734 pb[i].text.len, | |
735 (UBYTE *)cpbf_rsp.text, | |
736 BAT_MAX_CPBF_TEXT_LEN, | |
737 &len_cvtd_text, | |
738 GSM_ALPHA_Def); | |
739 | |
740 cpbf_rsp.c_text=(U8)len_cvtd_text; | |
741 | |
742 /* vsi_t_sleep (aci_handle, 500); */ | |
743 | |
744 aci_bat_send(src_infos_psi,&resp); | |
745 } | |
746 | |
747 /* | |
748 * Set the search mode for the next iteration, should there be | |
749 * one. | |
750 */ | |
751 | |
752 if (found>MAX_PB_ENTR) | |
753 { | |
754 TRACE_EVENT("More entries found"); | |
755 /* remember the string to search for (only necessary for first iteration)*/ | |
756 if (search_mode EQ CPBF_MOD_NewSearch) | |
757 { | |
758 TRACE_EVENT("Store string"); | |
759 src_infos_psi->index1 = (U16)cpbf_cmd->c_findtext; /* str length */ | |
760 ACI_MALLOC(src_infos_psi->search_str_ptr, BAT_MAX_CPBF_FIND_TEXT_LEN); | |
761 memcpy(src_infos_psi->search_str_ptr, cpbf_cmd->findtext, BAT_MAX_CPBF_FIND_TEXT_LEN); | |
762 } | |
763 /* This is a multi-line response */ | |
764 src_infos_psi->large_type = TRUE; | |
765 /* Save the number of found items - MAX_PB_ENTR send to user */ | |
766 src_infos_psi->index2 = found - MAX_PB_ENTR; | |
767 /* Still executing */ | |
768 ret = ACI_BAT_EXCT; | |
769 } | |
770 else /* no further entries to find */ | |
771 { | |
772 TRACE_EVENT("reset search string"); | |
773 /* reset search string info for iterations */ | |
774 src_infos_psi->index1 = 0; /* str length reset */ | |
775 src_infos_psi->index2 = 0; /* number found reset */ | |
776 if (src_infos_psi->search_str_ptr NEQ NULL) /* str mem reset, if necessary */ | |
777 { | |
778 ACI_MFREE(src_infos_psi->search_str_ptr); | |
779 src_infos_psi->search_str_ptr = NULL; | |
780 } | |
781 /* This is NO multiline response */ | |
782 src_infos_psi->large_type = FALSE; | |
783 /* completed */ | |
784 ret = ACI_BAT_CMPL; | |
785 } | |
786 | |
787 return (ret); | |
788 | |
789 } | |
790 | |
791 /* | |
792 +--------------------------------------------------------------------+ | |
793 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
794 | STATE : code ROUTINE : tBAT_PlusCPBF | | |
795 +--------------------------------------------------------------------+ | |
796 | |
797 PURPOSE : | |
798 */ | |
799 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCPBF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
800 T_BAT_cmd_send *cmd) | |
801 { | |
802 T_ACI_BAT_RSLT ret; | |
803 UBYTE nlength; | |
804 UBYTE tlength; | |
805 | |
806 TRACE_FUNCTION ("tBAT_PlusCPBF()"); | |
807 | |
808 /* | |
809 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
810 * assumed to be equivalent to T_ACI_RESULT. | |
811 */ | |
812 ret=(T_ACI_BAT_RSLT)tAT_PlusCPBF(src_infos_psi->srcId,&nlength,&tlength); | |
813 | |
814 /* | |
815 * If the command completes, send the response now. | |
816 */ | |
817 if (ret==ACI_BAT_CMPL) | |
818 { | |
819 T_BAT_cmd_response resp; | |
820 T_BAT_res_tst_plus_cpbf cpbf_data; | |
821 | |
822 resp.ctrl_response=BAT_RES_TST_PLUS_CPBF; | |
823 resp.response.ptr_tst_plus_cpbf=&cpbf_data; | |
824 | |
825 cpbf_data.nlength=(S16)nlength; | |
826 cpbf_data.tlength=(S16)tlength; | |
827 | |
828 aci_bat_send(src_infos_psi,&resp); | |
829 } | |
830 | |
831 return(ret); | |
832 } | |
833 | |
834 /* | |
835 +--------------------------------------------------------------------+ | |
836 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
837 | STATE : code ROUTINE : sBAT_PlusCSVM | | |
838 +--------------------------------------------------------------------+ | |
839 | |
840 PURPOSE : | |
841 */ | |
842 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSVM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
843 T_BAT_cmd_send *cmd) | |
844 { | |
845 T_ACI_BAT_RSLT ret; | |
846 T_ACI_TOA toa; | |
847 CHAR number[BAT_MAX_CSVM_NUMBER_LEN+1]; | |
848 CHAR *pnumber; | |
849 T_ACI_CSVM_MOD mode; | |
850 T_BAT_cmd_set_plus_csvm *csvm; | |
851 UBYTE num_len; | |
852 | |
853 TRACE_FUNCTION ("sBAT_PlusCSVM()"); | |
854 | |
855 /* | |
856 * Get a pointer to the BAT structure for convenience. | |
857 */ | |
858 csvm=cmd->params.ptr_set_plus_csvm; | |
859 | |
860 /* | |
861 * This assumes that T_ACI_CSVM_MOD and T_BAT_plus_csvm_mode are | |
862 * equivalent. They are, except that the ACI version has a | |
863 * NotPresent value - this is not a problem here as we are converting | |
864 * from BAT format to ACI format. | |
865 */ | |
866 mode=(T_ACI_CSVM_MOD)csvm->mode; | |
867 | |
868 if (csvm->v_number==TRUE) | |
869 { | |
870 /* | |
871 * I don't think that CSVM requires a null-terminated string, but | |
872 * it's best to err on the side of caution. | |
873 */ | |
874 pnumber=number; | |
875 memset(number,0,sizeof(number)); | |
876 memcpy(number,csvm->number,BAT_MAX_CSVM_NUMBER_LEN); | |
877 | |
878 if (csvm->c_number>BAT_MAX_CSVM_NUMBER_LEN) | |
879 num_len=(UBYTE)BAT_MAX_CSVM_NUMBER_LEN; | |
880 else | |
881 num_len=(UBYTE)csvm->c_number; | |
882 } | |
883 else | |
884 { | |
885 pnumber=NULL; | |
886 num_len=0; | |
887 } | |
888 | |
889 /* | |
890 * BAT stores the type of address in a single 8-bit value. We need to | |
891 * convert this to the ACI format. | |
892 */ | |
893 toa=toa_demerge(csvm->type); | |
894 | |
895 /* | |
896 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
897 * assumed to be equivalent to T_ACI_RESULT. | |
898 */ | |
899 ret=(T_ACI_BAT_RSLT)sAT_PlusCSVM(src_infos_psi->srcId,mode,pnumber,num_len,&toa); | |
900 | |
901 return(ret); | |
902 } | |
903 | |
904 /* | |
905 +--------------------------------------------------------------------+ | |
906 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
907 | STATE : code ROUTINE : qBAT_PlusCSVM | | |
908 +--------------------------------------------------------------------+ | |
909 | |
910 PURPOSE : | |
911 */ | |
912 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSVM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
913 T_BAT_cmd_send *cmd) | |
914 { | |
915 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
916 T_ACI_CSVM_MOD mode; | |
917 CHAR number[BAT_MAX_CSVM_NUMBER_LEN+1]; | |
918 SHORT toa_val; | |
919 | |
920 TRACE_FUNCTION ("qBAT_PlusCSVM()"); | |
921 | |
922 /* | |
923 * Call the corresponding qAT function. T_ACI_BAT_RSLT is | |
924 * assumed to be equivalent to T_ACI_RESULT. | |
925 */ | |
926 ret=(T_ACI_BAT_RSLT)qAT_PlusCSVM( | |
927 src_infos_psi->srcId, | |
928 &mode, | |
929 number, | |
930 BAT_MAX_CSVM_NUMBER_LEN, | |
931 &toa_val); | |
932 | |
933 /* | |
934 * If the query completes, send the response now. | |
935 */ | |
936 if (ret==ACI_BAT_CMPL) | |
937 { | |
938 T_BAT_cmd_response resp; | |
939 T_BAT_res_que_plus_csvm csvm_data; | |
940 | |
941 resp.ctrl_response=BAT_RES_QUE_PLUS_CSVM; | |
942 resp.response.ptr_que_plus_csvm=&csvm_data; | |
943 | |
944 /* | |
945 * We can't just cast the ACI value to the BAT value as it | |
946 * might be CSVM_MOD_NotPresent, for which the BAT has no | |
947 * equivalent. | |
948 */ | |
949 csvm_data.mode=(mode==CSVM_MOD_Enable) ? BAT_CSVM_MODE_ENABLE:BAT_CSVM_MODE_DISABLE; | |
950 | |
951 /* | |
952 * We trust the ACI to give us a null-terminated string. | |
953 */ | |
954 strcpy((CHAR*)csvm_data.number,number); | |
955 csvm_data.c_number=strlen((CHAR*)csvm_data.number); | |
956 | |
957 /* | |
958 * Note that in this instance the ACI is giving us the TOA as | |
959 * a single number, rather than in its usual T_ACI_TOA format. | |
960 */ | |
961 csvm_data.type=(U8)toa_val; | |
962 | |
963 aci_bat_send(src_infos_psi,&resp); | |
964 } | |
965 | |
966 return(ret); | |
967 } | |
968 | |
969 /* | |
970 +--------------------------------------------------------------------+ | |
971 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
972 | STATE : code ROUTINE : sBAT_PlusCLAN | | |
973 +--------------------------------------------------------------------+ | |
974 | |
975 PURPOSE : | |
976 */ | |
977 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCLAN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
978 T_BAT_cmd_send *cmd) | |
979 { | |
980 T_ACI_BAT_RSLT ret; | |
981 T_ACI_LAN_SUP lng; | |
982 CHAR str[BAT_MAX_CLAN_CODE_LEN+1]; | |
983 USHORT i; | |
984 | |
985 TRACE_FUNCTION ("sBAT_PlusCLAN()"); | |
986 | |
987 /* | |
988 * Ensure that we have a null-terminated string. | |
989 */ | |
990 memset(str,0,sizeof(str)); | |
991 memcpy(str,cmd->params.ptr_set_plus_clan->code,BAT_MAX_CLAN_CODE_LEN); | |
992 | |
993 lng.str=NULL; | |
994 | |
995 /* | |
996 * The BAT provides the language in string form only, we must also | |
997 * calculate the corresponding value. To do this we use the lookup | |
998 * table "lngs". | |
999 * | |
1000 * GSM 07.07 says that "AUTO" should be used for automatic mode, but | |
1001 * the (ATI) code uses "au". Here we want to accept both. | |
1002 */ | |
1003 if (!strcmp(str,"AUTO")) | |
1004 { | |
1005 lng.lng=CLAN_LNG_AUT; | |
1006 lng.str="AUTO"; | |
1007 } | |
1008 else | |
1009 { | |
1010 for (i=0;lngs[i].str;i++) | |
1011 { | |
1012 if (!strcmp(lngs[i].str,str)) | |
1013 { | |
1014 lng.str=lngs[i].str; | |
1015 lng.lng=lngs[i].lng; | |
1016 break; | |
1017 } | |
1018 } | |
1019 } | |
1020 | |
1021 if (lng.str==NULL) | |
1022 { | |
1023 /* | |
1024 * Can't work out the language so give up. | |
1025 */ | |
1026 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotSupp); | |
1027 return(ACI_BAT_FAIL); | |
1028 } | |
1029 | |
1030 /* | |
1031 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
1032 * assumed to be equivalent to T_ACI_RESULT. | |
1033 */ | |
1034 ret=(T_ACI_BAT_RSLT)sAT_PlusCLAN(src_infos_psi->srcId,&lng); | |
1035 | |
1036 return(ret); | |
1037 } | |
1038 | |
1039 /* | |
1040 +--------------------------------------------------------------------+ | |
1041 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1042 | STATE : code ROUTINE : qBAT_PlusCLAN | | |
1043 +--------------------------------------------------------------------+ | |
1044 | |
1045 PURPOSE : | |
1046 */ | |
1047 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCLAN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1048 T_BAT_cmd_send *cmd) | |
1049 { | |
1050 T_ACI_BAT_RSLT ret; | |
1051 T_ACI_LAN_SUP lng; | |
1052 T_BAT_cmd_response resp; | |
1053 T_BAT_res_que_plus_clan clan_data; | |
1054 | |
1055 TRACE_FUNCTION ("qBAT_PlusCLAN()"); | |
1056 | |
1057 resp.ctrl_response=BAT_RES_QUE_PLUS_CLAN; | |
1058 resp.response.ptr_que_plus_clan=&clan_data; | |
1059 | |
1060 memset(&clan_data,0,sizeof(clan_data)); | |
1061 lng.str=(CHAR *)clan_data.code; | |
1062 | |
1063 /* | |
1064 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
1065 * assumed to be equivalent to T_ACI_RESULT. | |
1066 * We are trusting this function not to deliver too long | |
1067 * a string. At the time of writing, it can only give us two | |
1068 * characters, which we easily have room for in the BAT | |
1069 * message. | |
1070 */ | |
1071 ret=(T_ACI_BAT_RSLT)qAT_PlusCLAN(src_infos_psi->srcId,&lng); | |
1072 | |
1073 /* | |
1074 * If the query completes, send the response now. | |
1075 */ | |
1076 if (ret==ACI_BAT_CMPL) | |
1077 { | |
1078 clan_data.c_code=strlen(lng.str); | |
1079 aci_bat_send(src_infos_psi,&resp); | |
1080 } | |
1081 | |
1082 return(ret); | |
1083 } | |
1084 | |
1085 /* | |
1086 +--------------------------------------------------------------------+ | |
1087 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
1088 | STATE : code ROUTINE : tBAT_PlusCLAN | | |
1089 +--------------------------------------------------------------------+ | |
1090 | |
1091 PURPOSE : | |
1092 */ | |
1093 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCLAN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
1094 T_BAT_cmd_send *cmd) | |
1095 { | |
1096 T_ACI_BAT_RSLT ret; | |
1097 T_ACI_LAN_SUP lng[MAX_LAN]; | |
1098 SHORT last_idx; | |
1099 | |
1100 TRACE_FUNCTION ("tBAT_PlusCLAN()"); | |
1101 | |
1102 /* | |
1103 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
1104 * assumed to be equivalent to T_ACI_RESULT. | |
1105 */ | |
1106 ret=(T_ACI_BAT_RSLT)tAT_PlusCLAN(src_infos_psi->srcId,&last_idx,lng); | |
1107 | |
1108 /* | |
1109 * If the command completes, send the response now. | |
1110 */ | |
1111 if (ret==ACI_BAT_CMPL) | |
1112 { | |
1113 USHORT i; | |
1114 T_BAT_cmd_response resp; | |
1115 T_BAT_res_tst_plus_clan clan_data; | |
1116 | |
1117 resp.ctrl_response=BAT_RES_TST_PLUS_CLAN; | |
1118 resp.response.ptr_tst_plus_clan=&clan_data; | |
1119 | |
1120 /* | |
1121 * We have received a list, however the BAT response only | |
1122 * allows for single items. So we must send each one | |
1123 * individually. | |
1124 */ | |
1125 for (i=0;i<last_idx;i++) | |
1126 { | |
1127 clan_data.c_code=strlen(lng[i].str); | |
1128 | |
1129 /* | |
1130 * Discard any languages for which the string is too long for | |
1131 * BAT (this should never happen). | |
1132 */ | |
1133 if (clan_data.c_code<=BAT_MAX_CLAN_CODE_LEN) | |
1134 { | |
1135 memcpy(clan_data.code,lng[i].str,BAT_MAX_CLAN_CODE_LEN); | |
1136 aci_bat_send(src_infos_psi,&resp); | |
1137 } | |
1138 } | |
1139 } | |
1140 | |
1141 return(ret); | |
1142 } | |
1143 |