FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/ati_cphs.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: $Workfile:: ati_cphs.c $| | |
4 | $Author:: $Revision:: $| | |
5 | CREATED: $Modtime:: $| | |
6 | STATE : code | | |
7 +--------------------------------------------------------------------+ | |
8 | |
9 MODULE : ATI | |
10 | |
11 PURPOSE : CPHS related proprietery AT commands. | |
12 */ | |
13 | |
14 | |
15 #ifndef ATI_CPHS_C | |
16 #define ATI_CPHS_C | |
17 | |
18 #include "aci_all.h" | |
19 #include "aci_cmh.h" | |
20 #include "ati_cmd.h" | |
21 #include "aci_cmd.h" | |
22 #include "aci_lst.h" | |
23 #include "ati_int.h" | |
24 #include "aci_prs.h" | |
25 #include "aci_mem.h" | |
26 #include "aci_io.h" | |
27 | |
28 #include "cphs.h" | |
29 #include "aci_cphs.h" | |
30 | |
31 #ifdef FF_ATI_BAT | |
32 | |
33 #include "typedefs.h" | |
34 #include "gdd.h" | |
35 #include "bat.h" | |
36 | |
37 #include "ati_bat.h" | |
38 | |
39 #endif /* FF_ATI_BAT */ | |
40 | |
41 LOCAL T_ATI_RSLT query_indicator_flags(UBYTE srcId, T_CPHS_LINES queried_lines, T_ACI_AT_CMD indicator_type); | |
42 | |
43 /* | |
44 +--------------------------------------------------------------------+ | |
45 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
46 | STATE : code ROUTINE : atPercentCPHS | | |
47 +--------------------------------------------------------------------+ | |
48 | |
49 PURPOSE : %CPHS: CPHS module initialing/closing/refreshing | |
50 */ | |
51 | |
52 GLOBAL T_ATI_RSLT setatPercentCPHS (CHAR *cl, UBYTE srcId) | |
53 { | |
54 T_ACI_CPHS_INIT initMode; | |
55 T_ACI_RETURN ret = AT_FAIL; | |
56 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
57 | |
58 cl = parse(cl, "d", &initMode); | |
59 if (cl EQ NULL) | |
60 { | |
61 cmdCmeError(CME_ERR_OpNotAllow); | |
62 return ATI_FAIL; | |
63 } | |
64 | |
65 #ifdef FF_ATI_BAT | |
66 { | |
67 T_BAT_cmd_send cmd; | |
68 T_BAT_cmd_set_percent_cphs my_bat_set_percent_cphs; | |
69 | |
70 TRACE_FUNCTION("setatPercentCPHS() calls bat_send() <=== as APPLICATION"); | |
71 | |
72 memset(&my_bat_set_percent_cphs, 0, sizeof(my_bat_set_percent_cphs)); | |
73 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPHS; | |
74 cmd.params.ptr_set_percent_cphs = &my_bat_set_percent_cphs; | |
75 | |
76 my_bat_set_percent_cphs.init_mode = initMode; | |
77 src_params->curAtCmd = AT_CMD_CPHS; | |
78 bat_send(ati_bat_get_client(srcId), &cmd); | |
79 | |
80 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
81 } | |
82 #else /* OLD FUNCTION BODY */ | |
83 TRACE_FUNCTION("setatPercentCPHS()"); | |
84 | |
85 ret=sAT_PercentCPHS((T_ACI_CMD_SRC)srcId, initMode); | |
86 | |
87 switch (ret) | |
88 { | |
89 case (AT_EXCT): | |
90 src_params->curAtCmd = AT_CMD_CPHS; | |
91 break; | |
92 | |
93 case (AT_BUSY): | |
94 cmdCmeError(CME_ERR_SimBusy); | |
95 return(ATI_FAIL); | |
96 | |
97 case (AT_FAIL): | |
98 cmdCmeError(CME_ERR_Unknown); | |
99 return(ATI_FAIL); | |
100 } | |
101 | |
102 return(map_aci_2_ati_rslt(ret)); | |
103 | |
104 #endif /* no FF_ATI_BAT*/ | |
105 } | |
106 | |
107 GLOBAL T_ATI_RSLT queatPercentCPHS (CHAR *cl, UBYTE srcId) | |
108 { | |
109 T_ACI_CPHS_INIT initMode; | |
110 T_ACI_RETURN ret; | |
111 | |
112 TRACE_FUNCTION("queatPercentCPHS()"); | |
113 | |
114 ret = qAT_PercentCPHS((T_ACI_CMD_SRC)srcId, &initMode); | |
115 | |
116 if (ret NEQ AT_CMPL) | |
117 { | |
118 cmdCmeError(CME_ERR_Unknown); | |
119 return(ATI_FAIL); | |
120 } | |
121 | |
122 sprintf(g_sa, "%s%d", "%CPHS: ", initMode); | |
123 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
124 return(ATI_CMPL); | |
125 } | |
126 | |
127 | |
128 /* | |
129 +--------------------------------------------------------------------+ | |
130 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
131 | STATE : code ROUTINE : atPercentCPNUMS | | |
132 +--------------------------------------------------------------------+ | |
133 | |
134 PURPOSE : %CPNUMS: CPHS information numbers management. | |
135 */ | |
136 | |
137 GLOBAL T_ATI_RSLT setatPercentCPNUMS (CHAR *cl, UBYTE srcId) | |
138 { | |
139 SHORT element_id; | |
140 T_CPHS_CPNUMS_MODE mode; | |
141 T_ACI_RETURN ret = AT_FAIL; | |
142 | |
143 cl = parse(cl, "rd", &element_id, &mode); | |
144 if (cl EQ NULL) | |
145 { | |
146 cmdCmeError(CME_ERR_OpNotAllow); | |
147 return ATI_FAIL; | |
148 } | |
149 | |
150 #ifdef FF_ATI_BAT | |
151 { | |
152 T_BAT_cmd_send cmd; | |
153 T_BAT_cmd_set_percent_cpnums my_bat_set_percent_cpnums; | |
154 | |
155 TRACE_FUNCTION("setatPercentYYYY() calls bat_send() <=== as APPLICATION"); | |
156 | |
157 memset(&my_bat_set_percent_cpnums, 0, sizeof(my_bat_set_percent_cpnums)); | |
158 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPNUMS; | |
159 cmd.params.ptr_set_percent_cpnums = &my_bat_set_percent_cpnums; | |
160 | |
161 my_bat_set_percent_cpnums.element_id = (U8)element_id; | |
162 my_bat_set_percent_cpnums.mode = mode; | |
163 | |
164 bat_send(ati_bat_get_client(srcId), &cmd); | |
165 | |
166 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
167 } | |
168 #else /* OLD FUNCTION BODY */ | |
169 | |
170 TRACE_FUNCTION("setatPercentCPNUMS()"); | |
171 | |
172 ret=sAT_PercentCPNUMS((T_ACI_CMD_SRC)srcId, (UBYTE)element_id, (UBYTE)mode); | |
173 | |
174 if (ret NEQ AT_CMPL) | |
175 { | |
176 cmdCmeError(CME_ERR_Unknown); | |
177 return(ATI_FAIL); | |
178 } | |
179 | |
180 return(ATI_CMPL); | |
181 | |
182 #endif /* no FF_ATI_BAT*/ | |
183 } | |
184 | |
185 GLOBAL T_ATI_RSLT tesatPercentCPNUMS (CHAR *cl, UBYTE srcId) | |
186 { | |
187 T_ACI_RETURN ret; | |
188 | |
189 TRACE_FUNCTION("tesatPercentCPNUMS()"); | |
190 | |
191 ret = tAT_PercentCPNUMS((T_ACI_CMD_SRC)srcId); | |
192 | |
193 if (ret NEQ AT_CMPL) | |
194 { | |
195 cmdCmeError(CME_ERR_Unknown); | |
196 return(ATI_FAIL); | |
197 } | |
198 return(ATI_CMPL); | |
199 } | |
200 | |
201 /* | |
202 +--------------------------------------------------------------------+ | |
203 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
204 | STATE : code ROUTINE : rCI_PercentCPNUMS | | |
205 +--------------------------------------------------------------------+ | |
206 | |
207 PURPOSE : handles AT%CPNUMS call back | |
208 */ | |
209 GLOBAL void rCI_PercentCPNUMS(UBYTE element_index, | |
210 UBYTE index_level, | |
211 CHAR *alpha_tag, | |
212 CHAR *number, | |
213 BOOL premium_flag, | |
214 BOOL network_flag, | |
215 UBYTE type_of_address) | |
216 { | |
217 UBYTE srcId = srcId_cb; | |
218 CHAR cvtd_text[4*CPHS_MAX_INF_ALPHA_TAG]; | |
219 USHORT len_cvtd=0; | |
220 USHORT pos=0; | |
221 | |
222 TRACE_FUNCTION("rCI_PercentCPNUMS()"); | |
223 | |
224 utl_chsetFromSim( | |
225 (UBYTE *)alpha_tag, | |
226 (USHORT)strlen(alpha_tag), | |
227 (UBYTE *)cvtd_text, | |
228 sizeof(cvtd_text), | |
229 &len_cvtd, | |
230 GSM_ALPHA_Def); | |
231 | |
232 pos=sprintf(g_sa,"%s%d,","%CPNUMS: ",element_index); | |
233 pos+=sprints(g_sa+pos,cvtd_text,len_cvtd); | |
234 pos+=sprintf(g_sa+pos,",\"%s\",%d,%d,%d,%d",number,index_level,premium_flag,network_flag,type_of_address); | |
235 | |
236 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
237 } | |
238 | |
239 #ifndef MFW | |
240 #ifndef FF_MMI_RIV | |
241 /* dummy in case of SMI */ | |
242 GLOBAL void rAT_PercentCPNUMS(UBYTE element_index, | |
243 UBYTE index_level, | |
244 CHAR *alpha_tag, | |
245 CHAR *number, | |
246 BOOL premium_flag, | |
247 BOOL network_flag, | |
248 UBYTE type_of_address) | |
249 { | |
250 } | |
251 #endif /*ndef FF_MMI_RIV */ | |
252 #endif /* ndef MFW */ | |
253 | |
254 /* | |
255 +--------------------------------------------------------------------+ | |
256 | PROJECT : GSM-F&D (8411) MODULE : ACI_RET | | |
257 | STATE : code ROUTINE : rCI_PercentCPROAM | | |
258 +--------------------------------------------------------------------+ | |
259 | |
260 PURPOSE : handles %CPROAM indication | |
261 roam_status = 1 mobile entering roaming service // = 0 going back to home netwrok | |
262 */ | |
263 GLOBAL void rCI_PercentCPROAM(UBYTE roam_status) | |
264 { | |
265 UBYTE srcId = srcId_cb; | |
266 | |
267 TRACE_FUNCTION("rCI_PercentCPROAM()"); | |
268 | |
269 sprintf(g_sa, "%s: %d", "%CPROAM", roam_status); | |
270 | |
271 io_sendIndication(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
272 } | |
273 | |
274 #ifndef MFW | |
275 #ifndef FF_MMI_RIV | |
276 /* dummy in case of SMI */ | |
277 GLOBAL void rAT_PercentCPROAM(UBYTE roam_status) | |
278 {} | |
279 #endif /* ndef FF_MMI_RIV */ | |
280 #endif /* ndef MFW */ | |
281 | |
282 /* | |
283 +--------------------------------------------------------------------+ | |
284 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
285 | STATE : code ROUTINE : atPercentCPALS | | |
286 +--------------------------------------------------------------------+ | |
287 | |
288 PURPOSE : %CPALS: CPHS Alternate Line Service. | |
289 */ | |
290 | |
291 LOCAL T_ATI_RSLT proceed_CPALS(UBYTE srcId, UBYTE call_id) | |
292 { | |
293 T_ACI_RETURN ret; | |
294 T_CPHS_LINES active_line; | |
295 CHAR *line_desc; | |
296 UBYTE max_line_desc; | |
297 | |
298 max_line_desc = 30; /* should be enough ! */ | |
299 MALLOC(line_desc, max_line_desc); | |
300 | |
301 ret = qAT_PercentCPALS((T_ACI_CMD_SRC)srcId, call_id, &active_line, line_desc, &max_line_desc); | |
302 | |
303 if (ret EQ AT_EXCT) | |
304 { | |
305 TRACE_EVENT_P1("Quite a line_desc !: %d", max_line_desc); | |
306 MFREE(line_desc); | |
307 MALLOC(line_desc, max_line_desc); | |
308 | |
309 /* retry */ | |
310 ret = qAT_PercentCPALS((T_ACI_CMD_SRC)srcId, call_id, &active_line, line_desc, &max_line_desc); | |
311 } | |
312 | |
313 if (ret NEQ AT_CMPL) | |
314 { | |
315 cmdCmeError(CME_ERR_OpNotAllow); | |
316 MFREE(line_desc); | |
317 return(ATI_FAIL); | |
318 } | |
319 | |
320 sprintf(g_sa, "%s: %d,\"%s\"", "%CPALS", active_line, line_desc); | |
321 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
322 MFREE(line_desc); | |
323 | |
324 return(ATI_CMPL); | |
325 } | |
326 | |
327 GLOBAL T_ATI_RSLT setatPercentCPALS (CHAR *cl, UBYTE srcId) | |
328 { | |
329 SHORT call_id; | |
330 | |
331 cl = parse(cl, "r", &call_id); | |
332 if (cl EQ NULL) | |
333 { | |
334 cmdCmeError(CME_ERR_OpNotAllow); | |
335 return ATI_FAIL; | |
336 } | |
337 | |
338 #ifdef FF_ATI_BAT | |
339 { | |
340 T_BAT_cmd_send cmd; | |
341 T_BAT_cmd_set_percent_cpals my_bat_set_percent_cpals; | |
342 | |
343 TRACE_FUNCTION("setatPercentCPALS() calls bat_send() <=== as APPLICATION"); | |
344 | |
345 memset(&my_bat_set_percent_cpals, 0, sizeof(my_bat_set_percent_cpals)); | |
346 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPALS; | |
347 cmd.params.ptr_set_percent_cpals = &my_bat_set_percent_cpals; | |
348 | |
349 my_bat_set_percent_cpals.call_id = (U8)call_id; | |
350 | |
351 bat_send(ati_bat_get_client(srcId), &cmd); | |
352 | |
353 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
354 } | |
355 #else /* OLD FUNCTION BODY */ | |
356 | |
357 TRACE_FUNCTION("setatPercentCPALS()"); | |
358 return proceed_CPALS(srcId, (UBYTE)call_id); | |
359 | |
360 #endif /* no FF_ATI_BAT */ | |
361 } | |
362 | |
363 GLOBAL T_ATI_RSLT queatPercentCPALS (CHAR *cl, UBYTE srcId) | |
364 { | |
365 TRACE_FUNCTION("queatPercentCPALS()"); | |
366 | |
367 return(proceed_CPALS(srcId, NOT_PRESENT_8BIT)); | |
368 } | |
369 | |
370 GLOBAL T_ATI_RSLT tesatPercentCPALS (CHAR *cl, UBYTE srcId) | |
371 { | |
372 TRACE_FUNCTION("tesatPercentCPALS()"); | |
373 | |
374 return(ATI_CMPL); | |
375 } | |
376 | |
377 /* | |
378 +--------------------------------------------------------------------+ | |
379 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
380 | STATE : code ROUTINE : atPercentCPVWI | | |
381 +--------------------------------------------------------------------+ | |
382 | |
383 PURPOSE : %CPVWI: set/clear/query voice message waiting flags | |
384 */ | |
385 | |
386 GLOBAL T_ATI_RSLT setatPercentCPVWI(CHAR *cl, UBYTE srcId) | |
387 { | |
388 T_CPHS_LINES i = 0, | |
389 typed_lines = NOT_PRESENT_16BIT, | |
390 line = 0; | |
391 SHORT action = 0; | |
392 T_ACI_RETURN ret = AT_FAIL; | |
393 T_ATI_SRC_PARAMS *src_params = find_element( ati_src_list, srcId, search_ati_src_id); | |
394 | |
395 cl = parse(cl,"rr", &action, &typed_lines); | |
396 if (cl EQ NULL) | |
397 { | |
398 cmdCmeError(CME_ERR_OpNotAllow); | |
399 return(ATI_FAIL); | |
400 } | |
401 | |
402 if (typed_lines EQ NOT_PRESENT_16BIT) | |
403 { | |
404 TRACE_EVENT("typed_lines omitted"); | |
405 | |
406 typed_lines = 0; | |
407 | |
408 /* lines parameter omitted: Provides VWI flags for all lines */ | |
409 for(i=0;i<8*sizeof(T_CPHS_LINES);i++) | |
410 { | |
411 line = CPHS_LINE1 << i; | |
412 | |
413 if (cphs_line_makes_sense(line)) | |
414 { | |
415 typed_lines |= line; | |
416 } | |
417 } | |
418 } | |
419 | |
420 TRACE_EVENT_P2("setatPercentCPVWI action: %d, lines: %d", action, typed_lines); | |
421 | |
422 | |
423 #ifdef FF_ATI_BAT | |
424 { | |
425 T_BAT_cmd_send cmd; | |
426 T_BAT_cmd_set_percent_cpvwi my_bat_set_percent_cpvwi; | |
427 | |
428 TRACE_FUNCTION("setatPercentCPVWI() calls bat_send() <=== as APPLICATION"); | |
429 | |
430 memset(&my_bat_set_percent_cpvwi, 0, sizeof(my_bat_set_percent_cpvwi)); | |
431 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPVWI; | |
432 cmd.params.ptr_set_percent_cpvwi = &my_bat_set_percent_cpvwi; | |
433 | |
434 my_bat_set_percent_cpvwi.mode = action; | |
435 my_bat_set_percent_cpvwi.lines = typed_lines; | |
436 src_params->curAtCmd = AT_CMD_CPVWI; | |
437 bat_send(ati_bat_get_client(srcId), &cmd); | |
438 | |
439 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
440 } | |
441 #else /* OLD FUNCTION BODY */ | |
442 | |
443 /******* QUERY ********/ | |
444 if (action EQ CPHS_QUERY_WAITING_FLAG) | |
445 { | |
446 return query_indicator_flags(srcId, typed_lines, AT_CMD_CPVWI); | |
447 } | |
448 | |
449 TRACE_FUNCTION("setatPercentCPVWI()"); | |
450 | |
451 /******* SETTING ********/ | |
452 ret = sAT_PercentCPVWI((T_ACI_CMD_SRC)srcId, (UBYTE)action, typed_lines); | |
453 | |
454 switch (ret) | |
455 { | |
456 case (AT_EXCT): | |
457 src_params->curAtCmd = AT_CMD_CPVWI; | |
458 break; | |
459 | |
460 case (AT_BUSY): | |
461 cmdCmeError(CME_ERR_SimBusy); | |
462 return(ATI_FAIL); | |
463 | |
464 case (AT_FAIL): | |
465 cmdCmeError(CME_ERR_Unknown); | |
466 return(ATI_FAIL); | |
467 } | |
468 | |
469 return(map_aci_2_ati_rslt(ret)); | |
470 | |
471 #endif /* no FF_ATI_BAT*/ | |
472 } | |
473 | |
474 | |
475 /* | |
476 +--------------------------------------------------------------------+ | |
477 | PROJECT : GSM-F&D (8411) MODULE : ATI_CPHS | | |
478 | STATE : code ROUTINE : rCI_PercentCPVWI | | |
479 +--------------------------------------------------------------------+ | |
480 | |
481 PURPOSE : handles AT_PercentCPVWI call back | |
482 | |
483 */ | |
484 | |
485 GLOBAL void rCI_PercentCPVWI (UBYTE flag_set, | |
486 USHORT line) | |
487 { | |
488 UBYTE srcId = srcId_cb; | |
489 | |
490 TRACE_FUNCTION("rCI_PercentCPVWI()"); | |
491 | |
492 sprintf(g_sa, "%s: %d,%d", "%CPVWI", flag_set, line); | |
493 io_sendIndication((UBYTE)srcId, g_sa, ATI_NORMAL_OUTPUT); | |
494 } | |
495 | |
496 #ifndef MFW | |
497 #ifndef FF_MMI_RIV | |
498 /* dummy in case of SMI */ | |
499 GLOBAL void rAT_PercentCPVWI ( UBYTE flag_set, | |
500 USHORT line) | |
501 { } | |
502 #endif /* FF_MMI_RIV */ | |
503 #endif /* MFW */ | |
504 | |
505 | |
506 /* | |
507 +--------------------------------------------------------------------+ | |
508 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
509 | STATE : code ROUTINE : atPercentCPOPN | | |
510 +--------------------------------------------------------------------+ | |
511 | |
512 PURPOSE : %CPOPN: query operator name string | |
513 */ | |
514 | |
515 GLOBAL T_ATI_RSLT queatPercentCPOPN(CHAR *cl, UBYTE srcId) | |
516 { | |
517 CHAR long_name[CPHS_MAX_OPER_LONG]; | |
518 CHAR short_name[CPHS_MAX_OPER_SHORT]; | |
519 UBYTE long_len; | |
520 UBYTE short_len; | |
521 T_ACI_RETURN ret; | |
522 | |
523 TRACE_FUNCTION("queatPercentCPOPN()"); | |
524 | |
525 long_len = CPHS_MAX_OPER_LONG; | |
526 short_len = CPHS_MAX_OPER_SHORT; | |
527 ret = qAT_PercentCPOPN((T_ACI_CMD_SRC)srcId, long_name, &long_len, short_name, &short_len); | |
528 | |
529 if (ret NEQ AT_CMPL) | |
530 { | |
531 if (short_len > 0 OR | |
532 long_len > 0) | |
533 { | |
534 TRACE_EVENT_P2("Buffer for Long Name or Short Name too small needed: %d, %d", long_len, short_len); | |
535 } | |
536 | |
537 cmdCmeError(CME_ERR_Unknown); | |
538 return(ATI_FAIL); | |
539 } | |
540 | |
541 if ( short_len > 0 ) | |
542 { | |
543 sprintf(g_sa, "%s: \"%s\",\"%s\"", "%CPOPN", long_name, short_name); | |
544 } | |
545 else | |
546 { | |
547 sprintf(g_sa, "%s: \"%s\"", "%CPOPN", long_name); | |
548 } | |
549 io_sendMessage((UBYTE)srcId, g_sa, ATI_NORMAL_OUTPUT); | |
550 | |
551 return(ATI_CMPL); | |
552 } | |
553 | |
554 | |
555 /* | |
556 +--------------------------------------------------------------------+ | |
557 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
558 | STATE : code ROUTINE : setatPercentCPINF | | |
559 +--------------------------------------------------------------------+ | |
560 | |
561 PURPOSE : %CPINF: set customer service profile | |
562 */ | |
563 | |
564 GLOBAL T_ATI_RSLT setatPercentCPINF(CHAR *cl, UBYTE srcId) | |
565 { | |
566 CHAR csp[CPHS_MAX_CSP*2 + 1]; | |
567 USHORT csp_size = 0; | |
568 UBYTE index; /* for parsing failure analysis */ | |
569 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
570 | |
571 /* initialize the local varibles */ | |
572 memset(csp,0,sizeof(csp)); | |
573 | |
574 cl = parse(cl, "z", | |
575 (LONG)sizeof (csp), | |
576 strlen(cl), | |
577 cl, | |
578 &csp_size, | |
579 csp); | |
580 | |
581 if (cl EQ NULL) | |
582 { | |
583 index = get_parse_index(); /* get the problematic component */ | |
584 TRACE_EVENT_P1("index %d",index); | |
585 switch (index) | |
586 { | |
587 case 1: | |
588 cmdCmeError(CME_ERR_TxtToLong); | |
589 break; | |
590 default: | |
591 cmdCmeError(CME_ERR_OpNotAllow); | |
592 break; | |
593 } | |
594 return ATI_FAIL; | |
595 } | |
596 | |
597 #ifdef FF_ATI_BAT | |
598 { | |
599 T_BAT_cmd_send cmd; | |
600 T_BAT_cmd_set_percent_cpinf cpinf; | |
601 TRACE_FUNCTION("setatPercentCPINF() calls bat_send() <=== as APPLICATION"); | |
602 | |
603 memset(&cpinf, 0, sizeof(cpinf)); | |
604 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPINF; | |
605 cmd.params.ptr_set_percent_cpinf = &cpinf; | |
606 cpinf.c_csp = (U8)csp_size; | |
607 memcpy(cpinf.csp, csp, csp_size); | |
608 src_params->curAtCmd = AT_CMD_CPINF; | |
609 bat_send(ati_bat_get_client(srcId), &cmd); | |
610 | |
611 return ATI_EXCT; | |
612 } | |
613 #else | |
614 { | |
615 T_ACI_RETURN ret = AT_FAIL; | |
616 UBYTE serv_group[CPHS_MAX_CSP]; | |
617 UBYTE serv_len = 0; | |
618 | |
619 TRACE_FUNCTION("setatPercentCPINF()"); | |
620 | |
621 memset(serv_group,0,sizeof(serv_group)); | |
622 | |
623 serv_len = utl_HexStrToBin((UBYTE*)csp, csp_size, serv_group, CPHS_MAX_CSP); | |
624 | |
625 /* Odd length CSP or empty CSP display operation not allowed */ | |
626 if(((serv_len % 2) NEQ 0) OR (serv_len EQ 0)) | |
627 { | |
628 cmdCmeError(CME_ERR_OpNotAllow); | |
629 return ATI_FAIL; | |
630 } | |
631 /* write customer service profile (csp) */ | |
632 ret = sAT_PercentCPINF( (T_ACI_CMD_SRC)srcId, | |
633 serv_group, | |
634 serv_len); | |
635 | |
636 switch (ret) | |
637 { | |
638 case (AT_EXCT): | |
639 src_params->curAtCmd = AT_CMD_CPINF; | |
640 break; | |
641 case (AT_CMPL): | |
642 break; | |
643 default: | |
644 break; | |
645 } | |
646 return(map_aci_2_ati_rslt(ret)); | |
647 } | |
648 #endif /* no FF_ATI_BAT*/ | |
649 } | |
650 | |
651 /* | |
652 +--------------------------------------------------------------------+ | |
653 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
654 | STATE : code ROUTINE : atPercentCPINF | | |
655 +--------------------------------------------------------------------+ | |
656 | |
657 PURPOSE : %CPINF: query cphs information and customer service profile | |
658 */ | |
659 | |
660 GLOBAL T_ATI_RSLT queatPercentCPINF(CHAR *cl, UBYTE srcId) | |
661 { | |
662 #ifdef FF_ATI_BAT | |
663 T_BAT_cmd_send cmd; | |
664 T_BAT_no_parameter dummy; | |
665 | |
666 TRACE_FUNCTION("queatPercentCPINF() calls bat_send() <=== as APPLICATION"); | |
667 | |
668 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_CPINF; | |
669 dummy.bat_dummy = 0xFF; | |
670 cmd.params.ptr_que_percent_cpinf = &dummy; | |
671 | |
672 bat_send(ati_bat_get_client(srcId),&cmd); | |
673 | |
674 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
675 | |
676 #else /* FF_ATI_BAT */ | |
677 | |
678 UBYTE phase; | |
679 USHORT sst; | |
680 CHAR csp[CPHS_MAX_CSP*2 + 1]; | |
681 CHAR csp2[CPHS_MAX_CSP*2 + 1]; /* Since the CPHS_MAX_CSP length has been updated to 22,then there is no need of CPHS_MAX_CSP2 */ | |
682 UBYTE max_csp_size = CPHS_MAX_CSP*2 + 1; | |
683 UBYTE max_csp2_size = CPHS_MAX_CSP*2 + 1; | |
684 T_ACI_RETURN ret; | |
685 | |
686 TRACE_FUNCTION("queatPercentCPINF()"); | |
687 | |
688 ret = qAT_PercentCPINF ((T_ACI_CMD_SRC)srcId, | |
689 &phase, | |
690 &sst, | |
691 csp, | |
692 csp2, | |
693 &max_csp_size, | |
694 &max_csp2_size); | |
695 | |
696 if (ret NEQ AT_CMPL) | |
697 { | |
698 if (max_csp_size > 0) | |
699 { | |
700 TRACE_EVENT_P1("Buffer for CSP is too small ! needed: %d", max_csp_size); | |
701 } | |
702 | |
703 if (max_csp2_size > 0) | |
704 { | |
705 TRACE_EVENT_P1("Buffer for CSP2 is too small ! needed: %d", max_csp2_size); | |
706 } | |
707 cmdCmeError(CME_ERR_Unknown); | |
708 return(ATI_FAIL); | |
709 } | |
710 | |
711 if ( max_csp_size > 0 ) | |
712 { | |
713 if ( max_csp2_size > 0 ) | |
714 { | |
715 sprintf(g_sa, "%s: %d,\"%04X\",\"%s\",\"%s\"", "%CPINF",phase, sst, csp, csp2); | |
716 } | |
717 else | |
718 { | |
719 sprintf(g_sa, "%s: %d,\"%04X\",\"%s\"", "%CPINF",phase, sst, csp); | |
720 } | |
721 } | |
722 else | |
723 { | |
724 sprintf(g_sa, "%s: %d,\"%04X\"", "%CPINF", phase, sst); | |
725 } | |
726 io_sendMessage((UBYTE)srcId, g_sa, ATI_NORMAL_OUTPUT); | |
727 | |
728 return(ATI_CMPL); | |
729 | |
730 #endif /* FF_ATI_BAT */ | |
731 } | |
732 | |
733 /* | |
734 +--------------------------------------------------------------------+ | |
735 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
736 | STATE : code ROUTINE : atPercentCPMB | | |
737 +--------------------------------------------------------------------+ | |
738 | |
739 PURPOSE : %CPMB: query mailbox numbers | |
740 */ | |
741 | |
742 GLOBAL T_ATI_RSLT setatPercentCPMB(CHAR *cl, UBYTE srcId) | |
743 { | |
744 SHORT rec_id; | |
745 T_ACI_RETURN ret = AT_FAIL; | |
746 | |
747 cl = parse(cl, "r", &rec_id); | |
748 if (cl EQ NULL) | |
749 { | |
750 cmdCmeError(CME_ERR_OpNotAllow); | |
751 return ATI_FAIL; | |
752 } | |
753 | |
754 #ifdef FF_ATI_BAT | |
755 { | |
756 T_BAT_cmd_send cmd; | |
757 T_BAT_cmd_set_percent_cpmb my_bat_set_percent_cpmb; | |
758 | |
759 TRACE_FUNCTION("setatPercentCPMB() calls bat_send() <=== as APPLICATION"); | |
760 | |
761 memset(&my_bat_set_percent_cpmb, 0, sizeof(my_bat_set_percent_cpmb)); | |
762 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPMB; | |
763 cmd.params.ptr_set_percent_cpmb = &my_bat_set_percent_cpmb; | |
764 | |
765 my_bat_set_percent_cpmb.record_id = rec_id; | |
766 | |
767 bat_send(ati_bat_get_client(srcId), &cmd); | |
768 | |
769 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
770 } | |
771 #else /* OLD FUNCTION BODY */ | |
772 { | |
773 T_CPHS_LINES line; | |
774 CHAR number[CPHS_MAX_MB_NUMBER_LEN]; | |
775 CHAR alpha_id[CPHS_MAX_MB_ALPHA_LEN]; | |
776 T_ACI_TOA_TON ton; | |
777 T_ACI_TOA_NPI npi; | |
778 UBYTE toa; | |
779 CHAR cvtd_text[4*CPHS_MAX_MB_ALPHA_LEN]; | |
780 USHORT len_cvtd=0; | |
781 USHORT pos=0; | |
782 | |
783 | |
784 TRACE_FUNCTION("setatPercentCPMB()"); | |
785 | |
786 ret = qAT_PercentCPMB((T_ACI_CMD_SRC)srcId, (UBYTE)rec_id, &line, number, &ton, &npi, alpha_id, NULL); | |
787 | |
788 if (ret NEQ AT_CMPL) | |
789 { | |
790 cmdCmeError(CME_ERR_Unknown); | |
791 return(ATI_FAIL); | |
792 } | |
793 | |
794 /* check if empty mb entry */ | |
795 if (number[0] EQ '\0') | |
796 { /* do not send to ATI */ | |
797 cmdCmeError(CME_ERR_NotFound); | |
798 return(ATI_FAIL); | |
799 } | |
800 | |
801 toa = ( ( ( ton << 4 ) & 0xF0 ) + ( npi & 0x0F ) ) | 0x80; | |
802 | |
803 utl_chsetFromSim( | |
804 (UBYTE *)alpha_id, | |
805 (USHORT)strlen(alpha_id), | |
806 (UBYTE *)cvtd_text, | |
807 sizeof(cvtd_text), | |
808 &len_cvtd, | |
809 GSM_ALPHA_Def); | |
810 | |
811 pos=sprintf(g_sa,"%s: %d,%d,\"%s\",%d,", "%CPMB", rec_id, line, number, toa); | |
812 pos+=sprints(g_sa+pos,cvtd_text,len_cvtd); | |
813 | |
814 io_sendMessage((UBYTE)srcId, g_sa, ATI_NORMAL_OUTPUT); | |
815 | |
816 return(ATI_CMPL); | |
817 } | |
818 #endif /* no FF_ATI_BAT*/ | |
819 } | |
820 | |
821 | |
822 /* | |
823 +--------------------------------------------------------------------+ | |
824 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
825 | STATE : code ROUTINE : queatPercentCPMB | | |
826 +--------------------------------------------------------------------+ | |
827 | |
828 PURPOSE : %CPMB?: query mailbox numbers | |
829 */ | |
830 GLOBAL T_ATI_RSLT queatPercentCPMB(char *cl, UBYTE srcId) | |
831 { | |
832 #ifdef FF_ATI_BAT | |
833 T_BAT_cmd_send cmd; | |
834 T_BAT_no_parameter dummy; | |
835 | |
836 TRACE_FUNCTION("queatPercentCPMB() calls bat_send() <=== as APPLICATION"); | |
837 | |
838 cmd.ctrl_params=BAT_CMD_QUE_PERCENT_CPMB; | |
839 dummy.bat_dummy=0xFF; | |
840 cmd.params.ptr_que_percent_cpmb=&dummy; | |
841 | |
842 bat_send(ati_bat_get_client(srcId),&cmd); | |
843 | |
844 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
845 | |
846 #else /* FF_ATI_BAT */ | |
847 char *me="%CPMB: "; | |
848 T_ACI_RETURN ret; | |
849 UBYTE first; | |
850 | |
851 TRACE_FUNCTION("queatPercentCPMB()"); | |
852 | |
853 /* | |
854 * Call the corresponding ACI function. | |
855 */ | |
856 ret=qAT_PercentCPMB((T_ACI_CMD_SRC)srcId,(UBYTE)ACI_NumParmNotPresent,NULL,NULL,NULL,NULL,NULL,&first); | |
857 | |
858 /* | |
859 * If the query completes successfully, build and send the | |
860 * answer. | |
861 */ | |
862 if (ret EQ AT_CMPL) | |
863 { | |
864 sprintf(g_sa,"%s%d",me,first); | |
865 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
866 } | |
867 | |
868 return (map_aci_2_ati_rslt(ret)); | |
869 #endif /* FF_ATI_BAT */ | |
870 } | |
871 | |
872 | |
873 /* | |
874 +--------------------------------------------------------------------+ | |
875 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
876 | STATE : code ROUTINE : atPercentCPMBW | | |
877 +--------------------------------------------------------------------+ | |
878 | |
879 PURPOSE : %CPMB: write mailbox numbers | |
880 */ | |
881 | |
882 GLOBAL T_ATI_RSLT setatPercentCPMBW(CHAR *cl, UBYTE srcId) | |
883 { | |
884 CHAR number[CPHS_MAX_MB_NUMBER_LEN]; | |
885 | |
886 #ifndef FF_ATI_BAT | |
887 CHAR *p_number; | |
888 | |
889 T_CPHS_PB_TEXT cvtdText; /* holds text converted to SIM alpha */ | |
890 T_ACI_TOA toa; /* holds the type of record */ | |
891 T_ACI_RETURN ret; | |
892 #endif | |
893 | |
894 UBYTE index; /* for parsing failure analysis */ | |
895 | |
896 CHAR alpha_id[CPHS_MAX_MB_ALPHA_LEN] = {0x00}; | |
897 USHORT len_alpha_id = 0; | |
898 USHORT lenCvtd = 0; /* holds length of converted text */ | |
899 T_CPHS_PB_TEXT *p_text = NULL; /* holds pointer to converted text */ | |
900 | |
901 SHORT toa_val = 0; /* holds type of record value */ | |
902 SHORT rec_id = -1; /* holds index of record */ | |
903 | |
904 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
905 | |
906 TRACE_FUNCTION("setatPercentCPMBW()"); | |
907 | |
908 /* initialize */ | |
909 memset(number,0,sizeof(number)); | |
910 | |
911 /***********************************************/ | |
912 /*** prepare parameters and test their range ***/ | |
913 /***********************************************/ | |
914 | |
915 /* parse command string */ | |
916 cl = parse(cl,"rsrz", | |
917 &rec_id, | |
918 (LONG)CPHS_MAX_MB_NUMBER_LEN, | |
919 number, | |
920 &toa_val, | |
921 (LONG)CPHS_MAX_MB_ALPHA_LEN, | |
922 strlen(cl), | |
923 cl, | |
924 &len_alpha_id, | |
925 alpha_id); | |
926 | |
927 /* Throw error if parsing has been failed */ | |
928 if (!cl) | |
929 { | |
930 TRACE_ERROR("ERROR: parsing failed !"); | |
931 /* analyse error component of input */ | |
932 index = get_parse_index(); /* get the problematic component */ | |
933 switch (index) | |
934 { | |
935 case 3: /* component 2 is the number */ | |
936 cmdCmeError(CME_ERR_DialToLong); | |
937 break; | |
938 case 5: /* component 4 is the alpha tag */ | |
939 cmdCmeError(CME_ERR_TxtToLong); | |
940 break; | |
941 default: | |
942 cmdCmeError(CME_ERR_OpNotAllow); | |
943 break; | |
944 } | |
945 return ATI_FAIL; | |
946 } | |
947 | |
948 /* test if values are in correct ranges */ | |
949 if ( rec_id >= CPHS_MAX_MB_ENTRIES) /* phonebook index is greater than max. */ | |
950 { | |
951 TRACE_ERROR("ERROR: phonebook index is greater than max possible index of SIM"); | |
952 cmdCmeError(CME_ERR_InvIdx); | |
953 return ATI_FAIL; | |
954 } | |
955 | |
956 #ifdef FF_ATI_BAT | |
957 | |
958 { | |
959 T_BAT_cmd_send cmd; | |
960 T_BAT_cmd_set_percent_cpmbw cpmbw; | |
961 int len; | |
962 | |
963 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPMBW; | |
964 cmd.params.ptr_set_percent_cpmbw=&cpmbw; | |
965 | |
966 cpmbw.record_id=(T_BAT_record_id)rec_id; | |
967 | |
968 len=strlen(number); | |
969 | |
970 if ((len<0) OR (len>BAT_MAX_CPMBW_NUMBER_LEN)) | |
971 { | |
972 /* | |
973 * Either the number wasn't present, or it was too big to | |
974 * fit in the BAT message. | |
975 */ | |
976 cpmbw.v_number=FALSE; | |
977 cpmbw.type=-1; | |
978 } | |
979 else | |
980 { | |
981 cpmbw.v_number=TRUE; | |
982 cpmbw.c_number=(U8)len; | |
983 memcpy(cpmbw.number,number,len); | |
984 cpmbw.type=(toa_val>0) ? toa_val:-1; | |
985 } | |
986 | |
987 if ((len_alpha_id>0) AND (len_alpha_id<=BAT_MAX_CPMBW_TEXT_LEN)) | |
988 { | |
989 cpmbw.v_text=TRUE; | |
990 cpmbw.c_text=(U8)len_alpha_id; | |
991 memcpy(cpmbw.text,alpha_id,len_alpha_id); | |
992 } | |
993 else | |
994 { | |
995 /* | |
996 * Either the alphanumeric data wasn't present, or it was | |
997 * too big to fit in the BAT message. | |
998 */ | |
999 cpmbw.v_text=FALSE; | |
1000 } | |
1001 | |
1002 bat_send(ati_bat_get_client(srcId),&cmd); | |
1003 return(ATI_EXCT); | |
1004 } | |
1005 | |
1006 #else /* OLD FUNCTION BODY */ | |
1007 | |
1008 /* | |
1009 * Initialise 'converted text'. | |
1010 */ | |
1011 cvtdText.len = 0; | |
1012 memset(cvtdText.data,0,sizeof(cvtdText.data)); | |
1013 | |
1014 /* extract type structure from type value */ | |
1015 if (toa_val > 0) | |
1016 { | |
1017 toa = toa_demerge(toa_val); | |
1018 } | |
1019 /* translate alpha text to SIM */ | |
1020 if ( len_alpha_id NEQ 0 ) | |
1021 { | |
1022 srcId_cb = srcId; | |
1023 utl_chsetToSim ((UBYTE*)alpha_id, len_alpha_id, (UBYTE*)cvtdText.data, | |
1024 &lenCvtd, GSM_ALPHA_Def); | |
1025 } | |
1026 | |
1027 /* set pointer for number */ | |
1028 if (number[0] EQ '\0') /* The number given is empty */ | |
1029 { | |
1030 p_number = NULL; | |
1031 } | |
1032 else | |
1033 { | |
1034 p_number = number; | |
1035 } | |
1036 | |
1037 /* when the text and the number are both empty, set p_text to NULL */ | |
1038 if (lenCvtd EQ 0 AND p_number EQ NULL) | |
1039 { | |
1040 p_text = NULL; | |
1041 } | |
1042 else | |
1043 { | |
1044 p_text = &cvtdText; | |
1045 cvtdText.len = (UBYTE)lenCvtd; | |
1046 } | |
1047 | |
1048 /* write number into cphs mailbox number phonebook */ | |
1049 ret = sAT_PercentCPMBW((T_ACI_CMD_SRC)srcId, rec_id, number, &toa, p_text); | |
1050 | |
1051 switch (ret) | |
1052 { | |
1053 case (AT_CMPL): /*operation completed*/ | |
1054 break; | |
1055 case (AT_EXCT): | |
1056 src_params->curAtCmd = AT_CMD_CPMBW; | |
1057 break; | |
1058 default: | |
1059 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1060 break; | |
1061 } | |
1062 | |
1063 return (map_aci_2_ati_rslt(ret)); | |
1064 | |
1065 #endif /* no FF_ATI_BAT*/ | |
1066 } | |
1067 | |
1068 /* | |
1069 +--------------------------------------------------------------------+ | |
1070 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1071 | STATE : code ROUTINE : atPercentCPMBW | | |
1072 +--------------------------------------------------------------------+ | |
1073 | |
1074 PURPOSE : %CPMB: test command | |
1075 */ | |
1076 | |
1077 GLOBAL T_ATI_RSLT tesatPercentCPMBW(char *cl, UBYTE srcId) | |
1078 { | |
1079 #ifndef FF_ATI_BAT | |
1080 char *me = "%CPMBW: "; | |
1081 SHORT first_idx = 0; | |
1082 SHORT last_idx = 0; | |
1083 UBYTE tlength = 0; | |
1084 UBYTE nlength = 0; | |
1085 T_ACI_RETURN ret = AT_FAIL; | |
1086 #endif | |
1087 | |
1088 TRACE_FUNCTION("tesatPercentCPMBW"); | |
1089 | |
1090 #ifdef FF_ATI_BAT | |
1091 { | |
1092 T_BAT_cmd_send cmd; | |
1093 T_BAT_no_parameter dummy; | |
1094 | |
1095 cmd.ctrl_params = BAT_CMD_TST_PERCENT_CPMBW; | |
1096 dummy.bat_dummy = 0xFF; | |
1097 cmd.params.ptr_tst_percent_cpmbw = &dummy; | |
1098 bat_send(ati_bat_get_client(srcId), &cmd); | |
1099 return(ATI_EXCT); | |
1100 } | |
1101 #else | |
1102 ret = tAT_PercentCPMBW((T_ACI_CMD_SRC)srcId,&first_idx,&last_idx,&nlength,&tlength); | |
1103 | |
1104 if (ret EQ AT_CMPL) | |
1105 { | |
1106 sprintf(g_sa,"%s(%d-%d),%d,%s,%d",me,first_idx,last_idx,nlength,"(128-201)",tlength); | |
1107 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1108 } | |
1109 else | |
1110 { | |
1111 cmdCmeError(CME_ERR_Unknown); | |
1112 } | |
1113 return (map_aci_2_ati_rslt(ret)); | |
1114 #endif | |
1115 } | |
1116 | |
1117 /* | |
1118 +--------------------------------------------------------------------+ | |
1119 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1120 | STATE : code ROUTINE : atPercentCPCFU | | |
1121 +--------------------------------------------------------------------+ | |
1122 | |
1123 PURPOSE : %CPCFU: call diverted flag status | |
1124 */ | |
1125 typedef T_ACI_RETURN T_QUERY_INDICATOR_CMH_CPHS_FNC (T_ACI_CMD_SRC srcId, UBYTE *cfu_set, T_CPHS_LINES line); | |
1126 | |
1127 LOCAL T_ATI_RSLT query_indicator_flags(UBYTE srcId, T_CPHS_LINES queried_lines, T_ACI_AT_CMD indicator_type) | |
1128 { | |
1129 T_ACI_RETURN ret; | |
1130 UBYTE flag_set; | |
1131 T_CPHS_LINES line = CPHS_LINE_NULL, | |
1132 set_line_bitmask = CPHS_LINE_NULL; | |
1133 USHORT i; | |
1134 T_QUERY_INDICATOR_CMH_CPHS_FNC *cmh_query_ind_fnc = NULL; | |
1135 CHAR *cmd_name = NULL; | |
1136 | |
1137 switch(indicator_type) | |
1138 { | |
1139 case(AT_CMD_CPCFU): | |
1140 cmh_query_ind_fnc = qAT_PercentCPCFU; | |
1141 cmd_name = "%CPCFU"; | |
1142 break; | |
1143 | |
1144 case(AT_CMD_CPVWI): | |
1145 cmh_query_ind_fnc = qAT_PercentCPVWI; | |
1146 cmd_name = "%CPVWI"; | |
1147 break; | |
1148 } | |
1149 | |
1150 /* Provides flags for queried lines */ | |
1151 for(i=0; i<8*sizeof(T_CPHS_LINES); i++) | |
1152 { | |
1153 line = CPHS_LINE1 << i; | |
1154 | |
1155 if ((line & queried_lines) EQ 0x00) | |
1156 { | |
1157 /* line has not been queried */ | |
1158 continue; | |
1159 } | |
1160 | |
1161 ret = cmh_query_ind_fnc((T_ACI_CMD_SRC)srcId, &flag_set, line)/*lint -e613*/; | |
1162 | |
1163 if (ret NEQ AT_CMPL) | |
1164 { | |
1165 TRACE_EVENT_P1("query_indicator_flags error: %d", ret); | |
1166 return(map_aci_2_ati_rslt(ret)); | |
1167 } | |
1168 | |
1169 if (flag_set EQ CPHS_FLAG_ACTIVATED) | |
1170 { | |
1171 set_line_bitmask |= line; | |
1172 } | |
1173 } | |
1174 | |
1175 if (set_line_bitmask NEQ CPHS_LINE_NULL) | |
1176 { | |
1177 sprintf(g_sa, "%s: %d,%d", cmd_name, CPHS_FLAG_ACTIVATED, set_line_bitmask); | |
1178 } | |
1179 else | |
1180 { | |
1181 sprintf(g_sa, "%s: %d",cmd_name, CPHS_FLAG_DEACTIVATED); | |
1182 } | |
1183 | |
1184 io_sendMessage((UBYTE)srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1185 | |
1186 return(ATI_CMPL); | |
1187 } | |
1188 | |
1189 | |
1190 /* | |
1191 +--------------------------------------------------------------------+ | |
1192 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1193 | STATE : code ROUTINE : atPercentCPCFU | | |
1194 +--------------------------------------------------------------------+ | |
1195 | |
1196 PURPOSE : %CPVWI: set/clear/query CFU flags | |
1197 */ | |
1198 | |
1199 GLOBAL T_ATI_RSLT setatPercentCPCFU(CHAR *cl, UBYTE srcId) | |
1200 { | |
1201 T_CPHS_LINES i, | |
1202 typed_lines = NOT_PRESENT_16BIT, | |
1203 line; | |
1204 SHORT action; | |
1205 T_ACI_RETURN ret; | |
1206 T_ATI_SRC_PARAMS *src_params = find_element( ati_src_list, srcId, search_ati_src_id); | |
1207 | |
1208 cl = parse(cl,"rr", &action, &typed_lines); | |
1209 if (cl EQ NULL) | |
1210 { | |
1211 cmdCmeError(CME_ERR_OpNotAllow); | |
1212 return(ATI_FAIL); | |
1213 } | |
1214 | |
1215 if (typed_lines EQ NOT_PRESENT_16BIT) | |
1216 { | |
1217 TRACE_EVENT("typed_lines omitted"); | |
1218 | |
1219 typed_lines = 0; | |
1220 | |
1221 /* lines parameter omitted: Provides CFU flags for all lines */ | |
1222 for(i=0;i<8*sizeof(T_CPHS_LINES);i++) | |
1223 { | |
1224 line = CPHS_LINE1 << i; | |
1225 | |
1226 if (cphs_line_makes_sense(line)) | |
1227 { | |
1228 typed_lines |= line; | |
1229 } | |
1230 } | |
1231 } | |
1232 | |
1233 TRACE_EVENT_P2("setatPercentCPCFU action: %d, lines: %d", action, typed_lines); | |
1234 | |
1235 #ifdef FF_ATI_BAT | |
1236 { | |
1237 T_BAT_cmd_send cmd; | |
1238 T_BAT_cmd_set_percent_cpcfu my_bat_set_percent_cpcfu; | |
1239 | |
1240 TRACE_FUNCTION("setatPercentCPCFU() calls bat_send() <=== as APPLICATION"); | |
1241 | |
1242 memset(&my_bat_set_percent_cpcfu, 0, sizeof(my_bat_set_percent_cpcfu)); | |
1243 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CPCFU; | |
1244 cmd.params.ptr_set_percent_cpcfu = &my_bat_set_percent_cpcfu; | |
1245 | |
1246 my_bat_set_percent_cpcfu.mode = action; | |
1247 my_bat_set_percent_cpcfu.line = typed_lines; | |
1248 src_params->curAtCmd = AT_CMD_CPCFU; | |
1249 bat_send(ati_bat_get_client(srcId), &cmd); | |
1250 | |
1251 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
1252 } | |
1253 #else /* OLD FUNCTION BODY */ | |
1254 | |
1255 /******* QUERY ********/ | |
1256 if (action EQ CPHS_QUERY_CFU_FLAG) | |
1257 { | |
1258 return query_indicator_flags(srcId, typed_lines, AT_CMD_CPCFU); | |
1259 } | |
1260 | |
1261 TRACE_FUNCTION("setatPercentCPCFU()"); | |
1262 | |
1263 /******* SETTING ********/ | |
1264 ret = sAT_PercentCPCFU((T_ACI_CMD_SRC)srcId, (UBYTE)action, typed_lines); | |
1265 | |
1266 switch (ret) | |
1267 { | |
1268 case (AT_EXCT): | |
1269 src_params->curAtCmd = AT_CMD_CPCFU; | |
1270 break; | |
1271 | |
1272 case (AT_BUSY): | |
1273 cmdCmeError(CME_ERR_SimBusy); | |
1274 return(ATI_FAIL); | |
1275 | |
1276 case (AT_FAIL): | |
1277 cmdCmeError(CME_ERR_Unknown); | |
1278 return(ATI_FAIL); | |
1279 } | |
1280 | |
1281 return(map_aci_2_ati_rslt(ret)); | |
1282 | |
1283 #endif /* no FF_ATI_BAT*/ | |
1284 } | |
1285 | |
1286 | |
1287 #endif /* CPHS_C */ | |
1288 | |
1289 | |
1290 |