FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/aci/ati_ss.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 : ATI | |
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 : AT Command Interpreter: Supplementary Service related commands. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_SS_C | |
22 #define ATI_SS_C | |
23 | |
24 #undef DUMMY_ATI_STRINGS | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 #include "aci_lst.h" | |
29 #include "aci_cmh.h" | |
30 #include "ati_cmd.h" | |
31 #include "aci_io.h" | |
32 #include "aci_cmd.h" | |
33 #include "l4_tim.h" | |
34 | |
35 #include "aci_mem.h" | |
36 #include "aci_prs.h" | |
37 | |
38 #include "ati_int.h" | |
39 | |
40 #ifdef FF_ATI_BAT | |
41 | |
42 #include "typedefs.h" | |
43 #include "gdd.h" | |
44 #include "bat.h" | |
45 | |
46 #include "ati_bat.h" | |
47 | |
48 #endif /*FF_ATI_BAT*/ | |
49 | |
50 typedef struct | |
51 { | |
52 char *name; | |
53 T_ACI_CPWD_FAC fac; | |
54 } net_fac; | |
55 | |
56 const net_fac fac[] = | |
57 { | |
58 {"SC", CPWD_FAC_Sc}, | |
59 {"AO", CPWD_FAC_Ao}, | |
60 {"OI", CPWD_FAC_Oi}, | |
61 {"OX", CPWD_FAC_Ox}, | |
62 {"AI", CPWD_FAC_Ai}, | |
63 {"IR", CPWD_FAC_Ir}, | |
64 {"AB", CPWD_FAC_Ab}, | |
65 {"AG", CPWD_FAC_Ag}, | |
66 {"AC", CPWD_FAC_Ac}, | |
67 {"FD", CPWD_FAC_Fd}, | |
68 {"PN", CPWD_FAC_Pn}, /* Network personalisation of the ME */ | |
69 {"PU", CPWD_FAC_Pu}, /* Network subset personalisation of the ME */ | |
70 {"PP", CPWD_FAC_Pp}, /* Service provider personalisation of the ME */ | |
71 {"PC", CPWD_FAC_Pc}, /* Corporate personalisation of the ME */ | |
72 {"PS", CPWD_FAC_Ps}, /* SIM personalisation */ | |
73 {"PF", CPWD_FAC_Pf}, /* Personalisation on first inserted SIM */ | |
74 {"AL", CPWD_FAC_Al}, /* ALS settings locked by CHV2 */ | |
75 {"P2", CPWD_FAC_P2}, | |
76 #ifdef SIM_PERS | |
77 {"FC", CLCK_FAC_Fc}, | |
78 {"FM", CLCK_FAC_Fcm}, | |
79 #endif | |
80 {0, CPWD_FAC_NotPresent} | |
81 }; | |
82 | |
83 #ifdef SIM_PERS | |
84 | |
85 typedef struct | |
86 { | |
87 char *name; | |
88 T_SUP_INFO_TYPE sup_info; | |
89 } net_mepd_sup_info; | |
90 | |
91 const net_mepd_sup_info mepd_sup_info[] = | |
92 { | |
93 {"MAX", FCMAX}, | |
94 {"ALE", FCATTEMPTSLEFT}, | |
95 {"RFM", FCRESETFAILMAX}, | |
96 {"RFA", FCRESETFAILATTEMPTSLEFT}, | |
97 {"RSM", FCRESETSUCCESSMAX}, | |
98 {"RSA", FCRESETSUCCESSATTEMPTSLEFT}, | |
99 {"TMF", TIMERFLAG}, | |
100 {"ETF", ETSIFLAG}, | |
101 {"AIF", AIRTELINDFLAG}, | |
102 {0, CMEPD_SUP_INFO_NotPresent} | |
103 }; | |
104 | |
105 #endif | |
106 GLOBAL char dialBuf[MAX_DIAL_LEN]; | |
107 GLOBAL char subBuf[MAX_SUBADDR_LEN]; | |
108 | |
109 /* | |
110 +--------------------------------------------------------------------+ | |
111 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
112 | STATE : code ROUTINE : setatPlusCTFR | | |
113 +--------------------------------------------------------------------+ | |
114 | |
115 PURPOSE : +CTFR command (Call TRansfer, Call Deflection) | |
116 */ | |
117 GLOBAL T_ATI_RSLT setatPlusCTFR (char * cl, UBYTE srcId) | |
118 { | |
119 T_ACI_RETURN ret = AT_FAIL; | |
120 T_ACI_TOA type; | |
121 T_ACI_TOA *p_type; | |
122 T_ACI_TOS satype; | |
123 T_ACI_TOS *p_satype; | |
124 CHAR *subadr = subBuf; | |
125 SHORT toa_oct = 0; | |
126 SHORT tos_oct = 0; | |
127 CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; | |
128 | |
129 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
130 | |
131 src_params->curAtCmd = AT_CMD_CTFR; | |
132 | |
133 /* init */ | |
134 p_type = &type; | |
135 p_satype = &satype; | |
136 memset( numBuf, 0, sizeof(numBuf)); | |
137 memset( subadr, 0, MAX_SUBADDR_LEN); | |
138 | |
139 cl = parse(cl,"srsr",(LONG)MAX_B_SUBSCR_NUM_LEN, numBuf, &toa_oct, | |
140 (LONG)MAX_SUBADDR_LEN, subadr, &tos_oct); | |
141 | |
142 /* Process number parameter (mandatory) */ | |
143 if(!cl OR numBuf[0] EQ '\0') | |
144 { | |
145 /* Number is mandatory. No number parameter => error */ | |
146 cmdCmeError (CME_ERR_OpNotAllow); | |
147 return (ATI_FAIL); | |
148 } | |
149 | |
150 /* Process Type Of Address (optional) */ | |
151 if(toa_oct EQ 0) | |
152 { | |
153 /* Type Of Address not present */ | |
154 p_type = NULL; | |
155 } | |
156 else | |
157 { | |
158 /* Type Of Address present */ | |
159 type = toa_demerge (toa_oct); | |
160 if (type.ton < 0 OR type.npi < 0) | |
161 { | |
162 cmdCmeError (CME_ERR_OpNotAllow); | |
163 return (ATI_FAIL); | |
164 } | |
165 } | |
166 | |
167 /* Process subadr (optional) */ | |
168 if( subadr[0] EQ 0 ) | |
169 { | |
170 /* subadr not present */ | |
171 subadr = NULL; | |
172 } | |
173 | |
174 /* Process Type Of Subaddress (optional) */ | |
175 if(tos_oct EQ 0) | |
176 { | |
177 /* Type Of Subaddress not present */ | |
178 p_satype = NULL; | |
179 } | |
180 else | |
181 { | |
182 satype = tos_demerge (tos_oct); | |
183 if (satype.tos < 0 OR satype.oe < 0) | |
184 { | |
185 cmdCmeError (CME_ERR_OpNotAllow); | |
186 return (ATI_FAIL); | |
187 } | |
188 } | |
189 | |
190 #ifdef FF_ATI_BAT | |
191 { | |
192 T_BAT_cmd_send cmd; | |
193 T_BAT_cmd_set_plus_ctfr my_bat_set_plus_ctfr; | |
194 | |
195 TRACE_FUNCTION("setatPlusCTFR() calls bat_send() <=== as APPLICATION"); | |
196 | |
197 memset(&my_bat_set_plus_ctfr, 0, sizeof(my_bat_set_plus_ctfr)); | |
198 cmd.ctrl_params = BAT_CMD_SET_PLUS_CTFR; | |
199 cmd.params.ptr_set_plus_ctfr = &my_bat_set_plus_ctfr; | |
200 | |
201 my_bat_set_plus_ctfr.c_number = strlen(numBuf); | |
202 memcpy(my_bat_set_plus_ctfr.number, numBuf, my_bat_set_plus_ctfr.c_number); | |
203 my_bat_set_plus_ctfr.type = (S16)p_type; | |
204 my_bat_set_plus_ctfr.v_subaddr = 0; //??? | |
205 my_bat_set_plus_ctfr.c_subaddr = strlen(subadr); | |
206 memcpy(my_bat_set_plus_ctfr.subaddr, subadr, my_bat_set_plus_ctfr.c_subaddr); | |
207 my_bat_set_plus_ctfr.satype = (S16)p_satype; | |
208 | |
209 bat_send(ati_bat_get_client(srcId), &cmd); | |
210 | |
211 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
212 } | |
213 #else /* OLD FUNCTION BODY */ | |
214 | |
215 TRACE_FUNCTION("setatPlusCTFR()"); | |
216 | |
217 ret = sAT_PlusCTFR (srcId, numBuf, p_type, subadr, p_satype); | |
218 | |
219 if (ret NEQ AT_EXCT) | |
220 { | |
221 cmdCmeError(CME_ERR_Unknown); | |
222 } | |
223 return (map_aci_2_ati_rslt(ret)); | |
224 | |
225 #endif /* no FF_ATI_BAT*/ | |
226 } | |
227 | |
228 /* | |
229 +--------------------------------------------------------------------+ | |
230 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
231 | STATE : code ROUTINE : atiSShandleCSSN | | |
232 +--------------------------------------------------------------------+ | |
233 | |
234 PURPOSE : Handles the +CSSN and %CSSN set commands.*/ | |
235 | |
236 GLOBAL T_ATI_RSLT atiSShandleCSSN (char* cl, UBYTE srcId) | |
237 { | |
238 int cssiMode = ati_user_output_cfg[srcId].CSSI_stat, cssuMode = ati_user_output_cfg[srcId].CSSU_stat; | |
239 | |
240 TRACE_FUNCTION("atiSShandleCSSN()"); | |
241 | |
242 if (*cl EQ 0 OR *cl EQ ';') | |
243 { | |
244 cmdCmeError(CME_ERR_OpNotAllow); | |
245 return (ATI_FAIL); | |
246 } | |
247 cl = parse(cl,"dd",&cssiMode,&cssuMode); | |
248 /* A value of 2 for cssiMode is now accepted. This value will only be set by %CSSN */ | |
249 if(!cl OR cssiMode > 2 OR cssiMode < 0 OR | |
250 cssuMode > 1 OR cssuMode < 0 ) | |
251 { | |
252 cmdCmeError(CME_ERR_OpNotAllow); | |
253 return (ATI_FAIL); | |
254 } | |
255 ati_user_output_cfg[srcId].CSSI_stat=(UBYTE)cssiMode; | |
256 ati_user_output_cfg[srcId].CSSU_stat=(UBYTE)cssuMode; | |
257 | |
258 if (*cl NEQ '\0' AND *cl NEQ ';') | |
259 { | |
260 cmdCmeError(CME_ERR_OpNotAllow); | |
261 return (ATI_FAIL); | |
262 } | |
263 return (ATI_CMPL); | |
264 | |
265 } | |
266 | |
267 | |
268 /* | |
269 +--------------------------------------------------------------------+ | |
270 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
271 | STATE : code ROUTINE : atPlusCSSN | | |
272 +--------------------------------------------------------------------+ | |
273 | |
274 PURPOSE : +CSSN command (supplementary service notifications) | |
275 */ | |
276 GLOBAL T_ATI_RSLT setatPlusCSSN (char* cl, UBYTE srcId) | |
277 { | |
278 TRACE_FUNCTION("setatPLusCSSN()"); | |
279 | |
280 /*Check that the range of the first parameter "CSSI mode" is valid (0 or 1).Further parameters are | |
281 checked in the function atiSShandleCSSN()*/ | |
282 if ((*cl EQ '0') || (*cl EQ '1') || (*cl EQ ',')) | |
283 return atiSShandleCSSN(cl,srcId); | |
284 else | |
285 { | |
286 cmdCmeError(CME_ERR_OpNotAllow); | |
287 return (ATI_FAIL); | |
288 } | |
289 } | |
290 | |
291 | |
292 /* | |
293 +--------------------------------------------------------------------+ | |
294 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
295 | STATE : code ROUTINE : atPercentCSSN | | |
296 +--------------------------------------------------------------------+ | |
297 | |
298 PURPOSE : %CSSN command (supplementary service notifications extension) | |
299 */ | |
300 GLOBAL T_ATI_RSLT setatPercentCSSN (char* cl, UBYTE srcId) | |
301 { | |
302 TRACE_FUNCTION("setatPercentCSSN()"); | |
303 | |
304 return atiSShandleCSSN(cl,srcId); | |
305 } | |
306 | |
307 | |
308 | |
309 GLOBAL T_ATI_RSLT queatPlusCSSN (char* cl, UBYTE srcId) | |
310 { | |
311 TRACE_FUNCTION("queatPLusCSSN()"); | |
312 | |
313 resp_disp(srcId, cl,"bb",&ati_user_output_cfg[srcId].CSSI_stat,&ati_user_output_cfg[srcId].CSSU_stat); | |
314 return (ATI_CMPL); | |
315 } | |
316 | |
317 /* | |
318 +--------------------------------------------------------------------+ | |
319 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
320 | STATE : code ROUTINE : queatPercentCSSN | | |
321 +--------------------------------------------------------------------+ | |
322 | |
323 PURPOSE : Handles the %CSSN query command.*/ | |
324 | |
325 | |
326 GLOBAL T_ATI_RSLT queatPercentCSSN (char* cl, UBYTE srcId) | |
327 { | |
328 TRACE_FUNCTION("queatPercentCSSN()"); | |
329 | |
330 resp_disp(srcId, cl,"bb",&ati_user_output_cfg[srcId].CSSI_stat,&ati_user_output_cfg[srcId].CSSU_stat); | |
331 return (ATI_CMPL); | |
332 } | |
333 | |
334 | |
335 | |
336 /* | |
337 +--------------------------------------------------------------------+ | |
338 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
339 | STATE : code ROUTINE : atPlusCCFC | | |
340 +--------------------------------------------------------------------+ | |
341 | |
342 PURPOSE : +CCFC call forwarding | |
343 */ | |
344 | |
345 GLOBAL T_ATI_RSLT setatPlusCCFC(char *cl, UBYTE srcId) | |
346 { | |
347 T_ACI_RETURN ret = AT_FAIL; | |
348 T_ACI_CCFC_RSN reason=CCFC_RSN_NotPresent; | |
349 T_ACI_CCFC_MOD mode=CCFC_MOD_NotPresent; | |
350 T_ACI_TOA type; | |
351 T_ACI_TOA *p_type; | |
352 T_ACI_TOS satype; | |
353 T_ACI_TOS *p_satype; | |
354 T_ACI_CLASS class_type=CLASS_NotPresent; | |
355 CHAR *subadr = subBuf; | |
356 SHORT time=-1; | |
357 SHORT toa_oct=0; | |
358 SHORT tos_oct=0; | |
359 CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; | |
360 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
361 | |
362 /* init */ | |
363 memset( numBuf, 0, sizeof(numBuf)); | |
364 memset( subadr, 0, MAX_SUBADDR_LEN); | |
365 | |
366 TRACE_FUNCTION("setatPLusCCFC()"); | |
367 | |
368 p_type=&type; | |
369 p_satype=&satype; | |
370 | |
371 cl = parse(cl,"ddsrdsrr",&reason,&mode, | |
372 (LONG)MAX_B_SUBSCR_NUM_LEN,numBuf,&toa_oct,&class_type, | |
373 (LONG)MAX_SUBADDR_LEN,subadr,&tos_oct,&time); | |
374 | |
375 if(!cl) | |
376 { | |
377 cmdCmeError(CME_ERR_OpNotAllow); | |
378 return (ATI_FAIL); | |
379 } | |
380 if (mode EQ 2) /*query mode*/ | |
381 { | |
382 #ifdef FF_ATI_BAT | |
383 { | |
384 T_BAT_cmd_send cmd; | |
385 T_BAT_cmd_set_plus_ccfc my_bat_set_plus_ccfc = {0}; | |
386 | |
387 TRACE_FUNCTION("setatPlusCCFC() {Query mode=2} calls bat_send() <=== as APPLICATION"); | |
388 | |
389 cmd.ctrl_params = BAT_CMD_SET_PLUS_CCFC; | |
390 cmd.params.ptr_set_plus_ccfc = &my_bat_set_plus_ccfc; | |
391 | |
392 my_bat_set_plus_ccfc.reason = (T_BAT_plus_ccfc_reason)reason; | |
393 my_bat_set_plus_ccfc.mode = (T_BAT_plus_ccfc_mode)mode; | |
394 my_bat_set_plus_ccfc.bearer_class = (T_BAT_plus_ccfc_bearer_class)class_type; | |
395 src_params->curAtCmd = AT_CMD_CCFC; | |
396 | |
397 bat_send(ati_bat_get_client(srcId), &cmd); | |
398 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
399 } | |
400 #else /* no FF_ATI_BAT */ | |
401 ret = qAT_PlusCCFC(srcId,reason,class_type); | |
402 switch (ret) | |
403 { | |
404 case AT_EXCT: | |
405 { | |
406 src_params->curAtCmd = AT_CMD_CCFC; | |
407 return (ATI_EXCT); | |
408 } | |
409 case AT_BUSY: | |
410 { | |
411 TRACE_EVENT("setatPLusCCFC(): qAT_PlusCCFC returns BUSY"); | |
412 return (ATI_BUSY); | |
413 } | |
414 case AT_FAIL: | |
415 { | |
416 TRACE_EVENT("setatPLusCCFC(): qAT_PlusCCFC returns FAIL"); | |
417 cmdCmeError(CME_ERR_Unknown); /* Extended error returned by qAT_PlusCCFC */ | |
418 return (ATI_FAIL); | |
419 } | |
420 default: | |
421 { | |
422 cmdCmeError(CME_ERR_Unknown); | |
423 return (ATI_FAIL); | |
424 } | |
425 } | |
426 #endif /* no FF_ATI_BAT */ | |
427 } | |
428 else /*set mode*/ | |
429 { | |
430 if( subadr[0] EQ 0 ) | |
431 { | |
432 /* subadr has been omitted in command */ | |
433 subadr = NULL; | |
434 } | |
435 | |
436 if(toa_oct EQ 0) | |
437 p_type=NULL; | |
438 else | |
439 { | |
440 type=toa_demerge(toa_oct); | |
441 if (type.ton < 0 OR type.npi < 0) | |
442 { | |
443 cmdCmeError(CME_ERR_OpNotAllow); | |
444 return (ATI_FAIL); | |
445 } | |
446 } | |
447 if(tos_oct EQ 0) | |
448 p_satype=NULL; | |
449 else | |
450 { | |
451 satype=tos_demerge(tos_oct); | |
452 if(satype.tos < 0 OR satype.oe < 0) | |
453 { | |
454 cmdCmeError(CME_ERR_OpNotAllow); | |
455 return (ATI_FAIL); | |
456 } | |
457 } | |
458 #ifdef FF_ATI_BAT | |
459 { | |
460 T_BAT_cmd_send cmd; | |
461 T_BAT_cmd_set_plus_ccfc my_bat_set_plus_ccfc = {0}; | |
462 | |
463 TRACE_FUNCTION("setatPlusCCFC() calls bat_send() <=== as APPLICATION"); | |
464 | |
465 cmd.ctrl_params = BAT_CMD_SET_PLUS_CCFC; | |
466 cmd.params.ptr_set_plus_ccfc = &my_bat_set_plus_ccfc; | |
467 | |
468 my_bat_set_plus_ccfc.reason = (T_BAT_plus_ccfc_reason)reason; | |
469 my_bat_set_plus_ccfc.mode = (T_BAT_plus_ccfc_mode)mode; | |
470 | |
471 /* check for number string and store for BAT send */ | |
472 if (my_bat_set_plus_ccfc.c_number = strlen(numBuf)) | |
473 { | |
474 my_bat_set_plus_ccfc.v_number = TRUE; | |
475 memcpy(my_bat_set_plus_ccfc.number, numBuf, my_bat_set_plus_ccfc.c_number); | |
476 } | |
477 | |
478 my_bat_set_plus_ccfc.type = (S16)toa_oct; | |
479 | |
480 /* check for subaddr string and store for BAT send */ | |
481 if (subadr NEQ NULL && | |
482 (my_bat_set_plus_ccfc.c_subaddr = strlen(subadr))) | |
483 { | |
484 my_bat_set_plus_ccfc.v_subaddr = TRUE; | |
485 memcpy(my_bat_set_plus_ccfc.subaddr, subadr, my_bat_set_plus_ccfc.c_subaddr); | |
486 } | |
487 | |
488 my_bat_set_plus_ccfc.satype = (S16)tos_oct; | |
489 my_bat_set_plus_ccfc.bearer_class = (T_BAT_plus_ccfc_bearer_class)class_type; | |
490 my_bat_set_plus_ccfc.time = (T_BAT_plus_ccfc_time)time; | |
491 | |
492 src_params->curAtCmd = AT_CMD_CCFC; | |
493 | |
494 bat_send(ati_bat_get_client(srcId), &cmd); | |
495 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
496 } | |
497 #else /* no FF_ATI_BAT */ | |
498 if( numBuf[0] EQ '\0' ) | |
499 { | |
500 /* number has been omitted in command */ | |
501 ret = sAT_PlusCCFC(srcId,reason,mode,NULL,p_type,class_type,subadr,p_satype,time); | |
502 } | |
503 else | |
504 { | |
505 ret = sAT_PlusCCFC(srcId,reason,mode,numBuf,p_type,class_type,subadr,p_satype,time); | |
506 } | |
507 if (ret EQ AT_EXCT) | |
508 { | |
509 src_params->curAtCmd = AT_CMD_CCFC; | |
510 } | |
511 else | |
512 { | |
513 cmdCmeError(CME_ERR_Unknown); | |
514 } | |
515 #endif /* no FF_ATI_BAT */ | |
516 } | |
517 return (map_aci_2_ati_rslt(ret)); | |
518 } | |
519 | |
520 /* | |
521 +--------------------------------------------------------------------+ | |
522 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
523 | STATE : code ROUTINE : atPlusCLCK | | |
524 +--------------------------------------------------------------------+ | |
525 | |
526 PURPOSE : +CLCK command (Select facility lock settings) | |
527 */ | |
528 | |
529 GLOBAL T_ATI_RSLT setatPlusCLCK(char *cl, UBYTE srcId) | |
530 { | |
531 T_ACI_RETURN ret = AT_FAIL; | |
532 T_ACI_CLCK_FAC fac_num = CLCK_FAC_NotPresent; | |
533 T_ACI_CLCK_MOD mod = CLCK_MOD_NotPresent; | |
534 T_ACI_CLASS class_type = CLASS_NotPresent; | |
535 char passwd[MAX_PWD_LENGTH] = {0}; | |
536 char fac_str[3] = {0,0,0}; | |
537 USHORT i; | |
538 | |
539 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
540 | |
541 src_params->curAtCmd = AT_CMD_CLCK; | |
542 TRACE_FUNCTION("setatPLusCLCK() "); | |
543 | |
544 cl = parse(cl, "sdnd", (LONG)3, fac_str, &mod, (LONG)MAX_PWD_LENGTH, passwd, &class_type); | |
545 | |
546 if (!cl OR *fac_str EQ 0) | |
547 { | |
548 cmdCmeError(CME_ERR_OpNotAllow); | |
549 return (ATI_FAIL); | |
550 } | |
551 strcpy(fac_str, strupper(fac_str)); | |
552 for (i=0;fac[i].name != 0; i++) | |
553 { | |
554 if (strcmp(fac[i].name, fac_str) EQ 0 ) | |
555 { | |
556 fac_num = fac[i].fac; /*translates facility string in facility number */ | |
557 break; | |
558 } | |
559 } | |
560 if (fac_num EQ CLCK_FAC_NotPresent) /* facility non existent*/ | |
561 { | |
562 cmdCmeError(CME_ERR_OpNotAllow); | |
563 return (ATI_FAIL); | |
564 } | |
565 | |
566 #ifdef FF_ATI_BAT | |
567 { | |
568 T_BAT_cmd_send cmd; | |
569 T_BAT_cmd_set_plus_clck my_bat_set_plus_clck; | |
570 | |
571 TRACE_FUNCTION("setatPLusCLCK() calls bat_send() <=== as APPLICATION"); | |
572 | |
573 memset(&my_bat_set_plus_clck, 0, sizeof(my_bat_set_plus_clck)); | |
574 cmd.ctrl_params = BAT_CMD_SET_PLUS_CLCK; | |
575 cmd.params.ptr_set_plus_clck = &my_bat_set_plus_clck; | |
576 | |
577 my_bat_set_plus_clck.fac = fac_num; | |
578 my_bat_set_plus_clck.mode = mod; | |
579 if(mod NEQ CLCK_MODE_QUERY) /*query mode*/ | |
580 { | |
581 my_bat_set_plus_clck.v_passwd = 1; | |
582 my_bat_set_plus_clck.c_passwd = strlen(passwd); | |
583 memcpy(my_bat_set_plus_clck.passwd, passwd, my_bat_set_plus_clck.c_passwd); | |
584 } | |
585 | |
586 my_bat_set_plus_clck.bearer_class = class_type; | |
587 | |
588 bat_send(ati_bat_get_client(srcId), &cmd); | |
589 | |
590 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
591 } | |
592 #else /* OLD FUNCTION BODY */ | |
593 { | |
594 T_ACI_CLSSTAT clsStat; | |
595 SHORT pos; | |
596 | |
597 TRACE_FUNCTION("setatPLusCLCK()"); | |
598 | |
599 if (mod EQ CLCK_MOD_NotPresent) /* mode non existent*/ | |
600 { | |
601 cmdCmeError(CME_ERR_OpNotAllow); | |
602 return(ATI_FAIL); | |
603 } | |
604 | |
605 if (mod EQ CLCK_MODE_QUERY) /*query mode*/ | |
606 { | |
607 ret = qAT_PlusCLCK(srcId, fac_num, class_type, &clsStat); | |
608 if(ret EQ AT_CMPL) | |
609 { | |
610 | |
611 pos = sprintf(g_sa,"+CLCK: "); | |
612 | |
613 if (clsStat.status NEQ STATUS_NotPresent) | |
614 { | |
615 pos += sprintf(g_sa+pos,"%d,",clsStat.status); | |
616 } | |
617 else | |
618 { | |
619 pos += sprintf(g_sa+pos,","); | |
620 } | |
621 if (clsStat.class_type NEQ CLASS_NotPresent) | |
622 { | |
623 pos += sprintf(g_sa+pos,"%d,",clsStat.class_type); | |
624 } | |
625 | |
626 ci_remTrailCom(g_sa, pos); | |
627 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
628 return (ATI_CMPL); | |
629 } | |
630 } | |
631 else /*set mode*/ | |
632 { | |
633 ret = sAT_PlusCLCK(srcId, fac_num, mod, passwd, class_type); | |
634 } | |
635 | |
636 switch(ret) | |
637 { | |
638 case(AT_EXCT): | |
639 break; | |
640 | |
641 case(AT_BUSY): | |
642 cmdCmeError(CME_ERR_Unknown); | |
643 TRACE_EVENT("ME is busy"); | |
644 break; | |
645 | |
646 case(AT_FAIL): | |
647 cmdCmeError(CME_ERR_Unknown); | |
648 break; | |
649 } | |
650 return (map_aci_2_ati_rslt(ret)); | |
651 } | |
652 #endif /* no FF_ATI_BAT*/ | |
653 } | |
654 | |
655 /* | |
656 +--------------------------------------------------------------------+ | |
657 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
658 | STATE : code ROUTINE : atPlusCPWD | | |
659 +--------------------------------------------------------------------+ | |
660 | |
661 PURPOSE : +CPWD command (changes password) | |
662 */ | |
663 | |
664 GLOBAL T_ATI_RSLT setatPlusCPWD(char *cl, UBYTE srcId) | |
665 { | |
666 T_ACI_RETURN ret = AT_FAIL; | |
667 T_ACI_CPWD_FAC fac_num = CPWD_FAC_NotPresent; | |
668 CHAR oldpwd[MAX_PWD_LENGTH]={0}; | |
669 CHAR newpwd[MAX_PWD_LENGTH]={0}; | |
670 CHAR fac_str[3]={0}; | |
671 T_ACI_CPWD_LST cpwdLst={0}; | |
672 USHORT i; | |
673 | |
674 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
675 | |
676 src_params->curAtCmd = AT_CMD_CPWD; | |
677 | |
678 cl = parse(cl, "snn", (LONG)3, fac_str, (LONG)MAX_PWD_LENGTH, oldpwd, (LONG)MAX_PWD_LENGTH, newpwd); | |
679 strcpy(fac_str, (char *)strupper(fac_str)); | |
680 if(!cl OR *fac_str EQ 0 OR *oldpwd EQ 0 OR *newpwd EQ 0) | |
681 { | |
682 cmdCmeError(CME_ERR_OpNotAllow); | |
683 return (ATI_FAIL); | |
684 } | |
685 for (i = 0; fac[i].name NEQ 0; i++) | |
686 { | |
687 if (strcmp(fac[i].name,fac_str) EQ 0 ) | |
688 { | |
689 fac_num=fac[i].fac; /*translates facility string in facility number */ | |
690 break; | |
691 } | |
692 } | |
693 if (fac[i].name EQ 0) /* facility non existent*/ | |
694 { | |
695 cmdCmeError(CME_ERR_OpNotAllow); | |
696 return (ATI_FAIL); | |
697 } | |
698 #ifdef FF_ATI_BAT | |
699 { | |
700 T_BAT_cmd_send cmd; | |
701 T_BAT_cmd_set_plus_cpwd my_bat_set_plus_cpwd; | |
702 | |
703 TRACE_FUNCTION("setatPLusCPWD() calls bat_send() <=== as APPLICATION"); | |
704 | |
705 memset(&my_bat_set_plus_cpwd, 0, sizeof(my_bat_set_plus_cpwd)); | |
706 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPWD; | |
707 cmd.params.ptr_set_plus_cpwd = &my_bat_set_plus_cpwd; | |
708 | |
709 my_bat_set_plus_cpwd.fac = fac_num; | |
710 my_bat_set_plus_cpwd.c_oldpwd = strlen(oldpwd); | |
711 memcpy(my_bat_set_plus_cpwd.oldpwd, oldpwd, my_bat_set_plus_cpwd.c_oldpwd); | |
712 my_bat_set_plus_cpwd.c_newpwd = strlen(newpwd); | |
713 memcpy(my_bat_set_plus_cpwd.newpwd, newpwd, my_bat_set_plus_cpwd.c_newpwd); | |
714 | |
715 bat_send(ati_bat_get_client(srcId), &cmd); | |
716 | |
717 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
718 } | |
719 #else /* OLD FUNCTION BODY */ | |
720 | |
721 TRACE_FUNCTION("setatPLusCPWD()"); | |
722 | |
723 ret = sAT_PlusCPWD(srcId, fac_num, oldpwd, newpwd); | |
724 if (ret EQ AT_CMPL) | |
725 { | |
726 return (ATI_CMPL); | |
727 } | |
728 else if (ret EQ AT_EXCT) | |
729 { | |
730 src_params->curAtCmd = AT_CMD_CPWD; | |
731 } | |
732 else | |
733 { | |
734 cmdCmeError(CME_ERR_Unknown); | |
735 } | |
736 return (map_aci_2_ati_rslt(ret)); | |
737 | |
738 #endif /* no FF_ATI_BAT*/ | |
739 } | |
740 | |
741 /* | |
742 +--------------------------------------------------------------------+ | |
743 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
744 | STATE : code ROUTINE : atPlusCUSD | | |
745 +--------------------------------------------------------------------+ | |
746 | |
747 PURPOSE : +CUSD Unstructured supplementary data | |
748 */ | |
749 GLOBAL T_ATI_RSLT setatPlusCUSD(char *cl, UBYTE srcId) | |
750 { | |
751 T_ACI_RETURN ret = AT_FAIL; | |
752 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
753 CHAR ussd [MAX_USSD_LEN] = {0x00}; | |
754 USHORT lenUssd = 0; | |
755 | |
756 #ifndef FF_ATI_BAT | |
757 T_ACI_USSD_DATA cvtdUssd; | |
758 T_ACI_USSD_DATA* p_cvtdUssd = NULL; | |
759 USHORT lenCvtdUssd = 0; | |
760 #endif | |
761 | |
762 SHORT dcs = ACI_NumParmNotPresent, | |
763 stat = ACI_NumParmNotPresent; | |
764 BOOL status_changed = FALSE; | |
765 | |
766 TRACE_FUNCTION("setatPlusCUSD()"); | |
767 | |
768 cl = parse(cl,"rzr", | |
769 &stat, | |
770 (LONG)MAX_USSD_LEN, | |
771 strlen(cl), | |
772 cl, | |
773 &lenUssd, | |
774 ussd, | |
775 &dcs); | |
776 | |
777 if(cl EQ NULL OR | |
778 stat > 2) | |
779 { | |
780 cmdCmeError(CME_ERR_OpNotAllow); | |
781 return (ATI_FAIL); | |
782 } | |
783 | |
784 if(stat EQ 2) | |
785 { | |
786 /* CANCEL ONGOING USSD OPERATION */ | |
787 ret = sAT_end_ussd(srcId); | |
788 } | |
789 else | |
790 { | |
791 if (dcs EQ 17 AND ati_user_output_cfg[srcId].cscsChset NEQ CSCS_CHSET_Ucs2) | |
792 { | |
793 cmdCmeError(CME_ERR_OpNotAllow); /* it makes no sense if TE<->MS is GSM7 but we talk to the Network | |
794 in UCS2 since afterwards we need to convert it back to GSM7 and | |
795 we will loose some characters */ | |
796 return (ATI_FAIL); | |
797 } | |
798 | |
799 if (stat NEQ ACI_NumParmNotPresent ) | |
800 { | |
801 /* SET CUSD Presentation Flag only for values stat 0 and 1 */ | |
802 ati_user_output_cfg[srcId].CUSD_stat = (UBYTE)stat; | |
803 status_changed = TRUE; | |
804 } | |
805 | |
806 if (dcs EQ ACI_NumParmNotPresent ) | |
807 { | |
808 /* GSM 03.38 [25] Cell Broadcast Data Coding Scheme in integer format (default 0) */ | |
809 dcs = 0; | |
810 } | |
811 | |
812 srcId_cb = srcId; | |
813 | |
814 #ifdef FF_ATI_BAT | |
815 | |
816 { | |
817 T_BAT_cmd_send cmd; | |
818 T_BAT_cmd_set_plus_cusd cusd; | |
819 | |
820 cmd.ctrl_params=BAT_CMD_SET_PLUS_CUSD; | |
821 cmd.params.ptr_set_plus_cusd=&cusd; | |
822 | |
823 /* | |
824 * This is the only possible value for 'n', as the other is | |
825 * dealt with further up this function. | |
826 */ | |
827 cusd.n=BAT_CUSD_N_NOT_PRESENT; | |
828 | |
829 /* | |
830 * Simplest thing to do is copy in as much data as the BAT | |
831 * structure can handle. If there is too much we won't | |
832 * overwrite memory. | |
833 */ | |
834 memcpy(cusd.str,ussd,BAT_MAX_USSD_LEN); | |
835 | |
836 /* | |
837 * Set the length. If there is too much data it will | |
838 * effectively be truncated. | |
839 */ | |
840 cusd.c_str=(U8)((lenUssd>BAT_MAX_USSD_LEN) ? BAT_MAX_USSD_LEN:lenUssd); | |
841 cusd.v_str=TRUE; | |
842 | |
843 cusd.dcs=(S16)dcs; | |
844 | |
845 bat_send(ati_bat_get_client(srcId), &cmd); | |
846 | |
847 src_params->curAtCmd=AT_CMD_CUSD; | |
848 | |
849 return(ATI_EXCT); | |
850 } | |
851 | |
852 #else /* no FF_ATI_BAT */ | |
853 | |
854 utl_ussdDtaFromTe ((UBYTE*)ussd, | |
855 lenUssd, | |
856 (UBYTE*)cvtdUssd.data, | |
857 &lenCvtdUssd, | |
858 (UBYTE)dcs); | |
859 | |
860 cvtdUssd.len = (UBYTE)lenCvtdUssd; | |
861 | |
862 if (cvtdUssd.len NEQ 0) | |
863 { | |
864 p_cvtdUssd=&cvtdUssd; | |
865 } | |
866 | |
867 if( p_cvtdUssd NEQ NULL ) | |
868 { | |
869 ret = sAT_PlusCUSD(srcId, p_cvtdUssd, dcs); | |
870 } | |
871 else | |
872 { | |
873 if (lenUssd NEQ 0) | |
874 { | |
875 cmdCmeError(CME_ERR_Unknown); | |
876 return (ATI_FAIL); | |
877 } | |
878 } | |
879 #endif /* no FF_ATI_BAT */ | |
880 | |
881 } | |
882 | |
883 if (ret EQ AT_CMPL) | |
884 { | |
885 return (ATI_CMPL); | |
886 } | |
887 else if (ret EQ AT_EXCT) | |
888 { | |
889 src_params->curAtCmd = AT_CMD_CUSD; | |
890 return (ATI_EXCT); | |
891 } | |
892 else if(status_changed) | |
893 { | |
894 return (ATI_CMPL); | |
895 } | |
896 | |
897 cmdCmeError(CME_ERR_Unknown); | |
898 return (ATI_FAIL); | |
899 } | |
900 | |
901 GLOBAL T_ATI_RSLT queatPlusCUSD(char *cl, UBYTE srcId) | |
902 { | |
903 TRACE_FUNCTION("queatPlusCUSD()"); | |
904 | |
905 resp_disp(srcId, cl,"b",&ati_user_output_cfg[srcId].CUSD_stat); | |
906 return (ATI_CMPL); | |
907 } | |
908 | |
909 | |
910 /* | |
911 +--------------------------------------------------------------------+ | |
912 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
913 | STATE : code ROUTINE : atPercentCSCN | | |
914 +--------------------------------------------------------------------+ | |
915 | |
916 PURPOSE : %CSCN - network service change notifications | |
917 */ | |
918 GLOBAL T_ATI_RSLT setatPercentCSCN (char *cl, UBYTE srcId) | |
919 { | |
920 T_ACI_SS_CSCN_MOD_STATE ss_switch = SS_CSCN_MOD_STATE_INVALID; | |
921 T_ACI_SS_CSCN_MOD_DIRECTION ss_direction = SS_CSCN_MOD_DIR_INVALID; | |
922 T_ACI_CC_CSCN_MOD_STATE cc_switch = CC_CSCN_MOD_STATE_INVALID; | |
923 T_ACI_CC_CSCN_MOD_DIRECTION cc_direction = CC_CSCN_MOD_DIR_INVALID; | |
924 | |
925 TRACE_FUNCTION("setatPercentCSCN()"); | |
926 | |
927 if((cl EQ NULL) OR (*cl EQ '\0')) /* No parameter passed ?? */ | |
928 { | |
929 cmdCmeError(CME_ERR_OpNotAllow); | |
930 return (ATI_FAIL); | |
931 } | |
932 | |
933 cl = parse(cl,"dddd", &ss_switch, &ss_direction, &cc_switch, &cc_direction); | |
934 | |
935 /* valid parameter ?? */ | |
936 if( (ss_switch >= SS_CSCN_MOD_STATE_MAX) OR | |
937 (ss_direction >= SS_CSCN_MOD_DIR_MAX) OR | |
938 (cc_switch >= CC_CSCN_MOD_STATE_MAX) OR | |
939 (cc_direction >= CC_CSCN_MOD_DIR_MAX) ) | |
940 { | |
941 cmdCmeError(CME_ERR_OpNotAllow); | |
942 return (ATI_FAIL); | |
943 } | |
944 | |
945 if (sAT_PercentCSCN( srcId, ss_switch, ss_direction, cc_switch, cc_direction ) NEQ AT_CMPL) | |
946 return (ATI_FAIL); | |
947 | |
948 return (ATI_CMPL); | |
949 } | |
950 | |
951 /* ------------------------------------------------------------------------- */ | |
952 GLOBAL T_ATI_RSLT queatPercentCSCN (char* cl, UBYTE srcId) | |
953 /* ------------------------------------------------------------------------- */ | |
954 { | |
955 T_ACI_SS_CSCN_MOD_STATE ss_switch; | |
956 T_ACI_SS_CSCN_MOD_DIRECTION ss_direction; | |
957 T_ACI_CC_CSCN_MOD_STATE cc_switch; | |
958 T_ACI_CC_CSCN_MOD_DIRECTION cc_direction; | |
959 | |
960 TRACE_FUNCTION("queatPercentCSCN()"); | |
961 | |
962 if (qAT_PercentCSCN( srcId, &ss_switch, &ss_direction, &cc_switch, &cc_direction ) NEQ AT_CMPL) | |
963 return (ATI_FAIL); | |
964 | |
965 if( ss_switch EQ SS_CSCN_MOD_STATE_INVALID ) ss_switch = SS_CSCN_MOD_STATE_OFF; | |
966 if( ss_direction EQ SS_CSCN_MOD_DIR_INVALID ) ss_direction = SS_CSCN_MOD_DIR_IN; | |
967 if( cc_switch EQ CC_CSCN_MOD_STATE_INVALID ) cc_switch = CC_CSCN_MOD_STATE_OFF; | |
968 if( cc_direction EQ CC_CSCN_MOD_DIR_INVALID ) cc_direction = CC_CSCN_MOD_DIR_IN; | |
969 | |
970 resp_disp(srcId, cl, "ssss", &ss_switch, &ss_direction, &cc_switch, &cc_direction); | |
971 return (ATI_CMPL); | |
972 } | |
973 | |
974 /* | |
975 +--------------------------------------------------------------------+ | |
976 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
977 | STATE : code ROUTINE : setatPercentCUSDR | | |
978 +--------------------------------------------------------------------+ | |
979 | |
980 PURPOSE : %CUSDR - Extended response for n/w initiated USSD. | |
981 */ | |
982 GLOBAL T_ATI_RSLT setatPercentCUSDR(char* cl, UBYTE srcId) | |
983 { | |
984 T_ACI_CUSDR_RES response; | |
985 T_ACI_RETURN ret = AT_FAIL; | |
986 | |
987 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
988 | |
989 TRACE_FUNCTION("setatPercentCUSDR()"); | |
990 | |
991 cl = parse(cl,"d",&response); | |
992 | |
993 if(!cl) | |
994 { | |
995 cmdCmeError(CME_ERR_OpNotAllow); | |
996 return (ATI_FAIL); | |
997 } | |
998 | |
999 ret = sAT_PercentCUSDR(srcId, response); | |
1000 | |
1001 return (map_aci_2_ati_rslt(ret)); | |
1002 | |
1003 } | |
1004 | |
1005 | |
1006 | |
1007 #ifdef SIM_PERS | |
1008 | |
1009 /* ----------Added on 11/03/2005--------------------*/ | |
1010 /*-------------For %MEPD AT comand----------------- */ | |
1011 /* ------------------------------------------------------------------------- */ | |
1012 /* | |
1013 +------------------------------------------------------------------------------ | |
1014 | Function : setatPercentMEPD | |
1015 +------------------------------------------------------------------------------ | |
1016 | Description : For %MEPD= AT comand | |
1017 | | |
1018 | Parameters :char* cl | |
1019 | UBYTE srcId | |
1020 | | |
1021 | Return : ATI_FAIL - at command failed | |
1022 | ATI_FAIL_NO_OUTPUT - at command failed with no output | |
1023 | ATI_BUSY - ATI busy | |
1024 | ATI_EXCT - ATI is executing the command | |
1025 | ATI_CMPL - at command successfully executed | |
1026 | ATI_CMPL_NO_OUTPUT - at command successfully executed with no output | |
1027 | | |
1028 +------------------------------------------------------------------------------ | |
1029 */ | |
1030 GLOBAL T_ATI_RSLT setatPercentMEPD (char* cl, UBYTE srcId) | |
1031 /* ------------------------------------------------------------------------- */ | |
1032 { | |
1033 T_ACI_RETURN ret = AT_FAIL; | |
1034 char sup_info_str[4] = {0,0,0,0}; | |
1035 T_SUP_INFO_TYPE sup_info_num = CMEPD_SUP_INFO_NotPresent; | |
1036 T_SUP_INFO sup_info; /*return Value of MEPD CFG Data */ | |
1037 USHORT i; | |
1038 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1039 | |
1040 src_params->curAtCmd = AT_CMD_MEPD; | |
1041 TRACE_FUNCTION("setatPercentMEPD()"); | |
1042 | |
1043 /*input functionality*/ | |
1044 cl = parse (cl,"s",(LONG)4, sup_info_str); | |
1045 | |
1046 if ( !cl OR (sup_info_str[0] EQ 0)) | |
1047 { | |
1048 cmdCmeError (CME_ERR_OpNotAllow); | |
1049 return (ATI_FAIL); | |
1050 } | |
1051 | |
1052 strcpy(sup_info_str, strupper(sup_info_str)); | |
1053 for (i=0;mepd_sup_info[i].name != 0; i++) | |
1054 { | |
1055 if (strcmp(mepd_sup_info[i].name, sup_info_str) EQ 0 ) | |
1056 { | |
1057 sup_info_num = mepd_sup_info[i].sup_info; /*translates facility string in facility number */ | |
1058 break; | |
1059 } | |
1060 } | |
1061 if (sup_info_num EQ CMEPD_SUP_INFO_NotPresent) /* facility non existent*/ | |
1062 { | |
1063 cmdCmeError(CME_ERR_OpNotAllow); | |
1064 return (ATI_FAIL); | |
1065 } | |
1066 | |
1067 sup_info.infoType=sup_info_num; | |
1068 ret = qAT_PercentMEPD(srcId, &sup_info); | |
1069 if (ret EQ AT_CMPL) | |
1070 { | |
1071 resp_disp(srcId,cl,"b", &sup_info.datavalue); | |
1072 return (ATI_CMPL); | |
1073 } | |
1074 else | |
1075 { | |
1076 cmdCmeError(CME_ERR_OpNotAllow); | |
1077 return (ATI_FAIL); | |
1078 } | |
1079 | |
1080 } | |
1081 | |
1082 #endif //SIM_PERS | |
1083 #endif /* ATI_SS_C */ |