FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/cmh_smss.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_SMSS | |
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 module provides the set functions related to the | |
18 | protocol stack adapter for the short message service. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_SMSS_C | |
23 #define CMH_SMSS_C | |
24 #endif | |
25 | |
26 #include "aci_all.h" | |
27 /*==== INCLUDES ===================================================*/ | |
28 #include "aci_cmh.h" | |
29 #include "ati_cmd.h" | |
30 #include "aci_cmd.h" | |
31 | |
32 #ifdef FAX_AND_DATA | |
33 #include "aci_fd.h" | |
34 #endif /* of #ifdef FAX_AND_DATA */ | |
35 | |
36 #include "gdi.h" | |
37 #include "aci.h" | |
38 #include "aci_lst.h" | |
39 #include "aci_mem.h" | |
40 | |
41 #if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_) | |
42 #include "conc_sms.h" | |
43 #endif | |
44 | |
45 #include "psa.h" | |
46 #include "psa_sms.h" | |
47 #include "psa_mmi.h" | |
48 #include "cmh.h" | |
49 #include "cmh_sms.h" | |
50 #include "pcm.h" | |
51 #include "phb.h" | |
52 #include "cmh_phb.h" | |
53 | |
54 #ifdef SIM_TOOLKIT | |
55 #include "psa_sim.h" | |
56 #include "psa_cc.h" | |
57 #include "psa_sat.h" | |
58 #include "cmh_sat.h" | |
59 #endif /*of SIM_TOOLKIT */ | |
60 | |
61 | |
62 #if 1 | |
63 #include <stdio.h> | |
64 #endif | |
65 | |
66 /*==== CONSTANTS ==================================================*/ | |
67 | |
68 | |
69 #define SMS_CMH_IDX_MAX (255) /* memory location index */ | |
70 /* maximum value */ | |
71 #define SMS_CMH_IDX_MIN (1) /* memory location index */ | |
72 /* minimum value */ | |
73 /*--------------------------------------------------------------*/ | |
74 #define SMS_CMH_MN_MAX (255) /* message number maximum value */ | |
75 #define SMS_CMH_MN_MIN (0) /* message number minimum value */ | |
76 /*--------------------------------------------------------------*/ | |
77 #define SMS_CMH_CT_MAX (255) /* command type maximum value */ | |
78 #define SMS_CMH_CT_MIN (0) /* command type minimum value */ | |
79 /*--------------------------------------------------------------*/ | |
80 #define SMS_CMH_FO_MAX (255) /* first octet maximum value */ | |
81 #define SMS_CMH_FO_MIN (0) /* first octet minimum value */ | |
82 /*--------------------------------------------------------------*/ | |
83 #define SMS_CMH_VPREL_MAX (255) /* relative validity period */ | |
84 /* maximum value */ | |
85 #define SMS_CMH_VPREL_MIN (0) /* relative validity period */ | |
86 /* minimum value */ | |
87 /*--------------------------------------------------------------*/ | |
88 #define SMS_CMH_DCS_MAX (255) /* data coding scheme */ | |
89 /* maximum value */ | |
90 #define SMS_CMH_DCS_MIN (0) /* data coding scheme */ | |
91 /* minimum value */ | |
92 /*--------------------------------------------------------------*/ | |
93 #define SMS_CMH_PID_MAX (255) /* TP-Protocol-Identifier */ | |
94 /* maximum value */ | |
95 #define SMS_CMH_PID_MIN (0) /* TP-Protocol-Identifier */ | |
96 /* minimum value */ | |
97 | |
98 /*==== EXPORT =====================================================*/ | |
99 /*==== VARIABLES ==================================================*/ | |
100 EXTERN T_ACI_LIST *set_prm_list; | |
101 /*==== FUNCTIONS ==================================================*/ | |
102 /* | |
103 +-------------------------------------------------------------------+ | |
104 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
105 | STATE : code ROUTINE : sAT_PlusCSMP | | |
106 +-------------------------------------------------------------------+ | |
107 | |
108 PURPOSE : This is the functional counterpart of the +CSMP | |
109 AT command which is responsible for setting the text | |
110 mode parameter. | |
111 | |
112 <fo>: first octet of SMS-DELIVER, SMS-SUBMIT, etc. | |
113 <vprel>: relative validity period | |
114 <vpabs>: absolute validity period | |
115 <vpenh>: enhanced validity period | |
116 <pid>: TP-Protocol-Identifier | |
117 <dcs>: SMS data coding scheme | |
118 */ | |
119 GLOBAL T_ACI_RETURN sAT_PlusCSMP ( T_ACI_CMD_SRC srcId, | |
120 SHORT fo, | |
121 SHORT vprel, | |
122 T_ACI_VP_ABS* vpabs, | |
123 T_ACI_VP_ENH* vpenh, | |
124 SHORT pid, | |
125 SHORT dcs ) | |
126 { | |
127 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
128 T_SMS_SET_PRM * pSMSSetPrmCopy;/* points to SMS parameter set */ | |
129 UBYTE chkFo; /* checked parameter <fo> */ | |
130 UBYTE chkVprel = '\0'; /* checked parameter <vprel> */ | |
131 T_tp_vp_abs chkVpabs; /* checked parameter <vpabs> */ | |
132 T_tp_vp_enh chkVpenh; /* checked parameter <vpenh> */ | |
133 UBYTE chkPid; /* checked parameter <pid> */ | |
134 UBYTE chkDcs; /* checked parameter <dcs> */ | |
135 | |
136 TRACE_FUNCTION ("sAT_PlusCSMP ()"); | |
137 | |
138 /* | |
139 *----------------------------------------------------------------- | |
140 * check command source | |
141 *----------------------------------------------------------------- | |
142 */ | |
143 if(!cmh_IsVldCmdSrc (srcId)) | |
144 { | |
145 return( AT_FAIL ); | |
146 } | |
147 | |
148 /* | |
149 *----------------------------------------------------------------- | |
150 * check if command executable | |
151 *----------------------------------------------------------------- | |
152 */ | |
153 if(!cmhSMS_checkSIM ()) | |
154 return AT_FAIL; | |
155 | |
156 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
157 | |
158 /* | |
159 *----------------------------------------------------------------- | |
160 * create a temporary copy | |
161 *----------------------------------------------------------------- | |
162 */ | |
163 if ( pSMSSetPrm->isCopy EQ FALSE ) | |
164 { | |
165 ACI_MALLOC(pSMSSetPrmCopy, sizeof(T_SMS_SET_PRM)); | |
166 memcpy(pSMSSetPrmCopy, pSMSSetPrm, sizeof(T_SMS_SET_PRM)); | |
167 | |
168 pSMSSetPrm->numOfRefs--; | |
169 pSMSSetPrmCopy->isCopy = TRUE; | |
170 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmCopy; | |
171 pSMSSetPrm = pSMSSetPrmCopy; | |
172 } | |
173 | |
174 /* | |
175 *----------------------------------------------------------------- | |
176 * process the <fo> parameter | |
177 *----------------------------------------------------------------- | |
178 */ | |
179 if( fo NEQ ACI_NumParmNotPresent ) | |
180 { | |
181 if( fo > SMS_CMH_FO_MAX OR fo < SMS_CMH_FO_MIN OR | |
182 ( fo & TP_MTI_MASK ) EQ TP_MTI_SMS_RESERVED ) | |
183 { | |
184 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
185 return ( AT_FAIL ); | |
186 } | |
187 else | |
188 | |
189 chkFo = (UBYTE) fo; | |
190 } | |
191 else | |
192 | |
193 chkFo = pSMSSetPrm -> msgType; | |
194 | |
195 /* | |
196 *----------------------------------------------------------------- | |
197 * process the <vprel> parameter | |
198 *----------------------------------------------------------------- | |
199 */ | |
200 if( ( chkFo & VPF_MASK ) EQ VPF_RELATIVE ) | |
201 { | |
202 if ( vprel NEQ ACI_NumParmNotPresent ) | |
203 { | |
204 if( vprel > SMS_CMH_VPREL_MAX OR vprel < SMS_CMH_VPREL_MIN ) | |
205 { | |
206 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
207 return ( AT_FAIL ); | |
208 } | |
209 else | |
210 | |
211 chkVprel = (UBYTE) vprel; | |
212 } | |
213 else | |
214 | |
215 chkVprel = pSMSSetPrm -> vpRel; | |
216 | |
217 } | |
218 | |
219 /* | |
220 *----------------------------------------------------------------- | |
221 * process the <vpabs> parameter | |
222 *----------------------------------------------------------------- | |
223 */ | |
224 memset(&chkVpabs, 0, sizeof(T_tp_vp_abs)); | |
225 if( ( chkFo & VPF_MASK ) EQ VPF_ABSOLUTE ) | |
226 { | |
227 if (vpabs NEQ NULL ) | |
228 { | |
229 if ( ! cmhSMS_isVpabsVld ( vpabs ) ) | |
230 { | |
231 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
232 return ( AT_FAIL ); | |
233 } | |
234 else | |
235 | |
236 cmhSMS_setVpabsPsa ( &chkVpabs, vpabs ); | |
237 } | |
238 else | |
239 | |
240 memcpy ( ( CHAR * ) &chkVpabs, ( CHAR * ) &pSMSSetPrm -> vpAbs, | |
241 sizeof ( T_tp_vp_abs ) ); | |
242 | |
243 } | |
244 | |
245 /* | |
246 *----------------------------------------------------------------- | |
247 * process the <vpenh> parameter | |
248 *----------------------------------------------------------------- | |
249 */ | |
250 | |
251 memset(&chkVpenh, 0, sizeof(T_tp_vp_enh)); | |
252 if( ( chkFo & VPF_MASK ) EQ VPF_ENHANCED ) | |
253 { | |
254 if (vpenh NEQ NULL ) | |
255 { | |
256 if ( ! cmhSMS_isVpenhVld ( vpenh ) ) | |
257 { | |
258 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
259 return ( AT_FAIL ); | |
260 } | |
261 else | |
262 | |
263 cmhSMS_setVpenhPsa ( &chkVpenh, vpenh ); | |
264 } | |
265 else | |
266 | |
267 memcpy ( ( CHAR * ) &chkVpenh, ( CHAR * ) &pSMSSetPrm -> vpEnh, | |
268 sizeof ( T_tp_vp_enh ) ); | |
269 | |
270 } | |
271 | |
272 /* | |
273 *----------------------------------------------------------------- | |
274 * process the <pid> parameter | |
275 *----------------------------------------------------------------- | |
276 */ | |
277 if( pid NEQ ACI_NumParmNotPresent ) | |
278 { | |
279 if( pid > SMS_CMH_PID_MAX OR pid < SMS_CMH_PID_MIN ) | |
280 { | |
281 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
282 return ( AT_FAIL ); | |
283 } | |
284 else | |
285 | |
286 chkPid = (UBYTE) pid; | |
287 } | |
288 else | |
289 | |
290 chkPid = pSMSSetPrm -> pid; | |
291 | |
292 /* | |
293 *----------------------------------------------------------------- | |
294 * process the <dcs> parameter | |
295 *----------------------------------------------------------------- | |
296 */ | |
297 if( dcs NEQ ACI_NumParmNotPresent ) | |
298 { | |
299 if( dcs > SMS_CMH_DCS_MAX OR dcs < SMS_CMH_DCS_MIN ) | |
300 { | |
301 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
302 return ( AT_FAIL ); | |
303 } | |
304 else | |
305 | |
306 chkDcs = (UBYTE) dcs; | |
307 } | |
308 else | |
309 | |
310 chkDcs = pSMSSetPrm -> dcs; | |
311 | |
312 /* | |
313 *----------------------------------------------------------------- | |
314 * copy parameter | |
315 *----------------------------------------------------------------- | |
316 */ | |
317 pSMSSetPrm -> msgType = chkFo; | |
318 | |
319 | |
320 if( ( chkFo & VPF_MASK ) EQ VPF_RELATIVE ) | |
321 { | |
322 pSMSSetPrm -> vpRel = chkVprel; | |
323 } | |
324 else if ( ( chkFo & VPF_MASK ) EQ VPF_ABSOLUTE ) | |
325 { | |
326 memcpy ( ( CHAR * ) &pSMSSetPrm -> vpAbs, ( CHAR * ) &chkVpabs, | |
327 sizeof ( T_tp_vp_abs ) ); | |
328 } | |
329 else if ( ( chkFo & VPF_MASK ) EQ VPF_ENHANCED ) | |
330 { | |
331 memcpy ( ( CHAR * ) &pSMSSetPrm -> vpEnh, ( CHAR * ) &chkVpenh, | |
332 sizeof ( T_tp_vp_enh ) ); | |
333 } | |
334 | |
335 pSMSSetPrm -> pid = chkPid; | |
336 pSMSSetPrm -> dcs = chkDcs; | |
337 return( AT_CMPL ); | |
338 } | |
339 | |
340 /* | |
341 +-------------------------------------------------------------------+ | |
342 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
343 | STATE : code ROUTINE : sAT_PlusCSCA | | |
344 +-------------------------------------------------------------------+ | |
345 | |
346 PURPOSE : This is the functional counterpart of the +CSCA | |
347 AT command which is responsible for setting the | |
348 service center address. | |
349 | |
350 <sca>: service center address | |
351 <tosca>: type of service center address | |
352 */ | |
353 GLOBAL T_ACI_RETURN sAT_PlusCSCA ( T_ACI_CMD_SRC srcId, | |
354 CHAR* sca, | |
355 T_ACI_TOA* tosca ) | |
356 { | |
357 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
358 T_SMS_SET_PRM * pSMSSetPrmCopy; /* copy of SMS parameter set */ | |
359 CHAR* restSca = sca; /* service center address without */ | |
360 /* international access function */ | |
361 /* characters */ | |
362 | |
363 TRACE_FUNCTION ("sAT_PlusCSCA ()"); | |
364 | |
365 /* | |
366 *----------------------------------------------------------------- | |
367 * check command source | |
368 *----------------------------------------------------------------- | |
369 */ | |
370 if(!cmh_IsVldCmdSrc (srcId)) | |
371 { | |
372 return( AT_FAIL ); | |
373 } | |
374 | |
375 /* | |
376 *----------------------------------------------------------------- | |
377 * check if command executable | |
378 *----------------------------------------------------------------- | |
379 */ | |
380 if(!cmhSMS_checkSIM ()) | |
381 return AT_FAIL; | |
382 | |
383 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
384 | |
385 /* | |
386 *----------------------------------------------------------------- | |
387 * create a temporary copy | |
388 *----------------------------------------------------------------- | |
389 */ | |
390 if ( pSMSSetPrm->isCopy EQ FALSE ) | |
391 { | |
392 ACI_MALLOC(pSMSSetPrmCopy, sizeof(T_SMS_SET_PRM)); | |
393 memcpy(pSMSSetPrmCopy, pSMSSetPrm, sizeof(T_SMS_SET_PRM)); | |
394 | |
395 pSMSSetPrm->numOfRefs--; | |
396 pSMSSetPrmCopy->isCopy = TRUE; | |
397 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmCopy; | |
398 pSMSSetPrm = pSMSSetPrmCopy; | |
399 } | |
400 | |
401 /* | |
402 *----------------------------------------------------------------- | |
403 * process the <sca> parameter | |
404 *----------------------------------------------------------------- | |
405 */ | |
406 if ( sca NEQ NULL ) | |
407 { | |
408 /* | |
409 *--------------------------------------------------------------- | |
410 * process the <tosca> parameter | |
411 *--------------------------------------------------------------- | |
412 */ | |
413 if ( tosca NEQ NULL ) | |
414 { | |
415 pSMSSetPrm -> sca.ton = cmhSMS_getNType ( tosca -> ton ); | |
416 pSMSSetPrm -> sca.npi = cmhSMS_getNPlan ( tosca -> npi ); | |
417 } | |
418 else | |
419 { | |
420 restSca = cmhSMS_setToaDef ( sca, | |
421 &pSMSSetPrm -> sca.ton, | |
422 &pSMSSetPrm -> sca.npi ); | |
423 } | |
424 | |
425 cmhSMS_getAdrBcd ( pSMSSetPrm -> sca.num, | |
426 &pSMSSetPrm -> sca.c_num, | |
427 MAX_SMS_ADDR_DIG, restSca); | |
428 | |
429 pSMSSetPrm -> sca.v_npi = TRUE; | |
430 pSMSSetPrm -> sca.v_ton = TRUE; | |
431 return ( AT_CMPL ); | |
432 } | |
433 else | |
434 { | |
435 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
436 return ( AT_FAIL ); | |
437 } | |
438 } | |
439 | |
440 /* | |
441 +-------------------------------------------------------------------+ | |
442 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
443 | STATE : code ROUTINE : sAT_PlusCSMS | | |
444 +-------------------------------------------------------------------+ | |
445 | |
446 PURPOSE : This is the functional counterpart of the +CSMS | |
447 AT command which is responsible for setting the | |
448 message service. | |
449 | |
450 <service>: message service | |
451 */ | |
452 GLOBAL T_ACI_RETURN sAT_PlusCSMS ( T_ACI_CMD_SRC srcId, | |
453 T_ACI_CSMS_SERV service ) | |
454 { | |
455 T_ACI_RETURN ret; /* AT response code */ | |
456 | |
457 TRACE_FUNCTION ("sAT_PlusCSMS ()"); | |
458 | |
459 /* | |
460 *----------------------------------------------------------------- | |
461 * check if command executable | |
462 *----------------------------------------------------------------- | |
463 */ | |
464 if(!cmhSMS_checkAccess (srcId, &ret)) | |
465 return ret; | |
466 | |
467 /* | |
468 *----------------------------------------------------------------- | |
469 * process the <service> parameter | |
470 *----------------------------------------------------------------- | |
471 */ | |
472 switch( service ) | |
473 { | |
474 case( CSMS_SERV_NotPresent ): | |
475 break; | |
476 | |
477 case( CSMS_SERV_GsmPh2 ): | |
478 case( CSMS_SERV_GsmPh2Plus ): | |
479 smsShrdPrm.CSMSservice = service; | |
480 | |
481 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CSMS; | |
482 smsShrdPrm.owner = (T_OWN)srcId; | |
483 smsShrdPrm.smsEntStat.entOwn = srcId; | |
484 /* Implements measure 147,148, 149 */ | |
485 cmhSMS_sendConfigureReq(FALSE); | |
486 { | |
487 R_AT ( RAT_CSMS, smsShrdPrm.smsEntStat.entOwn ) | |
488 ( CSMS_SERV_NotPresent, | |
489 smsShrdPrm.CSMSmt, | |
490 smsShrdPrm.CSMSmo, | |
491 smsShrdPrm.CSMSbm ); | |
492 } | |
493 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
494 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
495 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
496 break; | |
497 | |
498 default: | |
499 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
500 return( AT_FAIL ); | |
501 } | |
502 | |
503 return( AT_CMPL ); | |
504 } | |
505 | |
506 /* | |
507 +-------------------------------------------------------------------+ | |
508 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
509 | STATE : code ROUTINE : sAT_PlusCMGF | | |
510 +-------------------------------------------------------------------+ | |
511 | |
512 PURPOSE : This is the functional counterpart of the +CMGF | |
513 AT command which is responsible for setting the | |
514 message format. | |
515 | |
516 <mode>: indicates the message format | |
517 */ | |
518 GLOBAL T_ACI_RETURN sAT_PlusCMGF ( T_ACI_CMD_SRC srcId, | |
519 T_ACI_CMGF_MOD mode ) | |
520 { | |
521 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
522 | |
523 TRACE_FUNCTION ("sAT_PlusCMGF ()"); | |
524 | |
525 /* | |
526 *----------------------------------------------------------------- | |
527 * check command source | |
528 *----------------------------------------------------------------- | |
529 */ | |
530 if(!cmh_IsVldCmdSrc (srcId)) | |
531 { | |
532 return( AT_FAIL ); | |
533 } | |
534 | |
535 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
536 | |
537 /* | |
538 *----------------------------------------------------------------- | |
539 * process the <mode> parameter | |
540 *----------------------------------------------------------------- | |
541 */ | |
542 switch( mode ) | |
543 { | |
544 case( CMGF_MOD_NotPresent ): | |
545 pSMSSetPrm -> CMGFmode = CMGF_MOD_Pdu; | |
546 break; | |
547 | |
548 case( CMGF_MOD_Txt ): | |
549 case (CMGF_MOD_Pdu ): | |
550 pSMSSetPrm -> CMGFmode = mode; | |
551 break; | |
552 | |
553 default: | |
554 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
555 return( AT_FAIL ); | |
556 } | |
557 | |
558 return( AT_CMPL ); | |
559 } | |
560 | |
561 /* | |
562 +-------------------------------------------------------------------+ | |
563 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
564 | STATE : code ROUTINE : sAT_PercentSMBS | | |
565 +-------------------------------------------------------------------+ | |
566 | |
567 PURPOSE : This is the functional counterpart of the %SMBS | |
568 AT command which is responsible for setting the SMS message format. | |
569 | |
570 <mode>: indicates the message format | |
571 */ | |
572 #ifdef FF_MMI_RIV | |
573 GLOBAL T_ACI_RETURN sAT_PercentSMBS ( T_ACI_CMD_SRC srcId, | |
574 T_ACI_PERC_SMBS_MOD mode ) | |
575 { | |
576 TRACE_FUNCTION ("sAT_PercentSMBS ()"); | |
577 | |
578 /* check command source */ | |
579 if(!cmh_IsVldCmdSrc (srcId)) | |
580 { | |
581 return( AT_FAIL ); | |
582 } | |
583 | |
584 /* process the <mode> parameter */ | |
585 switch( mode ) | |
586 { | |
587 case( PERC_SMBS_MOD_NotPresent ): | |
588 smsShrdPrm.perccmgf_smbs_mode = PERC_SMBS_MOD_DISABLE; /* default */ | |
589 break; | |
590 | |
591 case( PERC_SMBS_MOD_DISABLE ): | |
592 case (PERC_SMBS_MOD_ENABLE ): | |
593 smsShrdPrm.perccmgf_smbs_mode = mode; | |
594 break; | |
595 | |
596 default: | |
597 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
598 return( AT_FAIL ); | |
599 } | |
600 | |
601 return( AT_CMPL ); | |
602 } | |
603 #endif /* #ifdef FF_MMI_RIV */ | |
604 /* | |
605 +-------------------------------------------------------------------+ | |
606 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
607 | STATE : code ROUTINE : sAT_PlusCNMA | | |
608 +-------------------------------------------------------------------+ | |
609 | |
610 PURPOSE : This is the functional counterpart of the +CNMA | |
611 AT command which is responsible for sending the | |
612 new message acknowledgement. | |
613 | |
614 */ | |
615 GLOBAL T_ACI_RETURN sAT_PlusCNMA ( T_ACI_CMD_SRC srcId) | |
616 { | |
617 T_ACI_RETURN ret; /* AT response code */ | |
618 | |
619 TRACE_FUNCTION ("sAT_PlusCNMA ()"); | |
620 | |
621 /* | |
622 *----------------------------------------------------------------- | |
623 * check if command executable | |
624 *----------------------------------------------------------------- | |
625 */ | |
626 if(!cmhSMS_checkAccess (srcId, &ret)) | |
627 return ret; | |
628 | |
629 /* | |
630 *----------------------------------------------------------------- | |
631 * check current service and whether an acknowledgement is expected. | |
632 *----------------------------------------------------------------- | |
633 */ | |
634 | |
635 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus AND | |
636 smsShrdPrm.cnma_ack_expected) | |
637 { | |
638 PALLOC (mnsms_ack_res, MNSMS_ACK_RES); | |
639 | |
640 smsShrdPrm.cnma_ack_expected = FALSE; | |
641 | |
642 mnsms_ack_res->resp = SMS_RP_ACK; | |
643 mnsms_ack_res->sms_sdu.o_buf = 0; | |
644 mnsms_ack_res->sms_sdu.l_buf = 0; | |
645 | |
646 PSENDX (SMS, mnsms_ack_res); | |
647 return ( AT_CMPL ); | |
648 } | |
649 else | |
650 { | |
651 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_NoCnmaAckExpect ); | |
652 return ( AT_FAIL ); | |
653 } | |
654 } | |
655 | |
656 #if defined (SMS_PDU_SUPPORT) | |
657 /* | |
658 +-------------------------------------------------------------------+ | |
659 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
660 | STATE : code ROUTINE : sAT_PlusCNMAPdu | | |
661 +-------------------------------------------------------------------+ | |
662 | |
663 PURPOSE : This is the functional counterpart of the +CNMA | |
664 AT command which is responsible for sending the | |
665 new message acknowledgement in PDU mode | |
666 | |
667 */ | |
668 GLOBAL T_ACI_RETURN sAT_PlusCNMAPdu ( T_ACI_CMD_SRC srcId, | |
669 SHORT n, | |
670 T_ACI_SM_DATA *pdu) | |
671 { | |
672 T_ACI_RETURN ret; /* AT response code */ | |
673 | |
674 TRACE_FUNCTION ("sAT_PlusCNMAPdu ()"); | |
675 | |
676 /* | |
677 *----------------------------------------------------------------- | |
678 * check if command executable | |
679 *----------------------------------------------------------------- | |
680 */ | |
681 if(!cmhSMS_checkAccess (srcId, &ret)) | |
682 return ret; | |
683 | |
684 /* | |
685 *----------------------------------------------------------------- | |
686 * check current service and whether an acknowledgement is expected. | |
687 *----------------------------------------------------------------- | |
688 */ | |
689 if (smsShrdPrm.CSMSservice EQ CSMS_SERV_GsmPh2Plus AND | |
690 smsShrdPrm.cnma_ack_expected) | |
691 { | |
692 PALLOC (mnsms_ack_res, MNSMS_ACK_RES); | |
693 | |
694 smsShrdPrm.cnma_ack_expected = FALSE; | |
695 | |
696 if (n EQ 2) | |
697 mnsms_ack_res->resp = SMS_RP_ERROR; | |
698 else | |
699 mnsms_ack_res->resp = SMS_RP_ACK; | |
700 | |
701 /* one byte for SCA length */ | |
702 if( pdu->len NEQ 0 ) | |
703 { | |
704 mnsms_ack_res->sms_sdu.l_buf = (pdu->len+1) * 8; | |
705 } | |
706 else | |
707 { | |
708 mnsms_ack_res->sms_sdu.l_buf = 0; | |
709 } | |
710 mnsms_ack_res->sms_sdu.o_buf = 0; | |
711 | |
712 /* length of SCA length (is always empty!) */ | |
713 mnsms_ack_res->sms_sdu.buf[0] = 0x00; | |
714 memcpy (&mnsms_ack_res->sms_sdu.buf[1], pdu->data, pdu->len); | |
715 | |
716 PSENDX (SMS, mnsms_ack_res); | |
717 return ( AT_CMPL ); | |
718 } | |
719 else | |
720 { | |
721 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_NoCnmaAckExpect ); | |
722 return ( AT_FAIL ); | |
723 } | |
724 } | |
725 | |
726 | |
727 | |
728 #endif | |
729 | |
730 | |
731 | |
732 /* | |
733 +-------------------------------------------------------------------+ | |
734 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
735 | STATE : code ROUTINE : sAT_PlusCNMI | | |
736 +-------------------------------------------------------------------+ | |
737 | |
738 PURPOSE : This is the functional counterpart of the +CNMI | |
739 AT command which is responsible for setting the | |
740 new message indication parameter. | |
741 | |
742 <mt>: indication routing for SMS-DELIVER | |
743 <bm>: indication routing for CBM | |
744 <ds>: indication routing for SMS-STATUS-REPORT | |
745 */ | |
746 GLOBAL T_ACI_RETURN sAT_PlusCNMI ( T_ACI_CMD_SRC srcId, | |
747 T_ACI_CNMI_MT mt, | |
748 T_ACI_CNMI_BM bm, | |
749 T_ACI_CNMI_DS ds ) | |
750 { | |
751 T_ACI_RETURN ret; /* AT response code */ | |
752 UBYTE chkMtHndl; /* checked parameter <mt>, prm set */ | |
753 UBYTE chkBmHndl; /* checked parameter <bm>, prm set */ | |
754 UBYTE chkDsHndl; /* checked parameter <ds>, prm set */ | |
755 | |
756 T_ACI_CNMI_MT chkMt; /* checked parameter <mt>, cmd set */ | |
757 T_ACI_CNMI_BM chkBm; /* checked parameter <bm>, cmd set */ | |
758 T_ACI_CNMI_DS chkDs; /* checked parameter <ds>, cmd set */ | |
759 | |
760 TRACE_FUNCTION ("sAT_PlusCNMI ()"); | |
761 | |
762 /* | |
763 *----------------------------------------------------------------- | |
764 * check if command executable | |
765 *----------------------------------------------------------------- | |
766 */ | |
767 if(!cmhSMS_checkAccess (srcId, &ret)) | |
768 return ret; | |
769 | |
770 /* | |
771 *----------------------------------------------------------------- | |
772 * process the <mt> parameter, prm set | |
773 *----------------------------------------------------------------- | |
774 */ | |
775 switch( mt ) | |
776 { | |
777 case(CNMI_MT_NotPresent ): chkMtHndl = smsShrdPrm.mtHndl; break; | |
778 case(CNMI_MT_NoSmsDeliverInd): chkMtHndl = MT0; break; | |
779 case(CNMI_MT_SmsDeliverInd ): chkMtHndl = MT1; break; | |
780 case(CNMI_MT_SmsDeliver ): chkMtHndl = MT2; break; | |
781 case(CNMI_MT_SmsDeliverCls3 ): chkMtHndl = MT3; break; | |
782 | |
783 default: | |
784 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
785 return( AT_FAIL ); | |
786 } | |
787 | |
788 /* | |
789 *----------------------------------------------------------------- | |
790 * process the <mt> parameter, cmd set | |
791 *----------------------------------------------------------------- | |
792 */ | |
793 if ( mt EQ CNMI_MT_NotPresent ) | |
794 | |
795 chkMt = smsShrdPrm.CNMImt; | |
796 | |
797 else | |
798 | |
799 chkMt = mt; | |
800 | |
801 /* | |
802 *----------------------------------------------------------------- | |
803 * process the <bm> parameter, prm set | |
804 *----------------------------------------------------------------- | |
805 */ | |
806 switch( bm ) | |
807 { | |
808 case( CNMI_BM_NotPresent ): chkBmHndl = smsShrdPrm.cbmPrm.cbmHndl; | |
809 break; | |
810 case( CNMI_BM_NoCbmInd ): chkBmHndl = BM0; break; | |
811 case( CNMI_BM_Cbm ): chkBmHndl = BM2; break; | |
812 | |
813 default: | |
814 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
815 return( AT_FAIL ); | |
816 } | |
817 | |
818 /* | |
819 *----------------------------------------------------------------- | |
820 * process the <bm> parameter, cmd set | |
821 *----------------------------------------------------------------- | |
822 */ | |
823 if ( bm EQ CNMI_BM_NotPresent ) | |
824 | |
825 chkBm = smsShrdPrm.CNMIbm; | |
826 | |
827 else | |
828 | |
829 chkBm = bm; | |
830 | |
831 /* | |
832 *----------------------------------------------------------------- | |
833 * process the <ds> parameter, prm set | |
834 *----------------------------------------------------------------- | |
835 */ | |
836 switch( ds ) | |
837 { | |
838 case( CNMI_DS_NotPresent ): chkDsHndl = smsShrdPrm.srHndl; break; | |
839 case( CNMI_DS_NoSmsStatRpt ): chkDsHndl = DS0; break; | |
840 case( CNMI_DS_SmsStatRpt ): chkDsHndl = DS1; break; | |
841 | |
842 default: | |
843 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
844 return( AT_FAIL ); | |
845 } | |
846 | |
847 /* | |
848 *----------------------------------------------------------------- | |
849 * process the <ds> parameter, cmd set | |
850 *----------------------------------------------------------------- | |
851 */ | |
852 if ( ds EQ CNMI_DS_NotPresent ) | |
853 | |
854 chkDs = smsShrdPrm.CNMIds; | |
855 | |
856 else | |
857 | |
858 chkDs = ds; | |
859 | |
860 /* | |
861 *----------------------------------------------------------------- | |
862 * copy parameter | |
863 *----------------------------------------------------------------- | |
864 */ | |
865 smsShrdPrm.mtHndl = chkMtHndl; | |
866 smsShrdPrm.cbmPrm.cbmHndl = chkBmHndl; | |
867 smsShrdPrm.srHndl = chkDsHndl; | |
868 | |
869 smsShrdPrm.CNMImt = chkMt; | |
870 smsShrdPrm.CNMIbm = chkBm; | |
871 smsShrdPrm.CNMIds = chkDs; | |
872 | |
873 /* | |
874 *----------------------------------------------------------------- | |
875 * configure SMS | |
876 *----------------------------------------------------------------- | |
877 */ | |
878 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CNMI; | |
879 smsShrdPrm.owner = (T_OWN)srcId; | |
880 smsShrdPrm.smsEntStat.entOwn = srcId; | |
881 /* Implements measure 147,148, 149 */ | |
882 cmhSMS_sendConfigureReq (FALSE); | |
883 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
884 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
885 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
886 | |
887 /* | |
888 *----------------------------------------------------------------- | |
889 * set the new CBCH configuration | |
890 *----------------------------------------------------------------- | |
891 */ | |
892 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId; | |
893 | |
894 if( psaMMI_Cbch() < 0 ) | |
895 { | |
896 TRACE_EVENT( "FATAL RETURN psaSMS in +CNMI" ); | |
897 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
898 return( AT_FAIL ); | |
899 } | |
900 | |
901 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
902 | |
903 return ( AT_CMPL ); | |
904 } | |
905 | |
906 /* | |
907 +-------------------------------------------------------------------+ | |
908 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
909 | STATE : code ROUTINE : sAT_PlusCPMS | | |
910 +-------------------------------------------------------------------+ | |
911 | |
912 PURPOSE : This is the functional counterpart of the +CPMS | |
913 AT command which is responsible for setting the | |
914 preferred message storages. | |
915 | |
916 <mem1>: preferred memory 1 | |
917 <mem2>: preferred memory 2 | |
918 <mem3>: preferred memory 3 | |
919 */ | |
920 GLOBAL T_ACI_RETURN sAT_PlusCPMS ( T_ACI_CMD_SRC srcId, | |
921 T_ACI_SMS_STOR mem1, | |
922 T_ACI_SMS_STOR mem2, | |
923 T_ACI_SMS_STOR mem3 ) | |
924 { | |
925 T_ACI_RETURN ret; /* AT response code */ | |
926 | |
927 UBYTE chkMem1; /* checked parameter <mem1> */ | |
928 UBYTE chkMem2; /* checked parameter <mem2> */ | |
929 UBYTE chkMem3; /* checked parameter <mem3> */ | |
930 | |
931 T_ACI_SMS_STOR_OCC m1; | |
932 T_ACI_SMS_STOR_OCC m2; | |
933 T_ACI_SMS_STOR_OCC m3; | |
934 | |
935 UBYTE isModified = FALSE; | |
936 | |
937 TRACE_FUNCTION ("sAT_PlusCPMS ()"); | |
938 | |
939 | |
940 /* | |
941 *----------------------------------------------------------------- | |
942 * check if command executable | |
943 *----------------------------------------------------------------- | |
944 */ | |
945 if(!cmhSMS_checkAccess (srcId, &ret)) | |
946 return ret; | |
947 | |
948 /* | |
949 *----------------------------------------------------------------- | |
950 * process the <mem1> parameter | |
951 *----------------------------------------------------------------- | |
952 */ | |
953 if( mem1 NEQ SMS_STOR_NotPresent ) | |
954 { | |
955 if( ! cmhSMS_getMemPsa ( mem1, &chkMem1 ) ) | |
956 { | |
957 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
958 return ( AT_FAIL ); | |
959 } | |
960 smsShrdPrm.mem1 = chkMem1; | |
961 } | |
962 | |
963 /* | |
964 *----------------------------------------------------------------- | |
965 * process the <mem2> parameter | |
966 *----------------------------------------------------------------- | |
967 */ | |
968 if( mem2 NEQ SMS_STOR_NotPresent ) | |
969 { | |
970 if( ! cmhSMS_getMemPsa ( mem2, &chkMem2 ) ) | |
971 { | |
972 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
973 return ( AT_FAIL ); | |
974 } | |
975 smsShrdPrm.mem2 = chkMem2; | |
976 } | |
977 | |
978 /* | |
979 *----------------------------------------------------------------- | |
980 * process the <mem3> parameter | |
981 *----------------------------------------------------------------- | |
982 */ | |
983 if( mem3 NEQ SMS_STOR_NotPresent ) | |
984 { | |
985 if( ! cmhSMS_getMemPsa ( mem3, &chkMem3 ) ) | |
986 { | |
987 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
988 return ( AT_FAIL ); | |
989 } | |
990 if (smsShrdPrm.mem3 NEQ chkMem3) | |
991 { | |
992 smsShrdPrm.mem3 = chkMem3; | |
993 isModified = TRUE; | |
994 } | |
995 } | |
996 | |
997 | |
998 /*------------------------------------------------------------------- | |
999 * create and send primitive for configure request | |
1000 *------------------------------------------------------------------- | |
1001 */ | |
1002 if (isModified) | |
1003 /* Implements measure 147,148, 149 */ | |
1004 cmhSMS_sendConfigureReq (FALSE); | |
1005 | |
1006 | |
1007 /* | |
1008 * ----------------------------------------------------------------- | |
1009 * Fills the T_ACI_SMS_STOR_OCC structure with data from the | |
1010 * shared parameter buffer (used mem, total mem). | |
1011 * ----------------------------------------------------------------- | |
1012 */ | |
1013 cmhSMS_setStorOcc ( &m1, smsShrdPrm.mem1 ); | |
1014 cmhSMS_setStorOcc ( &m2, smsShrdPrm.mem2 ); | |
1015 cmhSMS_setStorOcc ( &m3, smsShrdPrm.mem3 ); | |
1016 | |
1017 #ifdef FF_ATI | |
1018 cpmsCallType = SAT_CALL; | |
1019 #endif /* FF_ATI */ | |
1020 | |
1021 R_AT ( RAT_CPMS, srcId ) ( &m1, &m2, &m3 ); | |
1022 | |
1023 return( AT_CMPL ); | |
1024 } | |
1025 | |
1026 /* | |
1027 +-------------------------------------------------------------------+ | |
1028 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1029 | STATE : code ROUTINE : sAT_PlusCMGS_Old | | |
1030 +-------------------------------------------------------------------+ | |
1031 | |
1032 PURPOSE : This is the functional counterpart of the +CMSS | |
1033 AT command which is responsible for sending a short | |
1034 message from memory. | |
1035 | |
1036 This function exists for compatibility reasons. | |
1037 | |
1038 */ | |
1039 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1040 GLOBAL T_ACI_RETURN sAT_PlusCMGS_Old ( T_ACI_CMD_SRC srcId, | |
1041 CHAR* da, | |
1042 T_ACI_TOA* toda, | |
1043 T_ACI_SM_DATA* data, | |
1044 CHAR* sca, | |
1045 T_ACI_TOA* tosca, | |
1046 SHORT isReply ) | |
1047 { | |
1048 TRACE_FUNCTION ("sAT_PlusCMGS_Old ()"); | |
1049 | |
1050 return sAT_PlusCMGS_Gl | |
1051 (srcId, da, toda, data, NULL, sca, tosca, isReply, rAT_PlusCMGS, | |
1052 rAT_PlusCMS); | |
1053 } | |
1054 #endif /*#if defined SMI OR defined MFW OR defined FF_MMI_RIV*/ | |
1055 | |
1056 /* | |
1057 +-------------------------------------------------------------------+ | |
1058 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1059 | STATE : code ROUTINE : sAT_PlusCMGS | | |
1060 +-------------------------------------------------------------------+ | |
1061 | |
1062 PURPOSE : This is the functional counterpart of the +CMGS | |
1063 AT command which is responsible for sending a short | |
1064 message. | |
1065 | |
1066 Features Concatenated SMS. | |
1067 For GPF-MMI. | |
1068 | |
1069 <da>: destination address | |
1070 <toda>: type of destination address | |
1071 <data>: message data | |
1072 <sca>: service center address | |
1073 <tosca>: type of service center address | |
1074 <isReply>: > 0: set TP-Reply-Path explicitly | |
1075 EQ 0: clear TP-Reply-Path explicitly | |
1076 */ | |
1077 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
1078 GLOBAL T_ACI_RETURN sAT_PlusCMGS ( T_ACI_CMD_SRC srcId, | |
1079 CHAR* da, | |
1080 T_ACI_TOA* toda, | |
1081 T_SM_DATA_EXT* src_data, | |
1082 CHAR* sca, | |
1083 T_ACI_TOA* tosca, | |
1084 SHORT isReply ) | |
1085 { | |
1086 T_CONC_INIT_RETURN ret; | |
1087 T_ACI_UDH_DATA udh; | |
1088 | |
1089 T_ACI_SM_DATA tar_data; | |
1090 UBYTE alphabet; | |
1091 | |
1092 TRACE_FUNCTION ("sAT_PlusCMGS ()"); | |
1093 | |
1094 | |
1095 alphabet = cmhSMS_getAlphabetPp ( smsShrdPrm.pSetPrm[srcId]->dcs ); | |
1096 | |
1097 /* cut off more than CONC_MAX_SEGS segments */ | |
1098 if (alphabet EQ 0) | |
1099 { | |
1100 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp7bit_data_conc*CONC_MAX_SEGS); | |
1101 } | |
1102 else | |
1103 { | |
1104 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp8bit_data_conc*CONC_MAX_SEGS); | |
1105 } | |
1106 | |
1107 ret=concSMS_initSend(&tar_data, &udh, srcId, da, toda, src_data, sca, | |
1108 tosca, isReply, alphabet); | |
1109 | |
1110 if (ret EQ CONC_NEEDED) | |
1111 { | |
1112 SET_CONC; | |
1113 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, &udh, sca, tosca, | |
1114 isReply, rConcSMS_PlusCMGS, rConcSMS_PlusCMS_CMGS); | |
1115 } | |
1116 else | |
1117 { | |
1118 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, NULL, sca, tosca, | |
1119 isReply, rAT_PlusCMGS, rAT_PlusCMS); | |
1120 } | |
1121 } | |
1122 #endif /* #if (defined (MFW) OR defined (_CONC_TESTING_) */ | |
1123 | |
1124 /* | |
1125 +-------------------------------------------------------------------+ | |
1126 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1127 | STATE : code ROUTINE : sAT_PlusCMGS | | |
1128 +-------------------------------------------------------------------+ | |
1129 | |
1130 PURPOSE : For Riv-MMI if conc. is not needed. | |
1131 */ | |
1132 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
1133 GLOBAL T_ACI_RETURN sAT_PlusCMGS ( T_ACI_CMD_SRC srcId, | |
1134 CHAR* da, | |
1135 T_ACI_TOA* toda, | |
1136 T_ACI_SM_DATA* src_data, | |
1137 CHAR* sca, | |
1138 T_ACI_TOA* tosca, | |
1139 SHORT isReply ) | |
1140 { | |
1141 TRACE_FUNCTION ("sAT_PlusCMGS ()"); | |
1142 | |
1143 return sAT_PlusCMGS_Gl(srcId, da, toda, src_data, NULL, sca, tosca, | |
1144 isReply, rAT_PlusCMGS, rAT_PlusCMS); | |
1145 } | |
1146 | |
1147 /* | |
1148 +-------------------------------------------------------------------+ | |
1149 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1150 | STATE : code ROUTINE : sAT_PercentCMGS | | |
1151 +-------------------------------------------------------------------+ | |
1152 | |
1153 PURPOSE : Handling Percent CMGS command from Riv-MMI side which | |
1154 contains the UDH also for each segment. | |
1155 */ | |
1156 GLOBAL T_ACI_RETURN sAT_PercentCMGS ( T_ACI_CMD_SRC srcId, | |
1157 CHAR* da, | |
1158 T_ACI_TOA* toda, | |
1159 T_ACI_SM_DATA* src_data, | |
1160 T_ACI_UDH_DATA* udh_data, | |
1161 CHAR* sca, | |
1162 T_ACI_TOA* tosca, | |
1163 SHORT isReply ) | |
1164 { | |
1165 TRACE_FUNCTION ("sAT_PercentCMGS () with udh"); | |
1166 | |
1167 return sAT_PlusCMGS_Gl(srcId, da, toda, src_data, udh_data, sca, tosca, | |
1168 isReply, rAT_PlusCMGS, rAT_PlusCMS); | |
1169 } | |
1170 #endif /*#if defined FF_MMI_RIV*/ | |
1171 | |
1172 /* | |
1173 * The following function has been conditioned out for the FreeCalypso build | |
1174 * as it was failing compilation; it does not appear in the TCS211 version; | |
1175 * to be investigated later. | |
1176 */ | |
1177 | |
1178 #if 0 | |
1179 GLOBAL T_ACI_RETURN sAT_PlusCMGS_byPort( T_ACI_CMD_SRC srcId, | |
1180 CHAR* da, | |
1181 T_ACI_TOA* toda, | |
1182 T_SM_DATA_EXT* src_data, | |
1183 CHAR* sca, | |
1184 T_ACI_TOA* tosca, | |
1185 SHORT isReply, | |
1186 SHORT isSpPORT, | |
1187 SHORT destPORT, | |
1188 SHORT origPORT) | |
1189 { | |
1190 T_CONC_INIT_RETURN ret; | |
1191 T_ACI_UDH_DATA udh; | |
1192 | |
1193 | |
1194 | |
1195 T_ACI_SM_DATA tar_data; | |
1196 UBYTE alphabet; | |
1197 | |
1198 | |
1199 | |
1200 TRACE_FUNCTION ("sAT_PlusCMGS_byPort ()"); | |
1201 | |
1202 | |
1203 | |
1204 memset(&udh, 0, sizeof(T_ACI_UDH_DATA)); | |
1205 alphabet = cmhSMS_getAlphabetPp ( smsShrdPrm.pSetPrm[srcId]->dcs ); | |
1206 | |
1207 | |
1208 | |
1209 ret=concSMS_initSend(&tar_data, &udh, srcId, da, toda, src_data, sca, | |
1210 tosca, isReply, alphabet); | |
1211 if(isSpPORT)//add port data to udh | |
1212 { | |
1213 udh.data[udh.len] = 0x05;//Application Port Addressing 16 bit address | |
1214 udh.data[udh.len+1] = 0x04;//ud length | |
1215 udh.data[udh.len+2] = destPORT>>8;//destination port | |
1216 udh.data[udh.len+3] = destPORT&0xff; | |
1217 udh.data[udh.len+4] = origPORT>>8;//orignal port | |
1218 udh.data[udh.len+5] = origPORT&0xff; | |
1219 udh.len+=6; | |
1220 } | |
1221 if (ret EQ CONC_NEEDED) | |
1222 { | |
1223 SET_CONC; | |
1224 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, &udh, sca, tosca, | |
1225 isReply, rConcSMS_PlusCMGS, rConcSMS_PlusCMS_CMGS); | |
1226 } | |
1227 else if(isSpPORT) | |
1228 { | |
1229 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, &udh, sca, tosca, | |
1230 isReply, rAT_PlusCMGS, rAT_PlusCMS); | |
1231 } | |
1232 else | |
1233 { | |
1234 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, NULL, sca, tosca, | |
1235 isReply, rAT_PlusCMGS, rAT_PlusCMS); | |
1236 } | |
1237 } | |
1238 #endif | |
1239 | |
1240 /* | |
1241 +-------------------------------------------------------------------+ | |
1242 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1243 | STATE : code ROUTINE : sAT_PlusCMGS_Gl | | |
1244 +-------------------------------------------------------------------+ | |
1245 | |
1246 PURPOSE : This is the functional counterpart of the +CMGS | |
1247 AT command which is responsible for sending a short | |
1248 message. | |
1249 | |
1250 <da>: destination address | |
1251 <toda>: type of destination address | |
1252 <data>: message data | |
1253 <udh>: user data header | |
1254 <sca>: service center address | |
1255 <tosca>: type of service center address | |
1256 <isReply>: > 0: set TP-Reply-Path explicitly | |
1257 EQ 0: clear TP-Reply-Path explicitly | |
1258 <rplyCB>: reply call-back | |
1259 <errorCB>: error call-back | |
1260 */ | |
1261 GLOBAL T_ACI_RETURN sAT_PlusCMGS_Gl ( T_ACI_CMD_SRC srcId, | |
1262 CHAR* da, | |
1263 T_ACI_TOA* toda, | |
1264 T_ACI_SM_DATA* data, | |
1265 T_ACI_UDH_DATA* udh, | |
1266 CHAR* sca, | |
1267 T_ACI_TOA* tosca, | |
1268 SHORT isReply, | |
1269 T_CMSS_FCT rplyCB, | |
1270 T_ERROR_FCT errorCB) | |
1271 { | |
1272 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
1273 T_ACI_RETURN ret=AT_CMPL; /* AT response code */ | |
1274 CHAR* restDa = da; /* destination address without */ | |
1275 /* international access function */ | |
1276 /* characters */ | |
1277 CHAR* restSca = sca; /* service center address without */ | |
1278 /* international access function */ | |
1279 /* characters */ | |
1280 | |
1281 T_ACI_SM_DATA packedData; | |
1282 T_tp_da da_addr; | |
1283 UBYTE msgType; | |
1284 UBYTE byte_offset = 0; | |
1285 BOOL mtchFlag; | |
1286 | |
1287 #ifdef _CONC_TESTING_ | |
1288 /* Implements Measure#32 */ | |
1289 #endif | |
1290 | |
1291 TRACE_FUNCTION ("sAT_PlusCMGS_Gl ()"); | |
1292 | |
1293 | |
1294 /* | |
1295 *----------------------------------------------------------------- | |
1296 * check if command executable | |
1297 *----------------------------------------------------------------- | |
1298 */ | |
1299 if(!cmhSMS_checkAccess (srcId, &ret)) | |
1300 return ret; | |
1301 | |
1302 smsShrdPrm.rplyCB.cmgs = rplyCB; | |
1303 smsShrdPrm.errorCB = errorCB; | |
1304 | |
1305 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
1306 | |
1307 /* | |
1308 *----------------------------------------------------------------- | |
1309 * process the <da> parameter | |
1310 *----------------------------------------------------------------- | |
1311 */ | |
1312 if ( da NEQ NULL ) | |
1313 { | |
1314 /* | |
1315 *--------------------------------------------------------------- | |
1316 * process the <toda> parameter | |
1317 *--------------------------------------------------------------- | |
1318 */ | |
1319 if ( toda NEQ NULL ) | |
1320 { | |
1321 da_addr.ton = toda -> ton; | |
1322 da_addr.npi = toda -> npi; | |
1323 } | |
1324 else | |
1325 { | |
1326 restDa = cmhSMS_setToaDef ( da, &da_addr.ton, &da_addr.npi ); | |
1327 } | |
1328 | |
1329 /* start: check if fixed dialing phonebook is enabled */ | |
1330 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1331 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms ) | |
1332 { | |
1333 TRACE_FUNCTION("sAT_PlusCMGS_Gl: FDN"); | |
1334 if ( da_addr.ton NEQ TON_Alphanumeric ) /* not supported by Phonebook */ | |
1335 { | |
1336 TRACE_EVENT_P1("sAT_PlusCMGS_Gl: FDN checking: %s",da); | |
1337 | |
1338 if ( da[0] EQ '+' ) | |
1339 { | |
1340 /* check if '+' is within the string and remove it if it is */ | |
1341 mtchFlag = (pb_check_fdn (0, (const UBYTE *)(da + 1)) EQ PHB_OK); | |
1342 } | |
1343 else | |
1344 { | |
1345 mtchFlag = (pb_check_fdn (0, (const UBYTE *)(da )) EQ PHB_OK); | |
1346 } | |
1347 if ( mtchFlag ) | |
1348 { | |
1349 TRACE_EVENT("sAT_PlusCMGS_Gl: Found match in FDN!"); | |
1350 } | |
1351 else | |
1352 { | |
1353 TRACE_EVENT("sAT_PlusCMGS_Gl: No match in FDN found, SMS rejected!"); | |
1354 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed ); | |
1355 return ( AT_FAIL ); | |
1356 } | |
1357 } | |
1358 else /* TON signals ALPHANUMERIC */ | |
1359 { | |
1360 TRACE_EVENT("FDN doesn't support alphanumeric addr., SMS rejected"); | |
1361 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed ); | |
1362 return ( AT_FAIL ); | |
1363 } | |
1364 } | |
1365 /* end: check fixed dialing phonebook if enabled */ | |
1366 | |
1367 if ( da_addr.ton EQ TON_Alphanumeric ) | |
1368 { | |
1369 if( cmhSMS_packAlphaNumAddr(restDa, &da_addr) EQ AT_FAIL ) | |
1370 { | |
1371 return (AT_FAIL); | |
1372 } | |
1373 } | |
1374 else | |
1375 { | |
1376 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa); | |
1377 da_addr.digits = da_addr.c_num; | |
1378 } | |
1379 } | |
1380 else | |
1381 { | |
1382 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1383 return ( AT_FAIL ); | |
1384 } | |
1385 | |
1386 /* | |
1387 *------------------------------------------------------------------- | |
1388 * create and send primitive for SMS submit | |
1389 *------------------------------------------------------------------- | |
1390 */ | |
1391 { | |
1392 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ); | |
1393 | |
1394 /* | |
1395 *----------------------------------------------------------------- | |
1396 * process the <sca> parameter | |
1397 *----------------------------------------------------------------- | |
1398 */ | |
1399 if ( sca NEQ NULL AND *sca NEQ '\0' ) | |
1400 { | |
1401 /* | |
1402 *--------------------------------------------------------------- | |
1403 * process the <tosca> parameter | |
1404 *--------------------------------------------------------------- | |
1405 */ | |
1406 if ( tosca NEQ NULL ) | |
1407 { | |
1408 smsShrdPrm.tpdu.sc_addr.ton = tosca -> ton; | |
1409 smsShrdPrm.tpdu.sc_addr.npi = tosca -> npi; | |
1410 | |
1411 } | |
1412 else | |
1413 { | |
1414 restSca = cmhSMS_setToaDef( sca, &smsShrdPrm.tpdu.sc_addr.ton, | |
1415 &smsShrdPrm.tpdu.sc_addr.npi); | |
1416 } | |
1417 cmhSMS_getAdrBcd( smsShrdPrm.tpdu.sc_addr.num, | |
1418 &smsShrdPrm.tpdu.sc_addr.c_num, | |
1419 MAX_SMS_ADDR_DIG, restSca); | |
1420 | |
1421 smsShrdPrm.tpdu.sc_addr.v_ton = TRUE; | |
1422 smsShrdPrm.tpdu.sc_addr.v_npi = TRUE; | |
1423 | |
1424 } | |
1425 else | |
1426 { | |
1427 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr)); | |
1428 } | |
1429 | |
1430 /* | |
1431 *----------------------------------------------------------------- | |
1432 * process the <isReply> parameter | |
1433 *----------------------------------------------------------------- | |
1434 */ | |
1435 msgType = (pSMSSetPrm->msgType & ~TP_MTI_MASK) | |
1436 | TP_MTI_SMS_SUBMIT; | |
1437 if (isReply EQ 0) | |
1438 msgType &= ~TP_RP_MASK; /* set TP-Reply-Path bit to 0 */ | |
1439 else if (isReply > 0) | |
1440 msgType |= TP_RP_MASK; /* set TP-Reply-Path bit to 1 */ | |
1441 | |
1442 /* | |
1443 *----------------------------------------------------------------- | |
1444 * process the <data> parameter and | |
1445 * copy already to shared parameter | |
1446 *----------------------------------------------------------------- | |
1447 * reducing from 8 to 7 bit (if DCS is set) | |
1448 *----------------------------------------------------------------- | |
1449 */ | |
1450 | |
1451 if (udh) | |
1452 byte_offset = udh->len+1; | |
1453 | |
1454 if (data EQ NULL) | |
1455 { | |
1456 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1457 PFREE (mnsms_submit_req); | |
1458 | |
1459 return ( AT_FAIL ); | |
1460 } | |
1461 | |
1462 cmhSMS_rdcSmsPp ( byte_offset, | |
1463 pSMSSetPrm -> dcs, | |
1464 ( UBYTE * ) data->data, ( UBYTE ) data->len, | |
1465 packedData.data, | |
1466 ( UBYTE * ) &packedData.len); | |
1467 | |
1468 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT)); | |
1469 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit, | |
1470 srcId, | |
1471 msgType, | |
1472 0, | |
1473 &da_addr, | |
1474 &packedData, | |
1475 data->len, | |
1476 udh ); | |
1477 | |
1478 mnsms_submit_req -> mem_type = smsShrdPrm.mem2; | |
1479 mnsms_submit_req -> rec_num = SMS_RECORD_NOT_EXIST; | |
1480 mnsms_submit_req -> condx = SMS_CONDX_OVR_NON; | |
1481 mnsms_submit_req -> modify = SMS_MODIFY_NON; | |
1482 #ifdef REL99 | |
1483 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
1484 { | |
1485 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
1486 } | |
1487 else | |
1488 { | |
1489 mnsms_submit_req -> auto_rep_flag = FALSE; | |
1490 } | |
1491 #endif | |
1492 | |
1493 /* | |
1494 *----------------------------------------------------------------- | |
1495 * check if message should be transfered directly to SIM for SAT | |
1496 *----------------------------------------------------------------- | |
1497 */ | |
1498 | |
1499 #ifdef SIM_TOOLKIT | |
1500 | |
1501 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )) | |
1502 { | |
1503 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE) | |
1504 { | |
1505 ret = cmhSAT_MoSmCntr( smsShrdPrm.tpdu.sc_addr, | |
1506 da_addr, | |
1507 (UBYTE)srcId); | |
1508 } | |
1509 else | |
1510 { | |
1511 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
1512 } | |
1513 } | |
1514 | |
1515 /* SIM_TOOLKIT_REQ was sent */ | |
1516 if (ret NEQ AT_CMPL) | |
1517 { | |
1518 /* save primitive address for SIM_TOOLKIT response */ | |
1519 sat_mnsms_submit_req = mnsms_submit_req; | |
1520 | |
1521 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS; | |
1522 smsShrdPrm.owner = (T_OWN)srcId; | |
1523 smsShrdPrm.smsEntStat.entOwn = srcId; | |
1524 | |
1525 /* mnsms_submit_req is send and coded in cmhSAT_ResSMCntrlBySIM() */ | |
1526 | |
1527 return ret; | |
1528 } | |
1529 #endif /* SIM_TOOLKIT */ | |
1530 | |
1531 /* code SMS-SUBMIT here */ | |
1532 cmhSMS_codeMsg (&mnsms_submit_req->sms_sdu, SMS_VT_SUBMIT, | |
1533 &smsShrdPrm.tpdu.sc_addr, SMS_SUBMIT, | |
1534 (UBYTE*)smsShrdPrm.tpdu.tp_submit); | |
1535 | |
1536 PSENDX (SMS, mnsms_submit_req); | |
1537 | |
1538 #ifdef _CONC_TESTING_ | |
1539 /* Implements Measure#32 */ | |
1540 cmhSMS_sdu_buf_print(&(mnsms_submit_req->sms_sdu.buf[0]), 0); | |
1541 #endif | |
1542 | |
1543 if (smsShrdPrm.tpdu.tp_submit NEQ NULL) | |
1544 { | |
1545 ACI_MFREE(smsShrdPrm.tpdu.tp_submit); | |
1546 smsShrdPrm.tpdu.tp_submit = NULL; | |
1547 } | |
1548 } | |
1549 | |
1550 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS; | |
1551 smsShrdPrm.owner = (T_OWN)srcId; | |
1552 smsShrdPrm.smsEntStat.entOwn = srcId; | |
1553 | |
1554 return( AT_EXCT ); | |
1555 } | |
1556 | |
1557 #if defined (SMS_PDU_SUPPORT) || defined (SIM_TOOLKIT) | |
1558 | |
1559 /* | |
1560 +-------------------------------------------------------------------+ | |
1561 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1562 | STATE : code ROUTINE : sAT_PlusCMGSPdu | | |
1563 +-------------------------------------------------------------------+ | |
1564 | |
1565 PURPOSE : This is the functional counterpart of the +CMGS | |
1566 AT command which is responsible for sending a short | |
1567 message in pdu mode. | |
1568 | |
1569 */ | |
1570 GLOBAL T_ACI_RETURN sAT_PlusCMGSPdu ( T_ACI_CMD_SRC srcId, | |
1571 T_ACI_SM_DATA *pdu ) | |
1572 { | |
1573 T_ACI_RETURN ret=AT_CMPL; /* AT response code */ | |
1574 T_rp_addr sc_addr; | |
1575 T_tp_da dest_addr; | |
1576 UBYTE len; | |
1577 | |
1578 CHAR daString[MAX_DIAL_LEN]; | |
1579 | |
1580 TRACE_FUNCTION ("sAT_PlusCMGSPdu()"); | |
1581 | |
1582 /* | |
1583 *----------------------------------------------------------------- | |
1584 * check if command executable | |
1585 *----------------------------------------------------------------- | |
1586 */ | |
1587 if(!cmhSMS_checkAccess (srcId, &ret)) | |
1588 return ret; | |
1589 | |
1590 | |
1591 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1592 smsShrdPrm.rplyCB.cmgs = rAT_PlusCMGS; | |
1593 smsShrdPrm.errorCB = rAT_PlusCMS; | |
1594 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */ | |
1595 | |
1596 /* | |
1597 *------------------------------------------------------------------- | |
1598 * create and send primitive for SMS submit | |
1599 *------------------------------------------------------------------- | |
1600 */ | |
1601 { | |
1602 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ); | |
1603 | |
1604 mnsms_submit_req -> mem_type = smsShrdPrm.mem2; | |
1605 mnsms_submit_req -> rec_num = SMS_RECORD_NOT_EXIST; | |
1606 mnsms_submit_req -> condx = SMS_CONDX_OVR_NON; | |
1607 mnsms_submit_req -> modify = SMS_MODIFY_NON; | |
1608 | |
1609 #ifdef REL99 | |
1610 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
1611 { | |
1612 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
1613 } | |
1614 else | |
1615 { | |
1616 mnsms_submit_req -> auto_rep_flag = FALSE; | |
1617 } | |
1618 #endif /* REL99 */ | |
1619 | |
1620 if ( pdu->len > 0 ) | |
1621 { | |
1622 mnsms_submit_req->sms_sdu.l_buf = pdu->len * 8; | |
1623 mnsms_submit_req->sms_sdu.o_buf = 0; | |
1624 memcpy (mnsms_submit_req->sms_sdu.buf, pdu->data, pdu->len); | |
1625 } | |
1626 else | |
1627 { | |
1628 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1629 PFREE (mnsms_submit_req); | |
1630 return ( AT_FAIL ); | |
1631 } | |
1632 | |
1633 | |
1634 len = DecodeRPAddress( &sc_addr.c_num, &sc_addr.ton, | |
1635 &sc_addr.npi, (UBYTE*)&sc_addr.num, pdu->data ); | |
1636 | |
1637 DecodeTPAddress( &dest_addr.c_num, &dest_addr.ton, | |
1638 &dest_addr.npi, (UBYTE*)&dest_addr.num, pdu->data+len+2); | |
1639 | |
1640 /* start: check number if fdn is activated and search number */ | |
1641 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR | |
1642 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND | |
1643 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/ | |
1644 //TISH, patch for OMAPS00129150 | |
1645 //start | |
1646 #if 0 | |
1647 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1648 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms ) | |
1649 #else | |
1650 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1651 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms AND srcId NEQ OWN_SRC_SAT) | |
1652 #endif | |
1653 //end | |
1654 { | |
1655 cmhPHB_getAdrStr(daString, MAX_DIAL_LEN-1, | |
1656 pdu->data+len+4, dest_addr.c_num); | |
1657 | |
1658 TRACE_EVENT_P1("sAT_PlusCMGSPdu: FDN checking %s:", daString); | |
1659 | |
1660 if ( dest_addr.ton NEQ TON_Alphanumeric ) /* not supported by Phonebook */ | |
1661 { | |
1662 | |
1663 if (pb_check_fdn (0, (const UBYTE*)daString) EQ PHB_OK) | |
1664 { | |
1665 TRACE_EVENT("sAT_PlusCMGSPdu: Found match in FDN"); | |
1666 } | |
1667 else | |
1668 { | |
1669 TRACE_EVENT("sAT_PlusCMGSPdu: No match in FDN found, SMS rejected"); | |
1670 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed ); | |
1671 return ( AT_FAIL ); | |
1672 } | |
1673 } | |
1674 else /* da alphanumeric encoded */ | |
1675 { | |
1676 TRACE_EVENT("FDN doesn't support alphanumeric addr., SMS rejected"); | |
1677 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed ); | |
1678 return ( AT_FAIL ); | |
1679 } | |
1680 } | |
1681 /* end: check number if fdn is activated and search number */ | |
1682 | |
1683 /* | |
1684 *----------------------------------------------------------------- | |
1685 * check if message should be transfered directly to SIM for SAT | |
1686 *----------------------------------------------------------------- | |
1687 */ | |
1688 | |
1689 #ifdef SIM_TOOLKIT | |
1690 | |
1691 | |
1692 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )) | |
1693 { | |
1694 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE) | |
1695 { | |
1696 ret = cmhSAT_MoSmCntr( sc_addr, | |
1697 dest_addr, | |
1698 (UBYTE)srcId ); | |
1699 } | |
1700 else | |
1701 { | |
1702 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
1703 } | |
1704 } | |
1705 | |
1706 if (ret NEQ AT_CMPL) | |
1707 { | |
1708 /* save primitive address for SIM_TOOLKIT response */ | |
1709 sat_mnsms_submit_req = mnsms_submit_req; | |
1710 | |
1711 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS; | |
1712 smsShrdPrm.owner = (T_OWN)srcId; | |
1713 smsShrdPrm.smsEntStat.entOwn = srcId; | |
1714 | |
1715 return ret; | |
1716 /* PFREE(mnsms_submit_req); | |
1717 * NO PRIMITVE FREE !!! | |
1718 */ | |
1719 } | |
1720 #endif /* SIM_TOOLKIT */ | |
1721 | |
1722 | |
1723 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
1724 if ((srcId EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) AND | |
1725 (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1)) | |
1726 { | |
1727 /* | |
1728 ** MMI is a Cust1 Application | |
1729 ** Forward the original PDU to the MMI, and free the Primitive | |
1730 ** (it will be recreated when the MMI sends its Request) | |
1731 */ | |
1732 cmhSAT_Cust1StkCmdInd(); | |
1733 PFREE(mnsms_submit_req); | |
1734 | |
1735 /* | |
1736 ** Ensure that the SMS parameters are reset, so that the SMS Entity is freed to | |
1737 ** process the command later. | |
1738 */ | |
1739 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
1740 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
1741 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE; | |
1742 | |
1743 return( AT_EXCT ); | |
1744 } | |
1745 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
1746 PSENDX (SMS, mnsms_submit_req); | |
1747 } | |
1748 | |
1749 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS; | |
1750 smsShrdPrm.owner = (T_OWN)srcId; | |
1751 smsShrdPrm.smsEntStat.entOwn = srcId; | |
1752 | |
1753 return( AT_EXCT ); | |
1754 } | |
1755 | |
1756 #endif | |
1757 | |
1758 | |
1759 /* | |
1760 +-------------------------------------------------------------------+ | |
1761 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1762 | STATE : code ROUTINE : sAT_PlusCMSS | | |
1763 +-------------------------------------------------------------------+ | |
1764 | |
1765 PURPOSE : This is the functional counterpart of the +CMSS | |
1766 AT command which is responsible for sending a short | |
1767 message from memory. | |
1768 | |
1769 Features Concatenated SMS. | |
1770 For GPF-MMI. | |
1771 | |
1772 <index>: storage area index | |
1773 <da>: destination address | |
1774 <toda>: type of destination address | |
1775 */ | |
1776 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
1777 GLOBAL T_ACI_RETURN sAT_PlusCMSS ( T_ACI_CMD_SRC srcId, | |
1778 UBYTE index, | |
1779 CHAR* da, | |
1780 T_ACI_TOA* toda ) | |
1781 { | |
1782 T_CONC_INIT_RETURN ret; | |
1783 TRACE_FUNCTION ("sAT_PlusCMSS ()"); | |
1784 | |
1785 ret=concSMS_initSendFromMem(srcId, &index, da, toda); | |
1786 | |
1787 if (ret EQ CONC_NEEDED) | |
1788 { | |
1789 SET_CONC; | |
1790 | |
1791 /* memorize mem2, this is for rConcSMS_PlusCMGS */ | |
1792 concShrdPrm.mem_store = smsShrdPrm.mem2; | |
1793 | |
1794 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rConcSMS_PlusCMSS, | |
1795 rConcSMS_PlusCMS_CMSS); | |
1796 } | |
1797 else if (ret EQ CONC_NOT_NEEDED) | |
1798 { | |
1799 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rAT_PlusCMSS, | |
1800 rAT_PlusCMS); | |
1801 } | |
1802 else | |
1803 { | |
1804 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
1805 return ( AT_FAIL ); | |
1806 } | |
1807 } | |
1808 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/ | |
1809 | |
1810 /* | |
1811 +-------------------------------------------------------------------+ | |
1812 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1813 | STATE : code ROUTINE : sAT_PlusCMSS | | |
1814 +-------------------------------------------------------------------+ | |
1815 | |
1816 PURPOSE : For Riv-MMI. | |
1817 */ | |
1818 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
1819 GLOBAL T_ACI_RETURN sAT_PlusCMSS ( T_ACI_CMD_SRC srcId, | |
1820 UBYTE index, | |
1821 CHAR* da, | |
1822 T_ACI_TOA* toda ) | |
1823 { | |
1824 | |
1825 TRACE_FUNCTION ("sAT_PlusCMSS ()"); | |
1826 TRACE_EVENT_P1("sAT_PlusCMGS () index: %d", index); | |
1827 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rAT_PlusCMSS, | |
1828 rAT_PlusCMS); | |
1829 | |
1830 } | |
1831 #endif /*#if defined (FF_MMI_RIV)*/ | |
1832 | |
1833 /* | |
1834 +-------------------------------------------------------------------+ | |
1835 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
1836 | STATE : code ROUTINE : sAT_PlusCMSS_Gl | | |
1837 +-------------------------------------------------------------------+ | |
1838 | |
1839 PURPOSE : This is the functional counterpart of the +CMSS | |
1840 AT command which is responsible for sending a short | |
1841 message from memory. | |
1842 | |
1843 <index>: storage area index | |
1844 <da>: destination address | |
1845 <toda>: type of destination address | |
1846 <rplyCB>: reply call-back | |
1847 <errorCB>: error call-back | |
1848 */ | |
1849 GLOBAL T_ACI_RETURN sAT_PlusCMSS_Gl ( T_ACI_CMD_SRC srcId, | |
1850 UBYTE index, | |
1851 CHAR* da, | |
1852 T_ACI_TOA* toda, | |
1853 T_CMSS_FCT rplyCB, | |
1854 T_ERROR_FCT errorCB ) | |
1855 { | |
1856 T_SMS_SET_PRM * pSMSSetPrm; | |
1857 T_ACI_RETURN ret; /* AT response code */ | |
1858 CHAR *restDa = da; /* destination address without */ | |
1859 /* international access function */ | |
1860 /* characters */ | |
1861 T_tp_da da_addr; | |
1862 | |
1863 #ifdef _CONC_TESTING_ | |
1864 /* Implements Measure#32 */ | |
1865 #endif | |
1866 | |
1867 TRACE_FUNCTION ("sAT_PlusCMSS_Gl ()"); | |
1868 | |
1869 /* | |
1870 *----------------------------------------------------------------- | |
1871 * check if command executable | |
1872 *----------------------------------------------------------------- | |
1873 */ | |
1874 if(!cmhSMS_checkAccess (srcId, &ret)) | |
1875 return ret; | |
1876 | |
1877 | |
1878 smsShrdPrm.rplyCB.cmss = rplyCB; | |
1879 smsShrdPrm.errorCB = errorCB; | |
1880 | |
1881 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
1882 | |
1883 | |
1884 /* | |
1885 *----------------------------------------------------------------- | |
1886 * process the <da> parameter | |
1887 *----------------------------------------------------------------- | |
1888 */ | |
1889 if ( da NEQ NULL ) | |
1890 { | |
1891 /* | |
1892 *--------------------------------------------------------------- | |
1893 * process the <toda> parameter | |
1894 *--------------------------------------------------------------- | |
1895 */ | |
1896 if ( toda NEQ NULL ) | |
1897 { | |
1898 da_addr.ton = toda -> ton; | |
1899 da_addr.npi = toda -> npi; | |
1900 } | |
1901 else | |
1902 { | |
1903 restDa = cmhSMS_setToaDef ( da, &da_addr.ton, | |
1904 &da_addr.npi ); | |
1905 } | |
1906 | |
1907 if ( da_addr.ton EQ TON_Alphanumeric ) | |
1908 { | |
1909 if( cmhSMS_packAlphaNumAddr(restDa, &da_addr) EQ AT_FAIL ) | |
1910 { | |
1911 return (AT_FAIL); | |
1912 } | |
1913 } | |
1914 else | |
1915 { | |
1916 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, | |
1917 MAX_SMS_ADDR_DIG, restDa); | |
1918 da_addr.digits = da_addr.c_num; | |
1919 } | |
1920 | |
1921 /* check da_addr if FDN enabled */ | |
1922 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR | |
1923 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND | |
1924 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/ | |
1925 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1926 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms ) | |
1927 { | |
1928 | |
1929 TRACE_EVENT_P1("sAT_PlusCMSS_Gl: FDN check of %s", restDa ); | |
1930 | |
1931 if (pb_check_fdn (0, (const UBYTE*) restDa) EQ PHB_OK) | |
1932 { | |
1933 TRACE_EVENT("sAT_PlusCMSS_Gl: Found match in FDN!"); | |
1934 } | |
1935 else | |
1936 { | |
1937 TRACE_EVENT("sAT_PlusCMSS_Gl: No match in FDN found, SMS rejected!"); | |
1938 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed ); | |
1939 return ( AT_FAIL ); | |
1940 } | |
1941 } | |
1942 /* end: check FDN if enabled */ | |
1943 } | |
1944 else | |
1945 { | |
1946 #ifdef SIM_TOOLKIT | |
1947 /* FDN entry is already controlled by SAT */ | |
1948 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )) | |
1949 { | |
1950 memset (&da_addr, 0, sizeof(T_tp_da)); | |
1951 } | |
1952 else | |
1953 { | |
1954 #endif | |
1955 /* if FDN enabled read SMS from storage and verify address | |
1956 in callback function cmhSMS_SMReadCMSS() */ | |
1957 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR | |
1958 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND | |
1959 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/ | |
1960 if (pb_get_fdn_mode () EQ FDN_ENABLE AND | |
1961 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms ) | |
1962 { | |
1963 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS; | |
1964 smsShrdPrm.owner = (T_OWN)srcId; | |
1965 smsShrdPrm.smsEntStat.entOwn = srcId; | |
1966 psaSMS_ReadReq(smsShrdPrm.mem2, index, READ_PREVIEW, SMS_STAT_NotPresent); | |
1967 return ( AT_EXCT ); | |
1968 } | |
1969 else /* proceed with empty address */ | |
1970 { | |
1971 memset (&da_addr, 0, sizeof(T_tp_da)); | |
1972 } | |
1973 #ifdef SIM_TOOLKIT | |
1974 } /* end else psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )*/ | |
1975 #endif | |
1976 | |
1977 } | |
1978 | |
1979 | |
1980 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT)); | |
1981 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit, | |
1982 srcId, | |
1983 0, /* fo */ | |
1984 0, | |
1985 &da_addr, | |
1986 NULL, /* data */ | |
1987 0, | |
1988 NULL /* udh */ ); | |
1989 | |
1990 | |
1991 { | |
1992 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ); | |
1993 memset (mnsms_submit_req, 0, sizeof(T_MNSMS_SUBMIT_REQ)); | |
1994 | |
1995 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr)); | |
1996 mnsms_submit_req -> modify = SMS_MODIFY_SCA; | |
1997 | |
1998 if (da_addr.digits NEQ 0) | |
1999 { | |
2000 /* modify destination address */ | |
2001 mnsms_submit_req -> modify |= SMS_MODIFY_TPOA; | |
2002 } | |
2003 mnsms_submit_req -> mem_type = smsShrdPrm.mem2; | |
2004 mnsms_submit_req -> rec_num = index; | |
2005 mnsms_submit_req -> condx = SMS_CONDX_OVR_ANY; | |
2006 | |
2007 #ifdef REL99 | |
2008 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
2009 { | |
2010 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
2011 } | |
2012 else | |
2013 { | |
2014 mnsms_submit_req -> auto_rep_flag = FALSE; | |
2015 } | |
2016 #endif /* REL99 */ | |
2017 | |
2018 | |
2019 /* | |
2020 *----------------------------------------------------------------- | |
2021 * read the short message from memory | |
2022 *----------------------------------------------------------------- | |
2023 */ | |
2024 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS; | |
2025 smsShrdPrm.owner = (T_OWN)srcId; | |
2026 smsShrdPrm.smsEntStat.entOwn = srcId; | |
2027 | |
2028 /* | |
2029 *----------------------------------------------------------------- | |
2030 * check if message should be transfered directly to SIM for SAT | |
2031 *----------------------------------------------------------------- | |
2032 */ | |
2033 #ifdef SIM_TOOLKIT | |
2034 | |
2035 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )) | |
2036 { | |
2037 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE) | |
2038 { | |
2039 if (da_addr.digits) | |
2040 { | |
2041 ret = cmhSAT_MoSmCntr( smsShrdPrm.tpdu.sc_addr, | |
2042 da_addr, | |
2043 (UBYTE)srcId ); | |
2044 if (ret NEQ AT_CMPL) | |
2045 { | |
2046 /* save primitive address for SIM_TOOLKIT response */ | |
2047 sat_mnsms_submit_req = mnsms_submit_req; | |
2048 return ret; | |
2049 } | |
2050 } | |
2051 else | |
2052 { | |
2053 /* send MNSMS_READ_REQ to SMS entity */ | |
2054 psaSMS_ReadReq ( smsShrdPrm.mem2, index, READ_PREVIEW, SMS_STAT_NotPresent); | |
2055 if (smsShrdPrm.tpdu.tp_submit NEQ NULL) | |
2056 { | |
2057 ACI_MFREE(smsShrdPrm.tpdu.tp_submit); | |
2058 smsShrdPrm.tpdu.tp_submit = NULL; | |
2059 } | |
2060 PFREE(mnsms_submit_req); | |
2061 return ( AT_EXCT ); | |
2062 } | |
2063 } | |
2064 else | |
2065 { | |
2066 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE; | |
2067 } | |
2068 } | |
2069 | |
2070 #endif /* SIM_TOOLKIT */ | |
2071 | |
2072 /* code SMS-SUBMIT here */ | |
2073 cmhSMS_codeMsg (&mnsms_submit_req->sms_sdu, SMS_VT_SUBMIT, | |
2074 &smsShrdPrm.tpdu.sc_addr, SMS_SUBMIT, | |
2075 (UBYTE*)smsShrdPrm.tpdu.tp_submit); | |
2076 | |
2077 /* send message */ | |
2078 PSENDX (SMS, mnsms_submit_req); | |
2079 #ifdef _CONC_TESTING_ | |
2080 /* Implements Measure#32 */ | |
2081 cmhSMS_sdu_buf_print(&(mnsms_submit_req->sms_sdu.buf[0]), 0); | |
2082 #endif | |
2083 if (smsShrdPrm.tpdu.tp_submit NEQ NULL) | |
2084 { | |
2085 ACI_MFREE(smsShrdPrm.tpdu.tp_submit); | |
2086 smsShrdPrm.tpdu.tp_submit = NULL; | |
2087 } | |
2088 } | |
2089 | |
2090 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS; | |
2091 smsShrdPrm.owner = (T_OWN)srcId; | |
2092 smsShrdPrm.smsEntStat.entOwn = srcId; | |
2093 | |
2094 return( AT_EXCT ); | |
2095 } | |
2096 | |
2097 | |
2098 /* | |
2099 +-------------------------------------------------------------------+ | |
2100 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2101 | STATE : code ROUTINE : sAT_PlusCMGD | | |
2102 +-------------------------------------------------------------------+ | |
2103 | |
2104 PURPOSE : This is the functional counterpart of the +CMGD | |
2105 AT command which is responsible for deleting a short | |
2106 message from memory. | |
2107 | |
2108 Features Concatenated SMS. | |
2109 For GPF-MMI. | |
2110 | |
2111 <index>: storage area index | |
2112 */ | |
2113 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
2114 GLOBAL T_ACI_RETURN sAT_PlusCMGD ( T_ACI_CMD_SRC srcId, | |
2115 UBYTE index, | |
2116 UBYTE status ) | |
2117 { | |
2118 T_CONC_INIT_RETURN ret; | |
2119 | |
2120 TRACE_FUNCTION ("sAT_PlusCMGD ()"); | |
2121 | |
2122 ret=concSMS_initDeleteFromMem (srcId, index); | |
2123 | |
2124 if (ret EQ CONC_NEEDED) | |
2125 { | |
2126 SET_CONC; | |
2127 | |
2128 /* memorize mem1, this is for rConcSMS_PlusCMGD */ | |
2129 concShrdPrm.mem_store = smsShrdPrm.mem1; | |
2130 | |
2131 return sAT_PlusCMGD_Gl(srcId, index, status, rConcSMS_PlusCMGD, | |
2132 rConcSMS_PlusCMS_CMGD); | |
2133 } | |
2134 else if (ret EQ CONC_NOT_NEEDED) | |
2135 { | |
2136 return sAT_PlusCMGD_Gl(srcId, index, status, rAT_PlusCMGD, rAT_PlusCMS); | |
2137 } | |
2138 else | |
2139 { | |
2140 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
2141 return ( AT_FAIL ); | |
2142 } | |
2143 } | |
2144 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/ | |
2145 | |
2146 /* | |
2147 +-------------------------------------------------------------------+ | |
2148 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2149 | STATE : code ROUTINE : sAT_PlusCMGD | | |
2150 +-------------------------------------------------------------------+ | |
2151 | |
2152 PURPOSE : For Riv-MMI. | |
2153 */ | |
2154 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
2155 GLOBAL T_ACI_RETURN sAT_PlusCMGD ( T_ACI_CMD_SRC srcId, | |
2156 UBYTE index, | |
2157 UBYTE status ) | |
2158 { | |
2159 TRACE_FUNCTION ("sAT_PlusCMGD ()"); | |
2160 TRACE_EVENT_P1("sAT_PlusCMGD () index: %d", index); | |
2161 | |
2162 return sAT_PlusCMGD_Gl(srcId, index, status, rAT_PlusCMGD, rAT_PlusCMS); | |
2163 } | |
2164 #endif /*#if defined (FF_MMI_RIV)*/ | |
2165 | |
2166 /* | |
2167 +-------------------------------------------------------------------+ | |
2168 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2169 | STATE : code ROUTINE : sAT_PlusCMGD_Gl | | |
2170 +-------------------------------------------------------------------+ | |
2171 | |
2172 PURPOSE : This is the functional counterpart of the +CMGD | |
2173 AT command which is responsible for deleting a short | |
2174 message from memory. | |
2175 | |
2176 <index>: storage area index | |
2177 <rplyCB>: reply call-back | |
2178 <errorCB>: error call-back | |
2179 */ | |
2180 GLOBAL T_ACI_RETURN sAT_PlusCMGD_Gl ( T_ACI_CMD_SRC srcId, | |
2181 UBYTE index, | |
2182 UBYTE status, | |
2183 T_CMGD_FCT rplyCB, | |
2184 T_ERROR_FCT errorCB ) | |
2185 { | |
2186 T_ACI_RETURN ret; /* AT response code */ | |
2187 | |
2188 TRACE_FUNCTION ("sAT_PlusCMGD_Gl ()"); | |
2189 | |
2190 /* | |
2191 *----------------------------------------------------------------- | |
2192 * check if command executable | |
2193 *----------------------------------------------------------------- | |
2194 */ | |
2195 if(!cmhSMS_checkAccess (srcId, &ret)) | |
2196 return ret; | |
2197 | |
2198 smsShrdPrm.errorCB = errorCB; | |
2199 smsShrdPrm.rplyCB.cmgd = rplyCB; | |
2200 | |
2201 cmhSMS_SendDelete_Req (index, status); | |
2202 | |
2203 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGD; | |
2204 smsShrdPrm.owner = (T_OWN)srcId; | |
2205 smsShrdPrm.smsEntStat.entOwn = srcId; | |
2206 | |
2207 return( AT_EXCT ); | |
2208 } | |
2209 | |
2210 | |
2211 | |
2212 | |
2213 /* | |
2214 +-------------------------------------------------------------------+ | |
2215 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2216 | STATE : code ROUTINE : sAT_PlusCMGW_Old | | |
2217 +-------------------------------------------------------------------+ | |
2218 | |
2219 PURPOSE : This is the functional counterpart of the +CMGW | |
2220 AT command which is responsible for writing a short | |
2221 message to memory. | |
2222 | |
2223 <index>: index of location area to be written | |
2224 <address>: originating/destination address | |
2225 <toa>: type of address | |
2226 <stat>: message status | |
2227 <data>: message data | |
2228 <sca>: service center address | |
2229 <tosca>: type of service center address | |
2230 <isReply>: > 0: set TP-Reply-Path explicitly | |
2231 EQ 0: clear TP-Reply-Path explicitly | |
2232 */ | |
2233 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
2234 GLOBAL T_ACI_RETURN sAT_PlusCMGW_Old ( T_ACI_CMD_SRC srcId, | |
2235 SHORT index, | |
2236 CHAR* address, | |
2237 T_ACI_TOA* toa, | |
2238 T_ACI_SMS_STAT stat, | |
2239 UBYTE msg_ref, | |
2240 T_ACI_SM_DATA* data, | |
2241 CHAR* sca, | |
2242 T_ACI_TOA* tosca, | |
2243 SHORT isReply ) | |
2244 { | |
2245 TRACE_FUNCTION ("sAT_PlusCMGW_Old ()"); | |
2246 | |
2247 return sAT_PlusCMGW_Gl | |
2248 (srcId, index, address, toa, stat, msg_ref, data, | |
2249 NULL, sca, tosca, isReply, rAT_PlusCMGW, rAT_PlusCMS); | |
2250 } | |
2251 #endif /*#if defined SMI OR defined MFW */ | |
2252 | |
2253 /* | |
2254 +-------------------------------------------------------------------+ | |
2255 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2256 | STATE : code ROUTINE : sAT_PlusCMGW | | |
2257 +-------------------------------------------------------------------+ | |
2258 | |
2259 PURPOSE : This is the functional counterpart of the +CMGW | |
2260 AT command which is responsible for writing a short | |
2261 message to memory. | |
2262 | |
2263 Features Concatenated SMS. | |
2264 For GPF-MMI. | |
2265 | |
2266 <index>: index of location area to be written | |
2267 <address>: originating/destination address | |
2268 <toa>: type of address | |
2269 <stat>: message status | |
2270 <data>: message data | |
2271 <sca>: service center address | |
2272 <tosca>: type of service center address | |
2273 <isReply>: > 0: set TP-Reply-Path explicitly | |
2274 EQ 0: clear TP-Reply-Path explicitly | |
2275 */ | |
2276 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
2277 GLOBAL T_ACI_RETURN sAT_PlusCMGW ( T_ACI_CMD_SRC srcId, | |
2278 SHORT index, | |
2279 CHAR* address, | |
2280 T_ACI_TOA* toa, | |
2281 T_ACI_SMS_STAT stat, | |
2282 UBYTE msg_ref, | |
2283 T_SM_DATA_EXT* src_data, | |
2284 CHAR* sca, | |
2285 T_ACI_TOA* tosca, | |
2286 SHORT isReply ) | |
2287 { | |
2288 T_CONC_INIT_RETURN ret; | |
2289 T_ACI_UDH_DATA udh; | |
2290 T_ACI_SM_DATA tar_data; | |
2291 UBYTE alphabet; | |
2292 | |
2293 TRACE_FUNCTION ("sAT_PlusCMGW ()"); | |
2294 | |
2295 | |
2296 alphabet = cmhSMS_getAlphabetPp ( smsShrdPrm.pSetPrm[srcId]->dcs ); | |
2297 | |
2298 /* cut off more than CONC_MAX_SEGS segments */ | |
2299 if (alphabet EQ 0) | |
2300 { | |
2301 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp7bit_data_conc*CONC_MAX_SEGS); | |
2302 } | |
2303 else | |
2304 { | |
2305 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp8bit_data_conc*CONC_MAX_SEGS); | |
2306 } | |
2307 | |
2308 ret=concSMS_initStoreInMem(&tar_data, &udh, srcId, index, address, toa, stat, | |
2309 msg_ref, src_data, sca, tosca, isReply, alphabet); | |
2310 | |
2311 if (ret EQ CONC_NEEDED) | |
2312 { | |
2313 /* check if concBuffer is already full */ | |
2314 if (concSMS_concBufferAvail() EQ FALSE) | |
2315 { | |
2316 TRACE_ERROR ("no concBuffer available, so CSMS can not be written"); | |
2317 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_MemFull ); | |
2318 return AT_FAIL; | |
2319 } | |
2320 | |
2321 /* limit the maximum number of CSMS segments to MAX_SEG_TOTAL */ | |
2322 if (concShrdPrm.elem_count+concShrdPrm.udh.max_num > MAX_SEG_TOTAL) | |
2323 { | |
2324 TRACE_ERROR ("total number of segments will exceed the maximum, so CSMS can not be written"); | |
2325 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_UnknownErr ); | |
2326 return AT_FAIL; | |
2327 } | |
2328 | |
2329 SET_CONC; | |
2330 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat, | |
2331 msg_ref, &tar_data, &udh, sca, tosca, isReply, | |
2332 rConcSMS_PlusCMGW, rConcSMS_PlusCMS_CMGW); | |
2333 } | |
2334 else | |
2335 { | |
2336 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat, | |
2337 msg_ref, &tar_data, (T_ACI_UDH_DATA*)NULL, | |
2338 sca, tosca, isReply, | |
2339 rAT_PlusCMGW, rAT_PlusCMS); | |
2340 } | |
2341 } | |
2342 #endif /*#if defined (MFW) OR defined (_CONC_TESTING_)*/ | |
2343 | |
2344 /* | |
2345 +-------------------------------------------------------------------+ | |
2346 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2347 | STATE : code ROUTINE : sAT_PlusCMGW | | |
2348 +-------------------------------------------------------------------+ | |
2349 | |
2350 PURPOSE : For Riv-MMI if conc. is not needed. | |
2351 */ | |
2352 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
2353 GLOBAL T_ACI_RETURN sAT_PlusCMGW ( T_ACI_CMD_SRC srcId, | |
2354 SHORT index, | |
2355 CHAR* address, | |
2356 T_ACI_TOA* toa, | |
2357 T_ACI_SMS_STAT stat, | |
2358 UBYTE msg_ref, | |
2359 T_ACI_SM_DATA* src_data, | |
2360 CHAR* sca, | |
2361 T_ACI_TOA* tosca, | |
2362 SHORT isReply ) | |
2363 { | |
2364 | |
2365 | |
2366 | |
2367 | |
2368 | |
2369 TRACE_FUNCTION ("sAT_PlusCMGW ()"); | |
2370 | |
2371 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat, | |
2372 msg_ref, src_data, (T_ACI_UDH_DATA*)NULL, | |
2373 sca, tosca, isReply, | |
2374 rAT_PlusCMGW, rAT_PlusCMS); | |
2375 } | |
2376 | |
2377 /* | |
2378 +-------------------------------------------------------------------+ | |
2379 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2380 | STATE : code ROUTINE : sAT_PercentCMGW | | |
2381 +-------------------------------------------------------------------+ | |
2382 | |
2383 PURPOSE : Adding Percent CMGW command to handle udh and src | |
2384 data for each segment for conc module. | |
2385 | |
2386 For Riv-MMI if conc. is needed. | |
2387 */ | |
2388 GLOBAL T_ACI_RETURN sAT_PercentCMGW ( T_ACI_CMD_SRC srcId, | |
2389 SHORT index, | |
2390 CHAR* address, | |
2391 T_ACI_TOA* toa, | |
2392 T_ACI_SMS_STAT stat, | |
2393 UBYTE msg_ref, | |
2394 T_ACI_SM_DATA* src_data, | |
2395 T_ACI_UDH_DATA* udh_data, | |
2396 CHAR* sca, | |
2397 T_ACI_TOA* tosca, | |
2398 SHORT isReply ) | |
2399 { | |
2400 TRACE_FUNCTION ("sAT_PercentCMGW with udh()"); | |
2401 | |
2402 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat, | |
2403 msg_ref, src_data, udh_data, | |
2404 sca, tosca, isReply, | |
2405 rAT_PlusCMGW, rAT_PlusCMS); | |
2406 } | |
2407 | |
2408 #endif /*#if defined (FF_MMI_RIV)*/ | |
2409 | |
2410 /* | |
2411 +-------------------------------------------------------------------+ | |
2412 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2413 | STATE : code ROUTINE : sAT_PlusCMGW_Gl | | |
2414 +-------------------------------------------------------------------+ | |
2415 | |
2416 PURPOSE : This is the functional counterpart of the +CMGW | |
2417 AT command which is responsible for writing a short | |
2418 message to memory. | |
2419 | |
2420 <index>: index of location area to be written | |
2421 <address>: originating/destination address | |
2422 <toa>: type of address | |
2423 <stat>: message status | |
2424 <data>: message data | |
2425 <udh>: user data header | |
2426 <sca>: service center address | |
2427 <tosca>: type of service center address | |
2428 <isReply>: > 0: set TP-Reply-Path explicitly | |
2429 EQ 0: clear TP-Reply-Path explicitly | |
2430 <rplyCB>: reply call-back | |
2431 <errorCB>: error call-back | |
2432 */ | |
2433 GLOBAL T_ACI_RETURN sAT_PlusCMGW_Gl ( T_ACI_CMD_SRC srcId, | |
2434 SHORT index, | |
2435 CHAR* address, | |
2436 T_ACI_TOA* toa, | |
2437 T_ACI_SMS_STAT stat, | |
2438 UBYTE msg_ref, | |
2439 T_ACI_SM_DATA* data, | |
2440 T_ACI_UDH_DATA* udh, | |
2441 CHAR* sca, | |
2442 T_ACI_TOA* tosca, | |
2443 SHORT isReply, | |
2444 T_CMGW_FCT rplyCB, | |
2445 T_ERROR_FCT errorCB) | |
2446 { | |
2447 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */ | |
2448 T_ACI_RETURN ret; /* AT response code */ | |
2449 CHAR * restAddress = address; | |
2450 /* address without international access */ | |
2451 /* function characters */ | |
2452 UBYTE chkIdx; /* checked parameter <index> */ | |
2453 UBYTE chkStat; /* checked parameter <stat> */ | |
2454 CHAR* restSca = sca; /* service center address without */ | |
2455 /* international access function */ | |
2456 /* characters */ | |
2457 UBYTE msgType; | |
2458 | |
2459 T_ACI_SM_DATA packedData; | |
2460 T_tp_da da_addr; | |
2461 T_rp_addr sc_addr; | |
2462 UBYTE mr; | |
2463 UBYTE byte_offset = 0; | |
2464 | |
2465 #ifdef _CONC_TESTING_ | |
2466 /* Implements Measure#32 */ | |
2467 #endif | |
2468 | |
2469 TRACE_FUNCTION ("sAT_PlusCMGW_Gl ()"); | |
2470 | |
2471 | |
2472 /* | |
2473 *----------------------------------------------------------------- | |
2474 * check if command executable | |
2475 *----------------------------------------------------------------- | |
2476 */ | |
2477 if(!cmhSMS_checkAccess (srcId, &ret)) | |
2478 return ret; | |
2479 | |
2480 smsShrdPrm.rplyCB.cmgw = rplyCB; | |
2481 smsShrdPrm.errorCB = errorCB; | |
2482 | |
2483 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId]; | |
2484 | |
2485 /* | |
2486 *----------------------------------------------------------------- | |
2487 * process the <index> parameter | |
2488 *----------------------------------------------------------------- | |
2489 */ | |
2490 if( index NEQ ACI_NumParmNotPresent ) | |
2491 { | |
2492 if( ( index > SMS_CMH_IDX_MAX OR index < SMS_CMH_IDX_MIN ) AND | |
2493 index NEQ CMGW_IDX_FREE_ENTRY ) | |
2494 { | |
2495 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2496 return ( AT_FAIL ); | |
2497 } | |
2498 else | |
2499 | |
2500 chkIdx = (UBYTE) index; | |
2501 } | |
2502 else | |
2503 | |
2504 chkIdx = CMGW_IDX_FREE_ENTRY; | |
2505 | |
2506 /* | |
2507 *----------------------------------------------------------------- | |
2508 * process the <address> parameter | |
2509 *----------------------------------------------------------------- | |
2510 */ | |
2511 | |
2512 memset (&da_addr, 0, sizeof(T_tp_da)); | |
2513 if ( address NEQ NULL ) | |
2514 { | |
2515 /* | |
2516 *--------------------------------------------------------------- | |
2517 * process the <toa> parameter | |
2518 *--------------------------------------------------------------- | |
2519 */ | |
2520 if ( toa NEQ NULL ) | |
2521 { | |
2522 da_addr.ton = toa -> ton; | |
2523 da_addr.npi = toa -> npi; | |
2524 } | |
2525 else | |
2526 { | |
2527 restAddress = cmhSMS_setToaDef ( address, | |
2528 &da_addr.ton, | |
2529 &da_addr.npi ); | |
2530 } | |
2531 | |
2532 if ( da_addr.ton EQ TON_Alphanumeric ) | |
2533 { | |
2534 if( cmhSMS_packAlphaNumAddr(restAddress, &da_addr) EQ AT_FAIL ) | |
2535 { | |
2536 return (AT_FAIL); | |
2537 } | |
2538 } | |
2539 else | |
2540 { | |
2541 cmhSMS_getAdrBcd ( da_addr.num, | |
2542 &da_addr.c_num, | |
2543 MAX_SMS_ADDR_DIG, | |
2544 restAddress ); | |
2545 da_addr.digits = da_addr.c_num; | |
2546 } | |
2547 | |
2548 } | |
2549 else /* if ( address NEQ NULL ) */ | |
2550 { | |
2551 /* | |
2552 *--------------------------------------------------------------- | |
2553 * process the <toa> parameter | |
2554 *--------------------------------------------------------------- | |
2555 */ | |
2556 if ( toa NEQ NULL ) | |
2557 { | |
2558 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2559 return ( AT_FAIL ); | |
2560 } | |
2561 else | |
2562 { | |
2563 da_addr.digits = 0; | |
2564 } | |
2565 } | |
2566 | |
2567 /* | |
2568 *----------------------------------------------------------------- | |
2569 * process the <stat> parameter | |
2570 *----------------------------------------------------------------- | |
2571 */ | |
2572 if( stat NEQ SMS_STAT_NotPresent ) | |
2573 { | |
2574 if( !cmhSMS_getStatPsa ( stat, &chkStat ) ) | |
2575 { | |
2576 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2577 return ( AT_FAIL ); | |
2578 } | |
2579 } | |
2580 else | |
2581 { | |
2582 chkStat = STO_UNSENT; | |
2583 } | |
2584 | |
2585 /* | |
2586 *------------------------------------------------------------------- | |
2587 * create and send primitive for SMS store | |
2588 *------------------------------------------------------------------- | |
2589 */ | |
2590 { | |
2591 PALLOC (mnsms_store_req, MNSMS_STORE_REQ); | |
2592 | |
2593 mnsms_store_req -> mem_type = smsShrdPrm.mem2; | |
2594 if (chkIdx EQ CMGW_IDX_FREE_ENTRY) | |
2595 mnsms_store_req -> condx = SMS_CONDX_OVR_NON; | |
2596 else | |
2597 mnsms_store_req -> condx = SMS_CONDX_OVR_ANY; | |
2598 | |
2599 /* | |
2600 *----------------------------------------------------------------- | |
2601 * process the <sca> parameter | |
2602 *----------------------------------------------------------------- | |
2603 */ | |
2604 if ( sca NEQ NULL AND *sca NEQ '\0' ) | |
2605 { | |
2606 /* | |
2607 *--------------------------------------------------------------- | |
2608 * process the <tosca> parameter | |
2609 *--------------------------------------------------------------- | |
2610 */ | |
2611 if ( tosca NEQ NULL ) | |
2612 { | |
2613 sc_addr.ton = tosca -> ton; | |
2614 sc_addr.npi = tosca -> npi; | |
2615 } | |
2616 else | |
2617 { | |
2618 restSca = cmhSMS_setToaDef( sca, &sc_addr.ton, | |
2619 &sc_addr.npi); | |
2620 } | |
2621 cmhSMS_getAdrBcd( sc_addr.num, | |
2622 &sc_addr.c_num, | |
2623 MAX_SMS_ADDR_DIG, | |
2624 restSca); | |
2625 } | |
2626 else | |
2627 { | |
2628 memcpy (&sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr)); | |
2629 } | |
2630 | |
2631 /* | |
2632 *----------------------------------------------------------------- | |
2633 * process the <isReply> parameter | |
2634 *----------------------------------------------------------------- | |
2635 */ | |
2636 msgType = (pSMSSetPrm->msgType & ~TP_MTI_MASK) | |
2637 | TP_MTI_SMS_SUBMIT; | |
2638 if (isReply EQ 0) | |
2639 msgType &= ~TP_RP_MASK; /* set TP-Reply-Path bit to 0 */ | |
2640 else if (isReply > 0) | |
2641 msgType |= TP_RP_MASK; /* set TP-Reply-Path bit to 1 */ | |
2642 | |
2643 /* | |
2644 *----------------------------------------------------------------- | |
2645 * copy parameter | |
2646 *----------------------------------------------------------------- | |
2647 */ | |
2648 mnsms_store_req->rec_num = chkIdx; | |
2649 mnsms_store_req->status = chkStat; | |
2650 | |
2651 /* | |
2652 *----------------------------------------------------------------- | |
2653 * process the <msg_ref> parameter | |
2654 *----------------------------------------------------------------- | |
2655 */ | |
2656 if (msg_ref EQ NOT_PRESENT_8BIT) | |
2657 { | |
2658 mr = 0; | |
2659 } | |
2660 else | |
2661 { | |
2662 mr = msg_ref; | |
2663 } | |
2664 | |
2665 /* | |
2666 *----------------------------------------------------------------- | |
2667 * process the <data> parameter and | |
2668 * copy already to shared parameter | |
2669 *----------------------------------------------------------------- | |
2670 * reducing from 8 to 7 bit | |
2671 *----------------------------------------------------------------- | |
2672 */ | |
2673 if (udh) | |
2674 byte_offset = udh->len+1; | |
2675 | |
2676 if (data EQ NULL) | |
2677 { | |
2678 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2679 PFREE (mnsms_store_req); | |
2680 | |
2681 return ( AT_FAIL ); | |
2682 } | |
2683 | |
2684 cmhSMS_rdcSmsPp ( byte_offset, | |
2685 pSMSSetPrm -> dcs, | |
2686 ( UBYTE * ) data->data, ( UBYTE ) data->len, | |
2687 packedData.data, &packedData.len); | |
2688 | |
2689 if ( (chkStat EQ REC_UNREAD) OR (chkStat EQ REC_READ) ) | |
2690 { | |
2691 ACI_MALLOC(smsShrdPrm.tpdu.tp_deliver, sizeof(T_TP_DELIVER)); | |
2692 cmhSMS_fillTpDeliver (smsShrdPrm.tpdu.tp_deliver, | |
2693 srcId, | |
2694 msgType, | |
2695 (T_tp_oa *)&da_addr, | |
2696 &packedData, | |
2697 (UBYTE)data->len, | |
2698 udh ); | |
2699 | |
2700 /* code encode SMS-DELIVER here */ | |
2701 cmhSMS_codeMsg (&mnsms_store_req->sms_sdu, | |
2702 SMS_VT_DELIVER, | |
2703 &sc_addr, | |
2704 SMS_DELIVER, | |
2705 (UBYTE*)smsShrdPrm.tpdu.tp_deliver); | |
2706 | |
2707 PSENDX (SMS, mnsms_store_req); | |
2708 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
2709 if (smsShrdPrm.tpdu.tp_deliver NEQ NULL) | |
2710 { | |
2711 ACI_MFREE(smsShrdPrm.tpdu.tp_deliver); | |
2712 smsShrdPrm.tpdu.tp_deliver = NULL; | |
2713 } | |
2714 } | |
2715 else | |
2716 { | |
2717 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT)); | |
2718 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit, | |
2719 srcId, | |
2720 msgType, | |
2721 mr, | |
2722 &da_addr, | |
2723 &packedData, | |
2724 data->len, | |
2725 udh ); | |
2726 | |
2727 /* encode SMS-SUBMIT here */ | |
2728 cmhSMS_codeMsg (&mnsms_store_req->sms_sdu, | |
2729 SMS_VT_SUBMIT, | |
2730 &sc_addr, | |
2731 SMS_SUBMIT, | |
2732 (UBYTE*)smsShrdPrm.tpdu.tp_submit); | |
2733 | |
2734 PSENDX (SMS, mnsms_store_req); | |
2735 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
2736 #ifdef _CONC_TESTING_ | |
2737 TRACE_EVENT_P1("cmgw:rec_num: %d", mnsms_store_req->rec_num); | |
2738 TRACE_EVENT_P1("cmgw:status: %d", mnsms_store_req->status); | |
2739 TRACE_EVENT_P1("cmgw:mem_type:%d", mnsms_store_req -> mem_type); | |
2740 TRACE_EVENT_P1("cmgw:condx: %d", mnsms_store_req -> condx); | |
2741 /* Implements Measure#32 */ | |
2742 cmhSMS_sdu_buf_print(&(mnsms_store_req->sms_sdu.buf[0]), 0); | |
2743 #endif | |
2744 if (smsShrdPrm.tpdu.tp_submit NEQ NULL) | |
2745 { | |
2746 ACI_MFREE(smsShrdPrm.tpdu.tp_submit); | |
2747 smsShrdPrm.tpdu.tp_submit = NULL; | |
2748 } | |
2749 } | |
2750 } | |
2751 | |
2752 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGW; | |
2753 smsShrdPrm.owner = (T_OWN)srcId; | |
2754 smsShrdPrm.smsEntStat.entOwn = srcId; | |
2755 | |
2756 return( AT_EXCT ); | |
2757 } | |
2758 | |
2759 #if defined (SMS_PDU_SUPPORT) | |
2760 | |
2761 /* | |
2762 +-------------------------------------------------------------------+ | |
2763 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2764 | STATE : code ROUTINE : sAT_PlusCMGWPdu | | |
2765 +-------------------------------------------------------------------+ | |
2766 | |
2767 PURPOSE : This is the functional counterpart of the +CMGW | |
2768 AT command which is responsible for writing a short | |
2769 message to memory in PDU mode. | |
2770 | |
2771 */ | |
2772 | |
2773 GLOBAL T_ACI_RETURN sAT_PlusCMGWPdu ( T_ACI_CMD_SRC srcId, | |
2774 UBYTE stat, | |
2775 T_ACI_SM_DATA *pdu) | |
2776 { | |
2777 T_ACI_RETURN ret; /* AT response code */ | |
2778 UBYTE chkStat = '\0'; /* checked parameter <stat> */ | |
2779 | |
2780 TRACE_FUNCTION ("sAT_PlusCMGWPdu ()"); | |
2781 | |
2782 /* | |
2783 *----------------------------------------------------------------- | |
2784 * check if command executable | |
2785 *----------------------------------------------------------------- | |
2786 */ | |
2787 if(!cmhSMS_checkAccess (srcId, &ret)) | |
2788 return ret; | |
2789 | |
2790 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
2791 smsShrdPrm.errorCB = rAT_PlusCMS; | |
2792 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */ | |
2793 | |
2794 /* | |
2795 *----------------------------------------------------------------- | |
2796 * process the <stat> parameter | |
2797 *----------------------------------------------------------------- | |
2798 */ | |
2799 switch (stat) | |
2800 { | |
2801 case SMS_STAT_RecUnread: | |
2802 chkStat = REC_UNREAD; | |
2803 break; | |
2804 case SMS_STAT_RecRead: | |
2805 chkStat = REC_READ; | |
2806 break; | |
2807 case SMS_STAT_StoUnsent: | |
2808 chkStat = STO_UNSENT; | |
2809 break; | |
2810 case SMS_STAT_StoSent: | |
2811 chkStat = STO_SENT; | |
2812 break; | |
2813 } | |
2814 | |
2815 /* | |
2816 *------------------------------------------------------------------- | |
2817 * create and send primitive for SMS store | |
2818 *------------------------------------------------------------------- | |
2819 */ | |
2820 { | |
2821 PALLOC (mnsms_store_req, MNSMS_STORE_REQ); | |
2822 | |
2823 mnsms_store_req -> mem_type = smsShrdPrm.mem2; | |
2824 mnsms_store_req -> rec_num = CMGW_IDX_FREE_ENTRY; | |
2825 mnsms_store_req -> condx = SMS_CONDX_OVR_NON; | |
2826 mnsms_store_req -> status = chkStat; | |
2827 | |
2828 if ( pdu->len > 0 ) | |
2829 { | |
2830 mnsms_store_req->sms_sdu.l_buf = pdu->len * 8; | |
2831 mnsms_store_req->sms_sdu.o_buf = 0; | |
2832 memcpy (mnsms_store_req->sms_sdu.buf, pdu->data, pdu->len); | |
2833 } | |
2834 else | |
2835 { | |
2836 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2837 PFREE (mnsms_store_req); | |
2838 return ( AT_FAIL ); | |
2839 } | |
2840 | |
2841 PSENDX (SMS, mnsms_store_req); | |
2842 } | |
2843 | |
2844 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGW; | |
2845 smsShrdPrm.owner = (T_OWN)srcId; | |
2846 smsShrdPrm.smsEntStat.entOwn = srcId; | |
2847 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE; | |
2848 | |
2849 return( AT_EXCT ); | |
2850 } | |
2851 | |
2852 #endif | |
2853 | |
2854 | |
2855 /* | |
2856 +-------------------------------------------------------------------+ | |
2857 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2858 | STATE : code ROUTINE : sAT_PlusCMGC | | |
2859 +-------------------------------------------------------------------+ | |
2860 | |
2861 PURPOSE : This is the functional counterpart of the +CMGC | |
2862 AT command which is responsible for sending a command. | |
2863 | |
2864 Features Concatenated SMS. | |
2865 For GPF-MMI. | |
2866 | |
2867 <fo>: first octet of SMS-COMMAND | |
2868 <ct>: command type | |
2869 <pid>: protocol identifier | |
2870 <mn>: message number | |
2871 <da>: destination address | |
2872 <toda>: type of destination address | |
2873 <data>: command data | |
2874 */ | |
2875 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
2876 GLOBAL T_ACI_RETURN sAT_PlusCMGC ( T_ACI_CMD_SRC srcId, | |
2877 SHORT fo, | |
2878 SHORT ct, | |
2879 SHORT pid, | |
2880 SHORT mn, | |
2881 CHAR* da, | |
2882 T_ACI_TOA* toda, | |
2883 T_ACI_CMD_DATA* data ) | |
2884 { | |
2885 T_CONC_INIT_RETURN ret; | |
2886 | |
2887 TRACE_FUNCTION ("sAT_PlusCMGC ()"); | |
2888 | |
2889 | |
2890 ret=concSMS_initCommand (srcId, fo, ct, pid, mn, da, toda, | |
2891 data); | |
2892 | |
2893 if (ret EQ CONC_NEEDED) | |
2894 { | |
2895 SET_CONC; | |
2896 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda, | |
2897 data, rConcSMS_PlusCMGC); | |
2898 } | |
2899 else if (ret EQ CONC_NOT_NEEDED) | |
2900 { | |
2901 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda, | |
2902 data, rAT_PlusCMGC); | |
2903 } | |
2904 else | |
2905 { | |
2906 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_UnknownErr ); | |
2907 return ( AT_FAIL ); | |
2908 } | |
2909 } | |
2910 #endif /*#if defined (MFW) OR defined (_CONC_TESTING_)*/ | |
2911 | |
2912 /* | |
2913 +-------------------------------------------------------------------+ | |
2914 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2915 | STATE : code ROUTINE : sAT_PlusCMGC | | |
2916 +-------------------------------------------------------------------+ | |
2917 | |
2918 PURPOSE : New Plus CMGC command for handling the conc module on | |
2919 the Riv-MMI side. | |
2920 */ | |
2921 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
2922 GLOBAL T_ACI_RETURN sAT_PlusCMGC ( T_ACI_CMD_SRC srcId, | |
2923 SHORT fo, | |
2924 SHORT ct, | |
2925 SHORT pid, | |
2926 SHORT mn, | |
2927 CHAR* da, | |
2928 T_ACI_TOA* toda, | |
2929 T_ACI_CMD_DATA* data ) | |
2930 { | |
2931 TRACE_FUNCTION ("sAT_PlusCMGC ()"); | |
2932 TRACE_EVENT_P1("sAT_PlusCMGC () mn: %d", mn); | |
2933 | |
2934 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda, | |
2935 data, rAT_PlusCMGC); | |
2936 } | |
2937 #endif /*#if defined (FF_MMI_RIV)*/ | |
2938 | |
2939 /* | |
2940 +-------------------------------------------------------------------+ | |
2941 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
2942 | STATE : code ROUTINE : sAT_PlusCMGC_Gl | | |
2943 +-------------------------------------------------------------------+ | |
2944 | |
2945 PURPOSE : This is the functional counterpart of the +CMGC | |
2946 AT command which is responsible for sending a command. | |
2947 | |
2948 <fo>: first octet of SMS-COMMAND | |
2949 <ct>: command type | |
2950 <pid>: protocol identifier | |
2951 <mn>: message number | |
2952 <da>: destination address | |
2953 <toda>: type of destination address | |
2954 <data>: command data | |
2955 <rplyCB>: reply call-back | |
2956 */ | |
2957 GLOBAL T_ACI_RETURN sAT_PlusCMGC_Gl ( T_ACI_CMD_SRC srcId, | |
2958 SHORT fo, | |
2959 SHORT ct, | |
2960 SHORT pid, | |
2961 SHORT mn, | |
2962 CHAR* da, | |
2963 T_ACI_TOA* toda, | |
2964 T_ACI_CMD_DATA* data, | |
2965 T_CMGC_FCT rplyCB ) | |
2966 { | |
2967 T_ACI_RETURN ret; /* AT response code */ | |
2968 UBYTE chkFo; /* checked parameter <fo> */ | |
2969 UBYTE chkPid; /* checked parameter <pid> */ | |
2970 UBYTE chkCt; /* checked parameter <ct> */ | |
2971 UBYTE chkMn; /* checked parameter <mn> */ | |
2972 CHAR* restDa = da; /* destination address without */ | |
2973 /* international access function */ | |
2974 /* characters */ | |
2975 T_tp_da da_addr; /* destination address */ | |
2976 | |
2977 TRACE_FUNCTION ("sAT_PlusCMGC_Gl ()"); | |
2978 | |
2979 /* | |
2980 *----------------------------------------------------------------- | |
2981 * check if command executable | |
2982 *----------------------------------------------------------------- | |
2983 */ | |
2984 if(!cmhSMS_checkAccess (srcId, &ret)) | |
2985 return ret; | |
2986 | |
2987 smsShrdPrm.rplyCB.cmgc = rplyCB; | |
2988 /* | |
2989 *----------------------------------------------------------------- | |
2990 * process the <fo> parameter | |
2991 *----------------------------------------------------------------- | |
2992 */ | |
2993 if( fo NEQ ACI_NumParmNotPresent ) | |
2994 { | |
2995 if( fo > SMS_CMH_FO_MAX OR fo < SMS_CMH_FO_MIN OR | |
2996 ( fo & TP_MTI_MASK ) NEQ TP_MTI_SMS_COMMAND ) | |
2997 { | |
2998 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2999 return ( AT_FAIL ); | |
3000 } | |
3001 else | |
3002 | |
3003 chkFo = (UBYTE) fo; | |
3004 | |
3005 } | |
3006 else | |
3007 | |
3008 chkFo = TP_MTI_SMS_COMMAND; | |
3009 | |
3010 /* | |
3011 *----------------------------------------------------------------- | |
3012 * process the <ct> parameter | |
3013 *----------------------------------------------------------------- | |
3014 */ | |
3015 if( ct NEQ ACI_NumParmNotPresent ) | |
3016 { | |
3017 if( ct > SMS_CMH_CT_MAX OR ct < SMS_CMH_CT_MIN ) | |
3018 { | |
3019 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3020 return ( AT_FAIL ); | |
3021 } | |
3022 else | |
3023 | |
3024 chkCt = (UBYTE) ct; | |
3025 | |
3026 } | |
3027 else | |
3028 /* | |
3029 * set to default value | |
3030 */ | |
3031 chkCt = SMS_CT_ENQUIRY; | |
3032 | |
3033 /* | |
3034 *----------------------------------------------------------------- | |
3035 * process the <pid> parameter | |
3036 *----------------------------------------------------------------- | |
3037 */ | |
3038 if( pid NEQ ACI_NumParmNotPresent ) | |
3039 { | |
3040 if( pid > SMS_CMH_PID_MAX OR pid < SMS_CMH_PID_MIN ) | |
3041 { | |
3042 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3043 return ( AT_FAIL ); | |
3044 } | |
3045 else | |
3046 | |
3047 chkPid = (UBYTE) pid; | |
3048 } | |
3049 else | |
3050 | |
3051 /* | |
3052 * set to default value | |
3053 */ | |
3054 chkPid = SMS_PID_DEFAULT; | |
3055 | |
3056 /* | |
3057 *----------------------------------------------------------------- | |
3058 * process the <mn> parameter | |
3059 *----------------------------------------------------------------- | |
3060 */ | |
3061 if( mn NEQ ACI_NumParmNotPresent ) | |
3062 { | |
3063 if( mn > SMS_CMH_MN_MAX OR mn < SMS_CMH_MN_MIN ) | |
3064 { | |
3065 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3066 return ( AT_FAIL ); | |
3067 } | |
3068 else | |
3069 | |
3070 chkMn = (UBYTE) mn; | |
3071 } | |
3072 else | |
3073 { | |
3074 chkMn = smsShrdPrm.aci_sms_parameter.snd_msg_ref; | |
3075 } | |
3076 | |
3077 /* | |
3078 *--------------------------------------------------------------- | |
3079 * process the <da> and <toda> parameter | |
3080 *--------------------------------------------------------------- | |
3081 */ | |
3082 if ( toda NEQ NULL ) | |
3083 { | |
3084 if ( da NEQ NULL ) | |
3085 { | |
3086 da_addr.ton = toda -> ton; | |
3087 da_addr.npi = toda -> npi; | |
3088 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa); | |
3089 da_addr.digits = da_addr.c_num; | |
3090 } | |
3091 else | |
3092 { | |
3093 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3094 return ( AT_FAIL ); | |
3095 } | |
3096 } | |
3097 else | |
3098 { | |
3099 if ( da NEQ NULL ) | |
3100 { | |
3101 restDa = cmhSMS_setToaDef ( da, &da_addr.ton, &da_addr.npi ); | |
3102 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa); | |
3103 da_addr.digits = da_addr.c_num; | |
3104 } | |
3105 else | |
3106 { | |
3107 da_addr.digits = 0; | |
3108 } | |
3109 } | |
3110 | |
3111 /* | |
3112 *------------------------------------------------------------------- | |
3113 * create and send primitive for command request | |
3114 *------------------------------------------------------------------- | |
3115 */ | |
3116 { | |
3117 PALLOC (mnsms_command_req, MNSMS_COMMAND_REQ); | |
3118 | |
3119 ACI_MALLOC(smsShrdPrm.tpdu.tp_command, sizeof(T_TP_COMMAND)); | |
3120 cmhSMS_fillTpCommand( smsShrdPrm.tpdu.tp_command, | |
3121 chkFo, | |
3122 chkCt, | |
3123 0, | |
3124 chkPid, | |
3125 chkMn, | |
3126 &da_addr, | |
3127 data, | |
3128 NULL); | |
3129 | |
3130 #ifdef REL99 | |
3131 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
3132 { | |
3133 mnsms_command_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
3134 } | |
3135 else | |
3136 { | |
3137 mnsms_command_req -> auto_rep_flag = FALSE; | |
3138 } | |
3139 #endif | |
3140 | |
3141 /* code command here */ | |
3142 cmhSMS_codeMsg (&mnsms_command_req->sms_sdu, | |
3143 SMS_VT_COMMAND, | |
3144 &smsShrdPrm.pSetPrm[srcId]->sca, | |
3145 SMS_COMMAND, | |
3146 (UBYTE*)smsShrdPrm.tpdu.tp_command); | |
3147 | |
3148 PSENDX (SMS, mnsms_command_req); | |
3149 | |
3150 if (smsShrdPrm.tpdu.tp_command NEQ NULL) | |
3151 { | |
3152 ACI_MFREE(smsShrdPrm.tpdu.tp_command); | |
3153 smsShrdPrm.tpdu.tp_command = NULL; | |
3154 } | |
3155 } | |
3156 | |
3157 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGC; | |
3158 smsShrdPrm.owner = (T_OWN)srcId; | |
3159 smsShrdPrm.smsEntStat.entOwn = srcId; | |
3160 | |
3161 return( AT_EXCT ); | |
3162 } | |
3163 | |
3164 | |
3165 #if defined (SMS_PDU_SUPPORT) || defined (SIM_TOOLKIT) | |
3166 | |
3167 /* | |
3168 +-------------------------------------------------------------------+ | |
3169 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3170 | STATE : code ROUTINE : sAT_PlusCMGCPdu | | |
3171 +-------------------------------------------------------------------+ | |
3172 | |
3173 PURPOSE : This is the functional counterpart of the +CMGC | |
3174 AT command which is responsible for sending a command | |
3175 message in pdu mode. | |
3176 | |
3177 */ | |
3178 GLOBAL T_ACI_RETURN sAT_PlusCMGCPdu ( T_ACI_CMD_SRC srcId, | |
3179 T_ACI_SM_DATA *pdu ) | |
3180 { | |
3181 T_ACI_RETURN ret; /* AT response code */ | |
3182 | |
3183 TRACE_FUNCTION ("sAT_PlusCMGCPdu ()"); | |
3184 | |
3185 /* | |
3186 *----------------------------------------------------------------- | |
3187 * check if command executable | |
3188 *----------------------------------------------------------------- | |
3189 */ | |
3190 if(!cmhSMS_checkAccess (srcId, &ret)) | |
3191 return ret; | |
3192 | |
3193 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
3194 smsShrdPrm.rplyCB.cmgc = rAT_PlusCMGC; | |
3195 smsShrdPrm.errorCB = rAT_PlusCMS; | |
3196 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */ | |
3197 | |
3198 /* | |
3199 *------------------------------------------------------------------- | |
3200 * create and send primitive for SMS command | |
3201 *------------------------------------------------------------------- | |
3202 */ | |
3203 { | |
3204 PALLOC (mnsms_command_req, MNSMS_COMMAND_REQ); | |
3205 #ifdef REL99 | |
3206 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT) | |
3207 { | |
3208 mnsms_command_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
3209 } | |
3210 else | |
3211 { | |
3212 mnsms_command_req -> auto_rep_flag = FALSE; | |
3213 } | |
3214 #endif /* REL99 */ | |
3215 | |
3216 if ( pdu->len > 0 ) | |
3217 { | |
3218 mnsms_command_req->sms_sdu.l_buf = pdu->len * 8; | |
3219 mnsms_command_req->sms_sdu.o_buf = 0; | |
3220 memcpy (mnsms_command_req->sms_sdu.buf, pdu->data, pdu->len); | |
3221 } | |
3222 else | |
3223 { | |
3224 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3225 PFREE (mnsms_command_req); | |
3226 return ( AT_FAIL ); | |
3227 } | |
3228 | |
3229 PSENDX (SMS, mnsms_command_req); | |
3230 } | |
3231 | |
3232 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGC; | |
3233 smsShrdPrm.owner = (T_OWN)srcId; | |
3234 smsShrdPrm.smsEntStat.entOwn = srcId; | |
3235 | |
3236 return( AT_EXCT ); | |
3237 } | |
3238 #endif | |
3239 | |
3240 | |
3241 /* | |
3242 +-------------------------------------------------------------------+ | |
3243 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3244 | STATE : code ROUTINE : sAT_PlusCMGR | | |
3245 +-------------------------------------------------------------------+ | |
3246 | |
3247 PURPOSE : This is the functional counterpart of the +CMGR | |
3248 AT command which is responsible for reading a short | |
3249 message from memory. | |
3250 | |
3251 Features Concatenated SMS. | |
3252 For GPF-MMI. | |
3253 | |
3254 <index>: storage area index | |
3255 <rdMode>: read mode | |
3256 */ | |
3257 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
3258 GLOBAL T_ACI_RETURN sAT_PlusCMGR ( T_ACI_CMD_SRC srcId, | |
3259 UBYTE index, | |
3260 T_ACI_SMS_READ rdMode ) | |
3261 { | |
3262 T_CONC_INIT_RETURN ret; | |
3263 | |
3264 TRACE_FUNCTION ("sAT_PlusCMGR ()"); | |
3265 | |
3266 TRACE_EVENT_P1("sAT_PlusCMGR () index: %d", index); | |
3267 | |
3268 ret=concSMS_initReadFromMem(srcId, index, rdMode); | |
3269 | |
3270 if (ret EQ CONC_NEEDED) | |
3271 { | |
3272 SET_CONC; | |
3273 TRACE_EVENT("sAT_PlusCMGR: CONC_NEEDED"); | |
3274 | |
3275 /* memorize mem1, this is for rConcSMS_PlusCMGR */ | |
3276 concShrdPrm.mem_store = smsShrdPrm.mem1; | |
3277 | |
3278 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rConcSMS_PlusCMGR); | |
3279 } | |
3280 else if (ret EQ CONC_NOT_NEEDED) | |
3281 { | |
3282 TRACE_EVENT("sAT_PlusCMGR: CONC_NOT_NEEDED"); | |
3283 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rAT_PlusCMGR); | |
3284 } | |
3285 else | |
3286 { | |
3287 TRACE_EVENT("ERROR: sAT_PlusCMGR: CMS_ERR_InValMemIdx"); | |
3288 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
3289 return ( AT_FAIL ); | |
3290 } | |
3291 } | |
3292 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/ | |
3293 | |
3294 /* | |
3295 +-------------------------------------------------------------------+ | |
3296 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3297 | STATE : code ROUTINE : sAT_PlusCMGR | | |
3298 +-------------------------------------------------------------------+ | |
3299 | |
3300 PURPOSE : New Plus CMGR command for handling the conc module on | |
3301 the Riv-MMI side. | |
3302 */ | |
3303 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
3304 GLOBAL T_ACI_RETURN sAT_PlusCMGR ( T_ACI_CMD_SRC srcId, | |
3305 UBYTE index, | |
3306 T_ACI_SMS_READ rdMode ) | |
3307 { | |
3308 TRACE_FUNCTION ("sAT_PlusCMGR ()"); | |
3309 | |
3310 TRACE_EVENT_P1("sAT_PlusCMGR () index: %d", index); | |
3311 | |
3312 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rAT_PlusCMGR); | |
3313 } | |
3314 #endif /*#if defined (FF_MMI_RIV)*/ | |
3315 | |
3316 | |
3317 /* | |
3318 +-------------------------------------------------------------------+ | |
3319 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3320 | STATE : code ROUTINE : sAT_PlusCMGR_Gl | | |
3321 +-------------------------------------------------------------------+ | |
3322 | |
3323 PURPOSE : This is the functional counterpart of the +CMGR | |
3324 AT command which is responsible for reading a short | |
3325 message from memory. | |
3326 | |
3327 <index>: storage area index | |
3328 <rdMode>: read mode | |
3329 <rplyCB>: reply call-back | |
3330 <errorCB>: error call-back | |
3331 */ | |
3332 GLOBAL T_ACI_RETURN sAT_PlusCMGR_Gl ( T_ACI_CMD_SRC srcId, | |
3333 UBYTE index, | |
3334 T_ACI_SMS_READ rdMode, | |
3335 T_CMGR_FCT rplyCB ) | |
3336 { | |
3337 T_ACI_RETURN ret = AT_EXCT; | |
3338 | |
3339 TRACE_FUNCTION ("sAT_PlusCMGR_Gl ()"); | |
3340 | |
3341 /* | |
3342 *----------------------------------------------------------------- | |
3343 * check if command executable | |
3344 *----------------------------------------------------------------- | |
3345 */ | |
3346 if(!cmhSMS_checkAccess (srcId, &ret)) | |
3347 { | |
3348 return ret; | |
3349 } | |
3350 | |
3351 smsShrdPrm.rplyCB.cmgr = rplyCB; | |
3352 | |
3353 | |
3354 /* | |
3355 *----------------------------------------------------------------- | |
3356 * process the <index> parameter | |
3357 *----------------------------------------------------------------- | |
3358 */ | |
3359 switch (rdMode) | |
3360 { | |
3361 case SMS_READ_StatusChange: | |
3362 /* ret = AT_CMPL; Change to AT_EXCT, call back expected */ | |
3363 smsShrdPrm.rdMode = READ_STATUS_CHANGE; | |
3364 break; | |
3365 case SMS_READ_Preview: | |
3366 smsShrdPrm.rdMode = READ_PREVIEW; | |
3367 break; | |
3368 case SMS_READ_Normal: | |
3369 case SMS_READ_NotPresent: | |
3370 smsShrdPrm.rdMode = READ_NORMAL; | |
3371 break; | |
3372 default: | |
3373 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3374 return ( AT_FAIL ); | |
3375 } | |
3376 /* | |
3377 *----------------------------------------------------------------- | |
3378 * read a short message from memory | |
3379 *----------------------------------------------------------------- | |
3380 */ | |
3381 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGR; | |
3382 smsShrdPrm.owner = (T_OWN)srcId; | |
3383 smsShrdPrm.smsEntStat.entOwn = srcId; | |
3384 | |
3385 psaSMS_ReadReq ( smsShrdPrm.mem1, index, | |
3386 smsShrdPrm.rdMode, SMS_STAT_NotPresent); | |
3387 | |
3388 return( ret ); | |
3389 } | |
3390 | |
3391 /* | |
3392 +-------------------------------------------------------------------+ | |
3393 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3394 | STATE : code ROUTINE : sAT_PlusCSCB | | |
3395 +-------------------------------------------------------------------+ | |
3396 | |
3397 PURPOSE : This is the functional counterpart of the +CSCB | |
3398 AT command which is responsible for selecting the | |
3399 cell broadcast message types. | |
3400 | |
3401 <mode>: acception mode | |
3402 <mids>: message identifiers | |
3403 <dcss>: data coding schemes | |
3404 */ | |
3405 GLOBAL T_ACI_RETURN sAT_PlusCSCB ( T_ACI_CMD_SRC srcId, | |
3406 T_ACI_CSCB_MOD mode, | |
3407 USHORT* mids, | |
3408 UBYTE* dcss) | |
3409 { | |
3410 UBYTE chkMode; /* checked parameter <mode> */ | |
3411 USHORT chkMids[MAX_IDENTS]; /* checked parameter <mids> */ | |
3412 UBYTE chkDcss[MAX_IDENTS]; /* checked parameter <dcss> */ | |
3413 int i; /* used for counting */ | |
3414 | |
3415 TRACE_FUNCTION ("sAT_PlusCSCB ()"); | |
3416 | |
3417 /* | |
3418 *----------------------------------------------------------------- | |
3419 * check command source | |
3420 *----------------------------------------------------------------- | |
3421 */ | |
3422 if(!cmh_IsVldCmdSrc (srcId)) | |
3423 { | |
3424 return( AT_FAIL ); | |
3425 } | |
3426 | |
3427 /* | |
3428 *----------------------------------------------------------------- | |
3429 * check access status | |
3430 *----------------------------------------------------------------- | |
3431 */ | |
3432 if (!cmhSMS_checkSIM ()) /* sets error code */ | |
3433 { | |
3434 return( AT_FAIL ); | |
3435 } | |
3436 | |
3437 /* | |
3438 *----------------------------------------------------------------- | |
3439 * check entity status | |
3440 *----------------------------------------------------------------- | |
3441 */ | |
3442 if( smsShrdPrm.cbmPrm.cbchOwner NEQ ((T_OWN)CMD_SRC_NONE) ) | |
3443 { | |
3444 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
3445 return( AT_BUSY ); | |
3446 } | |
3447 | |
3448 /* | |
3449 *----------------------------------------------------------------- | |
3450 * process the <mode> parameter | |
3451 *----------------------------------------------------------------- | |
3452 */ | |
3453 switch ( mode ) | |
3454 { | |
3455 case (CSCB_MOD_NotPresent): chkMode = smsShrdPrm.cbmPrm.cbmMode; break; | |
3456 case (CSCB_MOD_Accept ): chkMode = CBCH_ACCEPT; break; | |
3457 case (CSCB_MOD_NotAccept ): chkMode = CBCH_IGNORE; break; | |
3458 | |
3459 default: | |
3460 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3461 return ( AT_FAIL ); | |
3462 } | |
3463 | |
3464 /* | |
3465 *----------------------------------------------------------------- | |
3466 * process the <mids> parameter | |
3467 *----------------------------------------------------------------- | |
3468 */ | |
3469 if( mids NEQ NULL ) | |
3470 | |
3471 memcpy ( ( CHAR * ) chkMids, ( CHAR * ) mids, sizeof (chkMids) ); | |
3472 | |
3473 else | |
3474 | |
3475 memcpy ( ( CHAR * ) chkMids, ( CHAR * ) smsShrdPrm.cbmPrm.msgId, | |
3476 sizeof ( chkMids ) ); | |
3477 | |
3478 /* | |
3479 *----------------------------------------------------------------- | |
3480 * process the <dcss> parameter | |
3481 *----------------------------------------------------------------- | |
3482 */ | |
3483 if( dcss NEQ NULL ) | |
3484 { | |
3485 i = 0; | |
3486 | |
3487 while ( i < MAX_IDENTS AND dcss[i] NEQ DEF_DCS_RANGE ) | |
3488 { | |
3489 /* Lint: this cannot happen | |
3490 if( dcss[i] > SMS_CMH_DCS_MAX OR dcss[i] < SMS_CMH_DCS_MIN ) | |
3491 { | |
3492 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3493 return ( AT_FAIL ); | |
3494 } | |
3495 else | |
3496 */ | |
3497 i++; | |
3498 } | |
3499 | |
3500 if ( i % 2 NEQ 0 ) | |
3501 { | |
3502 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3503 return ( AT_FAIL ); | |
3504 } | |
3505 | |
3506 memcpy ( ( CHAR * ) chkDcss, ( CHAR * ) dcss, sizeof (chkDcss) ); | |
3507 } | |
3508 else | |
3509 | |
3510 memcpy ( ( CHAR * ) chkDcss, ( CHAR * ) smsShrdPrm.cbmPrm.dcsId, | |
3511 sizeof ( chkDcss ) ); | |
3512 | |
3513 /* | |
3514 *----------------------------------------------------------------- | |
3515 * copy parameter | |
3516 *----------------------------------------------------------------- | |
3517 */ | |
3518 memcpy ( ( CHAR * ) smsShrdPrm.cbmPrm.msgId, | |
3519 ( CHAR * ) chkMids, | |
3520 sizeof ( smsShrdPrm.cbmPrm.msgId ) ); | |
3521 | |
3522 memcpy ( ( CHAR * ) smsShrdPrm.cbmPrm.dcsId, | |
3523 ( CHAR * ) chkDcss, | |
3524 sizeof ( smsShrdPrm.cbmPrm.dcsId ) ); | |
3525 | |
3526 smsShrdPrm.cbmPrm.cbmMode = chkMode; | |
3527 | |
3528 /* CSCBmode = mode; */ | |
3529 | |
3530 /* | |
3531 *----------------------------------------------------------------- | |
3532 * set the new CBCH configuration | |
3533 *----------------------------------------------------------------- | |
3534 */ | |
3535 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId; | |
3536 | |
3537 if( psaMMI_Cbch() < 0 ) | |
3538 { | |
3539 TRACE_EVENT( "FATAL RETURN psaSMS in +CSCB" ); | |
3540 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
3541 return( AT_FAIL ); | |
3542 } | |
3543 | |
3544 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
3545 | |
3546 return ( AT_CMPL ); | |
3547 } | |
3548 | |
3549 | |
3550 #ifdef FF_HOMEZONE | |
3551 /* | |
3552 +-------------------------------------------------------------------+ | |
3553 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3554 | STATE : code ROUTINE : sAT_PercentCBHZ | | |
3555 +-------------------------------------------------------------------+ | |
3556 | |
3557 PURPOSE : This is the functional counterpart of the %CBHZ | |
3558 AT command which is responsible for activation and | |
3559 deactivation of the homezone feature. | |
3560 | |
3561 <mode> : activation mode | |
3562 <dcs> : datacoding scheme | |
3563 <timeout>: timeout period for homezone CBM | |
3564 */ | |
3565 GLOBAL T_ACI_RETURN sAT_PercentCBHZ ( T_ACI_CMD_SRC srcId, | |
3566 T_ACI_CBHZ_MOD mode, | |
3567 T_ACI_CS dcs, | |
3568 UBYTE timeout) | |
3569 { | |
3570 UBYTE chkMode; /* checked parameter <mode> */ | |
3571 UBYTE chkDcs; /* checked parameter <dcs> */ | |
3572 UBYTE chkTimeout; /* checked parameter <timeout> */ | |
3573 | |
3574 TRACE_FUNCTION ("sAT_PercentCBHZ()"); | |
3575 | |
3576 /* | |
3577 *----------------------------------------------------------------- | |
3578 * check command source | |
3579 *----------------------------------------------------------------- | |
3580 */ | |
3581 if(!cmh_IsVldCmdSrc (srcId)) | |
3582 { | |
3583 return( AT_FAIL ); | |
3584 } | |
3585 | |
3586 /* | |
3587 *----------------------------------------------------------------- | |
3588 * check access status | |
3589 *----------------------------------------------------------------- | |
3590 */ | |
3591 if (!cmhSMS_checkSIM ()) /* sets error code */ | |
3592 { | |
3593 return( AT_FAIL ); | |
3594 } | |
3595 | |
3596 /* | |
3597 *----------------------------------------------------------------- | |
3598 * check entity status | |
3599 *----------------------------------------------------------------- | |
3600 */ | |
3601 if( smsShrdPrm.cbmPrm.cbchOwner NEQ ((T_OWN)CMD_SRC_NONE) ) | |
3602 { | |
3603 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
3604 return( AT_BUSY ); | |
3605 } | |
3606 | |
3607 /* | |
3608 *----------------------------------------------------------------- | |
3609 * process the <mode> parameter | |
3610 *----------------------------------------------------------------- | |
3611 */ | |
3612 switch ( mode ) | |
3613 { | |
3614 case (CBHZ_MOD_Active) : | |
3615 case (CBHZ_MOD_NotActive): | |
3616 chkMode = mode; | |
3617 break; | |
3618 | |
3619 default: | |
3620 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3621 return ( AT_FAIL ); | |
3622 } | |
3623 | |
3624 /* | |
3625 *----------------------------------------------------------------- | |
3626 * process the <dcs> parameter | |
3627 *----------------------------------------------------------------- | |
3628 */ | |
3629 switch ( dcs ) | |
3630 { | |
3631 case (CS_NotPresent): | |
3632 chkDcs = CS_GsmDef; | |
3633 break; | |
3634 | |
3635 case (CS_GsmDef) : | |
3636 case (CS_GsmInt) : | |
3637 case (CS_Hex) : | |
3638 case (CS_Ucs2) : | |
3639 case (CS_Sim) : | |
3640 case (CS_Ascii) : | |
3641 chkDcs = dcs; | |
3642 break; | |
3643 | |
3644 default: | |
3645 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3646 return ( AT_FAIL ); | |
3647 } | |
3648 | |
3649 /* | |
3650 *----------------------------------------------------------------- | |
3651 * process the <timeout> parameter | |
3652 *----------------------------------------------------------------- | |
3653 */ | |
3654 if ( (timeout >= CBHZ_MIN_TIMEOUT) AND (timeout <= CBHZ_MAX_TIMEOUT) ) | |
3655 { | |
3656 chkTimeout = timeout; | |
3657 } | |
3658 else if ( timeout EQ NOT_PRESENT_8BIT ) | |
3659 { | |
3660 chkTimeout = CBHZ_DEF_TIMEOUT; | |
3661 } | |
3662 else | |
3663 { | |
3664 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3665 return ( AT_FAIL ); | |
3666 } | |
3667 | |
3668 /* | |
3669 *----------------------------------------------------------------- | |
3670 * all parameters valid. now copy parameter | |
3671 *----------------------------------------------------------------- | |
3672 */ | |
3673 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId; | |
3674 smsShrdPrm.cbmPrm.hzMode = chkMode; | |
3675 smsShrdPrm.cbmPrm.hzDcs = chkDcs; | |
3676 smsShrdPrm.cbmPrm.hzTimeout = chkTimeout; | |
3677 | |
3678 /* send homezone request */ | |
3679 if( psaMMI_homezone_req() < 0 ) | |
3680 { | |
3681 TRACE_EVENT( "FATAL RETURN psaSMS in %%CBHZ" ); | |
3682 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
3683 return( AT_FAIL ); | |
3684 } | |
3685 | |
3686 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE; | |
3687 | |
3688 return ( AT_CMPL ); | |
3689 } | |
3690 #endif /* FF_HOMEZONE */ | |
3691 | |
3692 /* | |
3693 +-------------------------------------------------------------------+ | |
3694 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3695 | STATE : code ROUTINE : sAT_PlusCMGL | | |
3696 +-------------------------------------------------------------------+ | |
3697 | |
3698 PURPOSE : This is the functional counterpart of the +CMGL | |
3699 AT command which is responsible for creating a list of | |
3700 all stored short messages. | |
3701 | |
3702 <state>: state of stored short message | |
3703 */ | |
3704 GLOBAL T_ACI_RETURN sAT_PlusCMGL ( T_ACI_CMD_SRC srcId, | |
3705 T_ACI_SMS_STAT state, | |
3706 SHORT startIdx, | |
3707 T_ACI_SMS_READ rdMode ) | |
3708 { | |
3709 T_ACI_RETURN ret; /* AT response code */ | |
3710 T_ACI_SMS_STAT chk_state; | |
3711 | |
3712 TRACE_FUNCTION ("sAT_PlusCMGL ()"); | |
3713 | |
3714 /* | |
3715 *----------------------------------------------------------------- | |
3716 * check if command executable | |
3717 *----------------------------------------------------------------- | |
3718 */ | |
3719 if(!cmhSMS_checkAccess (srcId, &ret)) | |
3720 { | |
3721 return ret; | |
3722 } | |
3723 | |
3724 /* | |
3725 *----------------------------------------------------------------- | |
3726 * process the <state> parameter | |
3727 *----------------------------------------------------------------- | |
3728 */ | |
3729 switch ( state ) | |
3730 { | |
3731 case( SMS_STAT_NotPresent ): | |
3732 chk_state = SMS_STAT_RecUnread; | |
3733 break; | |
3734 | |
3735 case( SMS_STAT_Invalid ): | |
3736 case( SMS_STAT_All ): | |
3737 case( SMS_STAT_RecUnread ): | |
3738 case( SMS_STAT_RecRead ): | |
3739 case( SMS_STAT_StoUnsent ): | |
3740 case( SMS_STAT_StoSent ): | |
3741 chk_state = state; | |
3742 break; | |
3743 | |
3744 default: | |
3745 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3746 return ( AT_FAIL ); | |
3747 } | |
3748 | |
3749 /* | |
3750 *----------------------------------------------------------------- | |
3751 * check if startIdx is in range | |
3752 *----------------------------------------------------------------- | |
3753 */ | |
3754 if ( startIdx >= MAX_SIM_ME_ENTRIES /*256*/ OR | |
3755 startIdx > SMS_CMH_MAX_START_IDX /*255*/ ) | |
3756 { | |
3757 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3758 return ( AT_FAIL ); | |
3759 } | |
3760 | |
3761 /* | |
3762 *----------------------------------------------------------------- | |
3763 * process the <rdMode> parameter | |
3764 *----------------------------------------------------------------- | |
3765 */ | |
3766 switch (rdMode) | |
3767 { | |
3768 case SMS_READ_StatusChange: | |
3769 default: | |
3770 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
3771 return ( AT_FAIL ); | |
3772 case SMS_READ_Preview: | |
3773 smsShrdPrm.rdMode = READ_PREVIEW; | |
3774 break; | |
3775 case SMS_READ_Normal: | |
3776 case SMS_READ_NotPresent: | |
3777 smsShrdPrm.rdMode = READ_NORMAL; | |
3778 break; | |
3779 } | |
3780 | |
3781 /* | |
3782 *--------------------------------------------------------------- | |
3783 * PSA notification | |
3784 *--------------------------------------------------------------- | |
3785 */ | |
3786 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGL; | |
3787 smsShrdPrm.owner = (T_OWN)srcId; | |
3788 smsShrdPrm.smsEntStat.entOwn = srcId; | |
3789 | |
3790 /* | |
3791 *--------------------------------------------------------------- | |
3792 * request the list element | |
3793 *--------------------------------------------------------------- | |
3794 */ | |
3795 psaSMS_ReadReq ( smsShrdPrm.mem1, startIdx, | |
3796 smsShrdPrm.rdMode, chk_state ); | |
3797 | |
3798 return( AT_EXCT ); | |
3799 } | |
3800 | |
3801 /* | |
3802 +-------------------------------------------------------------------+ | |
3803 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3804 | STATE : code ROUTINE : sAT_PlusCSAS | | |
3805 +-------------------------------------------------------------------+ | |
3806 | |
3807 PURPOSE : This is the functional counterpart of the +CSAS | |
3808 AT command which is responsible for saving of certain | |
3809 SMS parameters to nonvolatile memory. | |
3810 | |
3811 <profile>: SMS profile number (1..max_record) | |
3812 */ | |
3813 GLOBAL T_ACI_RETURN sAT_PlusCSAS ( T_ACI_CMD_SRC srcId, | |
3814 SHORT profile) | |
3815 { | |
3816 T_ACI_RETURN ret; /* AT response code */ | |
3817 UBYTE tmpNumOfRefs; | |
3818 UBYTE max_record; | |
3819 | |
3820 TRACE_FUNCTION ("sAT_PlusCSAS ()"); | |
3821 | |
3822 /* | |
3823 *----------------------------------------------------------------- | |
3824 * check if command executable | |
3825 *----------------------------------------------------------------- | |
3826 */ | |
3827 if(!cmhSMS_checkAccess (srcId, &ret)) | |
3828 return ret; | |
3829 | |
3830 max_record = (UBYTE)cmhSMS_getPrfRge (); | |
3831 if ((profile <= 0) OR (profile > max_record)) | |
3832 { | |
3833 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
3834 return AT_FAIL; | |
3835 } | |
3836 | |
3837 smsShrdPrm.cbmPrm.cbmFoundIds = 0; | |
3838 | |
3839 if ( (smsShrdPrm.pSetPrm[srcId]->prflId NEQ profile) OR | |
3840 (smsShrdPrm.pSetPrm[srcId]->isCopy EQ TRUE) ) | |
3841 { | |
3842 T_SMS_SET_PRM * elem; | |
3843 T_SMS_SET_PRM * pSMSSetPrmOld = smsShrdPrm.pSetPrm[srcId]; | |
3844 | |
3845 /* | |
3846 *----------------------------------------------------------------- | |
3847 * find or create new profile | |
3848 *----------------------------------------------------------------- | |
3849 */ | |
3850 elem = find_element(set_prm_list, (UBYTE)profile, cmhSMS_findPrflId); | |
3851 if (elem EQ NULL) | |
3852 { | |
3853 ACI_MALLOC(elem, sizeof(T_SMS_SET_PRM)); | |
3854 memset(elem, 0, sizeof(T_SMS_SET_PRM)); | |
3855 insert_list(set_prm_list, elem); | |
3856 } | |
3857 | |
3858 /* save the number of references of the list element */ | |
3859 tmpNumOfRefs = elem->numOfRefs; | |
3860 | |
3861 /* copy the old profile */ | |
3862 memcpy(elem, pSMSSetPrmOld, sizeof(T_SMS_SET_PRM)); | |
3863 | |
3864 /* decrease the numOfRefs of the old profile */ | |
3865 pSMSSetPrmOld->numOfRefs--; | |
3866 | |
3867 /* set the Prm Pointer to the (new or found) list element */ | |
3868 smsShrdPrm.pSetPrm[srcId] = elem; | |
3869 | |
3870 smsShrdPrm.pSetPrm[srcId]->numOfRefs = ++tmpNumOfRefs; | |
3871 smsShrdPrm.pSetPrm[srcId]->isCopy = FALSE; | |
3872 smsShrdPrm.pSetPrm[srcId]->prflId = (UBYTE)profile; | |
3873 | |
3874 /* | |
3875 *----------------------------------------------------------------- | |
3876 * destroy temporary copy | |
3877 *----------------------------------------------------------------- | |
3878 */ | |
3879 if ( pSMSSetPrmOld->isCopy EQ TRUE ) | |
3880 { | |
3881 ACI_MFREE(pSMSSetPrmOld); | |
3882 } | |
3883 } | |
3884 | |
3885 /* | |
3886 *------------------------------------------------------------- | |
3887 * store parameters to non-volatile memory | |
3888 *------------------------------------------------------------- | |
3889 */ | |
3890 ret = cmhSMS_WriteParams (srcId, AT_CMD_CSAS, profile); | |
3891 return ret; | |
3892 | |
3893 } | |
3894 | |
3895 /* | |
3896 +-------------------------------------------------------------------+ | |
3897 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3898 | STATE : code ROUTINE : sAT_PlusCRES | | |
3899 +-------------------------------------------------------------------+ | |
3900 | |
3901 PURPOSE : This is the functional counterpart of the +CRES | |
3902 AT command which is responsible for retrieving of | |
3903 certain SMS parameters from nonvolatile memory. | |
3904 | |
3905 <profile>: SMS profile number (1..max_record) | |
3906 */ | |
3907 GLOBAL T_ACI_RETURN sAT_PlusCRES ( T_ACI_CMD_SRC srcId, | |
3908 SHORT profile) | |
3909 { | |
3910 T_ACI_RETURN ret=AT_CMPL; /* AT response code */ | |
3911 UBYTE max_record; | |
3912 | |
3913 TRACE_FUNCTION ("sAT_PlusCRES ()"); | |
3914 | |
3915 /* | |
3916 *----------------------------------------------------------------- | |
3917 * check if command executable | |
3918 *----------------------------------------------------------------- | |
3919 */ | |
3920 if(!cmhSMS_checkAccess (srcId, &ret)) | |
3921 return ret; | |
3922 | |
3923 max_record = (UBYTE)cmhSMS_getPrfRge (); | |
3924 if ((profile <= 0) OR (profile > max_record)) | |
3925 { | |
3926 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
3927 return AT_FAIL; | |
3928 } | |
3929 | |
3930 smsShrdPrm.cbmPrm.cbmFoundIds = 0; | |
3931 | |
3932 if ( (smsShrdPrm.pSetPrm[srcId]->prflId NEQ profile) OR | |
3933 (smsShrdPrm.pSetPrm[srcId]->isCopy EQ TRUE) ) | |
3934 { | |
3935 T_SMS_SET_PRM * pSMSSetPrmOld; /* points to SMS parameter set */ | |
3936 T_SMS_SET_PRM * pSMSSetPrmNew; /* points to SMS parameter set */ | |
3937 | |
3938 pSMSSetPrmOld = smsShrdPrm.pSetPrm[srcId]; | |
3939 pSMSSetPrmOld->numOfRefs--; | |
3940 | |
3941 /* | |
3942 *----------------------------------------------------------------- | |
3943 * destroy temporary copy | |
3944 *----------------------------------------------------------------- | |
3945 */ | |
3946 if ( pSMSSetPrmOld->isCopy EQ TRUE) | |
3947 { | |
3948 ACI_MFREE(pSMSSetPrmOld); | |
3949 } | |
3950 | |
3951 /* | |
3952 *------------------------------------------------------------- | |
3953 * find the new profile in the SET PRM list | |
3954 *------------------------------------------------------------- | |
3955 */ | |
3956 pSMSSetPrmNew = find_element(set_prm_list, (UBYTE)profile, cmhSMS_findPrflId); | |
3957 if (pSMSSetPrmNew NEQ NULL) /* element was in SET PRM List */ | |
3958 { | |
3959 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmNew; | |
3960 smsShrdPrm.pSetPrm[srcId]->numOfRefs++; | |
3961 } | |
3962 else /* element was not found in SET PRM List */ | |
3963 { | |
3964 ACI_MALLOC(pSMSSetPrmNew, sizeof(T_SMS_SET_PRM)); | |
3965 memset(pSMSSetPrmNew, 0, sizeof(T_SMS_SET_PRM)); | |
3966 insert_list(set_prm_list, pSMSSetPrmNew); | |
3967 pSMSSetPrmNew->prflId = (UBYTE)profile; | |
3968 | |
3969 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmNew; | |
3970 } | |
3971 } | |
3972 | |
3973 /* | |
3974 *------------------------------------------------------------- | |
3975 * read parameters from non-volatile memory | |
3976 *------------------------------------------------------------- | |
3977 */ | |
3978 ret = cmhSMS_ReadParams (srcId, AT_CMD_CRES, profile); | |
3979 return ret; | |
3980 | |
3981 } | |
3982 | |
3983 | |
3984 | |
3985 /* | |
3986 +-------------------------------------------------------------------+ | |
3987 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
3988 | STATE : code ROUTINE : tAT_PlusCRES | | |
3989 +-------------------------------------------------------------------+ | |
3990 | |
3991 PURPOSE : This is the functional counterpart of the +CRES | |
3992 AT command which is responsible for retrieving of | |
3993 certain SMS parameters from nonvolatile memory. | |
3994 | |
3995 Shen,Chao July 1st, 2003 | |
3996 | |
3997 */ | |
3998 GLOBAL T_ACI_RETURN tAT_PlusCRES ( T_ACI_CMD_SRC srcId, T_ACI_CRES *values) | |
3999 { | |
4000 SHORT profile = -1; | |
4001 if ((profile = cmhSMS_getPrfRge ()) < 1) | |
4002 { | |
4003 return (AT_FAIL); | |
4004 } | |
4005 | |
4006 values->min = 0; | |
4007 values->max = profile - 1; | |
4008 | |
4009 return AT_CMPL; | |
4010 } | |
4011 | |
4012 #ifdef TI_PS_FF_AT_P_CMD_CPRSM | |
4013 /* | |
4014 +-------------------------------------------------------------------+ | |
4015 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4016 | STATE : code ROUTINE : sAT_PercentCPRSM | | |
4017 +-------------------------------------------------------------------+ | |
4018 | |
4019 PURPOSE : This is the functional counterpart of the %CPRSM | |
4020 AT command which is responsible for setting the receiving | |
4021 of SMS to pause or resume. | |
4022 [MDF: 07.04.2004] | |
4023 */ | |
4024 GLOBAL T_ACI_RETURN sAT_PercentCPRSM ( T_ACI_CMD_SRC srcId, | |
4025 T_ACI_CPRSM_MOD mode) | |
4026 { | |
4027 T_ACI_RETURN ret; | |
4028 | |
4029 TRACE_FUNCTION("sAT_PercentCPRSM()"); | |
4030 | |
4031 /* check whether SMS is currently accessible */ | |
4032 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4033 return ret; | |
4034 | |
4035 /* check mode and inform SMS entity */ | |
4036 switch ( mode ) | |
4037 { | |
4038 case CPRSM_MOD_Pause: | |
4039 /* send pause request to SMS */ | |
4040 psaSMS_PauseReq(); | |
4041 /* command complete */ | |
4042 ret = AT_CMPL; | |
4043 break; | |
4044 case CPRSM_MOD_Resume: | |
4045 /* store paramters for current command */ | |
4046 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CPRSM; | |
4047 smsShrdPrm.owner = (T_OWN)srcId; | |
4048 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4049 /* send resume request to SMS */ | |
4050 psaSMS_ResumeReq(); | |
4051 ret = AT_EXCT; | |
4052 break; | |
4053 default: | |
4054 TRACE_EVENT_P1("sAT_PercentCPRSM ERROR: mode %d not supported", mode); | |
4055 ret = AT_FAIL; | |
4056 } | |
4057 return ret; | |
4058 } | |
4059 | |
4060 /* | |
4061 +-------------------------------------------------------------------+ | |
4062 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4063 | STATE : code ROUTINE : qAT_PercentCPRSM | | |
4064 +-------------------------------------------------------------------+ | |
4065 | |
4066 PURPOSE : This is the functional counterpart of the %CPRSM | |
4067 AT command which is responsible for quering the status | |
4068 of receiving of SMS. It might be resume or pause. | |
4069 [MDF: 15.04.2004] | |
4070 */ | |
4071 GLOBAL T_ACI_RETURN qAT_PercentCPRSM ( T_ACI_CMD_SRC srcId ) | |
4072 { | |
4073 T_ACI_RETURN ret = AT_EXCT; | |
4074 | |
4075 TRACE_FUNCTION("qAT_PercentCPRSM()"); | |
4076 | |
4077 /* check whether SMS is currently accessible */ | |
4078 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4079 return ret; | |
4080 | |
4081 /* store paramters for current command */ | |
4082 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CPRSM; | |
4083 smsShrdPrm.owner = (T_OWN)srcId; | |
4084 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4085 | |
4086 /* add parameter for signaling which parameter has been requested */ | |
4087 psaSMS_QueryReq (SMS_QUERY_DELIVER_STATUS); | |
4088 | |
4089 return ret; | |
4090 } | |
4091 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */ | |
4092 /* | |
4093 +-------------------------------------------------------------------+ | |
4094 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4095 | STATE : code ROUTINE : sAT_PlusCMMS | | |
4096 +-------------------------------------------------------------------+ | |
4097 | |
4098 PURPOSE : This is the functional counterpart of the +CMMS | |
4099 AT command which is responsible for setting the | |
4100 mode. | |
4101 | |
4102 <mode>: command mode | |
4103 */ | |
4104 GLOBAL T_ACI_RETURN sAT_PlusCMMS ( T_ACI_CMD_SRC srcId, | |
4105 UBYTE mode ) | |
4106 { | |
4107 T_ACI_RETURN ret = AT_FAIL; | |
4108 | |
4109 TRACE_FUNCTION ("sAT_PlusCMMS ()"); | |
4110 | |
4111 /* | |
4112 *----------------------------------------------------------------- | |
4113 * check source id and if command executable | |
4114 *----------------------------------------------------------------- | |
4115 */ | |
4116 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4117 return ret; | |
4118 | |
4119 smsShrdPrm.CMMSmode = mode; | |
4120 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMMS; | |
4121 | |
4122 /* Implements measure 147,148, 149 */ | |
4123 cmhSMS_sendConfigureReq(TRUE); | |
4124 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE; | |
4125 | |
4126 return( AT_CMPL ); | |
4127 } | |
4128 | |
4129 /* | |
4130 +-------------------------------------------------------------------+ | |
4131 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4132 | STATE : code ROUTINE : sAT_PercentCMGMDU | | |
4133 +-------------------------------------------------------------------+ | |
4134 | |
4135 PURPOSE : Function is used to reset the reply path | |
4136 | |
4137 <index>: Index of the record | |
4138 */ | |
4139 | |
4140 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
4141 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU ( T_ACI_CMD_SRC srcId, | |
4142 UBYTE index ) | |
4143 { | |
4144 T_CONC_INIT_RETURN ret; | |
4145 | |
4146 TRACE_FUNCTION ("sAT_PercentCMGMDU ()"); | |
4147 | |
4148 TRACE_EVENT_P1("sAT_PercentCMGMDU () index: %d", index); | |
4149 | |
4150 ret=concSMS_initReadFromMem(srcId, index, SMS_READ_Normal); | |
4151 | |
4152 if (ret EQ CONC_NEEDED) | |
4153 { | |
4154 SET_CONC; | |
4155 TRACE_EVENT("sAT_PercentCMGMDU: CONC_NEEDED"); | |
4156 return sAT_PercentCMGMDU_Gl(srcId, index, rConcSMS_PercentCMGMDU); | |
4157 } | |
4158 else if (ret EQ CONC_NOT_NEEDED) | |
4159 { | |
4160 TRACE_EVENT("sAT_PercentCMGMDU: CONC_NOT_NEEDED"); | |
4161 return sAT_PercentCMGMDU_Gl(srcId, index, NULL); | |
4162 } | |
4163 else | |
4164 { | |
4165 TRACE_EVENT("ERROR: sAT_PercentCMGMDU: CMS_ERR_InValMemIdx"); | |
4166 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
4167 return ( AT_FAIL ); | |
4168 } | |
4169 } | |
4170 #endif /* #if (defined (MFW) OR defined (_CONC_TESTING_) */ | |
4171 | |
4172 /* | |
4173 +-------------------------------------------------------------------+ | |
4174 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4175 | STATE : code ROUTINE : sAT_PercentCMGMDU | | |
4176 +-------------------------------------------------------------------+ | |
4177 | |
4178 PURPOSE : For Riv-MMI. | |
4179 */ | |
4180 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
4181 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU ( T_ACI_CMD_SRC srcId, | |
4182 UBYTE index ) | |
4183 { | |
4184 TRACE_FUNCTION ("sAT_PercentCMGMDU ()"); | |
4185 TRACE_EVENT_P1("sAT_PercentCMGMDU () index: %d", index); | |
4186 | |
4187 return sAT_PercentCMGMDU_Gl(srcId, index, NULL); | |
4188 } | |
4189 #endif /*#if defined (FF_MMI_RIV)*/ | |
4190 | |
4191 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU_Gl ( T_ACI_CMD_SRC srcId, | |
4192 UBYTE index, | |
4193 T_CMGMDU_FCT rplyCB ) | |
4194 { | |
4195 T_ACI_RETURN ret = AT_EXCT; | |
4196 | |
4197 TRACE_FUNCTION ("sAT_PercentCMGMDU_Gl ()"); | |
4198 | |
4199 /* | |
4200 *----------------------------------------------------------------- | |
4201 * check if command executable | |
4202 *----------------------------------------------------------------- | |
4203 */ | |
4204 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4205 { | |
4206 return ret; | |
4207 } | |
4208 | |
4209 smsShrdPrm.rplyCB.cmgmdu = rplyCB; | |
4210 smsShrdPrm.rdMode = READ_NORMAL; | |
4211 | |
4212 /* | |
4213 *----------------------------------------------------------------- | |
4214 * read a short message from memory | |
4215 *----------------------------------------------------------------- | |
4216 */ | |
4217 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGMDU; | |
4218 smsShrdPrm.owner = (T_OWN)srcId; | |
4219 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4220 | |
4221 psaSMS_ReadReq ( smsShrdPrm.mem1, index, | |
4222 smsShrdPrm.rdMode, SMS_STAT_NotPresent); | |
4223 | |
4224 return( ret ); | |
4225 } | |
4226 /* | |
4227 +-------------------------------------------------------------------+ | |
4228 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4229 | STATE : code ROUTINE : sAT_PercentCMGR_Gl | | |
4230 +-------------------------------------------------------------------+ | |
4231 | |
4232 PURPOSE : This is the functional counterpart of the %CMGR | |
4233 AT command which is responsible for reading a short | |
4234 message from memory. | |
4235 | |
4236 <index>: storage area index | |
4237 <rdMode>: read mode | |
4238 <rplyCB>: reply call-back | |
4239 <errorCB>: error call-back | |
4240 */ | |
4241 GLOBAL T_ACI_RETURN sAT_PercentCMGR_Gl ( T_ACI_CMD_SRC srcId, | |
4242 UBYTE index, | |
4243 T_ACI_SMS_READ rdMode, | |
4244 T_CMGR_FCT rplyCB ) | |
4245 { | |
4246 T_ACI_RETURN ret = AT_EXCT; | |
4247 | |
4248 TRACE_FUNCTION ("sAT_PercentCMGR_Gl ()"); | |
4249 | |
4250 /* | |
4251 *----------------------------------------------------------------- | |
4252 * check if command executable | |
4253 *----------------------------------------------------------------- | |
4254 */ | |
4255 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4256 { | |
4257 return ret; | |
4258 } | |
4259 | |
4260 smsShrdPrm.rplyCB.cmgr = rplyCB; | |
4261 | |
4262 | |
4263 /* | |
4264 *----------------------------------------------------------------- | |
4265 * process the <index> parameter | |
4266 *----------------------------------------------------------------- | |
4267 */ | |
4268 switch (rdMode) | |
4269 { | |
4270 case SMS_READ_StatusChange: | |
4271 smsShrdPrm.rdMode = READ_STATUS_CHANGE; | |
4272 break; | |
4273 case SMS_READ_Preview: | |
4274 smsShrdPrm.rdMode = READ_PREVIEW; | |
4275 break; | |
4276 case SMS_READ_Normal: | |
4277 case SMS_READ_NotPresent: | |
4278 smsShrdPrm.rdMode = READ_NORMAL; | |
4279 break; | |
4280 default: | |
4281 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
4282 return ( AT_FAIL ); | |
4283 } | |
4284 /* | |
4285 *----------------------------------------------------------------- | |
4286 * read a short message from memory | |
4287 *----------------------------------------------------------------- | |
4288 */ | |
4289 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGR; | |
4290 smsShrdPrm.owner = (T_OWN)srcId; | |
4291 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4292 | |
4293 psaSMS_ReadReq ( smsShrdPrm.mem1, index, | |
4294 smsShrdPrm.rdMode, SMS_STAT_NotPresent); | |
4295 | |
4296 return( ret ); | |
4297 } | |
4298 | |
4299 | |
4300 /* | |
4301 +-------------------------------------------------------------------+ | |
4302 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4303 | STATE : code ROUTINE : sAT_PercentCMGR | | |
4304 +-------------------------------------------------------------------+ | |
4305 | |
4306 PURPOSE : This is the functional counterpart of the %CMGR | |
4307 AT command which is responsible for reading a short | |
4308 message from memory. | |
4309 | |
4310 Features Concatenated SMS. | |
4311 For GPF-MMI. | |
4312 | |
4313 <index>: storage area index | |
4314 <rdMode>: read mode | |
4315 */ | |
4316 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS | |
4317 | |
4318 GLOBAL T_ACI_RETURN sAT_PercentCMGR ( T_ACI_CMD_SRC srcId, | |
4319 UBYTE index, | |
4320 T_ACI_SMS_READ rdMode ) | |
4321 { | |
4322 T_CONC_INIT_RETURN ret; | |
4323 | |
4324 TRACE_FUNCTION ("sAT_PercentCMGR ()"); | |
4325 | |
4326 ret=concSMS_initReadFromMem(srcId, index, rdMode); | |
4327 | |
4328 if (ret EQ CONC_NEEDED) | |
4329 { | |
4330 SET_CONC; | |
4331 TRACE_EVENT("sAT_PlusCMGR: CONC_NEEDED"); | |
4332 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rConcSMS_PercentCMGR); | |
4333 } | |
4334 else if (ret EQ CONC_NOT_NEEDED) | |
4335 { | |
4336 TRACE_EVENT("sAT_PlusCMGR: CONC_NOT_NEEDED"); | |
4337 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rAT_PercentCMGR); | |
4338 } | |
4339 else | |
4340 { | |
4341 TRACE_EVENT("ERROR: sAT_PercentCMGR: CMS_ERR_InValMemIdx"); | |
4342 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx ); | |
4343 return ( AT_FAIL ); | |
4344 } | |
4345 } | |
4346 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/ | |
4347 | |
4348 /* | |
4349 +-------------------------------------------------------------------+ | |
4350 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4351 | STATE : code ROUTINE : sAT_PercentCMGR | | |
4352 +-------------------------------------------------------------------+ | |
4353 | |
4354 PURPOSE : %CMGR command for handling the conc module on | |
4355 the Riv-MMI side. | |
4356 */ | |
4357 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS | |
4358 GLOBAL T_ACI_RETURN sAT_PercentCMGR ( T_ACI_CMD_SRC srcId, | |
4359 UBYTE index, | |
4360 T_ACI_SMS_READ rdMode ) | |
4361 { | |
4362 TRACE_FUNCTION ("sAT_PercentCMGR ()"); | |
4363 | |
4364 TRACE_EVENT_P1("sAT_PercentCMGR () index: %d", index); | |
4365 | |
4366 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rAT_PercentCMGR); | |
4367 } | |
4368 #endif /*#if defined (FF_MMI_RIV)*/ | |
4369 | |
4370 /* | |
4371 +-------------------------------------------------------------------+ | |
4372 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4373 | STATE : code ROUTINE : sAT_PercentCMGL | | |
4374 +-------------------------------------------------------------------+ | |
4375 | |
4376 PURPOSE : This is the functional counterpart of the %CMGL | |
4377 AT command which is responsible for creating a list of | |
4378 all stored short messages. | |
4379 | |
4380 <state>: state of stored short message | |
4381 <rdmode>: Read mode | |
4382 */ | |
4383 GLOBAL T_ACI_RETURN sAT_PercentCMGL ( T_ACI_CMD_SRC srcId, | |
4384 T_ACI_SMS_STAT state, | |
4385 T_ACI_SMS_READ rdMode ) | |
4386 { | |
4387 T_ACI_RETURN ret; /* AT response code */ | |
4388 T_ACI_SMS_STAT chk_state; | |
4389 | |
4390 TRACE_FUNCTION ("sAT_PercentCMGL ()"); | |
4391 | |
4392 /* | |
4393 *----------------------------------------------------------------- | |
4394 * check if command executable | |
4395 *----------------------------------------------------------------- | |
4396 */ | |
4397 if(!cmhSMS_checkAccess (srcId, &ret)) | |
4398 { | |
4399 return ret; | |
4400 } | |
4401 | |
4402 /* | |
4403 *----------------------------------------------------------------- | |
4404 * process the <state> parameter | |
4405 *----------------------------------------------------------------- | |
4406 */ | |
4407 switch ( state ) | |
4408 { | |
4409 case( SMS_STAT_NotPresent ): | |
4410 chk_state = SMS_STAT_RecUnread; | |
4411 break; | |
4412 | |
4413 case( SMS_STAT_Invalid ): | |
4414 case( SMS_STAT_All ): | |
4415 case( SMS_STAT_RecUnread ): | |
4416 case( SMS_STAT_RecRead ): | |
4417 case( SMS_STAT_StoUnsent ): | |
4418 case( SMS_STAT_StoSent ): | |
4419 chk_state = state; | |
4420 break; | |
4421 | |
4422 default: | |
4423 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
4424 return ( AT_FAIL ); | |
4425 } | |
4426 | |
4427 | |
4428 /* | |
4429 *----------------------------------------------------------------- | |
4430 * process the <rdMode> parameter | |
4431 *----------------------------------------------------------------- | |
4432 */ | |
4433 switch (rdMode) | |
4434 { | |
4435 case SMS_READ_StatusChange: | |
4436 smsShrdPrm.rdMode = READ_STATUS_CHANGE; | |
4437 break; | |
4438 case SMS_READ_Preview: | |
4439 smsShrdPrm.rdMode = READ_PREVIEW; | |
4440 break; | |
4441 case SMS_READ_Normal: | |
4442 case SMS_READ_NotPresent: | |
4443 smsShrdPrm.rdMode = READ_NORMAL; | |
4444 break; | |
4445 default: | |
4446 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
4447 return ( AT_FAIL ); | |
4448 } | |
4449 | |
4450 /* | |
4451 *--------------------------------------------------------------- | |
4452 * PSA notification | |
4453 *--------------------------------------------------------------- | |
4454 */ | |
4455 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGL; | |
4456 smsShrdPrm.owner = (T_OWN)srcId; | |
4457 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4458 | |
4459 /* | |
4460 *--------------------------------------------------------------- | |
4461 * request the list element | |
4462 *--------------------------------------------------------------- | |
4463 */ | |
4464 psaSMS_ReadReq ( smsShrdPrm.mem1, 0, | |
4465 smsShrdPrm.rdMode, chk_state ); | |
4466 | |
4467 return( AT_EXCT ); | |
4468 } | |
4469 | |
4470 /* | |
4471 +-------------------------------------------------------------------+ | |
4472 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4473 | STATE : code ROUTINE : cmhSMS_SendDelete_Req | | |
4474 +-------------------------------------------------------------------+ | |
4475 | |
4476 PURPOSE : This is the functional used to send a delete request | |
4477 to SMS module. | |
4478 | |
4479 */ | |
4480 | |
4481 GLOBAL void cmhSMS_SendDelete_Req ( UBYTE index, | |
4482 UBYTE status ) | |
4483 { | |
4484 TRACE_FUNCTION ("cmhSMS_SendDelete_Req ()"); | |
4485 | |
4486 smsShrdPrm.index = index; | |
4487 smsShrdPrm.status = status; | |
4488 | |
4489 /*-------------------------------------------------------------------* | |
4490 * Create and Send primitive for SMS delete * | |
4491 *-------------------------------------------------------------------*/ | |
4492 { | |
4493 PALLOC (mnsms_delete_req, MNSMS_DELETE_REQ); | |
4494 | |
4495 /* fill in primitive parameter: delete message */ | |
4496 mnsms_delete_req -> mem_type = smsShrdPrm.mem1; | |
4497 mnsms_delete_req -> rec_num = index; | |
4498 mnsms_delete_req -> delete_status = status; | |
4499 | |
4500 PSENDX (SMS, mnsms_delete_req); | |
4501 | |
4502 TRACE_EVENT_P1("cmgd: delete rec_num: %d", mnsms_delete_req->rec_num); | |
4503 } | |
4504 } | |
4505 | |
4506 | |
4507 /* | |
4508 +-------------------------------------------------------------------+ | |
4509 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS | | |
4510 | STATE : code ROUTINE : sAT_PercentCMGRS | | |
4511 +-------------------------------------------------------------------+ | |
4512 | |
4513 PURPOSE : This is the functional counterpart of the %CMGRS | |
4514 AT command which is responsible for selecting auto | |
4515 retransmission mode/request manual retransmission of last | |
4516 failed SMS | |
4517 | |
4518 <mode>: requested mode | |
4519 */ | |
4520 #ifdef REL99 | |
4521 | |
4522 GLOBAL T_ACI_RETURN sAT_PercentCMGRS ( T_ACI_CMD_SRC srcId, | |
4523 T_ACI_CMGRS_MODE mode) | |
4524 { | |
4525 T_ACI_RETURN aci_ret_val = AT_CMPL; | |
4526 | |
4527 TRACE_FUNCTION ("sAT_PercentCMGRS ()"); | |
4528 | |
4529 /* | |
4530 *----------------------------------------------------------------- | |
4531 * check command source | |
4532 *----------------------------------------------------------------- | |
4533 */ | |
4534 if(!cmh_IsVldCmdSrc (srcId) AND (srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)) | |
4535 { | |
4536 TRACE_ERROR ("[cmhSMS_checkAccess]: Cmd Src not valid"); | |
4537 return AT_FAIL; | |
4538 } | |
4539 /* | |
4540 *----------------------------------------------------------------- | |
4541 * check SMS access status | |
4542 *----------------------------------------------------------------- | |
4543 */ | |
4544 if (!cmhSMS_checkSIM ()) | |
4545 { | |
4546 return AT_FAIL; | |
4547 } | |
4548 | |
4549 switch( mode ) | |
4550 { | |
4551 case( CMGRS_MODE_DISABLE_AUTO_RETRANS ): | |
4552 case( CMGRS_MODE_ENABLE_AUTO_RETRANS ): | |
4553 smsShrdPrm.auto_repeat_flag = mode; | |
4554 aci_ret_val = AT_CMPL; | |
4555 break; | |
4556 | |
4557 case( CMGRS_MODE_MANUAL_RETRANS ): | |
4558 /* | |
4559 *----------------------------------------------------------------- | |
4560 * check entity status | |
4561 *----------------------------------------------------------------- | |
4562 */ | |
4563 if( smsShrdPrm.smsEntStat.curCmd NEQ AT_CMD_NONE ) | |
4564 { | |
4565 | |
4566 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
4567 TRACE_ERROR ("[cmhSMS_checkAccess]: Entity is busy"); | |
4568 aci_ret_val = AT_BUSY; | |
4569 break ; | |
4570 } | |
4571 | |
4572 if(smsShrdPrm.is_msg_present_for_retrans EQ FALSE) | |
4573 { | |
4574 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_FailedMsgNotPresent ); | |
4575 aci_ret_val = AT_FAIL; | |
4576 } | |
4577 else | |
4578 { | |
4579 /*------------------------------------------------------------------- | |
4580 * create and send primitive for retrasnmission request | |
4581 *------------------------------------------------------------------- | |
4582 */ | |
4583 PALLOC (mnsms_retrans_req, MNSMS_RETRANS_REQ); | |
4584 mnsms_retrans_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag; | |
4585 PSENDX (SMS, mnsms_retrans_req); | |
4586 | |
4587 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGRS; | |
4588 smsShrdPrm.smsEntStat.entOwn = srcId; | |
4589 smsShrdPrm.owner = (T_OWN)srcId; | |
4590 #if defined (MFW) OR defined (FF_MMI_RIV) | |
4591 smsShrdPrm.rplyCB.cmgrs = rAT_PercentCMGRS; | |
4592 smsShrdPrm.errorCB = rAT_PlusCMS; | |
4593 #else | |
4594 smsShrdPrm.rplyCB.cmgrs = NULL; | |
4595 smsShrdPrm.errorCB = NULL; | |
4596 #endif | |
4597 aci_ret_val = AT_EXCT; | |
4598 } | |
4599 break; | |
4600 | |
4601 default: | |
4602 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
4603 aci_ret_val = AT_FAIL; | |
4604 break; | |
4605 } | |
4606 | |
4607 return aci_ret_val; | |
4608 } | |
4609 #endif | |
4610 | |
4611 /*==== EOF ========================================================*/ |