comparison g23m/condat/ms/src/aci/aci_bat_sms.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 "ati_cmd.h"
25 #include "aci_cmd.h"
26 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */
27 #include "aci_bat.h"
28 #include "psa.h"
29 #include "psa_sms.h"
30 #include "cmh.h"
31
32 EXTERN T_SMS_SHRD_PRM smsShrdPrm;
33
34 EXTERN SHORT cmhSMS_getPrfRge ( void );
35
36 EXTERN T_ATI_RSLT txt_rdmode_to_smsrdmode(char *txt_rdmode);
37
38 LOCAL SHORT length_of_pdu_message = 0;
39 LOCAL UBYTE pdu_error_detected = FALSE;
40 /*
41 +--------------------------------------------------------------------+
42 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
43 | STATE : code ROUTINE : sBAT_PlusCSMS |
44 +--------------------------------------------------------------------+
45
46 PURPOSE :
47 */
48 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
49 T_BAT_cmd_send *cmd)
50 {
51 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
52
53 TRACE_FUNCTION ("sBAT_PlusCSMS()");
54
55 ret = sAT_PlusCSMS(src_infos_psi->srcId,cmd->params.ptr_set_plus_csms->service);
56 if (ret EQ AT_FAIL)
57 {
58 /* within sAT_PlusCSMS() the appropriate error value has been set */
59 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
60 return (ACI_BAT_FAIL);
61 }
62 return ret;
63 }
64
65 /*
66 +--------------------------------------------------------------------+
67 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
68 | STATE : code ROUTINE : qBAT_PlusCSMS |
69 +--------------------------------------------------------------------+
70
71 PURPOSE :
72 */
73 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
74 T_BAT_cmd_send *cmd)
75 {
76 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
77 T_ACI_CSMS_SERV service;
78 T_ACI_CSMS_SUPP mt;
79 T_ACI_CSMS_SUPP mo;
80 T_ACI_CSMS_SUPP bm;
81 T_BAT_cmd_response resp;
82 T_BAT_res_que_plus_csms que_csms_buffer;
83
84 TRACE_FUNCTION ("qBAT_PlusCSMS()");
85
86 resp.ctrl_response = BAT_RES_QUE_PLUS_CSMS;
87 resp.response.ptr_que_plus_csms = &que_csms_buffer;
88 ret = qAT_PlusCSMS(src_infos_psi->srcId,&service,&mt,&mo,&bm);
89 if (ret EQ ATI_CMPL)
90 {
91 resp.response.ptr_que_plus_csms->service = service;
92 resp.response.ptr_que_plus_csms->mt = mt;
93 resp.response.ptr_que_plus_csms->mo = mo;
94 resp.response.ptr_que_plus_csms->bm = bm;
95 aci_bat_send(src_infos_psi,&resp);
96 return (ACI_BAT_CMPL);
97 }
98 if (ret EQ ATI_EXCT)
99 {
100 return (ACI_BAT_EXCT);
101 }
102 else
103 {
104 /* within qAT_PlusCSMS() the appropriate error value has been set */
105 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
106 return ACI_BAT_FAIL;
107 }
108 }
109
110 /*
111 +--------------------------------------------------------------------+
112 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
113 | STATE : code ROUTINE : sBAT_PlusCPMS |
114 +--------------------------------------------------------------------+
115
116 PURPOSE :
117 */
118 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
119 T_BAT_cmd_send *cmd)
120 {
121 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
122 T_BAT_plus_cpms_mem1 mem1;
123 T_BAT_plus_cpms_mem2 mem2 = BAT_CPMS_MEM2_NOT_PRESENT;
124 T_BAT_plus_cpms_mem3 mem3 = BAT_CPMS_MEM2_NOT_PRESENT;
125
126 TRACE_FUNCTION ("sBAT_PlusCPMS()");
127
128 mem1 = cmd->params.ptr_set_plus_cpms->mem1;
129 mem2 = cmd->params.ptr_set_plus_cpms->mem2;
130 mem3 = cmd->params.ptr_set_plus_cpms->mem3;
131 ret = sAT_PlusCPMS ( src_infos_psi->srcId,mem1, mem2, mem3);
132 if (ret NEQ ACI_BAT_CMPL)
133 {
134 /* within sAT_PlusCPMS() the appropriate error value has been set */
135 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
136 return (ACI_BAT_FAIL);
137 }
138 return ret;
139 }
140
141 /*
142 +--------------------------------------------------------------------+
143 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
144 | STATE : code ROUTINE : qBAT_PlusCPMS |
145 +--------------------------------------------------------------------+
146
147 PURPOSE :
148 */
149 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCPMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
150 T_BAT_cmd_send *cmd)
151 {
152 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
153
154 TRACE_FUNCTION ("qBAT_PlusCPMS()");
155 ret = qAT_PlusCPMS ( src_infos_psi->srcId );
156 /* ..............RECEHECK............. */
157 /* Needs to be looked into. The cmd params are not filled thru this function call
158 see implementation of qAT_plusCPMS, Needs to be rewritten */
159 if ( ret EQ AT_CMPL )
160 {
161 return (ACI_BAT_CMPL);
162 }
163 else if ( ret EQ AT_EXCT )
164 {
165 return (ACI_BAT_EXCT);
166 }
167 else
168 {
169 /* within qAT_PlusCPMS() the appropriate error value has been set */
170 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
171 return (ACI_BAT_FAIL);
172 }
173 }
174
175 /*
176 +--------------------------------------------------------------------+
177 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
178 | STATE : code ROUTINE : sBAT_PlusCSCA |
179 +--------------------------------------------------------------------+
180
181 PURPOSE :
182 */
183 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSCA (T_ACI_DTI_PRC_PSI *src_infos_psi,
184 T_BAT_cmd_send *cmd)
185 {
186 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
187 T_ACI_TOA tosca;
188 T_ACI_TOA *p_tosca;
189 SHORT octet=0;
190 CHAR sca[MAX_SMS_NUM_LEN];
191
192 TRACE_FUNCTION ("sBAT_PlusCSCA()");
193
194 memset (sca, 0, sizeof(sca));
195 p_tosca=&tosca;
196
197 if(cmd->params.ptr_set_plus_csca->tosca EQ BAT_PARAMETER_NOT_PRESENT)
198 {
199 p_tosca = NULL;
200 }
201 else
202 {
203 tosca=toa_demerge(cmd->params.ptr_set_plus_csca->tosca);
204 if (tosca.ton < 0 OR tosca.npi < 0)
205 {
206 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
207 return (ACI_BAT_FAIL);
208 }
209 }
210 memcpy(sca,cmd->params.ptr_set_plus_csca->sca,cmd->params.ptr_set_plus_csca->c_sca);
211 ret = sAT_PlusCSCA(src_infos_psi->srcId,sca,p_tosca);
212 if (ret EQ AT_FAIL)
213 {
214 /* within sAT_PlusCSCA() the appropriate error value has been set */
215 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
216 return (ACI_BAT_FAIL);
217 }
218 return ret;
219 }
220
221 /*
222 +--------------------------------------------------------------------+
223 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
224 | STATE : code ROUTINE : qBAT_PlusCSCA |
225 +--------------------------------------------------------------------+
226
227 PURPOSE :
228 */
229 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSCA (T_ACI_DTI_PRC_PSI *src_infos_psi,
230 T_BAT_cmd_send *cmd)
231 {
232 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
233 T_ACI_TOA tosca;
234 SHORT octet=0;
235 CHAR sca[MAX_SMS_NUM_LEN];
236 T_BAT_cmd_response resp;
237 T_BAT_res_que_plus_csca que_csca_buffer;
238
239 TRACE_FUNCTION ("qBAT_PlusCSCA()");
240 ret = qAT_PlusCSCA (src_infos_psi->srcId,sca,&tosca);
241 resp.ctrl_response = BAT_RES_QUE_PLUS_CSCA;
242 resp.response.ptr_que_plus_csca = &que_csca_buffer;
243 if (ret EQ AT_CMPL)
244 {
245 octet=toa_merge(tosca);
246 resp.response.ptr_que_plus_csca->tosca = (U8)octet;
247 resp.response.ptr_que_plus_csca->c_sca = strlen(sca);
248 /* Are we sure the length is strlen(sca)? */
249 memcpy(resp.response.ptr_que_plus_csca->sca,sca,strlen(sca));
250 aci_bat_send(src_infos_psi,&resp);
251 return (ACI_BAT_CMPL);
252 }
253 else
254 {
255 /* within qAT_PlusCSCA() the appropriate error value has been set */
256 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
257 return (ACI_BAT_FAIL);
258 }
259 }
260
261 /*
262 +--------------------------------------------------------------------+
263 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
264 | STATE : code ROUTINE : sBAT_PlusCSCB |
265 +--------------------------------------------------------------------+
266
267 PURPOSE :
268 */
269 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSCB (T_ACI_DTI_PRC_PSI *src_infos_psi,
270 T_BAT_cmd_send *cmd)
271 {
272 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
273 USHORT *p_mids;
274 UBYTE *p_dcss;
275
276 TRACE_FUNCTION ("sBAT_PlusCSCB()");
277
278 if(cmd->params.ptr_set_plus_cscb->v_mids)
279 {
280 p_mids = cmd->params.ptr_set_plus_cscb->mids;
281 }
282 else
283 {
284 p_mids = NULL;
285 }
286 if(cmd->params.ptr_set_plus_cscb->v_dcss)
287 {
288 p_dcss = cmd->params.ptr_set_plus_cscb->dcss;
289 }
290 else
291 {
292 p_dcss = NULL;
293 }
294 ret=sAT_PlusCSCB(src_infos_psi->srcId, cmd->params.ptr_set_plus_cscb->mode, p_mids, p_dcss);
295 if (ret EQ AT_FAIL)
296 {
297 /* within sAT_PlusCSCB() the appropriate error value has been set */
298 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
299 return (ACI_BAT_FAIL);
300 }
301 return ret;
302 }
303
304 /*
305 +--------------------------------------------------------------------+
306 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
307 | STATE : code ROUTINE : qBAT_PlusCSCB |
308 +--------------------------------------------------------------------+
309
310 PURPOSE : to query the cell broadcast channels, we pass to qAT_PlusCSCB()
311 two arrays (mids and dcss), which are filled in the following way:
312 - two consecutive array entries form one logical information
313 - when both entries have the same value, then it is a single channel
314 - when both entries have different values, then it is a range of channels.
315 mids is more or less a copy of EF CBMIR of the SIM. refer to 11.11
316 A string based response +CSCB: 0,"2,3,4-6,7,922-1003","0-3,5"
317 is on binary level as follow:
318 mode = BAT_CSCB_MODE_ACCEPT; <=== 0 = accepted
319 mids[0] = 0x0002;
320 mids[1] = 0x0002;
321 mids[2] = 0x0003;
322 mids[3] = 0x0003;
323 mids[4] = 0x0004; <=== range lower bound
324 mids[5] = 0x0006; <=== range upper bound
325 mids[6] = 0x0007;
326 mids[7] = 0x0007;
327 mids[8] = 0x039A; <=== range lower bound
328 mids[9] = 0x03EB; <=== range upper bound
329 dcss[0] = 0x00;
330 dcss[1] = 0x03;
331 dcss[2] = 0x05;
332 dcss[3] = 0x05;
333
334 */
335 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSCB (T_ACI_DTI_PRC_PSI *src_infos_psi,
336 T_BAT_cmd_send *cmd)
337 {
338 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
339 T_BAT_cmd_response resp;
340 T_BAT_res_que_plus_cscb cscb;
341 int i;
342
343 TRACE_FUNCTION ("qBAT_PlusCSCB()");
344
345 resp.ctrl_response = BAT_RES_QUE_PLUS_CSCB;
346 resp.response.ptr_que_plus_cscb = &cscb;
347
348 cscb.c_mids = 0;
349 cscb.v_mids = FALSE;
350 cscb.c_dcss = 0;
351 cscb.v_dcss = FALSE;
352
353 memset(cscb.mids, 0xFF, BAT_MAX_IDENTS);
354 memset(cscb.dcss, 0xFF, BAT_MAX_IDENTS);
355
356 ret = qAT_PlusCSCB(src_infos_psi->srcId,
357 (T_ACI_CSCB_MOD*)&cscb.mode,
358 cscb.mids,
359 cscb.dcss);
360
361 if(ret EQ AT_CMPL)
362 {
363 i = 0;
364
365 if ((cscb.mids[0] NEQ 0xFFFF)
366 AND (cscb.mids[1] NEQ 0xFFFF))
367 {
368 cscb.v_mids = TRUE;
369 }
370
371 while ((cscb.mids[i] NEQ 0xFFFF)
372 AND (cscb.mids[i+1] NEQ 0xFFFF)
373 AND (i < BAT_MAX_IDENTS-1))
374 {
375 i += 2;
376 cscb.c_mids += 2;
377 }
378
379 i = 0;
380
381 if ((cscb.dcss[0] NEQ 0xFF)
382 AND (cscb.dcss[1] NEQ 0xFF))
383 {
384 cscb.v_dcss = TRUE;
385 }
386
387 while ((cscb.dcss[i] NEQ 0xFF)
388 AND (cscb.dcss[i+1] NEQ 0xFF)
389 AND (i < BAT_MAX_IDENTS-1))
390 {
391 i += 2;
392 cscb.c_dcss += 2;
393 }
394
395 aci_bat_send(src_infos_psi,&resp);
396 return (ACI_BAT_CMPL);
397 }
398 else
399 {
400 /* within qAT_PlusCSCB() the appropriate error value has been set */
401 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
402 return (ACI_BAT_FAIL);
403 }
404 }
405
406
407 #pragma message( __TODO__"FF_HOMEZONE is currently a problem for linking" )
408 /* #ifdef FF_HOMEZONE */
409 /*
410 +--------------------------------------------------------------------+
411 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
412 | STATE : code ROUTINE : sBAT_PercentCBHZ |
413 +--------------------------------------------------------------------+
414
415 PURPOSE :
416 */
417 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCBHZ (T_ACI_DTI_PRC_PSI *src_infos_psi,
418 T_BAT_cmd_send *cmd)
419 {
420 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
421
422 TRACE_FUNCTION ("sBAT_PercentCBHZ()");
423
424 /* CBHZ_xxx depends on FF_HOMEZONE
425 ret = sAT_PercentCBHZ(src_infos_psi->srcId,cmd->params.ptr_set_percent_cbhz->mode
426 ,cmd->params.ptr_set_percent_cbhz->dcs,
427 cmd->params.ptr_set_percent_cbhz->timeout);
428 if (ret EQ AT_FAIL)
429 {
430 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown);
431 return (ACI_BAT_FAIL);
432 }
433 return (ACI_BAT_CMPL);
434 */
435 return(ret);
436 }
437
438 /*
439 +--------------------------------------------------------------------+
440 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
441 | STATE : code ROUTINE : tBAT_PercentCBHZ |
442 +--------------------------------------------------------------------+
443
444 PURPOSE :
445 */
446 GLOBAL T_ACI_BAT_RSLT tBAT_PercentCBHZ (T_ACI_DTI_PRC_PSI *src_infos_psi,
447 T_BAT_cmd_send *cmd)
448 {
449 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
450 /* CBHZ_xxx depends on FF_HOMEZONE
451 T_BAT_cmd_response resp;
452 T_BAT_res_tst_percent_cbhz tst_cbhz_buffer;
453 T_BAT_percent_cbhz_mode mode;
454 T_ACI_CS dcs;
455 T_BAT_percent_cbhz_timeout timeout = BAT_P_CBHZ_TIMOUT_NOT_PRESENT;
456
457 TRACE_FUNCTION ("tBAT_PercentCBHZ()");
458 resp.ctrl_response = BAT_RES_QUE_PERCENT_CBHZ;
459 resp.response.ptr_tst_percent_cbhz = &tst_cbhz_buffer;
460
461
462 resp.response.ptr_tst_percent_cbhz->mode = CBHZ_MOD_Active;
463 resp.response.ptr_tst_percent_cbhz->dcs = CS_Ascii;
464 resp.response.ptr_tst_percent_cbhz->timeout = CBHZ_MAX_TIMEOUT;
465
466 dont know how to fill the lower values ???
467 CBHZ_xxx depends on FF_HOMEZONE
468 aci_bat_send(src_infos_psi,&resp);
469 return(ACI_BAT_CMPL);
470 */
471 return(ret);
472 }
473
474 /*
475 +--------------------------------------------------------------------+
476 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
477 | STATE : code ROUTINE : qBAT_PercentCBHZ |
478 +--------------------------------------------------------------------+
479
480 PURPOSE :
481 */
482 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCBHZ (T_ACI_DTI_PRC_PSI *src_infos_psi,
483 T_BAT_cmd_send *cmd)
484 {
485 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
486 /* qAT_PercentCBHZ depends on FF_HOMEZONE
487 T_BAT_percent_cbhz_mode mode;
488 T_ACI_CS dcs;
489 T_BAT_percent_cbhz_timeout timeout = BAT_P_CBHZ_TIMOUT_NOT_PRESENT;
490 T_BAT_cmd_response resp;
491 T_BAT_res_que_percent_cbhz que_cbhz_buffer;
492
493 TRACE_FUNCTION ("qBAT_PercentCBHZ()");
494
495 resp.ctrl_response = BAT_RES_QUE_PERCENT_CBHZ;
496 resp.response.ptr_que_percent_cbhz = &que_cbhz_buffer;
497 ret = qAT_PercentCBHZ(src_infos_psi->srcId, &mode, &dcs, &timeout);
498 if (ret EQ AT_FAIL)
499 {
500 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_NotPresent);
501 return (ATI_FAIL);
502 }
503 resp.response.ptr_que_percent_cbhz->mode = mode;
504 resp.response.ptr_que_percent_cbhz->timeout = timeout;
505 resp.response.ptr_que_percent_cbhz->dcs = dcs;
506 */
507 return(ret);
508 }
509
510 /* #endif *//* FF_HOMEZONE */
511 /*
512 +--------------------------------------------------------------------+
513 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
514 | STATE : code ROUTINE : sBAT_PlusCSAS |
515 +--------------------------------------------------------------------+
516
517 PURPOSE :
518 */
519 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSAS (T_ACI_DTI_PRC_PSI *src_infos_psi,
520 T_BAT_cmd_send *cmd)
521 {
522 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
523
524 TRACE_FUNCTION ("sBAT_PlusCSAS()");
525
526 ret = sAT_PlusCSAS (src_infos_psi->srcId,cmd->params.ptr_set_plus_csas->profile);
527 if (ret EQ AT_FAIL)
528 {
529 /* within sAT_PlusCSAS() the appropriate error value has been set */
530 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
531 return (ACI_BAT_FAIL);
532 }
533 return ret;
534 }
535
536
537 /*
538 +--------------------------------------------------------------------+
539 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
540 | STATE : code ROUTINE : tBAT_PlusCSAS |
541 +--------------------------------------------------------------------+
542
543 PURPOSE :
544 */
545 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCSAS (T_ACI_DTI_PRC_PSI *src_infos_psi,
546 T_BAT_cmd_send *cmd)
547 {
548 SHORT profile = -1;
549 T_BAT_cmd_response resp;
550 T_BAT_res_tst_plus_csas tst_csas_buffer;
551
552 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
553
554 TRACE_FUNCTION ("tBAT_PlusCSAS()");
555
556 if ((profile = cmhSMS_getPrfRge ()) < 1)
557 {
558 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_MemFail );
559 return (ACI_BAT_FAIL);
560 }
561 else
562 {
563 resp.ctrl_response = BAT_RES_TST_PLUS_CSAS;
564 resp.response.ptr_tst_plus_csas = &tst_csas_buffer;
565 resp.response.ptr_tst_plus_csas->max = (profile - 1) ;
566 aci_bat_send(src_infos_psi,&resp);
567 return (ACI_BAT_CMPL);
568 }
569 }
570
571 /*
572 +--------------------------------------------------------------------+
573 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
574 | STATE : code ROUTINE : sBAT_PlusCRES |
575 +--------------------------------------------------------------------+
576
577 PURPOSE :
578 */
579 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCRES (T_ACI_DTI_PRC_PSI *src_infos_psi,
580 T_BAT_cmd_send *cmd)
581 {
582 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
583
584 TRACE_FUNCTION ("sBAT_PlusCRES()");
585
586 ret = sAT_PlusCRES (src_infos_psi->srcId,cmd->params.ptr_set_plus_cres->profile);
587 if (ret EQ AT_FAIL)
588 {
589 /* within sAT_PlusCRES() the appropriate error value has been set */
590 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
591 return (ACI_BAT_FAIL);
592 }
593 return ret;
594 }
595
596 /*
597 +--------------------------------------------------------------------+
598 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
599 | STATE : code ROUTINE : tBAT_PlusCRES |
600 +--------------------------------------------------------------------+
601
602 PURPOSE :
603 */
604 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCRES (T_ACI_DTI_PRC_PSI *src_infos_psi,
605 T_BAT_cmd_send *cmd)
606 {
607 T_ACI_CRES profile ;
608 T_BAT_cmd_response resp;
609 T_BAT_res_tst_plus_cres tst_cres_buffer;
610 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
611
612 TRACE_FUNCTION ("tBAT_PlusCRES()");
613
614 ret = tAT_PlusCRES (src_infos_psi->srcId, &profile);
615 switch (ret)
616 {
617 case AT_CMPL:
618 {
619 break;
620 }
621 case AT_FAIL:
622 default:
623 {
624 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_MemFail );
625 return (ACI_BAT_FAIL);
626 }
627 }
628 resp.ctrl_response = BAT_RES_TST_PLUS_CRES;
629 resp.response.ptr_tst_plus_cres = &tst_cres_buffer;
630 resp.response.ptr_tst_plus_cres->max = profile.max ;
631 /* there is no min field to fill in */
632 //resp.response.ptr_tst_plus_cres->min = profile.min ;
633 aci_bat_send(src_infos_psi,&resp);
634 return (ACI_BAT_CMPL);
635 }
636
637
638 /*
639 +--------------------------------------------------------------------+
640 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
641 | STATE : code ROUTINE : sBAT_PlusCMGR |
642 +--------------------------------------------------------------------+
643
644 PURPOSE :
645 */
646 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGR (T_ACI_DTI_PRC_PSI *src_infos_psi,
647 T_BAT_cmd_send *cmd)
648 {
649 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
650 SHORT idx=-1;
651
652 TRACE_FUNCTION ("sBAT_PlusCMGR()");
653
654 idx = cmd->params.ptr_set_plus_cmgr->sms_index;
655 if ( idx > 255 OR idx < 0)
656 {
657 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
658 return (ACI_BAT_FAIL);
659 }
660 ret = sAT_PlusCMGR_Gl(src_infos_psi->srcId, (UBYTE)idx, SMS_READ_Normal, NULL);
661 /*
662 TO DO
663 ret = sAT_PlusCMGR_Gl(src_infos_psi->srcId, (UBYTE)idx, cmglRead, NULL);
664
665 */
666 if ((ret EQ AT_CMPL) OR (ret EQ AT_EXCT))
667 {
668 return ret;
669 }
670 else
671 {
672 /* within sAT_PlusCMGR_Gl() the appropriate error value has been set */
673 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
674 return (ACI_BAT_FAIL);
675 }
676 }
677
678 /*
679 +--------------------------------------------------------------------+
680 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
681 | STATE : code ROUTINE : sBAT_PercentCMGR |
682 +--------------------------------------------------------------------+
683
684 PURPOSE :
685 */
686 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCMGR (T_ACI_DTI_PRC_PSI *src_infos_psi,
687 T_BAT_cmd_send *cmd)
688 {
689 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
690 SHORT idx=-1;
691 #ifdef SMS_PDU_SUPPORT
692 T_ACI_CMGF_MOD mode;
693 #endif
694 CHAR *txtRdMode = NULL;
695
696
697 TRACE_FUNCTION ("sBAT_PercentCMGR()");
698
699 smsReadMode = SMS_READ_Normal;
700
701 #ifdef SMS_PDU_SUPPORT
702 /*
703 * request current mode
704 */
705 qAT_PlusCMGF(src_infos_psi->srcId, &mode);
706 if (mode EQ 0)
707 {
708 /*
709 * %CMGR=[index],[preview]
710 */
711 idx = cmd->params.ptr_set_percent_cmgr->sms_index;
712 smsReadMode = cmd->params.ptr_set_percent_cmgr->rdmode;
713 if ( idx > 255 OR idx < 0 OR smsReadMode > SMS_READ_StatusChange)
714 {
715 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
716 return (ACI_BAT_FAIL);
717 }
718 }
719 else
720 #endif
721 {
722 idx = cmd->params.ptr_set_percent_cmgr->sms_index;
723 if ( idx > 255 OR idx < 0)
724 {
725 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
726 return (ACI_BAT_FAIL);
727 }
728 txtRdMode = &cmd->params.ptr_set_percent_cmgr->rdmode;
729 ret = txt_rdmode_to_smsrdmode(txtRdMode);
730 if (ret EQ ATI_FAIL)
731 {
732 return (ACI_BAT_FAIL);
733 }
734 }
735 ret = sAT_PercentCMGR_Gl(src_infos_psi->srcId, (UBYTE)idx, smsReadMode , NULL);
736
737 if ((ret EQ AT_CMPL) OR (ret EQ AT_EXCT))
738 {
739 return ret;
740 }
741 else
742 {
743 return (ACI_BAT_FAIL);
744 }
745 }
746 /*
747 +--------------------------------------------------------------------+
748 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
749 | STATE : code ROUTINE : sBAT_PlusCMGS |
750 +--------------------------------------------------------------------+
751
752 PURPOSE :
753 */
754 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGS (T_ACI_DTI_PRC_PSI *src_infos_psi,
755 T_BAT_cmd_send *cmd)
756 {
757 T_ACI_BAT_RSLT ret;
758 T_ACI_SM_DATA pdu;
759
760 TRACE_FUNCTION ("sBAT_PlusCMGS()");
761
762 /*
763 * Check that 'data' in the T_ACI_SM_DATA structure is large enough
764 * to store the data in the BAT command. If it isn't then we may
765 * as well give up.
766 */
767 if (cmd->params.ptr_set_plus_cmgs->c_pdu>MAX_SM_LEN)
768 {
769 ACI_ERR_DESC(ACI_ERR_CLASS_Ext,EXT_ERR_Parameter);
770 return(AT_FAIL);
771 }
772
773 /*
774 * Copy the data, secure in the knowledge that we have enough room.
775 */
776 memcpy(
777 pdu.data,
778 cmd->params.ptr_set_plus_cmgs->pdu,
779 MAX_SM_LEN);
780
781 pdu.len=cmd->params.ptr_set_plus_cmgs->c_pdu;
782
783 /*
784 * Call the corresponding sAT function. T_ACI_BAT_RSLT is
785 * assumed to be equivalent to T_ACI_RESULT.
786 */
787 ret=(T_ACI_BAT_RSLT)sAT_PlusCMGSPdu(src_infos_psi->srcId,&pdu);
788
789 return(ret);
790 }
791
792 /*
793 +--------------------------------------------------------------------+
794 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
795 | STATE : code ROUTINE : sBAT_PlusCMSS |
796 +--------------------------------------------------------------------+
797
798 PURPOSE :
799 */
800 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMSS (T_ACI_DTI_PRC_PSI *src_infos_psi,
801 T_BAT_cmd_send *cmd)
802 {
803 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
804 T_ACI_TOA toda;
805 T_ACI_TOA *p_toda;
806 SHORT index=-1,
807 toda_val=0;
808 CHAR da[MAX_SMS_NUM_LEN] , *p_da;
809
810 TRACE_FUNCTION ("sBAT_PlusCMSS()");
811
812 p_toda=&toda;
813 p_da=da;
814
815 index = cmd->params.ptr_set_plus_cmss->index;
816 if(cmd->params.ptr_set_plus_cmss->v_da)
817 {
818 memcpy(da,cmd->params.ptr_set_plus_cmss->da,cmd->params.ptr_set_plus_cmss->c_da);
819 }
820 else
821 {
822 p_da = NULL;
823 }
824 toda_val=cmd->params.ptr_set_plus_cmss->toda;
825 if(toda_val EQ BAT_PARAMETER_NOT_PRESENT)
826 {
827 p_toda=NULL;
828 }
829 else
830 {
831 toda=toa_demerge(toda_val);
832 if (toda.ton < 0 OR toda.npi < 0)
833 {
834 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent);
835 return (ACI_BAT_FAIL);
836 }
837 }
838 ret = sAT_PlusCMSS_Gl(src_infos_psi->srcId, (UBYTE)index, p_da, p_toda, NULL, NULL);
839 if (ret EQ AT_EXCT)
840 {
841 return ACI_BAT_EXCT;
842 }
843 else
844 {
845 /* within sAT_PlusCMSS_Gl() the appropriate error value has been set */
846 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
847 return (ATI_FAIL);
848 }
849 }
850
851 /*
852 +--------------------------------------------------------------------+
853 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
854 | STATE : code ROUTINE : sBAT_PlusCMGW |
855 +--------------------------------------------------------------------+
856
857 PURPOSE :
858 */
859 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGW (T_ACI_DTI_PRC_PSI *src_infos_psi,
860 T_BAT_cmd_send *cmd)
861 {
862 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
863 T_ACI_SMS_STAT stat;
864 T_ACI_SM_DATA pdu;
865 UBYTE sca_len;
866 UBYTE pdu_message_octets_length = 0;
867
868 TRACE_FUNCTION ("sBAT_PlusCMGW()");
869
870 stat = cmd->params.ptr_set_plus_cmgw->sms_stat;
871 sca_len = cmd->params.ptr_set_plus_cmgw->pdu[0];
872 /* The first octet in pdu is length of sca */
873
874 if (sca_len > ((MAX_SMS_ADDR_DIG+1)/2) + 1)
875 {
876 TRACE_ERROR("SCA too long !!!");
877 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
878 return (ACI_BAT_FAIL);
879 }
880
881 pdu_message_octets_length = (cmd->params.ptr_set_plus_cmgw->length-2-sca_len*2)/2;
882 if(pdu_message_octets_length NEQ cmd->params.ptr_set_plus_cmgw->length)
883 {
884 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
885 TRACE_EVENT("ERROR: input pdu message length do not match the real length!");
886 return (ACI_BAT_FAIL);
887 }
888 memcpy(pdu.data,cmd->params.ptr_set_plus_cmgw->pdu,cmd->params.ptr_set_plus_cmgw->c_pdu);
889 ret = sAT_PlusCMGWPdu (src_infos_psi->srcId, (UBYTE)stat, &pdu);
890 if ( ret NEQ AT_EXCT )
891 {
892 /* within sAT_PlusCMGWPdu() the appropriate error value has been set */
893 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
894 return (ACI_BAT_FAIL);
895 }
896 return ACI_BAT_EXCT;
897 }
898
899 /*
900 |+--------------------------------------------------------------------+
901 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
902 | STATE : code ROUTINE : sBAT_PlusCNMA |
903 +---------------------------------------------------------------------+
904
905 PURPOSE :
906 */
907 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCNMA (T_ACI_DTI_PRC_PSI *src_infos_psi,
908 T_BAT_cmd_send *cmd)
909 {
910 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
911 T_ACI_SM_DATA pdu = {0}, *p_pdu;
912 UBYTE pdu_message_octets_lenth = 0;
913
914 TRACE_FUNCTION ("sBAT_PlusCNMA()");
915 p_pdu = &pdu;
916 if(cmd->params.ptr_set_plus_cnma->v_pdu)
917 {
918 memcpy(pdu.data,cmd->params.ptr_set_plus_cnma->pdu,cmd->params.ptr_set_plus_cnma->c_pdu);
919 pdu.len = cmd->params.ptr_set_plus_cnma->c_pdu ;
920 }
921 else
922 {
923 p_pdu = NULL;
924 }
925 ret = sAT_PlusCNMAPdu (src_infos_psi->srcId, (SHORT)cmd->params.ptr_set_plus_cnma->n, p_pdu);
926 if(ret EQ AT_FAIL)
927 {
928 /* within sAT_PlusCNMAPdu() the appropriate error value has been set */
929 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
930 }
931 return(ret);
932 }
933
934 /*
935 +--------------------------------------------------------------------+
936 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
937 | STATE : code ROUTINE : sBAT_PlusCMGD |
938 +--------------------------------------------------------------------+
939
940 PURPOSE :
941 */
942 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGD (T_ACI_DTI_PRC_PSI *src_infos_psi,
943 T_BAT_cmd_send *cmd)
944 {
945 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
946 SHORT index=-1;
947 UBYTE status = BAT_CMGD_DEL_INDEX;
948
949
950 TRACE_FUNCTION ("sBAT_PlusCMGD()");
951
952 index = cmd->params.ptr_set_plus_cmgd->index;
953 status = cmd->params.ptr_set_plus_cmgd->status;
954
955 if((index > 255 OR index < 0) OR ((status < BAT_CMGD_DEL_INDEX) OR (status > BAT_CMGD_DEL_ALL)))
956 {
957 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
958 return 0;
959 }
960
961 if (status > BAT_CMGD_DEL_INDEX)
962 {
963 index = 0;
964 }
965 ret = sAT_PlusCMGD_Gl(src_infos_psi->srcId,(UBYTE)index,status,NULL,NULL);
966 if (ret EQ AT_EXCT)
967 {
968 return (ACI_BAT_EXCT);
969 }
970 else
971 {
972 /* within sAT_PlusCMGD_Gl() the appropriate error value has been set */
973 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
974 return (ACI_BAT_FAIL);
975 }
976 }
977
978 /*
979 +--------------------------------------------------------------------+
980 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
981 | STATE : code ROUTINE : sBAT_PlusCMGC |
982 +--------------------------------------------------------------------+
983
984 PURPOSE :
985 */
986 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGC (T_ACI_DTI_PRC_PSI *src_infos_psi,
987 T_BAT_cmd_send *cmd)
988 {
989 T_ACI_SM_DATA pdu;
990 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
991 UBYTE sca_len;
992 UBYTE pdu_message_octets_length = 0;
993
994 TRACE_FUNCTION ("sBAT_PlusCMGC()");
995
996 sca_len = cmd->params.ptr_set_plus_cmgc->pdu[0];
997 /* The first octet in pdu is length of sca */
998
999 if (sca_len > ((MAX_SMS_ADDR_DIG+1)/2) + 1)
1000 {
1001 TRACE_ERROR("SCA too long !!!");
1002 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
1003 return (ACI_BAT_FAIL);
1004 }
1005 /*
1006 pdu_message_octets_length = (cmd->params.ptr_set_plus_cmgc->length-2-sca_len*2)/2;
1007
1008 if(pdu_message_octets_length NEQ cmd->params.ptr_set_plus_cmgc->length)
1009 {
1010 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
1011 TRACE_EVENT("ERROR: input pdu message length in cmgc do not match the real length!");
1012 return (ACI_BAT_FAIL);
1013 }
1014 length paramter is not present in cmgc struct ??? its there in old ati code
1015 */
1016 memcpy(pdu.data,cmd->params.ptr_set_plus_cmgc->pdu,cmd->params.ptr_set_plus_cmgc->c_pdu);
1017 pdu.len = cmd->params.ptr_set_plus_cmgc->c_pdu ;
1018 ret = sAT_PlusCMGCPdu ( src_infos_psi->srcId, &pdu );
1019 if ( ret NEQ AT_EXCT )
1020 {
1021 /* within sAT_PlusCMGCPdu() the appropriate error value has been set */
1022 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
1023 return (ACI_BAT_FAIL);
1024 }
1025 return ACI_BAT_EXCT;
1026 }
1027
1028 /*
1029 +--------------------------------------------------------------------+
1030 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1031 | STATE : code ROUTINE : sBAT_PlusCMGL |
1032 +--------------------------------------------------------------------+
1033
1034 PURPOSE :
1035 */
1036 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMGL (T_ACI_DTI_PRC_PSI *src_infos_psi,
1037 T_BAT_cmd_send *cmd)
1038 {
1039 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1040
1041 TRACE_FUNCTION ("sBAT_PlusCMGL()");
1042
1043 ret = sAT_PlusCMGL ( src_infos_psi->srcId, cmd->params.ptr_set_plus_cmgl->stat, 0, SMS_READ_Normal );
1044 if ( ret EQ AT_EXCT )
1045 {
1046 return (ACI_BAT_EXCT);
1047 }
1048 else
1049 {
1050 /* within sAT_PlusCMGL() the appropriate error value has been set */
1051 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
1052 return (ACI_BAT_FAIL);
1053 }
1054 }
1055
1056 /*
1057 +--------------------------------------------------------------------+
1058 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1059 | STATE : code ROUTINE : sBAT_PercentCMGL |
1060 +--------------------------------------------------------------------+
1061
1062 PURPOSE :
1063 */
1064 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCMGL (T_ACI_DTI_PRC_PSI *src_infos_psi,
1065 T_BAT_cmd_send *cmd)
1066 {
1067 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1068 #ifdef SMS_PDU_SUPPORT
1069 T_ACI_CMGF_MOD mode;
1070 #endif
1071 CHAR *txtRdMode = NULL;
1072 CHAR *txtStat = NULL;
1073 USHORT i;
1074
1075 TRACE_FUNCTION ("sBAT_PercentCMGL()");
1076
1077 #ifdef SMS_PDU_SUPPORT
1078 /*
1079 * request current mode
1080 */
1081 qAT_PlusCMGF(src_infos_psi->srcId, &mode);
1082 if (mode EQ 0)
1083 {
1084 /*
1085 * %CMGL=[stat],[preview]
1086 */
1087 smsReadMode = cmd->params.ptr_set_percent_cmgl->rdmode;
1088 cmglStat = cmd->params.ptr_set_percent_cmgl->stat;
1089 if ( ((cmglStat < SMS_STAT_RecUnread OR cmglStat > SMS_STAT_All)
1090 AND smsReadMode EQ SMS_READ_NotPresent)
1091 OR (smsReadMode < SMS_STAT_RecUnread AND smsReadMode > SMS_READ_NotPresent)
1092 OR (smsReadMode > SMS_READ_StatusChange))
1093 {
1094 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
1095 return (ACI_BAT_FAIL);
1096 }
1097 }
1098 else
1099 #endif
1100 {
1101 txtStat = (char*)&cmd->params.ptr_set_percent_cmgl->stat;
1102 txtRdMode = &cmd->params.ptr_set_percent_cmgl->rdmode;
1103 if (txtStat[0] EQ '\0')
1104 {
1105 strcpy (txtStat, sms_stat[4].name); /* ALL as default */
1106 }
1107 i = 0;
1108 while ( sms_stat[i].name NEQ NULL AND
1109 strcmp ( sms_stat[i].name, txtStat ) NEQ 0 )
1110 i++;
1111
1112 if ( sms_stat[i].name EQ NULL )
1113 {
1114 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_OpNotAllowed);
1115 return (ACI_BAT_FAIL);
1116 }
1117 cmglStat = sms_stat[i].stat;
1118
1119 ret = txt_rdmode_to_smsrdmode(txtRdMode);
1120 if (ret EQ ATI_FAIL)
1121 {
1122 return (ACI_BAT_FAIL);
1123 }
1124 }
1125
1126 ret = sAT_PercentCMGL ( src_infos_psi->srcId, cmglStat, smsReadMode );
1127 if ( ret EQ AT_EXCT )
1128 {
1129 return (ACI_BAT_EXCT);
1130 }
1131 else
1132 {
1133 return (ACI_BAT_FAIL);
1134 }
1135 }
1136
1137 /*
1138 +--------------------------------------------------------------------+
1139 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1140 | STATE : code ROUTINE : sBAT_PlusCNMI |
1141 +--------------------------------------------------------------------+
1142
1143 PURPOSE :
1144 */
1145
1146
1147 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCNMI (T_ACI_DTI_PRC_PSI *src_infos_psi,
1148 T_BAT_cmd_send *cmd)
1149 {
1150 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1151
1152 TRACE_FUNCTION ("sBAT_PlusCNMI()");
1153
1154 ret = sAT_PlusCNMI ( src_infos_psi->srcId, cmd->params.ptr_set_plus_cnmi->mt, cmd->params.ptr_set_plus_cnmi->bm, cmd->params.ptr_set_plus_cnmi->ds );
1155 if ( (ret EQ AT_FAIL) OR (ret EQ AT_BUSY) )
1156 {
1157 /* within sAT_PlusCNMI() the appropriate error value has been set */
1158 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
1159 }
1160 else
1161 {
1162 if(src_infos_psi->srcId NEQ CMD_SRC_LCL)
1163 {
1164 smsShrdPrm.smsSrcId = src_infos_psi->srcId;
1165 }
1166 }
1167
1168 return(ret);
1169 }
1170
1171 /*
1172 +--------------------------------------------------------------------+
1173 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1174 | STATE : code ROUTINE : qBAT_PlusCNMI |
1175 +--------------------------------------------------------------------+
1176
1177 PURPOSE :
1178 */
1179 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCNMI (T_ACI_DTI_PRC_PSI *src_infos_psi,
1180 T_BAT_cmd_send *cmd)
1181 {
1182 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1183 T_BAT_plus_cnmi_mt mt = BAT_CNMI_MT_NOT_PRESENT; /*< 0: 4> (enum=32bit)<->T_BAT_plus_cnmi_mt Indication routing for SMS-DELIVERs */
1184 T_BAT_plus_cnmi_bm bm = BAT_CNMI_BM_NOT_PRESENT; /*< 4: 4> (enum=32bit)<->T_BAT_plus_cnmi_bm Indication routing for CBMs */
1185 T_BAT_plus_cnmi_ds ds = BAT_CNMI_DS_NOT_PRESENT;
1186 T_BAT_cmd_response resp;
1187 T_BAT_res_que_plus_cnmi que_cnmi_buffer;
1188
1189 TRACE_FUNCTION ("qBAT_PlusCNMI()");
1190
1191 resp.ctrl_response = BAT_RES_QUE_PLUS_CNMI;
1192 resp.response.ptr_que_plus_cnmi = &que_cnmi_buffer;
1193
1194 if ( qAT_PlusCNMI ( src_infos_psi->srcId,(T_ACI_CNMI_MT*)&mt,(T_ACI_CNMI_BM*)&bm,(T_ACI_CNMI_DS*)&ds ) EQ AT_CMPL )
1195 {
1196 resp.response.ptr_que_plus_cnmi->mt = mt;
1197 resp.response.ptr_que_plus_cnmi->bm = bm;
1198 resp.response.ptr_que_plus_cnmi->ds = ds;
1199 aci_bat_send(src_infos_psi,&resp);
1200 return ACI_BAT_CMPL ;
1201 }
1202 /* within qAT_PlusCNMI() the appropriate error value has been set */
1203 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
1204 return (ACI_BAT_FAIL);
1205 }
1206
1207 /*
1208 +--------------------------------------------------------------------+
1209 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1210 | STATE : code ROUTINE : sBAT_PercentCPRSM |
1211 +--------------------------------------------------------------------+
1212
1213 PURPOSE :
1214 */
1215 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCPRSM (T_ACI_DTI_PRC_PSI *src_infos_psi,
1216 T_BAT_cmd_send *cmd)
1217 {
1218 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1219 T_ACI_CPRSM_MOD mode = CPRSM_MOD_NotPresent;
1220
1221 TRACE_FUNCTION ("sBAT_PercentCPRSM()");
1222
1223 ret = sAT_PercentCPRSM(src_infos_psi->srcId, cmd->params.ptr_set_percent_cprsm->mode);
1224 switch (ret)
1225 {
1226 case (AT_CMPL):
1227 case (AT_EXCT):
1228 {
1229 break;
1230 }
1231 default:
1232 {
1233 TRACE_EVENT_P1("+CPRSM ERROR: undefined result: %d", ret);
1234 ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_UnknownErr);
1235 return ACI_BAT_FAIL;
1236 }
1237 }
1238 return(ret);
1239 }
1240
1241 /*
1242 +--------------------------------------------------------------------+
1243 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1244 | STATE : code ROUTINE : qBAT_PercentCPRSM |
1245 +--------------------------------------------------------------------+
1246
1247 PURPOSE :
1248 */
1249 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCPRSM (T_ACI_DTI_PRC_PSI *src_infos_psi,
1250 T_BAT_cmd_send *cmd)
1251 {
1252 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1253
1254 TRACE_FUNCTION ("qBAT_PercentCPRSM()");
1255 ret = qAT_PercentCPRSM( src_infos_psi->srcId );
1256 /* Does not fill in the response structure? */
1257 /* ACI does not fill in response mode in qAT_PercentCPRSM?*/
1258 if (ret EQ AT_EXCT)
1259 {
1260 return (ACI_BAT_EXCT);
1261 }
1262 else
1263 {
1264 /* within qAT_PlusCPRSM() the appropriate error value has been set */
1265 /* ACI_ERR_DESC(ACI_ERR_CLASS_Cms,CMS_ERR_NotPresent); */
1266 return (ATI_FAIL);
1267 }
1268 }
1269