comparison src/g23m-aci/aci/cmh_smss.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children b135e1505ae4
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
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 #endif /*#if defined FF_MMI_RIV*/
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 GLOBAL T_ACI_RETURN sAT_PlusCMGS_byPort( T_ACI_CMD_SRC srcId,
1171 CHAR* da,
1172 T_ACI_TOA* toda,
1173 T_SM_DATA_EXT* src_data,
1174 CHAR* sca,
1175 T_ACI_TOA* tosca,
1176 SHORT isReply,
1177 SHORT isSpPORT,
1178 SHORT destPORT,
1179 SHORT origPORT)
1180 {
1181 T_CONC_INIT_RETURN ret;
1182 T_ACI_UDH_DATA udh;
1183
1184
1185
1186 T_ACI_SM_DATA tar_data;
1187 UBYTE alphabet;
1188
1189
1190
1191 TRACE_FUNCTION ("sAT_PlusCMGS_byPort ()");
1192
1193
1194
1195 memset(&udh, 0, sizeof(T_ACI_UDH_DATA));
1196 alphabet = cmhSMS_getAlphabetPp ( smsShrdPrm.pSetPrm[srcId]->dcs );
1197
1198
1199
1200 ret=concSMS_initSend(&tar_data, &udh, srcId, da, toda, src_data, sca,
1201 tosca, isReply, alphabet);
1202 if(isSpPORT)//add port data to udh
1203 {
1204 udh.data[udh.len] = 0x05;//Application Port Addressing 16 bit address
1205 udh.data[udh.len+1] = 0x04;//ud length
1206 udh.data[udh.len+2] = destPORT>>8;//destination port
1207 udh.data[udh.len+3] = destPORT&0xff;
1208 udh.data[udh.len+4] = origPORT>>8;//orignal port
1209 udh.data[udh.len+5] = origPORT&0xff;
1210 udh.len+=6;
1211 }
1212 if (ret EQ CONC_NEEDED)
1213 {
1214 SET_CONC;
1215 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, &udh, sca, tosca,
1216 isReply, rConcSMS_PlusCMGS, rConcSMS_PlusCMS_CMGS);
1217 }
1218 else if(isSpPORT)
1219 {
1220 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, &udh, sca, tosca,
1221 isReply, rAT_PlusCMGS, rAT_PlusCMS);
1222 }
1223 else
1224 {
1225 return sAT_PlusCMGS_Gl(srcId, da, toda, &tar_data, NULL, sca, tosca,
1226 isReply, rAT_PlusCMGS, rAT_PlusCMS);
1227 }
1228 }
1229
1230
1231 /*
1232 +-------------------------------------------------------------------+
1233 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
1234 | STATE : code ROUTINE : sAT_PlusCMGS_Gl |
1235 +-------------------------------------------------------------------+
1236
1237 PURPOSE : This is the functional counterpart of the +CMGS
1238 AT command which is responsible for sending a short
1239 message.
1240
1241 <da>: destination address
1242 <toda>: type of destination address
1243 <data>: message data
1244 <udh>: user data header
1245 <sca>: service center address
1246 <tosca>: type of service center address
1247 <isReply>: > 0: set TP-Reply-Path explicitly
1248 EQ 0: clear TP-Reply-Path explicitly
1249 <rplyCB>: reply call-back
1250 <errorCB>: error call-back
1251 */
1252 GLOBAL T_ACI_RETURN sAT_PlusCMGS_Gl ( T_ACI_CMD_SRC srcId,
1253 CHAR* da,
1254 T_ACI_TOA* toda,
1255 T_ACI_SM_DATA* data,
1256 T_ACI_UDH_DATA* udh,
1257 CHAR* sca,
1258 T_ACI_TOA* tosca,
1259 SHORT isReply,
1260 T_CMSS_FCT rplyCB,
1261 T_ERROR_FCT errorCB)
1262 {
1263 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
1264 T_ACI_RETURN ret=AT_CMPL; /* AT response code */
1265 CHAR* restDa = da; /* destination address without */
1266 /* international access function */
1267 /* characters */
1268 CHAR* restSca = sca; /* service center address without */
1269 /* international access function */
1270 /* characters */
1271
1272 T_ACI_SM_DATA packedData;
1273 T_tp_da da_addr;
1274 UBYTE msgType;
1275 UBYTE byte_offset = 0;
1276 BOOL mtchFlag;
1277
1278 #ifdef _CONC_TESTING_
1279 /* Implements Measure#32 */
1280 #endif
1281
1282 TRACE_FUNCTION ("sAT_PlusCMGS_Gl ()");
1283
1284
1285 /*
1286 *-----------------------------------------------------------------
1287 * check if command executable
1288 *-----------------------------------------------------------------
1289 */
1290 if(!cmhSMS_checkAccess (srcId, &ret))
1291 return ret;
1292
1293 smsShrdPrm.rplyCB.cmgs = rplyCB;
1294 smsShrdPrm.errorCB = errorCB;
1295
1296 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
1297
1298 /*
1299 *-----------------------------------------------------------------
1300 * process the <da> parameter
1301 *-----------------------------------------------------------------
1302 */
1303 if ( da NEQ NULL )
1304 {
1305 /*
1306 *---------------------------------------------------------------
1307 * process the <toda> parameter
1308 *---------------------------------------------------------------
1309 */
1310 if ( toda NEQ NULL )
1311 {
1312 da_addr.ton = toda -> ton;
1313 da_addr.npi = toda -> npi;
1314 }
1315 else
1316 {
1317 restDa = cmhSMS_setToaDef ( da, &da_addr.ton, &da_addr.npi );
1318 }
1319
1320 /* start: check if fixed dialing phonebook is enabled */
1321 if (pb_get_fdn_mode () EQ FDN_ENABLE AND
1322 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )
1323 {
1324 TRACE_FUNCTION("sAT_PlusCMGS_Gl: FDN");
1325 if ( da_addr.ton NEQ TON_Alphanumeric ) /* not supported by Phonebook */
1326 {
1327 TRACE_EVENT_P1("sAT_PlusCMGS_Gl: FDN checking: %s",da);
1328
1329 if ( da[0] EQ '+' )
1330 {
1331 /* check if '+' is within the string and remove it if it is */
1332 mtchFlag = (pb_check_fdn (0, (const UBYTE *)(da + 1)) EQ PHB_OK);
1333 }
1334 else
1335 {
1336 mtchFlag = (pb_check_fdn (0, (const UBYTE *)(da )) EQ PHB_OK);
1337 }
1338 if ( mtchFlag )
1339 {
1340 TRACE_EVENT("sAT_PlusCMGS_Gl: Found match in FDN!");
1341 }
1342 else
1343 {
1344 TRACE_EVENT("sAT_PlusCMGS_Gl: No match in FDN found, SMS rejected!");
1345 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed );
1346 return ( AT_FAIL );
1347 }
1348 }
1349 else /* TON signals ALPHANUMERIC */
1350 {
1351 TRACE_EVENT("FDN doesn't support alphanumeric addr., SMS rejected");
1352 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed );
1353 return ( AT_FAIL );
1354 }
1355 }
1356 /* end: check fixed dialing phonebook if enabled */
1357
1358 if ( da_addr.ton EQ TON_Alphanumeric )
1359 {
1360 if( cmhSMS_packAlphaNumAddr(restDa, &da_addr) EQ AT_FAIL )
1361 {
1362 return (AT_FAIL);
1363 }
1364 }
1365 else
1366 {
1367 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa);
1368 da_addr.digits = da_addr.c_num;
1369 }
1370 }
1371 else
1372 {
1373 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1374 return ( AT_FAIL );
1375 }
1376
1377 /*
1378 *-------------------------------------------------------------------
1379 * create and send primitive for SMS submit
1380 *-------------------------------------------------------------------
1381 */
1382 {
1383 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ);
1384
1385 /*
1386 *-----------------------------------------------------------------
1387 * process the <sca> parameter
1388 *-----------------------------------------------------------------
1389 */
1390 if ( sca NEQ NULL AND *sca NEQ '\0' )
1391 {
1392 /*
1393 *---------------------------------------------------------------
1394 * process the <tosca> parameter
1395 *---------------------------------------------------------------
1396 */
1397 if ( tosca NEQ NULL )
1398 {
1399 smsShrdPrm.tpdu.sc_addr.ton = tosca -> ton;
1400 smsShrdPrm.tpdu.sc_addr.npi = tosca -> npi;
1401
1402 }
1403 else
1404 {
1405 restSca = cmhSMS_setToaDef( sca, &smsShrdPrm.tpdu.sc_addr.ton,
1406 &smsShrdPrm.tpdu.sc_addr.npi);
1407 }
1408 cmhSMS_getAdrBcd( smsShrdPrm.tpdu.sc_addr.num,
1409 &smsShrdPrm.tpdu.sc_addr.c_num,
1410 MAX_SMS_ADDR_DIG, restSca);
1411
1412 smsShrdPrm.tpdu.sc_addr.v_ton = TRUE;
1413 smsShrdPrm.tpdu.sc_addr.v_npi = TRUE;
1414
1415 }
1416 else
1417 {
1418 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr));
1419 }
1420
1421 /*
1422 *-----------------------------------------------------------------
1423 * process the <isReply> parameter
1424 *-----------------------------------------------------------------
1425 */
1426 msgType = (pSMSSetPrm->msgType & ~TP_MTI_MASK)
1427 | TP_MTI_SMS_SUBMIT;
1428 if (isReply EQ 0)
1429 msgType &= ~TP_RP_MASK; /* set TP-Reply-Path bit to 0 */
1430 else if (isReply > 0)
1431 msgType |= TP_RP_MASK; /* set TP-Reply-Path bit to 1 */
1432
1433 /*
1434 *-----------------------------------------------------------------
1435 * process the <data> parameter and
1436 * copy already to shared parameter
1437 *-----------------------------------------------------------------
1438 * reducing from 8 to 7 bit (if DCS is set)
1439 *-----------------------------------------------------------------
1440 */
1441
1442 if (udh)
1443 byte_offset = udh->len+1;
1444
1445 if (data EQ NULL)
1446 {
1447 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1448 PFREE (mnsms_submit_req);
1449
1450 return ( AT_FAIL );
1451 }
1452
1453 cmhSMS_rdcSmsPp ( byte_offset,
1454 pSMSSetPrm -> dcs,
1455 ( UBYTE * ) data->data, ( UBYTE ) data->len,
1456 packedData.data,
1457 ( UBYTE * ) &packedData.len);
1458
1459 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT));
1460 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit,
1461 srcId,
1462 msgType,
1463 0,
1464 &da_addr,
1465 &packedData,
1466 data->len,
1467 udh );
1468
1469 mnsms_submit_req -> mem_type = smsShrdPrm.mem2;
1470 mnsms_submit_req -> rec_num = SMS_RECORD_NOT_EXIST;
1471 mnsms_submit_req -> condx = SMS_CONDX_OVR_NON;
1472 mnsms_submit_req -> modify = SMS_MODIFY_NON;
1473 #ifdef REL99
1474 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
1475 {
1476 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
1477 }
1478 else
1479 {
1480 mnsms_submit_req -> auto_rep_flag = FALSE;
1481 }
1482 #endif
1483
1484 /*
1485 *-----------------------------------------------------------------
1486 * check if message should be transfered directly to SIM for SAT
1487 *-----------------------------------------------------------------
1488 */
1489
1490 #ifdef SIM_TOOLKIT
1491
1492 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM ))
1493 {
1494 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE)
1495 {
1496 ret = cmhSAT_MoSmCntr( smsShrdPrm.tpdu.sc_addr,
1497 da_addr,
1498 (UBYTE)srcId);
1499 }
1500 else
1501 {
1502 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE;
1503 }
1504 }
1505
1506 /* SIM_TOOLKIT_REQ was sent */
1507 if (ret NEQ AT_CMPL)
1508 {
1509 /* save primitive address for SIM_TOOLKIT response */
1510 sat_mnsms_submit_req = mnsms_submit_req;
1511
1512 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS;
1513 smsShrdPrm.owner = (T_OWN)srcId;
1514 smsShrdPrm.smsEntStat.entOwn = srcId;
1515
1516 /* mnsms_submit_req is send and coded in cmhSAT_ResSMCntrlBySIM() */
1517
1518 return ret;
1519 }
1520 #endif /* SIM_TOOLKIT */
1521
1522 /* code SMS-SUBMIT here */
1523 cmhSMS_codeMsg (&mnsms_submit_req->sms_sdu, SMS_VT_SUBMIT,
1524 &smsShrdPrm.tpdu.sc_addr, SMS_SUBMIT,
1525 (UBYTE*)smsShrdPrm.tpdu.tp_submit);
1526
1527 PSENDX (SMS, mnsms_submit_req);
1528
1529 #ifdef _CONC_TESTING_
1530 /* Implements Measure#32 */
1531 cmhSMS_sdu_buf_print(&(mnsms_submit_req->sms_sdu.buf[0]), 0);
1532 #endif
1533
1534 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
1535 {
1536 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
1537 smsShrdPrm.tpdu.tp_submit = NULL;
1538 }
1539 }
1540
1541 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS;
1542 smsShrdPrm.owner = (T_OWN)srcId;
1543 smsShrdPrm.smsEntStat.entOwn = srcId;
1544
1545 return( AT_EXCT );
1546 }
1547
1548 #if defined (SMS_PDU_SUPPORT) || defined (SIM_TOOLKIT)
1549
1550 /*
1551 +-------------------------------------------------------------------+
1552 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
1553 | STATE : code ROUTINE : sAT_PlusCMGSPdu |
1554 +-------------------------------------------------------------------+
1555
1556 PURPOSE : This is the functional counterpart of the +CMGS
1557 AT command which is responsible for sending a short
1558 message in pdu mode.
1559
1560 */
1561 GLOBAL T_ACI_RETURN sAT_PlusCMGSPdu ( T_ACI_CMD_SRC srcId,
1562 T_ACI_SM_DATA *pdu )
1563 {
1564 T_ACI_RETURN ret=AT_CMPL; /* AT response code */
1565 T_rp_addr sc_addr;
1566 T_tp_da dest_addr;
1567 UBYTE len;
1568
1569 CHAR daString[MAX_DIAL_LEN];
1570
1571 TRACE_FUNCTION ("sAT_PlusCMGSPdu()");
1572
1573 /*
1574 *-----------------------------------------------------------------
1575 * check if command executable
1576 *-----------------------------------------------------------------
1577 */
1578 if(!cmhSMS_checkAccess (srcId, &ret))
1579 return ret;
1580
1581
1582 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1583 smsShrdPrm.rplyCB.cmgs = rAT_PlusCMGS;
1584 smsShrdPrm.errorCB = rAT_PlusCMS;
1585 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */
1586
1587 /*
1588 *-------------------------------------------------------------------
1589 * create and send primitive for SMS submit
1590 *-------------------------------------------------------------------
1591 */
1592 {
1593 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ);
1594
1595 mnsms_submit_req -> mem_type = smsShrdPrm.mem2;
1596 mnsms_submit_req -> rec_num = SMS_RECORD_NOT_EXIST;
1597 mnsms_submit_req -> condx = SMS_CONDX_OVR_NON;
1598 mnsms_submit_req -> modify = SMS_MODIFY_NON;
1599
1600 #ifdef REL99
1601 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
1602 {
1603 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
1604 }
1605 else
1606 {
1607 mnsms_submit_req -> auto_rep_flag = FALSE;
1608 }
1609 #endif /* REL99 */
1610
1611 if ( pdu->len > 0 )
1612 {
1613 mnsms_submit_req->sms_sdu.l_buf = pdu->len * 8;
1614 mnsms_submit_req->sms_sdu.o_buf = 0;
1615 memcpy (mnsms_submit_req->sms_sdu.buf, pdu->data, pdu->len);
1616 }
1617 else
1618 {
1619 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1620 PFREE (mnsms_submit_req);
1621 return ( AT_FAIL );
1622 }
1623
1624
1625 len = DecodeRPAddress( &sc_addr.c_num, &sc_addr.ton,
1626 &sc_addr.npi, (UBYTE*)&sc_addr.num, pdu->data );
1627
1628 DecodeTPAddress( &dest_addr.c_num, &dest_addr.ton,
1629 &dest_addr.npi, (UBYTE*)&dest_addr.num, pdu->data+len+2);
1630
1631 /* start: check number if fdn is activated and search number */
1632 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR
1633 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND
1634 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/
1635 //TISH, patch for OMAPS00129150
1636 //start
1637 #if 0
1638 if (pb_get_fdn_mode () EQ FDN_ENABLE AND
1639 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )
1640 #else
1641 if (pb_get_fdn_mode () EQ FDN_ENABLE AND
1642 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms AND srcId NEQ OWN_SRC_SAT)
1643 #endif
1644 //end
1645 {
1646 cmhPHB_getAdrStr(daString, MAX_DIAL_LEN-1,
1647 pdu->data+len+4, dest_addr.c_num);
1648
1649 TRACE_EVENT_P1("sAT_PlusCMGSPdu: FDN checking %s:", daString);
1650
1651 if ( dest_addr.ton NEQ TON_Alphanumeric ) /* not supported by Phonebook */
1652 {
1653
1654 if (pb_check_fdn (0, (const UBYTE*)daString) EQ PHB_OK)
1655 {
1656 TRACE_EVENT("sAT_PlusCMGSPdu: Found match in FDN");
1657 }
1658 else
1659 {
1660 TRACE_EVENT("sAT_PlusCMGSPdu: No match in FDN found, SMS rejected");
1661 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed );
1662 return ( AT_FAIL );
1663 }
1664 }
1665 else /* da alphanumeric encoded */
1666 {
1667 TRACE_EVENT("FDN doesn't support alphanumeric addr., SMS rejected");
1668 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed );
1669 return ( AT_FAIL );
1670 }
1671 }
1672 /* end: check number if fdn is activated and search number */
1673
1674 /*
1675 *-----------------------------------------------------------------
1676 * check if message should be transfered directly to SIM for SAT
1677 *-----------------------------------------------------------------
1678 */
1679
1680 #ifdef SIM_TOOLKIT
1681
1682
1683 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM ))
1684 {
1685 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE)
1686 {
1687 ret = cmhSAT_MoSmCntr( sc_addr,
1688 dest_addr,
1689 (UBYTE)srcId );
1690 }
1691 else
1692 {
1693 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE;
1694 }
1695 }
1696
1697 if (ret NEQ AT_CMPL)
1698 {
1699 /* save primitive address for SIM_TOOLKIT response */
1700 sat_mnsms_submit_req = mnsms_submit_req;
1701
1702 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS;
1703 smsShrdPrm.owner = (T_OWN)srcId;
1704 smsShrdPrm.smsEntStat.entOwn = srcId;
1705
1706 return ret;
1707 /* PFREE(mnsms_submit_req);
1708 * NO PRIMITVE FREE !!!
1709 */
1710 }
1711 #endif /* SIM_TOOLKIT */
1712
1713
1714 #ifdef TI_PS_FF_AT_P_CMD_CUST
1715 if ((srcId EQ ((T_ACI_CMD_SRC)OWN_SRC_SAT)) AND
1716 (simShrdPrm.overall_cust_mode EQ (UBYTE)CUST_MODE_BEHAVIOUR_1))
1717 {
1718 /*
1719 ** MMI is a Cust1 Application
1720 ** Forward the original PDU to the MMI, and free the Primitive
1721 ** (it will be recreated when the MMI sends its Request)
1722 */
1723 cmhSAT_Cust1StkCmdInd();
1724 PFREE(mnsms_submit_req);
1725
1726 /*
1727 ** Ensure that the SMS parameters are reset, so that the SMS Entity is freed to
1728 ** process the command later.
1729 */
1730 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE;
1731 smsShrdPrm.owner = (T_OWN)CMD_SRC_NONE;
1732 smsShrdPrm.smsEntStat.entOwn = CMD_SRC_NONE;
1733
1734 return( AT_EXCT );
1735 }
1736 #endif /* TI_PS_FF_AT_P_CMD_CUST */
1737 PSENDX (SMS, mnsms_submit_req);
1738 }
1739
1740 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGS;
1741 smsShrdPrm.owner = (T_OWN)srcId;
1742 smsShrdPrm.smsEntStat.entOwn = srcId;
1743
1744 return( AT_EXCT );
1745 }
1746
1747 #endif
1748
1749
1750 /*
1751 +-------------------------------------------------------------------+
1752 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
1753 | STATE : code ROUTINE : sAT_PlusCMSS |
1754 +-------------------------------------------------------------------+
1755
1756 PURPOSE : This is the functional counterpart of the +CMSS
1757 AT command which is responsible for sending a short
1758 message from memory.
1759
1760 Features Concatenated SMS.
1761 For GPF-MMI.
1762
1763 <index>: storage area index
1764 <da>: destination address
1765 <toda>: type of destination address
1766 */
1767 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
1768 GLOBAL T_ACI_RETURN sAT_PlusCMSS ( T_ACI_CMD_SRC srcId,
1769 UBYTE index,
1770 CHAR* da,
1771 T_ACI_TOA* toda )
1772 {
1773 T_CONC_INIT_RETURN ret;
1774 TRACE_FUNCTION ("sAT_PlusCMSS ()");
1775
1776 ret=concSMS_initSendFromMem(srcId, &index, da, toda);
1777
1778 if (ret EQ CONC_NEEDED)
1779 {
1780 SET_CONC;
1781
1782 /* memorize mem2, this is for rConcSMS_PlusCMGS */
1783 concShrdPrm.mem_store = smsShrdPrm.mem2;
1784
1785 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rConcSMS_PlusCMSS,
1786 rConcSMS_PlusCMS_CMSS);
1787 }
1788 else if (ret EQ CONC_NOT_NEEDED)
1789 {
1790 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rAT_PlusCMSS,
1791 rAT_PlusCMS);
1792 }
1793 else
1794 {
1795 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
1796 return ( AT_FAIL );
1797 }
1798 }
1799 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/
1800
1801 /*
1802 +-------------------------------------------------------------------+
1803 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
1804 | STATE : code ROUTINE : sAT_PlusCMSS |
1805 +-------------------------------------------------------------------+
1806
1807 PURPOSE : For Riv-MMI.
1808 */
1809 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
1810 GLOBAL T_ACI_RETURN sAT_PlusCMSS ( T_ACI_CMD_SRC srcId,
1811 UBYTE index,
1812 CHAR* da,
1813 T_ACI_TOA* toda )
1814 {
1815
1816 TRACE_FUNCTION ("sAT_PlusCMSS ()");
1817 TRACE_EVENT_P1("sAT_PlusCMGS () index: %d", index);
1818 return sAT_PlusCMSS_Gl(srcId, index, da, toda, rAT_PlusCMSS,
1819 rAT_PlusCMS);
1820
1821 }
1822 #endif /*#if defined (FF_MMI_RIV)*/
1823
1824 /*
1825 +-------------------------------------------------------------------+
1826 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
1827 | STATE : code ROUTINE : sAT_PlusCMSS_Gl |
1828 +-------------------------------------------------------------------+
1829
1830 PURPOSE : This is the functional counterpart of the +CMSS
1831 AT command which is responsible for sending a short
1832 message from memory.
1833
1834 <index>: storage area index
1835 <da>: destination address
1836 <toda>: type of destination address
1837 <rplyCB>: reply call-back
1838 <errorCB>: error call-back
1839 */
1840 GLOBAL T_ACI_RETURN sAT_PlusCMSS_Gl ( T_ACI_CMD_SRC srcId,
1841 UBYTE index,
1842 CHAR* da,
1843 T_ACI_TOA* toda,
1844 T_CMSS_FCT rplyCB,
1845 T_ERROR_FCT errorCB )
1846 {
1847 T_SMS_SET_PRM * pSMSSetPrm;
1848 T_ACI_RETURN ret; /* AT response code */
1849 CHAR *restDa = da; /* destination address without */
1850 /* international access function */
1851 /* characters */
1852 T_tp_da da_addr;
1853
1854 #ifdef _CONC_TESTING_
1855 /* Implements Measure#32 */
1856 #endif
1857
1858 TRACE_FUNCTION ("sAT_PlusCMSS_Gl ()");
1859
1860 /*
1861 *-----------------------------------------------------------------
1862 * check if command executable
1863 *-----------------------------------------------------------------
1864 */
1865 if(!cmhSMS_checkAccess (srcId, &ret))
1866 return ret;
1867
1868
1869 smsShrdPrm.rplyCB.cmss = rplyCB;
1870 smsShrdPrm.errorCB = errorCB;
1871
1872 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
1873
1874
1875 /*
1876 *-----------------------------------------------------------------
1877 * process the <da> parameter
1878 *-----------------------------------------------------------------
1879 */
1880 if ( da NEQ NULL )
1881 {
1882 /*
1883 *---------------------------------------------------------------
1884 * process the <toda> parameter
1885 *---------------------------------------------------------------
1886 */
1887 if ( toda NEQ NULL )
1888 {
1889 da_addr.ton = toda -> ton;
1890 da_addr.npi = toda -> npi;
1891 }
1892 else
1893 {
1894 restDa = cmhSMS_setToaDef ( da, &da_addr.ton,
1895 &da_addr.npi );
1896 }
1897
1898 if ( da_addr.ton EQ TON_Alphanumeric )
1899 {
1900 if( cmhSMS_packAlphaNumAddr(restDa, &da_addr) EQ AT_FAIL )
1901 {
1902 return (AT_FAIL);
1903 }
1904 }
1905 else
1906 {
1907 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num,
1908 MAX_SMS_ADDR_DIG, restDa);
1909 da_addr.digits = da_addr.c_num;
1910 }
1911
1912 /* check da_addr if FDN enabled */
1913 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR
1914 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND
1915 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/
1916 if (pb_get_fdn_mode () EQ FDN_ENABLE AND
1917 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )
1918 {
1919
1920 TRACE_EVENT_P1("sAT_PlusCMSS_Gl: FDN check of %s", restDa );
1921
1922 if (pb_check_fdn (0, (const UBYTE*) restDa) EQ PHB_OK)
1923 {
1924 TRACE_EVENT("sAT_PlusCMSS_Gl: Found match in FDN!");
1925 }
1926 else
1927 {
1928 TRACE_EVENT("sAT_PlusCMSS_Gl: No match in FDN found, SMS rejected!");
1929 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_OpNotAllowed );
1930 return ( AT_FAIL );
1931 }
1932 }
1933 /* end: check FDN if enabled */
1934 }
1935 else
1936 {
1937 #ifdef SIM_TOOLKIT
1938 /* FDN entry is already controlled by SAT */
1939 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM ))
1940 {
1941 memset (&da_addr, 0, sizeof(T_tp_da));
1942 }
1943 else
1944 {
1945 #endif
1946 /* if FDN enabled read SMS from storage and verify address
1947 in callback function cmhSMS_SMReadCMSS() */
1948 /* if( ( simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR
1949 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) AND
1950 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )*/
1951 if (pb_get_fdn_mode () EQ FDN_ENABLE AND
1952 pb_get_fdn_classtype() EQ CLASS_VceDatFaxSms )
1953 {
1954 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS;
1955 smsShrdPrm.owner = (T_OWN)srcId;
1956 smsShrdPrm.smsEntStat.entOwn = srcId;
1957 psaSMS_ReadReq(smsShrdPrm.mem2, index, READ_PREVIEW, SMS_STAT_NotPresent);
1958 return ( AT_EXCT );
1959 }
1960 else /* proceed with empty address */
1961 {
1962 memset (&da_addr, 0, sizeof(T_tp_da));
1963 }
1964 #ifdef SIM_TOOLKIT
1965 } /* end else psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM )*/
1966 #endif
1967
1968 }
1969
1970
1971 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT));
1972 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit,
1973 srcId,
1974 0, /* fo */
1975 0,
1976 &da_addr,
1977 NULL, /* data */
1978 0,
1979 NULL /* udh */ );
1980
1981
1982 {
1983 PALLOC (mnsms_submit_req, MNSMS_SUBMIT_REQ);
1984 memset (mnsms_submit_req, 0, sizeof(T_MNSMS_SUBMIT_REQ));
1985
1986 memcpy (&smsShrdPrm.tpdu.sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr));
1987 mnsms_submit_req -> modify = SMS_MODIFY_SCA;
1988
1989 if (da_addr.digits NEQ 0)
1990 {
1991 /* modify destination address */
1992 mnsms_submit_req -> modify |= SMS_MODIFY_TPOA;
1993 }
1994 mnsms_submit_req -> mem_type = smsShrdPrm.mem2;
1995 mnsms_submit_req -> rec_num = index;
1996 mnsms_submit_req -> condx = SMS_CONDX_OVR_ANY;
1997
1998 #ifdef REL99
1999 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
2000 {
2001 mnsms_submit_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
2002 }
2003 else
2004 {
2005 mnsms_submit_req -> auto_rep_flag = FALSE;
2006 }
2007 #endif /* REL99 */
2008
2009
2010 /*
2011 *-----------------------------------------------------------------
2012 * read the short message from memory
2013 *-----------------------------------------------------------------
2014 */
2015 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS;
2016 smsShrdPrm.owner = (T_OWN)srcId;
2017 smsShrdPrm.smsEntStat.entOwn = srcId;
2018
2019 /*
2020 *-----------------------------------------------------------------
2021 * check if message should be transfered directly to SIM for SAT
2022 *-----------------------------------------------------------------
2023 */
2024 #ifdef SIM_TOOLKIT
2025
2026 if (psaSIM_ChkSIMSrvSup( SRV_MOSMCtrlSIM ))
2027 {
2028 if (simShrdPrm.setPrm[srcId].sat_cc_mode EQ SATCC_CONTROL_BY_SIM_ACTIVE)
2029 {
2030 if (da_addr.digits)
2031 {
2032 ret = cmhSAT_MoSmCntr( smsShrdPrm.tpdu.sc_addr,
2033 da_addr,
2034 (UBYTE)srcId );
2035 if (ret NEQ AT_CMPL)
2036 {
2037 /* save primitive address for SIM_TOOLKIT response */
2038 sat_mnsms_submit_req = mnsms_submit_req;
2039 return ret;
2040 }
2041 }
2042 else
2043 {
2044 /* send MNSMS_READ_REQ to SMS entity */
2045 psaSMS_ReadReq ( smsShrdPrm.mem2, index, READ_PREVIEW, SMS_STAT_NotPresent);
2046 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
2047 {
2048 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
2049 smsShrdPrm.tpdu.tp_submit = NULL;
2050 }
2051 PFREE(mnsms_submit_req);
2052 return ( AT_EXCT );
2053 }
2054 }
2055 else
2056 {
2057 simShrdPrm.setPrm[srcId].sat_cc_mode = SATCC_CONTROL_BY_SIM_ACTIVE;
2058 }
2059 }
2060
2061 #endif /* SIM_TOOLKIT */
2062
2063 /* code SMS-SUBMIT here */
2064 cmhSMS_codeMsg (&mnsms_submit_req->sms_sdu, SMS_VT_SUBMIT,
2065 &smsShrdPrm.tpdu.sc_addr, SMS_SUBMIT,
2066 (UBYTE*)smsShrdPrm.tpdu.tp_submit);
2067
2068 /* send message */
2069 PSENDX (SMS, mnsms_submit_req);
2070 #ifdef _CONC_TESTING_
2071 /* Implements Measure#32 */
2072 cmhSMS_sdu_buf_print(&(mnsms_submit_req->sms_sdu.buf[0]), 0);
2073 #endif
2074 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
2075 {
2076 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
2077 smsShrdPrm.tpdu.tp_submit = NULL;
2078 }
2079 }
2080
2081 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMSS;
2082 smsShrdPrm.owner = (T_OWN)srcId;
2083 smsShrdPrm.smsEntStat.entOwn = srcId;
2084
2085 return( AT_EXCT );
2086 }
2087
2088
2089 /*
2090 +-------------------------------------------------------------------+
2091 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2092 | STATE : code ROUTINE : sAT_PlusCMGD |
2093 +-------------------------------------------------------------------+
2094
2095 PURPOSE : This is the functional counterpart of the +CMGD
2096 AT command which is responsible for deleting a short
2097 message from memory.
2098
2099 Features Concatenated SMS.
2100 For GPF-MMI.
2101
2102 <index>: storage area index
2103 */
2104 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
2105 GLOBAL T_ACI_RETURN sAT_PlusCMGD ( T_ACI_CMD_SRC srcId,
2106 UBYTE index,
2107 UBYTE status )
2108 {
2109 T_CONC_INIT_RETURN ret;
2110
2111 TRACE_FUNCTION ("sAT_PlusCMGD ()");
2112
2113 ret=concSMS_initDeleteFromMem (srcId, index);
2114
2115 if (ret EQ CONC_NEEDED)
2116 {
2117 SET_CONC;
2118
2119 /* memorize mem1, this is for rConcSMS_PlusCMGD */
2120 concShrdPrm.mem_store = smsShrdPrm.mem1;
2121
2122 return sAT_PlusCMGD_Gl(srcId, index, status, rConcSMS_PlusCMGD,
2123 rConcSMS_PlusCMS_CMGD);
2124 }
2125 else if (ret EQ CONC_NOT_NEEDED)
2126 {
2127 return sAT_PlusCMGD_Gl(srcId, index, status, rAT_PlusCMGD, rAT_PlusCMS);
2128 }
2129 else
2130 {
2131 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
2132 return ( AT_FAIL );
2133 }
2134 }
2135 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/
2136
2137 /*
2138 +-------------------------------------------------------------------+
2139 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2140 | STATE : code ROUTINE : sAT_PlusCMGD |
2141 +-------------------------------------------------------------------+
2142
2143 PURPOSE : For Riv-MMI.
2144 */
2145 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
2146 GLOBAL T_ACI_RETURN sAT_PlusCMGD ( T_ACI_CMD_SRC srcId,
2147 UBYTE index,
2148 UBYTE status )
2149 {
2150 TRACE_FUNCTION ("sAT_PlusCMGD ()");
2151 TRACE_EVENT_P1("sAT_PlusCMGD () index: %d", index);
2152
2153 return sAT_PlusCMGD_Gl(srcId, index, status, rAT_PlusCMGD, rAT_PlusCMS);
2154 }
2155 #endif /*#if defined (FF_MMI_RIV)*/
2156
2157 /*
2158 +-------------------------------------------------------------------+
2159 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2160 | STATE : code ROUTINE : sAT_PlusCMGD_Gl |
2161 +-------------------------------------------------------------------+
2162
2163 PURPOSE : This is the functional counterpart of the +CMGD
2164 AT command which is responsible for deleting a short
2165 message from memory.
2166
2167 <index>: storage area index
2168 <rplyCB>: reply call-back
2169 <errorCB>: error call-back
2170 */
2171 GLOBAL T_ACI_RETURN sAT_PlusCMGD_Gl ( T_ACI_CMD_SRC srcId,
2172 UBYTE index,
2173 UBYTE status,
2174 T_CMGD_FCT rplyCB,
2175 T_ERROR_FCT errorCB )
2176 {
2177 T_ACI_RETURN ret; /* AT response code */
2178
2179 TRACE_FUNCTION ("sAT_PlusCMGD_Gl ()");
2180
2181 /*
2182 *-----------------------------------------------------------------
2183 * check if command executable
2184 *-----------------------------------------------------------------
2185 */
2186 if(!cmhSMS_checkAccess (srcId, &ret))
2187 return ret;
2188
2189 smsShrdPrm.errorCB = errorCB;
2190 smsShrdPrm.rplyCB.cmgd = rplyCB;
2191
2192 cmhSMS_SendDelete_Req (index, status);
2193
2194 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGD;
2195 smsShrdPrm.owner = (T_OWN)srcId;
2196 smsShrdPrm.smsEntStat.entOwn = srcId;
2197
2198 return( AT_EXCT );
2199 }
2200
2201
2202
2203
2204 /*
2205 +-------------------------------------------------------------------+
2206 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2207 | STATE : code ROUTINE : sAT_PlusCMGW_Old |
2208 +-------------------------------------------------------------------+
2209
2210 PURPOSE : This is the functional counterpart of the +CMGW
2211 AT command which is responsible for writing a short
2212 message to memory.
2213
2214 <index>: index of location area to be written
2215 <address>: originating/destination address
2216 <toa>: type of address
2217 <stat>: message status
2218 <data>: message data
2219 <sca>: service center address
2220 <tosca>: type of service center address
2221 <isReply>: > 0: set TP-Reply-Path explicitly
2222 EQ 0: clear TP-Reply-Path explicitly
2223 */
2224 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
2225 GLOBAL T_ACI_RETURN sAT_PlusCMGW_Old ( T_ACI_CMD_SRC srcId,
2226 SHORT index,
2227 CHAR* address,
2228 T_ACI_TOA* toa,
2229 T_ACI_SMS_STAT stat,
2230 UBYTE msg_ref,
2231 T_ACI_SM_DATA* data,
2232 CHAR* sca,
2233 T_ACI_TOA* tosca,
2234 SHORT isReply )
2235 {
2236 TRACE_FUNCTION ("sAT_PlusCMGW_Old ()");
2237
2238 return sAT_PlusCMGW_Gl
2239 (srcId, index, address, toa, stat, msg_ref, data,
2240 NULL, sca, tosca, isReply, rAT_PlusCMGW, rAT_PlusCMS);
2241 }
2242 #endif /*#if defined SMI OR defined MFW */
2243
2244 /*
2245 +-------------------------------------------------------------------+
2246 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2247 | STATE : code ROUTINE : sAT_PlusCMGW |
2248 +-------------------------------------------------------------------+
2249
2250 PURPOSE : This is the functional counterpart of the +CMGW
2251 AT command which is responsible for writing a short
2252 message to memory.
2253
2254 Features Concatenated SMS.
2255 For GPF-MMI.
2256
2257 <index>: index of location area to be written
2258 <address>: originating/destination address
2259 <toa>: type of address
2260 <stat>: message status
2261 <data>: message data
2262 <sca>: service center address
2263 <tosca>: type of service center address
2264 <isReply>: > 0: set TP-Reply-Path explicitly
2265 EQ 0: clear TP-Reply-Path explicitly
2266 */
2267 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
2268 GLOBAL T_ACI_RETURN sAT_PlusCMGW ( T_ACI_CMD_SRC srcId,
2269 SHORT index,
2270 CHAR* address,
2271 T_ACI_TOA* toa,
2272 T_ACI_SMS_STAT stat,
2273 UBYTE msg_ref,
2274 T_SM_DATA_EXT* src_data,
2275 CHAR* sca,
2276 T_ACI_TOA* tosca,
2277 SHORT isReply )
2278 {
2279 T_CONC_INIT_RETURN ret;
2280 T_ACI_UDH_DATA udh;
2281 T_ACI_SM_DATA tar_data;
2282 UBYTE alphabet;
2283
2284 TRACE_FUNCTION ("sAT_PlusCMGW ()");
2285
2286
2287 alphabet = cmhSMS_getAlphabetPp ( smsShrdPrm.pSetPrm[srcId]->dcs );
2288
2289 /* cut off more than CONC_MAX_SEGS segments */
2290 if (alphabet EQ 0)
2291 {
2292 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp7bit_data_conc*CONC_MAX_SEGS);
2293 }
2294 else
2295 {
2296 src_data->len = MINIMUM (src_data->len, concShrdPrm.l_uncomp8bit_data_conc*CONC_MAX_SEGS);
2297 }
2298
2299 ret=concSMS_initStoreInMem(&tar_data, &udh, srcId, index, address, toa, stat,
2300 msg_ref, src_data, sca, tosca, isReply, alphabet);
2301
2302 if (ret EQ CONC_NEEDED)
2303 {
2304 /* check if concBuffer is already full */
2305 if (concSMS_concBufferAvail() EQ FALSE)
2306 {
2307 TRACE_ERROR ("no concBuffer available, so CSMS can not be written");
2308 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_MemFull );
2309 return AT_FAIL;
2310 }
2311
2312 /* limit the maximum number of CSMS segments to MAX_SEG_TOTAL */
2313 if (concShrdPrm.elem_count+concShrdPrm.udh.max_num > MAX_SEG_TOTAL)
2314 {
2315 TRACE_ERROR ("total number of segments will exceed the maximum, so CSMS can not be written");
2316 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_UnknownErr );
2317 return AT_FAIL;
2318 }
2319
2320 SET_CONC;
2321 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat,
2322 msg_ref, &tar_data, &udh, sca, tosca, isReply,
2323 rConcSMS_PlusCMGW, rConcSMS_PlusCMS_CMGW);
2324 }
2325 else
2326 {
2327 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat,
2328 msg_ref, &tar_data, (T_ACI_UDH_DATA*)NULL,
2329 sca, tosca, isReply,
2330 rAT_PlusCMGW, rAT_PlusCMS);
2331 }
2332 }
2333 #endif /*#if defined (MFW) OR defined (_CONC_TESTING_)*/
2334
2335 /*
2336 +-------------------------------------------------------------------+
2337 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2338 | STATE : code ROUTINE : sAT_PlusCMGW |
2339 +-------------------------------------------------------------------+
2340
2341 PURPOSE : For Riv-MMI if conc. is not needed.
2342 */
2343 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
2344 GLOBAL T_ACI_RETURN sAT_PlusCMGW ( T_ACI_CMD_SRC srcId,
2345 SHORT index,
2346 CHAR* address,
2347 T_ACI_TOA* toa,
2348 T_ACI_SMS_STAT stat,
2349 UBYTE msg_ref,
2350 T_ACI_SM_DATA* src_data,
2351 CHAR* sca,
2352 T_ACI_TOA* tosca,
2353 SHORT isReply )
2354 {
2355
2356
2357
2358
2359
2360 TRACE_FUNCTION ("sAT_PlusCMGW ()");
2361
2362 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat,
2363 msg_ref, src_data, (T_ACI_UDH_DATA*)NULL,
2364 sca, tosca, isReply,
2365 rAT_PlusCMGW, rAT_PlusCMS);
2366 }
2367
2368 /*
2369 +-------------------------------------------------------------------+
2370 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2371 | STATE : code ROUTINE : sAT_PercentCMGW |
2372 +-------------------------------------------------------------------+
2373
2374 PURPOSE : Adding Percent CMGW command to handle udh and src
2375 data for each segment for conc module.
2376
2377 For Riv-MMI if conc. is needed.
2378 */
2379 GLOBAL T_ACI_RETURN sAT_PercentCMGW ( T_ACI_CMD_SRC srcId,
2380 SHORT index,
2381 CHAR* address,
2382 T_ACI_TOA* toa,
2383 T_ACI_SMS_STAT stat,
2384 UBYTE msg_ref,
2385 T_ACI_SM_DATA* src_data,
2386 T_ACI_UDH_DATA* udh_data,
2387 CHAR* sca,
2388 T_ACI_TOA* tosca,
2389 SHORT isReply )
2390 {
2391 TRACE_FUNCTION ("sAT_PercentCMGW with udh()");
2392
2393 return sAT_PlusCMGW_Gl(srcId, index, address, toa, stat,
2394 msg_ref, src_data, udh_data,
2395 sca, tosca, isReply,
2396 rAT_PlusCMGW, rAT_PlusCMS);
2397 }
2398
2399 #endif /*#if defined (FF_MMI_RIV)*/
2400
2401 /*
2402 +-------------------------------------------------------------------+
2403 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2404 | STATE : code ROUTINE : sAT_PlusCMGW_Gl |
2405 +-------------------------------------------------------------------+
2406
2407 PURPOSE : This is the functional counterpart of the +CMGW
2408 AT command which is responsible for writing a short
2409 message to memory.
2410
2411 <index>: index of location area to be written
2412 <address>: originating/destination address
2413 <toa>: type of address
2414 <stat>: message status
2415 <data>: message data
2416 <udh>: user data header
2417 <sca>: service center address
2418 <tosca>: type of service center address
2419 <isReply>: > 0: set TP-Reply-Path explicitly
2420 EQ 0: clear TP-Reply-Path explicitly
2421 <rplyCB>: reply call-back
2422 <errorCB>: error call-back
2423 */
2424 GLOBAL T_ACI_RETURN sAT_PlusCMGW_Gl ( T_ACI_CMD_SRC srcId,
2425 SHORT index,
2426 CHAR* address,
2427 T_ACI_TOA* toa,
2428 T_ACI_SMS_STAT stat,
2429 UBYTE msg_ref,
2430 T_ACI_SM_DATA* data,
2431 T_ACI_UDH_DATA* udh,
2432 CHAR* sca,
2433 T_ACI_TOA* tosca,
2434 SHORT isReply,
2435 T_CMGW_FCT rplyCB,
2436 T_ERROR_FCT errorCB)
2437 {
2438 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
2439 T_ACI_RETURN ret; /* AT response code */
2440 CHAR * restAddress = address;
2441 /* address without international access */
2442 /* function characters */
2443 UBYTE chkIdx; /* checked parameter <index> */
2444 UBYTE chkStat; /* checked parameter <stat> */
2445 CHAR* restSca = sca; /* service center address without */
2446 /* international access function */
2447 /* characters */
2448 UBYTE msgType;
2449
2450 T_ACI_SM_DATA packedData;
2451 T_tp_da da_addr;
2452 T_rp_addr sc_addr;
2453 UBYTE mr;
2454 UBYTE byte_offset = 0;
2455
2456 #ifdef _CONC_TESTING_
2457 /* Implements Measure#32 */
2458 #endif
2459
2460 TRACE_FUNCTION ("sAT_PlusCMGW_Gl ()");
2461
2462
2463 /*
2464 *-----------------------------------------------------------------
2465 * check if command executable
2466 *-----------------------------------------------------------------
2467 */
2468 if(!cmhSMS_checkAccess (srcId, &ret))
2469 return ret;
2470
2471 smsShrdPrm.rplyCB.cmgw = rplyCB;
2472 smsShrdPrm.errorCB = errorCB;
2473
2474 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
2475
2476 /*
2477 *-----------------------------------------------------------------
2478 * process the <index> parameter
2479 *-----------------------------------------------------------------
2480 */
2481 if( index NEQ ACI_NumParmNotPresent )
2482 {
2483 if( ( index > SMS_CMH_IDX_MAX OR index < SMS_CMH_IDX_MIN ) AND
2484 index NEQ CMGW_IDX_FREE_ENTRY )
2485 {
2486 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2487 return ( AT_FAIL );
2488 }
2489 else
2490
2491 chkIdx = (UBYTE) index;
2492 }
2493 else
2494
2495 chkIdx = CMGW_IDX_FREE_ENTRY;
2496
2497 /*
2498 *-----------------------------------------------------------------
2499 * process the <address> parameter
2500 *-----------------------------------------------------------------
2501 */
2502
2503 memset (&da_addr, 0, sizeof(T_tp_da));
2504 if ( address NEQ NULL )
2505 {
2506 /*
2507 *---------------------------------------------------------------
2508 * process the <toa> parameter
2509 *---------------------------------------------------------------
2510 */
2511 if ( toa NEQ NULL )
2512 {
2513 da_addr.ton = toa -> ton;
2514 da_addr.npi = toa -> npi;
2515 }
2516 else
2517 {
2518 restAddress = cmhSMS_setToaDef ( address,
2519 &da_addr.ton,
2520 &da_addr.npi );
2521 }
2522
2523 if ( da_addr.ton EQ TON_Alphanumeric )
2524 {
2525 if( cmhSMS_packAlphaNumAddr(restAddress, &da_addr) EQ AT_FAIL )
2526 {
2527 return (AT_FAIL);
2528 }
2529 }
2530 else
2531 {
2532 cmhSMS_getAdrBcd ( da_addr.num,
2533 &da_addr.c_num,
2534 MAX_SMS_ADDR_DIG,
2535 restAddress );
2536 da_addr.digits = da_addr.c_num;
2537 }
2538
2539 }
2540 else /* if ( address NEQ NULL ) */
2541 {
2542 /*
2543 *---------------------------------------------------------------
2544 * process the <toa> parameter
2545 *---------------------------------------------------------------
2546 */
2547 if ( toa NEQ NULL )
2548 {
2549 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2550 return ( AT_FAIL );
2551 }
2552 else
2553 {
2554 da_addr.digits = 0;
2555 }
2556 }
2557
2558 /*
2559 *-----------------------------------------------------------------
2560 * process the <stat> parameter
2561 *-----------------------------------------------------------------
2562 */
2563 if( stat NEQ SMS_STAT_NotPresent )
2564 {
2565 if( !cmhSMS_getStatPsa ( stat, &chkStat ) )
2566 {
2567 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2568 return ( AT_FAIL );
2569 }
2570 }
2571 else
2572 {
2573 chkStat = STO_UNSENT;
2574 }
2575
2576 /*
2577 *-------------------------------------------------------------------
2578 * create and send primitive for SMS store
2579 *-------------------------------------------------------------------
2580 */
2581 {
2582 PALLOC (mnsms_store_req, MNSMS_STORE_REQ);
2583
2584 mnsms_store_req -> mem_type = smsShrdPrm.mem2;
2585 if (chkIdx EQ CMGW_IDX_FREE_ENTRY)
2586 mnsms_store_req -> condx = SMS_CONDX_OVR_NON;
2587 else
2588 mnsms_store_req -> condx = SMS_CONDX_OVR_ANY;
2589
2590 /*
2591 *-----------------------------------------------------------------
2592 * process the <sca> parameter
2593 *-----------------------------------------------------------------
2594 */
2595 if ( sca NEQ NULL AND *sca NEQ '\0' )
2596 {
2597 /*
2598 *---------------------------------------------------------------
2599 * process the <tosca> parameter
2600 *---------------------------------------------------------------
2601 */
2602 if ( tosca NEQ NULL )
2603 {
2604 sc_addr.ton = tosca -> ton;
2605 sc_addr.npi = tosca -> npi;
2606 }
2607 else
2608 {
2609 restSca = cmhSMS_setToaDef( sca, &sc_addr.ton,
2610 &sc_addr.npi);
2611 }
2612 cmhSMS_getAdrBcd( sc_addr.num,
2613 &sc_addr.c_num,
2614 MAX_SMS_ADDR_DIG,
2615 restSca);
2616 }
2617 else
2618 {
2619 memcpy (&sc_addr, &pSMSSetPrm->sca, sizeof(T_rp_addr));
2620 }
2621
2622 /*
2623 *-----------------------------------------------------------------
2624 * process the <isReply> parameter
2625 *-----------------------------------------------------------------
2626 */
2627 msgType = (pSMSSetPrm->msgType & ~TP_MTI_MASK)
2628 | TP_MTI_SMS_SUBMIT;
2629 if (isReply EQ 0)
2630 msgType &= ~TP_RP_MASK; /* set TP-Reply-Path bit to 0 */
2631 else if (isReply > 0)
2632 msgType |= TP_RP_MASK; /* set TP-Reply-Path bit to 1 */
2633
2634 /*
2635 *-----------------------------------------------------------------
2636 * copy parameter
2637 *-----------------------------------------------------------------
2638 */
2639 mnsms_store_req->rec_num = chkIdx;
2640 mnsms_store_req->status = chkStat;
2641
2642 /*
2643 *-----------------------------------------------------------------
2644 * process the <msg_ref> parameter
2645 *-----------------------------------------------------------------
2646 */
2647 if (msg_ref EQ NOT_PRESENT_8BIT)
2648 {
2649 mr = 0;
2650 }
2651 else
2652 {
2653 mr = msg_ref;
2654 }
2655
2656 /*
2657 *-----------------------------------------------------------------
2658 * process the <data> parameter and
2659 * copy already to shared parameter
2660 *-----------------------------------------------------------------
2661 * reducing from 8 to 7 bit
2662 *-----------------------------------------------------------------
2663 */
2664 if (udh)
2665 byte_offset = udh->len+1;
2666
2667 if (data EQ NULL)
2668 {
2669 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2670 PFREE (mnsms_store_req);
2671
2672 return ( AT_FAIL );
2673 }
2674
2675 cmhSMS_rdcSmsPp ( byte_offset,
2676 pSMSSetPrm -> dcs,
2677 ( UBYTE * ) data->data, ( UBYTE ) data->len,
2678 packedData.data, &packedData.len);
2679
2680 if ( (chkStat EQ REC_UNREAD) OR (chkStat EQ REC_READ) )
2681 {
2682 ACI_MALLOC(smsShrdPrm.tpdu.tp_deliver, sizeof(T_TP_DELIVER));
2683 cmhSMS_fillTpDeliver (smsShrdPrm.tpdu.tp_deliver,
2684 srcId,
2685 msgType,
2686 (T_tp_oa *)&da_addr,
2687 &packedData,
2688 (UBYTE)data->len,
2689 udh );
2690
2691 /* code encode SMS-DELIVER here */
2692 cmhSMS_codeMsg (&mnsms_store_req->sms_sdu,
2693 SMS_VT_DELIVER,
2694 &sc_addr,
2695 SMS_DELIVER,
2696 (UBYTE*)smsShrdPrm.tpdu.tp_deliver);
2697
2698 PSENDX (SMS, mnsms_store_req);
2699 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE;
2700 if (smsShrdPrm.tpdu.tp_deliver NEQ NULL)
2701 {
2702 ACI_MFREE(smsShrdPrm.tpdu.tp_deliver);
2703 smsShrdPrm.tpdu.tp_deliver = NULL;
2704 }
2705 }
2706 else
2707 {
2708 ACI_MALLOC(smsShrdPrm.tpdu.tp_submit, sizeof(T_TP_SUBMIT));
2709 cmhSMS_fillTpSubmit (smsShrdPrm.tpdu.tp_submit,
2710 srcId,
2711 msgType,
2712 mr,
2713 &da_addr,
2714 &packedData,
2715 data->len,
2716 udh );
2717
2718 /* encode SMS-SUBMIT here */
2719 cmhSMS_codeMsg (&mnsms_store_req->sms_sdu,
2720 SMS_VT_SUBMIT,
2721 &sc_addr,
2722 SMS_SUBMIT,
2723 (UBYTE*)smsShrdPrm.tpdu.tp_submit);
2724
2725 PSENDX (SMS, mnsms_store_req);
2726 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE;
2727 #ifdef _CONC_TESTING_
2728 TRACE_EVENT_P1("cmgw:rec_num: %d", mnsms_store_req->rec_num);
2729 TRACE_EVENT_P1("cmgw:status: %d", mnsms_store_req->status);
2730 TRACE_EVENT_P1("cmgw:mem_type:%d", mnsms_store_req -> mem_type);
2731 TRACE_EVENT_P1("cmgw:condx: %d", mnsms_store_req -> condx);
2732 /* Implements Measure#32 */
2733 cmhSMS_sdu_buf_print(&(mnsms_store_req->sms_sdu.buf[0]), 0);
2734 #endif
2735 if (smsShrdPrm.tpdu.tp_submit NEQ NULL)
2736 {
2737 ACI_MFREE(smsShrdPrm.tpdu.tp_submit);
2738 smsShrdPrm.tpdu.tp_submit = NULL;
2739 }
2740 }
2741 }
2742
2743 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGW;
2744 smsShrdPrm.owner = (T_OWN)srcId;
2745 smsShrdPrm.smsEntStat.entOwn = srcId;
2746
2747 return( AT_EXCT );
2748 }
2749
2750 #if defined (SMS_PDU_SUPPORT)
2751
2752 /*
2753 +-------------------------------------------------------------------+
2754 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2755 | STATE : code ROUTINE : sAT_PlusCMGWPdu |
2756 +-------------------------------------------------------------------+
2757
2758 PURPOSE : This is the functional counterpart of the +CMGW
2759 AT command which is responsible for writing a short
2760 message to memory in PDU mode.
2761
2762 */
2763
2764 GLOBAL T_ACI_RETURN sAT_PlusCMGWPdu ( T_ACI_CMD_SRC srcId,
2765 UBYTE stat,
2766 T_ACI_SM_DATA *pdu)
2767 {
2768 T_ACI_RETURN ret; /* AT response code */
2769 UBYTE chkStat = '\0'; /* checked parameter <stat> */
2770
2771 TRACE_FUNCTION ("sAT_PlusCMGWPdu ()");
2772
2773 /*
2774 *-----------------------------------------------------------------
2775 * check if command executable
2776 *-----------------------------------------------------------------
2777 */
2778 if(!cmhSMS_checkAccess (srcId, &ret))
2779 return ret;
2780
2781 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
2782 smsShrdPrm.errorCB = rAT_PlusCMS;
2783 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */
2784
2785 /*
2786 *-----------------------------------------------------------------
2787 * process the <stat> parameter
2788 *-----------------------------------------------------------------
2789 */
2790 switch (stat)
2791 {
2792 case SMS_STAT_RecUnread:
2793 chkStat = REC_UNREAD;
2794 break;
2795 case SMS_STAT_RecRead:
2796 chkStat = REC_READ;
2797 break;
2798 case SMS_STAT_StoUnsent:
2799 chkStat = STO_UNSENT;
2800 break;
2801 case SMS_STAT_StoSent:
2802 chkStat = STO_SENT;
2803 break;
2804 }
2805
2806 /*
2807 *-------------------------------------------------------------------
2808 * create and send primitive for SMS store
2809 *-------------------------------------------------------------------
2810 */
2811 {
2812 PALLOC (mnsms_store_req, MNSMS_STORE_REQ);
2813
2814 mnsms_store_req -> mem_type = smsShrdPrm.mem2;
2815 mnsms_store_req -> rec_num = CMGW_IDX_FREE_ENTRY;
2816 mnsms_store_req -> condx = SMS_CONDX_OVR_NON;
2817 mnsms_store_req -> status = chkStat;
2818
2819 if ( pdu->len > 0 )
2820 {
2821 mnsms_store_req->sms_sdu.l_buf = pdu->len * 8;
2822 mnsms_store_req->sms_sdu.o_buf = 0;
2823 memcpy (mnsms_store_req->sms_sdu.buf, pdu->data, pdu->len);
2824 }
2825 else
2826 {
2827 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2828 PFREE (mnsms_store_req);
2829 return ( AT_FAIL );
2830 }
2831
2832 PSENDX (SMS, mnsms_store_req);
2833 }
2834
2835 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGW;
2836 smsShrdPrm.owner = (T_OWN)srcId;
2837 smsShrdPrm.smsEntStat.entOwn = srcId;
2838 smsShrdPrm.uiInternalSmsStorage = CMD_SRC_NONE;
2839
2840 return( AT_EXCT );
2841 }
2842
2843 #endif
2844
2845
2846 /*
2847 +-------------------------------------------------------------------+
2848 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2849 | STATE : code ROUTINE : sAT_PlusCMGC |
2850 +-------------------------------------------------------------------+
2851
2852 PURPOSE : This is the functional counterpart of the +CMGC
2853 AT command which is responsible for sending a command.
2854
2855 Features Concatenated SMS.
2856 For GPF-MMI.
2857
2858 <fo>: first octet of SMS-COMMAND
2859 <ct>: command type
2860 <pid>: protocol identifier
2861 <mn>: message number
2862 <da>: destination address
2863 <toda>: type of destination address
2864 <data>: command data
2865 */
2866 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
2867 GLOBAL T_ACI_RETURN sAT_PlusCMGC ( T_ACI_CMD_SRC srcId,
2868 SHORT fo,
2869 SHORT ct,
2870 SHORT pid,
2871 SHORT mn,
2872 CHAR* da,
2873 T_ACI_TOA* toda,
2874 T_ACI_CMD_DATA* data )
2875 {
2876 T_CONC_INIT_RETURN ret;
2877
2878 TRACE_FUNCTION ("sAT_PlusCMGC ()");
2879
2880
2881 ret=concSMS_initCommand (srcId, fo, ct, pid, mn, da, toda,
2882 data);
2883
2884 if (ret EQ CONC_NEEDED)
2885 {
2886 SET_CONC;
2887 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda,
2888 data, rConcSMS_PlusCMGC);
2889 }
2890 else if (ret EQ CONC_NOT_NEEDED)
2891 {
2892 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda,
2893 data, rAT_PlusCMGC);
2894 }
2895 else
2896 {
2897 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_UnknownErr );
2898 return ( AT_FAIL );
2899 }
2900 }
2901 #endif /*#if defined (MFW) OR defined (_CONC_TESTING_)*/
2902
2903 /*
2904 +-------------------------------------------------------------------+
2905 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2906 | STATE : code ROUTINE : sAT_PlusCMGC |
2907 +-------------------------------------------------------------------+
2908
2909 PURPOSE : New Plus CMGC command for handling the conc module on
2910 the Riv-MMI side.
2911 */
2912 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
2913 GLOBAL T_ACI_RETURN sAT_PlusCMGC ( T_ACI_CMD_SRC srcId,
2914 SHORT fo,
2915 SHORT ct,
2916 SHORT pid,
2917 SHORT mn,
2918 CHAR* da,
2919 T_ACI_TOA* toda,
2920 T_ACI_CMD_DATA* data )
2921 {
2922 TRACE_FUNCTION ("sAT_PlusCMGC ()");
2923 TRACE_EVENT_P1("sAT_PlusCMGC () mn: %d", mn);
2924
2925 return sAT_PlusCMGC_Gl(srcId, fo, ct, pid, mn, da, toda,
2926 data, rAT_PlusCMGC);
2927 }
2928 #endif /*#if defined (FF_MMI_RIV)*/
2929
2930 /*
2931 +-------------------------------------------------------------------+
2932 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
2933 | STATE : code ROUTINE : sAT_PlusCMGC_Gl |
2934 +-------------------------------------------------------------------+
2935
2936 PURPOSE : This is the functional counterpart of the +CMGC
2937 AT command which is responsible for sending a command.
2938
2939 <fo>: first octet of SMS-COMMAND
2940 <ct>: command type
2941 <pid>: protocol identifier
2942 <mn>: message number
2943 <da>: destination address
2944 <toda>: type of destination address
2945 <data>: command data
2946 <rplyCB>: reply call-back
2947 */
2948 GLOBAL T_ACI_RETURN sAT_PlusCMGC_Gl ( T_ACI_CMD_SRC srcId,
2949 SHORT fo,
2950 SHORT ct,
2951 SHORT pid,
2952 SHORT mn,
2953 CHAR* da,
2954 T_ACI_TOA* toda,
2955 T_ACI_CMD_DATA* data,
2956 T_CMGC_FCT rplyCB )
2957 {
2958 T_ACI_RETURN ret; /* AT response code */
2959 UBYTE chkFo; /* checked parameter <fo> */
2960 UBYTE chkPid; /* checked parameter <pid> */
2961 UBYTE chkCt; /* checked parameter <ct> */
2962 UBYTE chkMn; /* checked parameter <mn> */
2963 CHAR* restDa = da; /* destination address without */
2964 /* international access function */
2965 /* characters */
2966 T_tp_da da_addr; /* destination address */
2967
2968 TRACE_FUNCTION ("sAT_PlusCMGC_Gl ()");
2969
2970 /*
2971 *-----------------------------------------------------------------
2972 * check if command executable
2973 *-----------------------------------------------------------------
2974 */
2975 if(!cmhSMS_checkAccess (srcId, &ret))
2976 return ret;
2977
2978 smsShrdPrm.rplyCB.cmgc = rplyCB;
2979 /*
2980 *-----------------------------------------------------------------
2981 * process the <fo> parameter
2982 *-----------------------------------------------------------------
2983 */
2984 if( fo NEQ ACI_NumParmNotPresent )
2985 {
2986 if( fo > SMS_CMH_FO_MAX OR fo < SMS_CMH_FO_MIN OR
2987 ( fo & TP_MTI_MASK ) NEQ TP_MTI_SMS_COMMAND )
2988 {
2989 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2990 return ( AT_FAIL );
2991 }
2992 else
2993
2994 chkFo = (UBYTE) fo;
2995
2996 }
2997 else
2998
2999 chkFo = TP_MTI_SMS_COMMAND;
3000
3001 /*
3002 *-----------------------------------------------------------------
3003 * process the <ct> parameter
3004 *-----------------------------------------------------------------
3005 */
3006 if( ct NEQ ACI_NumParmNotPresent )
3007 {
3008 if( ct > SMS_CMH_CT_MAX OR ct < SMS_CMH_CT_MIN )
3009 {
3010 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3011 return ( AT_FAIL );
3012 }
3013 else
3014
3015 chkCt = (UBYTE) ct;
3016
3017 }
3018 else
3019 /*
3020 * set to default value
3021 */
3022 chkCt = SMS_CT_ENQUIRY;
3023
3024 /*
3025 *-----------------------------------------------------------------
3026 * process the <pid> parameter
3027 *-----------------------------------------------------------------
3028 */
3029 if( pid NEQ ACI_NumParmNotPresent )
3030 {
3031 if( pid > SMS_CMH_PID_MAX OR pid < SMS_CMH_PID_MIN )
3032 {
3033 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3034 return ( AT_FAIL );
3035 }
3036 else
3037
3038 chkPid = (UBYTE) pid;
3039 }
3040 else
3041
3042 /*
3043 * set to default value
3044 */
3045 chkPid = SMS_PID_DEFAULT;
3046
3047 /*
3048 *-----------------------------------------------------------------
3049 * process the <mn> parameter
3050 *-----------------------------------------------------------------
3051 */
3052 if( mn NEQ ACI_NumParmNotPresent )
3053 {
3054 if( mn > SMS_CMH_MN_MAX OR mn < SMS_CMH_MN_MIN )
3055 {
3056 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3057 return ( AT_FAIL );
3058 }
3059 else
3060
3061 chkMn = (UBYTE) mn;
3062 }
3063 else
3064 {
3065 chkMn = smsShrdPrm.aci_sms_parameter.snd_msg_ref;
3066 }
3067
3068 /*
3069 *---------------------------------------------------------------
3070 * process the <da> and <toda> parameter
3071 *---------------------------------------------------------------
3072 */
3073 if ( toda NEQ NULL )
3074 {
3075 if ( da NEQ NULL )
3076 {
3077 da_addr.ton = toda -> ton;
3078 da_addr.npi = toda -> npi;
3079 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa);
3080 da_addr.digits = da_addr.c_num;
3081 }
3082 else
3083 {
3084 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3085 return ( AT_FAIL );
3086 }
3087 }
3088 else
3089 {
3090 if ( da NEQ NULL )
3091 {
3092 restDa = cmhSMS_setToaDef ( da, &da_addr.ton, &da_addr.npi );
3093 cmhSMS_getAdrBcd ( da_addr.num, &da_addr.c_num, MAX_SMS_ADDR_DIG, restDa);
3094 da_addr.digits = da_addr.c_num;
3095 }
3096 else
3097 {
3098 da_addr.digits = 0;
3099 }
3100 }
3101
3102 /*
3103 *-------------------------------------------------------------------
3104 * create and send primitive for command request
3105 *-------------------------------------------------------------------
3106 */
3107 {
3108 PALLOC (mnsms_command_req, MNSMS_COMMAND_REQ);
3109
3110 ACI_MALLOC(smsShrdPrm.tpdu.tp_command, sizeof(T_TP_COMMAND));
3111 cmhSMS_fillTpCommand( smsShrdPrm.tpdu.tp_command,
3112 chkFo,
3113 chkCt,
3114 0,
3115 chkPid,
3116 chkMn,
3117 &da_addr,
3118 data,
3119 NULL);
3120
3121 #ifdef REL99
3122 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
3123 {
3124 mnsms_command_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
3125 }
3126 else
3127 {
3128 mnsms_command_req -> auto_rep_flag = FALSE;
3129 }
3130 #endif
3131
3132 /* code command here */
3133 cmhSMS_codeMsg (&mnsms_command_req->sms_sdu,
3134 SMS_VT_COMMAND,
3135 &smsShrdPrm.pSetPrm[srcId]->sca,
3136 SMS_COMMAND,
3137 (UBYTE*)smsShrdPrm.tpdu.tp_command);
3138
3139 PSENDX (SMS, mnsms_command_req);
3140
3141 if (smsShrdPrm.tpdu.tp_command NEQ NULL)
3142 {
3143 ACI_MFREE(smsShrdPrm.tpdu.tp_command);
3144 smsShrdPrm.tpdu.tp_command = NULL;
3145 }
3146 }
3147
3148 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGC;
3149 smsShrdPrm.owner = (T_OWN)srcId;
3150 smsShrdPrm.smsEntStat.entOwn = srcId;
3151
3152 return( AT_EXCT );
3153 }
3154
3155
3156 #if defined (SMS_PDU_SUPPORT) || defined (SIM_TOOLKIT)
3157
3158 /*
3159 +-------------------------------------------------------------------+
3160 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3161 | STATE : code ROUTINE : sAT_PlusCMGCPdu |
3162 +-------------------------------------------------------------------+
3163
3164 PURPOSE : This is the functional counterpart of the +CMGC
3165 AT command which is responsible for sending a command
3166 message in pdu mode.
3167
3168 */
3169 GLOBAL T_ACI_RETURN sAT_PlusCMGCPdu ( T_ACI_CMD_SRC srcId,
3170 T_ACI_SM_DATA *pdu )
3171 {
3172 T_ACI_RETURN ret; /* AT response code */
3173
3174 TRACE_FUNCTION ("sAT_PlusCMGCPdu ()");
3175
3176 /*
3177 *-----------------------------------------------------------------
3178 * check if command executable
3179 *-----------------------------------------------------------------
3180 */
3181 if(!cmhSMS_checkAccess (srcId, &ret))
3182 return ret;
3183
3184 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
3185 smsShrdPrm.rplyCB.cmgc = rAT_PlusCMGC;
3186 smsShrdPrm.errorCB = rAT_PlusCMS;
3187 #endif /* defined SMI OR defined MFW OR defined FF_MMI_RIV */
3188
3189 /*
3190 *-------------------------------------------------------------------
3191 * create and send primitive for SMS command
3192 *-------------------------------------------------------------------
3193 */
3194 {
3195 PALLOC (mnsms_command_req, MNSMS_COMMAND_REQ);
3196 #ifdef REL99
3197 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
3198 {
3199 mnsms_command_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
3200 }
3201 else
3202 {
3203 mnsms_command_req -> auto_rep_flag = FALSE;
3204 }
3205 #endif /* REL99 */
3206
3207 if ( pdu->len > 0 )
3208 {
3209 mnsms_command_req->sms_sdu.l_buf = pdu->len * 8;
3210 mnsms_command_req->sms_sdu.o_buf = 0;
3211 memcpy (mnsms_command_req->sms_sdu.buf, pdu->data, pdu->len);
3212 }
3213 else
3214 {
3215 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3216 PFREE (mnsms_command_req);
3217 return ( AT_FAIL );
3218 }
3219
3220 PSENDX (SMS, mnsms_command_req);
3221 }
3222
3223 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGC;
3224 smsShrdPrm.owner = (T_OWN)srcId;
3225 smsShrdPrm.smsEntStat.entOwn = srcId;
3226
3227 return( AT_EXCT );
3228 }
3229 #endif
3230
3231
3232 /*
3233 +-------------------------------------------------------------------+
3234 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3235 | STATE : code ROUTINE : sAT_PlusCMGR |
3236 +-------------------------------------------------------------------+
3237
3238 PURPOSE : This is the functional counterpart of the +CMGR
3239 AT command which is responsible for reading a short
3240 message from memory.
3241
3242 Features Concatenated SMS.
3243 For GPF-MMI.
3244
3245 <index>: storage area index
3246 <rdMode>: read mode
3247 */
3248 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
3249 GLOBAL T_ACI_RETURN sAT_PlusCMGR ( T_ACI_CMD_SRC srcId,
3250 UBYTE index,
3251 T_ACI_SMS_READ rdMode )
3252 {
3253 T_CONC_INIT_RETURN ret;
3254
3255 TRACE_FUNCTION ("sAT_PlusCMGR ()");
3256
3257 TRACE_EVENT_P1("sAT_PlusCMGR () index: %d", index);
3258
3259 ret=concSMS_initReadFromMem(srcId, index, rdMode);
3260
3261 if (ret EQ CONC_NEEDED)
3262 {
3263 SET_CONC;
3264 TRACE_EVENT("sAT_PlusCMGR: CONC_NEEDED");
3265
3266 /* memorize mem1, this is for rConcSMS_PlusCMGR */
3267 concShrdPrm.mem_store = smsShrdPrm.mem1;
3268
3269 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rConcSMS_PlusCMGR);
3270 }
3271 else if (ret EQ CONC_NOT_NEEDED)
3272 {
3273 TRACE_EVENT("sAT_PlusCMGR: CONC_NOT_NEEDED");
3274 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rAT_PlusCMGR);
3275 }
3276 else
3277 {
3278 TRACE_EVENT("ERROR: sAT_PlusCMGR: CMS_ERR_InValMemIdx");
3279 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
3280 return ( AT_FAIL );
3281 }
3282 }
3283 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/
3284
3285 /*
3286 +-------------------------------------------------------------------+
3287 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3288 | STATE : code ROUTINE : sAT_PlusCMGR |
3289 +-------------------------------------------------------------------+
3290
3291 PURPOSE : New Plus CMGR command for handling the conc module on
3292 the Riv-MMI side.
3293 */
3294 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
3295 GLOBAL T_ACI_RETURN sAT_PlusCMGR ( T_ACI_CMD_SRC srcId,
3296 UBYTE index,
3297 T_ACI_SMS_READ rdMode )
3298 {
3299 TRACE_FUNCTION ("sAT_PlusCMGR ()");
3300
3301 TRACE_EVENT_P1("sAT_PlusCMGR () index: %d", index);
3302
3303 return sAT_PlusCMGR_Gl(srcId, index, rdMode, rAT_PlusCMGR);
3304 }
3305 #endif /*#if defined (FF_MMI_RIV)*/
3306
3307
3308 /*
3309 +-------------------------------------------------------------------+
3310 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3311 | STATE : code ROUTINE : sAT_PlusCMGR_Gl |
3312 +-------------------------------------------------------------------+
3313
3314 PURPOSE : This is the functional counterpart of the +CMGR
3315 AT command which is responsible for reading a short
3316 message from memory.
3317
3318 <index>: storage area index
3319 <rdMode>: read mode
3320 <rplyCB>: reply call-back
3321 <errorCB>: error call-back
3322 */
3323 GLOBAL T_ACI_RETURN sAT_PlusCMGR_Gl ( T_ACI_CMD_SRC srcId,
3324 UBYTE index,
3325 T_ACI_SMS_READ rdMode,
3326 T_CMGR_FCT rplyCB )
3327 {
3328 T_ACI_RETURN ret = AT_EXCT;
3329
3330 TRACE_FUNCTION ("sAT_PlusCMGR_Gl ()");
3331
3332 /*
3333 *-----------------------------------------------------------------
3334 * check if command executable
3335 *-----------------------------------------------------------------
3336 */
3337 if(!cmhSMS_checkAccess (srcId, &ret))
3338 {
3339 return ret;
3340 }
3341
3342 smsShrdPrm.rplyCB.cmgr = rplyCB;
3343
3344
3345 /*
3346 *-----------------------------------------------------------------
3347 * process the <index> parameter
3348 *-----------------------------------------------------------------
3349 */
3350 switch (rdMode)
3351 {
3352 case SMS_READ_StatusChange:
3353 /* ret = AT_CMPL; Change to AT_EXCT, call back expected */
3354 smsShrdPrm.rdMode = READ_STATUS_CHANGE;
3355 break;
3356 case SMS_READ_Preview:
3357 smsShrdPrm.rdMode = READ_PREVIEW;
3358 break;
3359 case SMS_READ_Normal:
3360 case SMS_READ_NotPresent:
3361 smsShrdPrm.rdMode = READ_NORMAL;
3362 break;
3363 default:
3364 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3365 return ( AT_FAIL );
3366 }
3367 /*
3368 *-----------------------------------------------------------------
3369 * read a short message from memory
3370 *-----------------------------------------------------------------
3371 */
3372 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGR;
3373 smsShrdPrm.owner = (T_OWN)srcId;
3374 smsShrdPrm.smsEntStat.entOwn = srcId;
3375
3376 psaSMS_ReadReq ( smsShrdPrm.mem1, index,
3377 smsShrdPrm.rdMode, SMS_STAT_NotPresent);
3378
3379 return( ret );
3380 }
3381
3382 /*
3383 +-------------------------------------------------------------------+
3384 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3385 | STATE : code ROUTINE : sAT_PlusCSCB |
3386 +-------------------------------------------------------------------+
3387
3388 PURPOSE : This is the functional counterpart of the +CSCB
3389 AT command which is responsible for selecting the
3390 cell broadcast message types.
3391
3392 <mode>: acception mode
3393 <mids>: message identifiers
3394 <dcss>: data coding schemes
3395 */
3396 GLOBAL T_ACI_RETURN sAT_PlusCSCB ( T_ACI_CMD_SRC srcId,
3397 T_ACI_CSCB_MOD mode,
3398 USHORT* mids,
3399 UBYTE* dcss)
3400 {
3401 UBYTE chkMode; /* checked parameter <mode> */
3402 USHORT chkMids[MAX_IDENTS]; /* checked parameter <mids> */
3403 UBYTE chkDcss[MAX_IDENTS]; /* checked parameter <dcss> */
3404 int i; /* used for counting */
3405
3406 TRACE_FUNCTION ("sAT_PlusCSCB ()");
3407
3408 /*
3409 *-----------------------------------------------------------------
3410 * check command source
3411 *-----------------------------------------------------------------
3412 */
3413 if(!cmh_IsVldCmdSrc (srcId))
3414 {
3415 return( AT_FAIL );
3416 }
3417
3418 /*
3419 *-----------------------------------------------------------------
3420 * check access status
3421 *-----------------------------------------------------------------
3422 */
3423 if (!cmhSMS_checkSIM ()) /* sets error code */
3424 {
3425 return( AT_FAIL );
3426 }
3427
3428 /*
3429 *-----------------------------------------------------------------
3430 * check entity status
3431 *-----------------------------------------------------------------
3432 */
3433 if( smsShrdPrm.cbmPrm.cbchOwner NEQ ((T_OWN)CMD_SRC_NONE) )
3434 {
3435 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal );
3436 return( AT_BUSY );
3437 }
3438
3439 /*
3440 *-----------------------------------------------------------------
3441 * process the <mode> parameter
3442 *-----------------------------------------------------------------
3443 */
3444 switch ( mode )
3445 {
3446 case (CSCB_MOD_NotPresent): chkMode = smsShrdPrm.cbmPrm.cbmMode; break;
3447 case (CSCB_MOD_Accept ): chkMode = CBCH_ACCEPT; break;
3448 case (CSCB_MOD_NotAccept ): chkMode = CBCH_IGNORE; break;
3449
3450 default:
3451 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3452 return ( AT_FAIL );
3453 }
3454
3455 /*
3456 *-----------------------------------------------------------------
3457 * process the <mids> parameter
3458 *-----------------------------------------------------------------
3459 */
3460 if( mids NEQ NULL )
3461
3462 memcpy ( ( CHAR * ) chkMids, ( CHAR * ) mids, sizeof (chkMids) );
3463
3464 else
3465
3466 memcpy ( ( CHAR * ) chkMids, ( CHAR * ) smsShrdPrm.cbmPrm.msgId,
3467 sizeof ( chkMids ) );
3468
3469 /*
3470 *-----------------------------------------------------------------
3471 * process the <dcss> parameter
3472 *-----------------------------------------------------------------
3473 */
3474 if( dcss NEQ NULL )
3475 {
3476 i = 0;
3477
3478 while ( i < MAX_IDENTS AND dcss[i] NEQ DEF_DCS_RANGE )
3479 {
3480 /* Lint: this cannot happen
3481 if( dcss[i] > SMS_CMH_DCS_MAX OR dcss[i] < SMS_CMH_DCS_MIN )
3482 {
3483 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3484 return ( AT_FAIL );
3485 }
3486 else
3487 */
3488 i++;
3489 }
3490
3491 if ( i % 2 NEQ 0 )
3492 {
3493 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3494 return ( AT_FAIL );
3495 }
3496
3497 memcpy ( ( CHAR * ) chkDcss, ( CHAR * ) dcss, sizeof (chkDcss) );
3498 }
3499 else
3500
3501 memcpy ( ( CHAR * ) chkDcss, ( CHAR * ) smsShrdPrm.cbmPrm.dcsId,
3502 sizeof ( chkDcss ) );
3503
3504 /*
3505 *-----------------------------------------------------------------
3506 * copy parameter
3507 *-----------------------------------------------------------------
3508 */
3509 memcpy ( ( CHAR * ) smsShrdPrm.cbmPrm.msgId,
3510 ( CHAR * ) chkMids,
3511 sizeof ( smsShrdPrm.cbmPrm.msgId ) );
3512
3513 memcpy ( ( CHAR * ) smsShrdPrm.cbmPrm.dcsId,
3514 ( CHAR * ) chkDcss,
3515 sizeof ( smsShrdPrm.cbmPrm.dcsId ) );
3516
3517 smsShrdPrm.cbmPrm.cbmMode = chkMode;
3518
3519 /* CSCBmode = mode; */
3520
3521 /*
3522 *-----------------------------------------------------------------
3523 * set the new CBCH configuration
3524 *-----------------------------------------------------------------
3525 */
3526 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId;
3527
3528 if( psaMMI_Cbch() < 0 )
3529 {
3530 TRACE_EVENT( "FATAL RETURN psaSMS in +CSCB" );
3531 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal );
3532 return( AT_FAIL );
3533 }
3534
3535 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE;
3536
3537 return ( AT_CMPL );
3538 }
3539
3540
3541 #ifdef FF_HOMEZONE
3542 /*
3543 +-------------------------------------------------------------------+
3544 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3545 | STATE : code ROUTINE : sAT_PercentCBHZ |
3546 +-------------------------------------------------------------------+
3547
3548 PURPOSE : This is the functional counterpart of the %CBHZ
3549 AT command which is responsible for activation and
3550 deactivation of the homezone feature.
3551
3552 <mode> : activation mode
3553 <dcs> : datacoding scheme
3554 <timeout>: timeout period for homezone CBM
3555 */
3556 GLOBAL T_ACI_RETURN sAT_PercentCBHZ ( T_ACI_CMD_SRC srcId,
3557 T_ACI_CBHZ_MOD mode,
3558 T_ACI_CS dcs,
3559 UBYTE timeout)
3560 {
3561 UBYTE chkMode; /* checked parameter <mode> */
3562 UBYTE chkDcs; /* checked parameter <dcs> */
3563 UBYTE chkTimeout; /* checked parameter <timeout> */
3564
3565 TRACE_FUNCTION ("sAT_PercentCBHZ()");
3566
3567 /*
3568 *-----------------------------------------------------------------
3569 * check command source
3570 *-----------------------------------------------------------------
3571 */
3572 if(!cmh_IsVldCmdSrc (srcId))
3573 {
3574 return( AT_FAIL );
3575 }
3576
3577 /*
3578 *-----------------------------------------------------------------
3579 * check access status
3580 *-----------------------------------------------------------------
3581 */
3582 if (!cmhSMS_checkSIM ()) /* sets error code */
3583 {
3584 return( AT_FAIL );
3585 }
3586
3587 /*
3588 *-----------------------------------------------------------------
3589 * check entity status
3590 *-----------------------------------------------------------------
3591 */
3592 if( smsShrdPrm.cbmPrm.cbchOwner NEQ ((T_OWN)CMD_SRC_NONE) )
3593 {
3594 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal );
3595 return( AT_BUSY );
3596 }
3597
3598 /*
3599 *-----------------------------------------------------------------
3600 * process the <mode> parameter
3601 *-----------------------------------------------------------------
3602 */
3603 switch ( mode )
3604 {
3605 case (CBHZ_MOD_Active) :
3606 case (CBHZ_MOD_NotActive):
3607 chkMode = mode;
3608 break;
3609
3610 default:
3611 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3612 return ( AT_FAIL );
3613 }
3614
3615 /*
3616 *-----------------------------------------------------------------
3617 * process the <dcs> parameter
3618 *-----------------------------------------------------------------
3619 */
3620 switch ( dcs )
3621 {
3622 case (CS_NotPresent):
3623 chkDcs = CS_GsmDef;
3624 break;
3625
3626 case (CS_GsmDef) :
3627 case (CS_GsmInt) :
3628 case (CS_Hex) :
3629 case (CS_Ucs2) :
3630 case (CS_Sim) :
3631 case (CS_Ascii) :
3632 chkDcs = dcs;
3633 break;
3634
3635 default:
3636 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3637 return ( AT_FAIL );
3638 }
3639
3640 /*
3641 *-----------------------------------------------------------------
3642 * process the <timeout> parameter
3643 *-----------------------------------------------------------------
3644 */
3645 if ( (timeout >= CBHZ_MIN_TIMEOUT) AND (timeout <= CBHZ_MAX_TIMEOUT) )
3646 {
3647 chkTimeout = timeout;
3648 }
3649 else if ( timeout EQ NOT_PRESENT_8BIT )
3650 {
3651 chkTimeout = CBHZ_DEF_TIMEOUT;
3652 }
3653 else
3654 {
3655 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3656 return ( AT_FAIL );
3657 }
3658
3659 /*
3660 *-----------------------------------------------------------------
3661 * all parameters valid. now copy parameter
3662 *-----------------------------------------------------------------
3663 */
3664 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)srcId;
3665 smsShrdPrm.cbmPrm.hzMode = chkMode;
3666 smsShrdPrm.cbmPrm.hzDcs = chkDcs;
3667 smsShrdPrm.cbmPrm.hzTimeout = chkTimeout;
3668
3669 /* send homezone request */
3670 if( psaMMI_homezone_req() < 0 )
3671 {
3672 TRACE_EVENT( "FATAL RETURN psaSMS in %%CBHZ" );
3673 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal );
3674 return( AT_FAIL );
3675 }
3676
3677 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE;
3678
3679 return ( AT_CMPL );
3680 }
3681 #endif /* FF_HOMEZONE */
3682
3683 /*
3684 +-------------------------------------------------------------------+
3685 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3686 | STATE : code ROUTINE : sAT_PlusCMGL |
3687 +-------------------------------------------------------------------+
3688
3689 PURPOSE : This is the functional counterpart of the +CMGL
3690 AT command which is responsible for creating a list of
3691 all stored short messages.
3692
3693 <state>: state of stored short message
3694 */
3695 GLOBAL T_ACI_RETURN sAT_PlusCMGL ( T_ACI_CMD_SRC srcId,
3696 T_ACI_SMS_STAT state,
3697 SHORT startIdx,
3698 T_ACI_SMS_READ rdMode )
3699 {
3700 T_ACI_RETURN ret; /* AT response code */
3701 T_ACI_SMS_STAT chk_state;
3702
3703 TRACE_FUNCTION ("sAT_PlusCMGL ()");
3704
3705 /*
3706 *-----------------------------------------------------------------
3707 * check if command executable
3708 *-----------------------------------------------------------------
3709 */
3710 if(!cmhSMS_checkAccess (srcId, &ret))
3711 {
3712 return ret;
3713 }
3714
3715 /*
3716 *-----------------------------------------------------------------
3717 * process the <state> parameter
3718 *-----------------------------------------------------------------
3719 */
3720 switch ( state )
3721 {
3722 case( SMS_STAT_NotPresent ):
3723 chk_state = SMS_STAT_RecUnread;
3724 break;
3725
3726 case( SMS_STAT_Invalid ):
3727 case( SMS_STAT_All ):
3728 case( SMS_STAT_RecUnread ):
3729 case( SMS_STAT_RecRead ):
3730 case( SMS_STAT_StoUnsent ):
3731 case( SMS_STAT_StoSent ):
3732 chk_state = state;
3733 break;
3734
3735 default:
3736 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3737 return ( AT_FAIL );
3738 }
3739
3740 /*
3741 *-----------------------------------------------------------------
3742 * check if startIdx is in range
3743 *-----------------------------------------------------------------
3744 */
3745 if ( startIdx >= MAX_SIM_ME_ENTRIES /*256*/ OR
3746 startIdx > SMS_CMH_MAX_START_IDX /*255*/ )
3747 {
3748 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3749 return ( AT_FAIL );
3750 }
3751
3752 /*
3753 *-----------------------------------------------------------------
3754 * process the <rdMode> parameter
3755 *-----------------------------------------------------------------
3756 */
3757 switch (rdMode)
3758 {
3759 case SMS_READ_StatusChange:
3760 default:
3761 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3762 return ( AT_FAIL );
3763 case SMS_READ_Preview:
3764 smsShrdPrm.rdMode = READ_PREVIEW;
3765 break;
3766 case SMS_READ_Normal:
3767 case SMS_READ_NotPresent:
3768 smsShrdPrm.rdMode = READ_NORMAL;
3769 break;
3770 }
3771
3772 /*
3773 *---------------------------------------------------------------
3774 * PSA notification
3775 *---------------------------------------------------------------
3776 */
3777 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMGL;
3778 smsShrdPrm.owner = (T_OWN)srcId;
3779 smsShrdPrm.smsEntStat.entOwn = srcId;
3780
3781 /*
3782 *---------------------------------------------------------------
3783 * request the list element
3784 *---------------------------------------------------------------
3785 */
3786 psaSMS_ReadReq ( smsShrdPrm.mem1, startIdx,
3787 smsShrdPrm.rdMode, chk_state );
3788
3789 return( AT_EXCT );
3790 }
3791
3792 /*
3793 +-------------------------------------------------------------------+
3794 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3795 | STATE : code ROUTINE : sAT_PlusCSAS |
3796 +-------------------------------------------------------------------+
3797
3798 PURPOSE : This is the functional counterpart of the +CSAS
3799 AT command which is responsible for saving of certain
3800 SMS parameters to nonvolatile memory.
3801
3802 <profile>: SMS profile number (1..max_record)
3803 */
3804 GLOBAL T_ACI_RETURN sAT_PlusCSAS ( T_ACI_CMD_SRC srcId,
3805 SHORT profile)
3806 {
3807 T_ACI_RETURN ret; /* AT response code */
3808 UBYTE tmpNumOfRefs;
3809 UBYTE max_record;
3810
3811 TRACE_FUNCTION ("sAT_PlusCSAS ()");
3812
3813 /*
3814 *-----------------------------------------------------------------
3815 * check if command executable
3816 *-----------------------------------------------------------------
3817 */
3818 if(!cmhSMS_checkAccess (srcId, &ret))
3819 return ret;
3820
3821 max_record = (UBYTE)cmhSMS_getPrfRge ();
3822 if ((profile <= 0) OR (profile > max_record))
3823 {
3824 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
3825 return AT_FAIL;
3826 }
3827
3828 smsShrdPrm.cbmPrm.cbmFoundIds = 0;
3829
3830 if ( (smsShrdPrm.pSetPrm[srcId]->prflId NEQ profile) OR
3831 (smsShrdPrm.pSetPrm[srcId]->isCopy EQ TRUE) )
3832 {
3833 T_SMS_SET_PRM * elem;
3834 T_SMS_SET_PRM * pSMSSetPrmOld = smsShrdPrm.pSetPrm[srcId];
3835
3836 /*
3837 *-----------------------------------------------------------------
3838 * find or create new profile
3839 *-----------------------------------------------------------------
3840 */
3841 elem = find_element(set_prm_list, (UBYTE)profile, cmhSMS_findPrflId);
3842 if (elem EQ NULL)
3843 {
3844 ACI_MALLOC(elem, sizeof(T_SMS_SET_PRM));
3845 memset(elem, 0, sizeof(T_SMS_SET_PRM));
3846 insert_list(set_prm_list, elem);
3847 }
3848
3849 /* save the number of references of the list element */
3850 tmpNumOfRefs = elem->numOfRefs;
3851
3852 /* copy the old profile */
3853 memcpy(elem, pSMSSetPrmOld, sizeof(T_SMS_SET_PRM));
3854
3855 /* decrease the numOfRefs of the old profile */
3856 pSMSSetPrmOld->numOfRefs--;
3857
3858 /* set the Prm Pointer to the (new or found) list element */
3859 smsShrdPrm.pSetPrm[srcId] = elem;
3860
3861 smsShrdPrm.pSetPrm[srcId]->numOfRefs = ++tmpNumOfRefs;
3862 smsShrdPrm.pSetPrm[srcId]->isCopy = FALSE;
3863 smsShrdPrm.pSetPrm[srcId]->prflId = (UBYTE)profile;
3864
3865 /*
3866 *-----------------------------------------------------------------
3867 * destroy temporary copy
3868 *-----------------------------------------------------------------
3869 */
3870 if ( pSMSSetPrmOld->isCopy EQ TRUE )
3871 {
3872 ACI_MFREE(pSMSSetPrmOld);
3873 }
3874 }
3875
3876 /*
3877 *-------------------------------------------------------------
3878 * store parameters to non-volatile memory
3879 *-------------------------------------------------------------
3880 */
3881 ret = cmhSMS_WriteParams (srcId, AT_CMD_CSAS, profile);
3882 return ret;
3883
3884 }
3885
3886 /*
3887 +-------------------------------------------------------------------+
3888 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3889 | STATE : code ROUTINE : sAT_PlusCRES |
3890 +-------------------------------------------------------------------+
3891
3892 PURPOSE : This is the functional counterpart of the +CRES
3893 AT command which is responsible for retrieving of
3894 certain SMS parameters from nonvolatile memory.
3895
3896 <profile>: SMS profile number (1..max_record)
3897 */
3898 GLOBAL T_ACI_RETURN sAT_PlusCRES ( T_ACI_CMD_SRC srcId,
3899 SHORT profile)
3900 {
3901 T_ACI_RETURN ret=AT_CMPL; /* AT response code */
3902 UBYTE max_record;
3903
3904 TRACE_FUNCTION ("sAT_PlusCRES ()");
3905
3906 /*
3907 *-----------------------------------------------------------------
3908 * check if command executable
3909 *-----------------------------------------------------------------
3910 */
3911 if(!cmhSMS_checkAccess (srcId, &ret))
3912 return ret;
3913
3914 max_record = (UBYTE)cmhSMS_getPrfRge ();
3915 if ((profile <= 0) OR (profile > max_record))
3916 {
3917 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
3918 return AT_FAIL;
3919 }
3920
3921 smsShrdPrm.cbmPrm.cbmFoundIds = 0;
3922
3923 if ( (smsShrdPrm.pSetPrm[srcId]->prflId NEQ profile) OR
3924 (smsShrdPrm.pSetPrm[srcId]->isCopy EQ TRUE) )
3925 {
3926 T_SMS_SET_PRM * pSMSSetPrmOld; /* points to SMS parameter set */
3927 T_SMS_SET_PRM * pSMSSetPrmNew; /* points to SMS parameter set */
3928
3929 pSMSSetPrmOld = smsShrdPrm.pSetPrm[srcId];
3930 pSMSSetPrmOld->numOfRefs--;
3931
3932 /*
3933 *-----------------------------------------------------------------
3934 * destroy temporary copy
3935 *-----------------------------------------------------------------
3936 */
3937 if ( pSMSSetPrmOld->isCopy EQ TRUE)
3938 {
3939 ACI_MFREE(pSMSSetPrmOld);
3940 }
3941
3942 /*
3943 *-------------------------------------------------------------
3944 * find the new profile in the SET PRM list
3945 *-------------------------------------------------------------
3946 */
3947 pSMSSetPrmNew = find_element(set_prm_list, (UBYTE)profile, cmhSMS_findPrflId);
3948 if (pSMSSetPrmNew NEQ NULL) /* element was in SET PRM List */
3949 {
3950 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmNew;
3951 smsShrdPrm.pSetPrm[srcId]->numOfRefs++;
3952 }
3953 else /* element was not found in SET PRM List */
3954 {
3955 ACI_MALLOC(pSMSSetPrmNew, sizeof(T_SMS_SET_PRM));
3956 memset(pSMSSetPrmNew, 0, sizeof(T_SMS_SET_PRM));
3957 insert_list(set_prm_list, pSMSSetPrmNew);
3958 pSMSSetPrmNew->prflId = (UBYTE)profile;
3959
3960 smsShrdPrm.pSetPrm[srcId] = pSMSSetPrmNew;
3961 }
3962 }
3963
3964 /*
3965 *-------------------------------------------------------------
3966 * read parameters from non-volatile memory
3967 *-------------------------------------------------------------
3968 */
3969 ret = cmhSMS_ReadParams (srcId, AT_CMD_CRES, profile);
3970 return ret;
3971
3972 }
3973
3974
3975
3976 /*
3977 +-------------------------------------------------------------------+
3978 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
3979 | STATE : code ROUTINE : tAT_PlusCRES |
3980 +-------------------------------------------------------------------+
3981
3982 PURPOSE : This is the functional counterpart of the +CRES
3983 AT command which is responsible for retrieving of
3984 certain SMS parameters from nonvolatile memory.
3985
3986 Shen,Chao July 1st, 2003
3987
3988 */
3989 GLOBAL T_ACI_RETURN tAT_PlusCRES ( T_ACI_CMD_SRC srcId, T_ACI_CRES *values)
3990 {
3991 SHORT profile = -1;
3992 if ((profile = cmhSMS_getPrfRge ()) < 1)
3993 {
3994 return (AT_FAIL);
3995 }
3996
3997 values->min = 0;
3998 values->max = profile - 1;
3999
4000 return AT_CMPL;
4001 }
4002
4003 #ifdef TI_PS_FF_AT_P_CMD_CPRSM
4004 /*
4005 +-------------------------------------------------------------------+
4006 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4007 | STATE : code ROUTINE : sAT_PercentCPRSM |
4008 +-------------------------------------------------------------------+
4009
4010 PURPOSE : This is the functional counterpart of the %CPRSM
4011 AT command which is responsible for setting the receiving
4012 of SMS to pause or resume.
4013 [MDF: 07.04.2004]
4014 */
4015 GLOBAL T_ACI_RETURN sAT_PercentCPRSM ( T_ACI_CMD_SRC srcId,
4016 T_ACI_CPRSM_MOD mode)
4017 {
4018 T_ACI_RETURN ret;
4019
4020 TRACE_FUNCTION("sAT_PercentCPRSM()");
4021
4022 /* check whether SMS is currently accessible */
4023 if(!cmhSMS_checkAccess (srcId, &ret))
4024 return ret;
4025
4026 /* check mode and inform SMS entity */
4027 switch ( mode )
4028 {
4029 case CPRSM_MOD_Pause:
4030 /* send pause request to SMS */
4031 psaSMS_PauseReq();
4032 /* command complete */
4033 ret = AT_CMPL;
4034 break;
4035 case CPRSM_MOD_Resume:
4036 /* store paramters for current command */
4037 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CPRSM;
4038 smsShrdPrm.owner = (T_OWN)srcId;
4039 smsShrdPrm.smsEntStat.entOwn = srcId;
4040 /* send resume request to SMS */
4041 psaSMS_ResumeReq();
4042 ret = AT_EXCT;
4043 break;
4044 default:
4045 TRACE_EVENT_P1("sAT_PercentCPRSM ERROR: mode %d not supported", mode);
4046 ret = AT_FAIL;
4047 }
4048 return ret;
4049 }
4050
4051 /*
4052 +-------------------------------------------------------------------+
4053 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4054 | STATE : code ROUTINE : qAT_PercentCPRSM |
4055 +-------------------------------------------------------------------+
4056
4057 PURPOSE : This is the functional counterpart of the %CPRSM
4058 AT command which is responsible for quering the status
4059 of receiving of SMS. It might be resume or pause.
4060 [MDF: 15.04.2004]
4061 */
4062 GLOBAL T_ACI_RETURN qAT_PercentCPRSM ( T_ACI_CMD_SRC srcId )
4063 {
4064 T_ACI_RETURN ret = AT_EXCT;
4065
4066 TRACE_FUNCTION("qAT_PercentCPRSM()");
4067
4068 /* check whether SMS is currently accessible */
4069 if(!cmhSMS_checkAccess (srcId, &ret))
4070 return ret;
4071
4072 /* store paramters for current command */
4073 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CPRSM;
4074 smsShrdPrm.owner = (T_OWN)srcId;
4075 smsShrdPrm.smsEntStat.entOwn = srcId;
4076
4077 /* add parameter for signaling which parameter has been requested */
4078 psaSMS_QueryReq (SMS_QUERY_DELIVER_STATUS);
4079
4080 return ret;
4081 }
4082 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */
4083 /*
4084 +-------------------------------------------------------------------+
4085 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4086 | STATE : code ROUTINE : sAT_PlusCMMS |
4087 +-------------------------------------------------------------------+
4088
4089 PURPOSE : This is the functional counterpart of the +CMMS
4090 AT command which is responsible for setting the
4091 mode.
4092
4093 <mode>: command mode
4094 */
4095 GLOBAL T_ACI_RETURN sAT_PlusCMMS ( T_ACI_CMD_SRC srcId,
4096 UBYTE mode )
4097 {
4098 T_ACI_RETURN ret = AT_FAIL;
4099
4100 TRACE_FUNCTION ("sAT_PlusCMMS ()");
4101
4102 /*
4103 *-----------------------------------------------------------------
4104 * check source id and if command executable
4105 *-----------------------------------------------------------------
4106 */
4107 if(!cmhSMS_checkAccess (srcId, &ret))
4108 return ret;
4109
4110 smsShrdPrm.CMMSmode = mode;
4111 smsShrdPrm.smsEntStat.curCmd = AT_CMD_CMMS;
4112
4113 /* Implements measure 147,148, 149 */
4114 cmhSMS_sendConfigureReq(TRUE);
4115 smsShrdPrm.smsEntStat.curCmd = AT_CMD_NONE;
4116
4117 return( AT_CMPL );
4118 }
4119
4120 /*
4121 +-------------------------------------------------------------------+
4122 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4123 | STATE : code ROUTINE : sAT_PercentCMGMDU |
4124 +-------------------------------------------------------------------+
4125
4126 PURPOSE : Function is used to reset the reply path
4127
4128 <index>: Index of the record
4129 */
4130
4131 #if (defined (MFW) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
4132 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU ( T_ACI_CMD_SRC srcId,
4133 UBYTE index )
4134 {
4135 T_CONC_INIT_RETURN ret;
4136
4137 TRACE_FUNCTION ("sAT_PercentCMGMDU ()");
4138
4139 TRACE_EVENT_P1("sAT_PercentCMGMDU () index: %d", index);
4140
4141 ret=concSMS_initReadFromMem(srcId, index, SMS_READ_Normal);
4142
4143 if (ret EQ CONC_NEEDED)
4144 {
4145 SET_CONC;
4146 TRACE_EVENT("sAT_PercentCMGMDU: CONC_NEEDED");
4147 return sAT_PercentCMGMDU_Gl(srcId, index, rConcSMS_PercentCMGMDU);
4148 }
4149 else if (ret EQ CONC_NOT_NEEDED)
4150 {
4151 TRACE_EVENT("sAT_PercentCMGMDU: CONC_NOT_NEEDED");
4152 return sAT_PercentCMGMDU_Gl(srcId, index, NULL);
4153 }
4154 else
4155 {
4156 TRACE_EVENT("ERROR: sAT_PercentCMGMDU: CMS_ERR_InValMemIdx");
4157 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
4158 return ( AT_FAIL );
4159 }
4160 }
4161 #endif /* #if (defined (MFW) OR defined (_CONC_TESTING_) */
4162
4163 /*
4164 +-------------------------------------------------------------------+
4165 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4166 | STATE : code ROUTINE : sAT_PercentCMGMDU |
4167 +-------------------------------------------------------------------+
4168
4169 PURPOSE : For Riv-MMI.
4170 */
4171 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
4172 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU ( T_ACI_CMD_SRC srcId,
4173 UBYTE index )
4174 {
4175 TRACE_FUNCTION ("sAT_PercentCMGMDU ()");
4176 TRACE_EVENT_P1("sAT_PercentCMGMDU () index: %d", index);
4177
4178 return sAT_PercentCMGMDU_Gl(srcId, index, NULL);
4179 }
4180 #endif /*#if defined (FF_MMI_RIV)*/
4181
4182 GLOBAL T_ACI_RETURN sAT_PercentCMGMDU_Gl ( T_ACI_CMD_SRC srcId,
4183 UBYTE index,
4184 T_CMGMDU_FCT rplyCB )
4185 {
4186 T_ACI_RETURN ret = AT_EXCT;
4187
4188 TRACE_FUNCTION ("sAT_PercentCMGMDU_Gl ()");
4189
4190 /*
4191 *-----------------------------------------------------------------
4192 * check if command executable
4193 *-----------------------------------------------------------------
4194 */
4195 if(!cmhSMS_checkAccess (srcId, &ret))
4196 {
4197 return ret;
4198 }
4199
4200 smsShrdPrm.rplyCB.cmgmdu = rplyCB;
4201 smsShrdPrm.rdMode = READ_NORMAL;
4202
4203 /*
4204 *-----------------------------------------------------------------
4205 * read a short message from memory
4206 *-----------------------------------------------------------------
4207 */
4208 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGMDU;
4209 smsShrdPrm.owner = (T_OWN)srcId;
4210 smsShrdPrm.smsEntStat.entOwn = srcId;
4211
4212 psaSMS_ReadReq ( smsShrdPrm.mem1, index,
4213 smsShrdPrm.rdMode, SMS_STAT_NotPresent);
4214
4215 return( ret );
4216 }
4217 /*
4218 +-------------------------------------------------------------------+
4219 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4220 | STATE : code ROUTINE : sAT_PercentCMGR_Gl |
4221 +-------------------------------------------------------------------+
4222
4223 PURPOSE : This is the functional counterpart of the %CMGR
4224 AT command which is responsible for reading a short
4225 message from memory.
4226
4227 <index>: storage area index
4228 <rdMode>: read mode
4229 <rplyCB>: reply call-back
4230 <errorCB>: error call-back
4231 */
4232 GLOBAL T_ACI_RETURN sAT_PercentCMGR_Gl ( T_ACI_CMD_SRC srcId,
4233 UBYTE index,
4234 T_ACI_SMS_READ rdMode,
4235 T_CMGR_FCT rplyCB )
4236 {
4237 T_ACI_RETURN ret = AT_EXCT;
4238
4239 TRACE_FUNCTION ("sAT_PercentCMGR_Gl ()");
4240
4241 /*
4242 *-----------------------------------------------------------------
4243 * check if command executable
4244 *-----------------------------------------------------------------
4245 */
4246 if(!cmhSMS_checkAccess (srcId, &ret))
4247 {
4248 return ret;
4249 }
4250
4251 smsShrdPrm.rplyCB.cmgr = rplyCB;
4252
4253
4254 /*
4255 *-----------------------------------------------------------------
4256 * process the <index> parameter
4257 *-----------------------------------------------------------------
4258 */
4259 switch (rdMode)
4260 {
4261 case SMS_READ_StatusChange:
4262 smsShrdPrm.rdMode = READ_STATUS_CHANGE;
4263 break;
4264 case SMS_READ_Preview:
4265 smsShrdPrm.rdMode = READ_PREVIEW;
4266 break;
4267 case SMS_READ_Normal:
4268 case SMS_READ_NotPresent:
4269 smsShrdPrm.rdMode = READ_NORMAL;
4270 break;
4271 default:
4272 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4273 return ( AT_FAIL );
4274 }
4275 /*
4276 *-----------------------------------------------------------------
4277 * read a short message from memory
4278 *-----------------------------------------------------------------
4279 */
4280 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGR;
4281 smsShrdPrm.owner = (T_OWN)srcId;
4282 smsShrdPrm.smsEntStat.entOwn = srcId;
4283
4284 psaSMS_ReadReq ( smsShrdPrm.mem1, index,
4285 smsShrdPrm.rdMode, SMS_STAT_NotPresent);
4286
4287 return( ret );
4288 }
4289
4290
4291 /*
4292 +-------------------------------------------------------------------+
4293 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4294 | STATE : code ROUTINE : sAT_PercentCMGR |
4295 +-------------------------------------------------------------------+
4296
4297 PURPOSE : This is the functional counterpart of the %CMGR
4298 AT command which is responsible for reading a short
4299 message from memory.
4300
4301 Features Concatenated SMS.
4302 For GPF-MMI.
4303
4304 <index>: storage area index
4305 <rdMode>: read mode
4306 */
4307 #if (defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)) AND defined TI_PS_FF_CONC_SMS
4308
4309 GLOBAL T_ACI_RETURN sAT_PercentCMGR ( T_ACI_CMD_SRC srcId,
4310 UBYTE index,
4311 T_ACI_SMS_READ rdMode )
4312 {
4313 T_CONC_INIT_RETURN ret;
4314
4315 TRACE_FUNCTION ("sAT_PercentCMGR ()");
4316
4317 ret=concSMS_initReadFromMem(srcId, index, rdMode);
4318
4319 if (ret EQ CONC_NEEDED)
4320 {
4321 SET_CONC;
4322 TRACE_EVENT("sAT_PlusCMGR: CONC_NEEDED");
4323 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rConcSMS_PercentCMGR);
4324 }
4325 else if (ret EQ CONC_NOT_NEEDED)
4326 {
4327 TRACE_EVENT("sAT_PlusCMGR: CONC_NOT_NEEDED");
4328 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rAT_PercentCMGR);
4329 }
4330 else
4331 {
4332 TRACE_EVENT("ERROR: sAT_PercentCMGR: CMS_ERR_InValMemIdx");
4333 ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_InValMemIdx );
4334 return ( AT_FAIL );
4335 }
4336 }
4337 #endif /*#if defined (MFW) OR defined (SMI) OR defined (_CONC_TESTING_)*/
4338
4339 /*
4340 +-------------------------------------------------------------------+
4341 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4342 | STATE : code ROUTINE : sAT_PercentCMGR |
4343 +-------------------------------------------------------------------+
4344
4345 PURPOSE : %CMGR command for handling the conc module on
4346 the Riv-MMI side.
4347 */
4348 #if defined (FF_MMI_RIV) OR !defined TI_PS_FF_CONC_SMS
4349 GLOBAL T_ACI_RETURN sAT_PercentCMGR ( T_ACI_CMD_SRC srcId,
4350 UBYTE index,
4351 T_ACI_SMS_READ rdMode )
4352 {
4353 TRACE_FUNCTION ("sAT_PercentCMGR ()");
4354
4355 TRACE_EVENT_P1("sAT_PercentCMGR () index: %d", index);
4356
4357 return sAT_PercentCMGR_Gl(srcId, index, rdMode, rAT_PercentCMGR);
4358 }
4359 #endif /*#if defined (FF_MMI_RIV)*/
4360
4361 /*
4362 +-------------------------------------------------------------------+
4363 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4364 | STATE : code ROUTINE : sAT_PercentCMGL |
4365 +-------------------------------------------------------------------+
4366
4367 PURPOSE : This is the functional counterpart of the %CMGL
4368 AT command which is responsible for creating a list of
4369 all stored short messages.
4370
4371 <state>: state of stored short message
4372 <rdmode>: Read mode
4373 */
4374 GLOBAL T_ACI_RETURN sAT_PercentCMGL ( T_ACI_CMD_SRC srcId,
4375 T_ACI_SMS_STAT state,
4376 T_ACI_SMS_READ rdMode )
4377 {
4378 T_ACI_RETURN ret; /* AT response code */
4379 T_ACI_SMS_STAT chk_state;
4380
4381 TRACE_FUNCTION ("sAT_PercentCMGL ()");
4382
4383 /*
4384 *-----------------------------------------------------------------
4385 * check if command executable
4386 *-----------------------------------------------------------------
4387 */
4388 if(!cmhSMS_checkAccess (srcId, &ret))
4389 {
4390 return ret;
4391 }
4392
4393 /*
4394 *-----------------------------------------------------------------
4395 * process the <state> parameter
4396 *-----------------------------------------------------------------
4397 */
4398 switch ( state )
4399 {
4400 case( SMS_STAT_NotPresent ):
4401 chk_state = SMS_STAT_RecUnread;
4402 break;
4403
4404 case( SMS_STAT_Invalid ):
4405 case( SMS_STAT_All ):
4406 case( SMS_STAT_RecUnread ):
4407 case( SMS_STAT_RecRead ):
4408 case( SMS_STAT_StoUnsent ):
4409 case( SMS_STAT_StoSent ):
4410 chk_state = state;
4411 break;
4412
4413 default:
4414 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4415 return ( AT_FAIL );
4416 }
4417
4418
4419 /*
4420 *-----------------------------------------------------------------
4421 * process the <rdMode> parameter
4422 *-----------------------------------------------------------------
4423 */
4424 switch (rdMode)
4425 {
4426 case SMS_READ_StatusChange:
4427 smsShrdPrm.rdMode = READ_STATUS_CHANGE;
4428 break;
4429 case SMS_READ_Preview:
4430 smsShrdPrm.rdMode = READ_PREVIEW;
4431 break;
4432 case SMS_READ_Normal:
4433 case SMS_READ_NotPresent:
4434 smsShrdPrm.rdMode = READ_NORMAL;
4435 break;
4436 default:
4437 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4438 return ( AT_FAIL );
4439 }
4440
4441 /*
4442 *---------------------------------------------------------------
4443 * PSA notification
4444 *---------------------------------------------------------------
4445 */
4446 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGL;
4447 smsShrdPrm.owner = (T_OWN)srcId;
4448 smsShrdPrm.smsEntStat.entOwn = srcId;
4449
4450 /*
4451 *---------------------------------------------------------------
4452 * request the list element
4453 *---------------------------------------------------------------
4454 */
4455 psaSMS_ReadReq ( smsShrdPrm.mem1, 0,
4456 smsShrdPrm.rdMode, chk_state );
4457
4458 return( AT_EXCT );
4459 }
4460
4461 /*
4462 +-------------------------------------------------------------------+
4463 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4464 | STATE : code ROUTINE : cmhSMS_SendDelete_Req |
4465 +-------------------------------------------------------------------+
4466
4467 PURPOSE : This is the functional used to send a delete request
4468 to SMS module.
4469
4470 */
4471
4472 GLOBAL void cmhSMS_SendDelete_Req ( UBYTE index,
4473 UBYTE status )
4474 {
4475 TRACE_FUNCTION ("cmhSMS_SendDelete_Req ()");
4476
4477 smsShrdPrm.index = index;
4478 smsShrdPrm.status = status;
4479
4480 /*-------------------------------------------------------------------*
4481 * Create and Send primitive for SMS delete *
4482 *-------------------------------------------------------------------*/
4483 {
4484 PALLOC (mnsms_delete_req, MNSMS_DELETE_REQ);
4485
4486 /* fill in primitive parameter: delete message */
4487 mnsms_delete_req -> mem_type = smsShrdPrm.mem1;
4488 mnsms_delete_req -> rec_num = index;
4489 mnsms_delete_req -> delete_status = status;
4490
4491 PSENDX (SMS, mnsms_delete_req);
4492
4493 TRACE_EVENT_P1("cmgd: delete rec_num: %d", mnsms_delete_req->rec_num);
4494 }
4495 }
4496
4497
4498 /*
4499 +-------------------------------------------------------------------+
4500 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSS |
4501 | STATE : code ROUTINE : sAT_PercentCMGRS |
4502 +-------------------------------------------------------------------+
4503
4504 PURPOSE : This is the functional counterpart of the %CMGRS
4505 AT command which is responsible for selecting auto
4506 retransmission mode/request manual retransmission of last
4507 failed SMS
4508
4509 <mode>: requested mode
4510 */
4511 #ifdef REL99
4512
4513 GLOBAL T_ACI_RETURN sAT_PercentCMGRS ( T_ACI_CMD_SRC srcId,
4514 T_ACI_CMGRS_MODE mode)
4515 {
4516 T_ACI_RETURN aci_ret_val = AT_CMPL;
4517
4518 TRACE_FUNCTION ("sAT_PercentCMGRS ()");
4519
4520 /*
4521 *-----------------------------------------------------------------
4522 * check command source
4523 *-----------------------------------------------------------------
4524 */
4525 if(!cmh_IsVldCmdSrc (srcId) AND (srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT))
4526 {
4527 TRACE_ERROR ("[cmhSMS_checkAccess]: Cmd Src not valid");
4528 return AT_FAIL;
4529 }
4530 /*
4531 *-----------------------------------------------------------------
4532 * check SMS access status
4533 *-----------------------------------------------------------------
4534 */
4535 if (!cmhSMS_checkSIM ())
4536 {
4537 return AT_FAIL;
4538 }
4539
4540 switch( mode )
4541 {
4542 case( CMGRS_MODE_DISABLE_AUTO_RETRANS ):
4543 case( CMGRS_MODE_ENABLE_AUTO_RETRANS ):
4544 smsShrdPrm.auto_repeat_flag = mode;
4545 aci_ret_val = AT_CMPL;
4546 break;
4547
4548 case( CMGRS_MODE_MANUAL_RETRANS ):
4549 /*
4550 *-----------------------------------------------------------------
4551 * check entity status
4552 *-----------------------------------------------------------------
4553 */
4554 if( smsShrdPrm.smsEntStat.curCmd NEQ AT_CMD_NONE )
4555 {
4556
4557 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal );
4558 TRACE_ERROR ("[cmhSMS_checkAccess]: Entity is busy");
4559 aci_ret_val = AT_BUSY;
4560 break ;
4561 }
4562
4563 if(smsShrdPrm.is_msg_present_for_retrans EQ FALSE)
4564 {
4565 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_FailedMsgNotPresent );
4566 aci_ret_val = AT_FAIL;
4567 }
4568 else
4569 {
4570 /*-------------------------------------------------------------------
4571 * create and send primitive for retrasnmission request
4572 *-------------------------------------------------------------------
4573 */
4574 PALLOC (mnsms_retrans_req, MNSMS_RETRANS_REQ);
4575 mnsms_retrans_req -> auto_rep_flag = smsShrdPrm.auto_repeat_flag;
4576 PSENDX (SMS, mnsms_retrans_req);
4577
4578 smsShrdPrm.smsEntStat.curCmd = AT_CMD_P_CMGRS;
4579 smsShrdPrm.smsEntStat.entOwn = srcId;
4580 smsShrdPrm.owner = (T_OWN)srcId;
4581 #if defined (MFW) OR defined (FF_MMI_RIV)
4582 smsShrdPrm.rplyCB.cmgrs = rAT_PercentCMGRS;
4583 smsShrdPrm.errorCB = rAT_PlusCMS;
4584 #else
4585 smsShrdPrm.rplyCB.cmgrs = NULL;
4586 smsShrdPrm.errorCB = NULL;
4587 #endif
4588 aci_ret_val = AT_EXCT;
4589 }
4590 break;
4591
4592 default:
4593 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4594 aci_ret_val = AT_FAIL;
4595 break;
4596 }
4597
4598 return aci_ret_val;
4599 }
4600 #endif
4601
4602 /*==== EOF ========================================================*/