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