comparison src/aci2/aci/cmh_smsq.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_SMSQ
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 query functions related to the
18 | protocol stack adapter for short message service.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_SMSQ_C
23 #define CMH_SMSQ_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
37 #include "aci.h"
38 #include "psa.h"
39 #include "psa_sms.h"
40 #include "cmh.h"
41 #include "cmh_sms.h"
42
43 /*==== CONSTANTS ==================================================*/
44
45 /*==== EXPORT =====================================================*/
46
47 /*==== VARIABLES ==================================================*/
48
49 /* parameter block for delayed rAT_PlusCPMS call */
50 LOCAL struct qAT_PlusCPMS_buffer {
51 T_ACI_CMD_SRC srcId;
52 T_ACI_SMS_STOR_OCC m1;
53 T_ACI_SMS_STOR_OCC m2;
54 T_ACI_SMS_STOR_OCC m3;
55 } qAT_PlusCPMS_buffer;
56
57
58 /*==== PROTOTYPES =================================================*/
59 LOCAL UCHAR qAT_PlusCPMS_delayed (void* arg);
60
61 /*==== FUNCTIONS ==================================================*/
62 /*
63 +--------------------------------------------------------------------+
64 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
65 | STATE : code ROUTINE : qAT_PlusCSMP |
66 +--------------------------------------------------------------------+
67
68 PURPOSE : This is the functional counterpart to the +CSMP?
69 AT command which returns the current settings of the
70 text mode parameter.
71
72 <fo>: first octet of SMS-SUBMIT
73 <vprel>: relative validity period
74 <vpabs>: absolute validity period
75 <vpenh>: enhanced validity period
76 <pid>: TP-Protocol-Identifier
77 <dcs>: SMS data coding scheme
78 */
79 GLOBAL T_ACI_RETURN qAT_PlusCSMP ( T_ACI_CMD_SRC srcId,
80 SHORT* fo,
81 SHORT* vprel,
82 T_ACI_VP_ABS* vpabs,
83 T_ACI_VP_ENH* vpenh,
84 SHORT* pid,
85 SHORT* dcs )
86 {
87 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
88
89 TRACE_FUNCTION ("qAT_PlusCSMP ()");
90
91 /*
92 *-----------------------------------------------------------------
93 * check command source
94 *-----------------------------------------------------------------
95 */
96 if(!cmh_IsVldCmdSrc (srcId))
97 {
98 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
99 return( AT_FAIL );
100 }
101
102 /*
103 *-----------------------------------------------------------------
104 * check if command executable
105 *-----------------------------------------------------------------
106 */
107 if(!cmhSMS_checkSIM ())
108 return AT_FAIL;
109
110 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
111
112 /*
113 *-----------------------------------------------------------------
114 * fill in parameters
115 *-----------------------------------------------------------------
116 */
117 *fo = pSMSSetPrm -> msgType;
118
119 *vprel = pSMSSetPrm -> vpRel;
120
121 if (vpabs)
122 cmhSMS_setVpabsCmh ( vpabs, &pSMSSetPrm -> vpAbs );
123
124 if (vpenh)
125 cmhSMS_setVpenhCmh ( vpenh, &pSMSSetPrm -> vpEnh );
126
127 *pid = pSMSSetPrm -> pid;
128 *dcs = pSMSSetPrm -> dcs;
129
130 return ( AT_CMPL );
131 }
132
133 /*
134 +--------------------------------------------------------------------+
135 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
136 | STATE : code ROUTINE : qAT_PlusCPMS |
137 +--------------------------------------------------------------------+
138
139 PURPOSE : This is the functional counterpart to the +CPMS?
140 AT command which returns the current settings and usage
141 of the memory for writing, reading, ... of SMS.
142
143 <mem1>: memory information, reading, deleting
144 <mem2>: memory information, writing, sending
145 <mem3>: memory information, storing
146 */
147 GLOBAL T_ACI_RETURN qAT_PlusCPMS ( T_ACI_CMD_SRC srcId )
148 {
149 T_ACI_RETURN ret; /* AT response code */
150
151 T_ACI_AT_CMD cmdBuf = AT_CMD_CPMS;
152
153 TRACE_FUNCTION ("qAT_PlusCPMS ()");
154
155 /*
156 *-----------------------------------------------------------------
157 * check if command executable
158 *-----------------------------------------------------------------
159 */
160 if(!cmhSMS_checkAccess (srcId, &ret))
161 return ret;
162
163 if (!cmh_set_delayed_call (qAT_PlusCPMS_delayed, &qAT_PlusCPMS_buffer))
164 return AT_BUSY;
165
166 /*
167 *-----------------------------------------------------------------
168 * Fills the T_ACI_SMS_STOR_OCC structure with data from the
169 * shared parameter buffer (used mem, total mem).
170 *-----------------------------------------------------------------
171 */
172 qAT_PlusCPMS_buffer.srcId = srcId;
173 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m1, smsShrdPrm.mem1 );
174 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m2, smsShrdPrm.mem2 );
175 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m3, smsShrdPrm.mem3 );
176
177 #ifdef FF_ATI
178 cpmsCallType = QAT_CALL;
179 #endif /* FF_ATI */
180 TRACE_EVENT("delayed return requested: 100 ms");
181 cmh_start_delayed_call (100);
182
183 return( AT_EXCT );
184 }
185
186 /* function for delivering delayed rAT_PlusCPMS callback */
187 LOCAL UCHAR qAT_PlusCPMS_delayed (void* arg)
188 {
189 struct qAT_PlusCPMS_buffer* p = (struct qAT_PlusCPMS_buffer*) arg;
190 TRACE_EVENT("delayed delivery of RAT_CPMS after qAT_PlusCPMS");
191 R_AT ( RAT_CPMS, p->srcId ) ( &p->m1, &p->m2, &p->m3 );
192 R_AT ( RAT_OK, p->srcId ) ( AT_CMD_CPMS );
193 return FALSE; /* single-shot */
194 }
195
196 /*
197 +--------------------------------------------------------------------+
198 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
199 | STATE : code ROUTINE : qAT_PlusCSMS |
200 +--------------------------------------------------------------------+
201
202 PURPOSE : This is the functional counterpart to the +CSMS?
203 AT command which returns the current settings of the
204 message service.
205
206 <service>: message service
207 <mt>: mobile terminated messages
208 <mo>: mobile originated messages
209 <bm>: broadcast type messages
210 */
211 GLOBAL T_ACI_RETURN qAT_PlusCSMS ( T_ACI_CMD_SRC srcId,
212 T_ACI_CSMS_SERV *service,
213 T_ACI_CSMS_SUPP *mt,
214 T_ACI_CSMS_SUPP *mo,
215 T_ACI_CSMS_SUPP *bm )
216 {
217 TRACE_FUNCTION ("qAT_PlusCSMS ()");
218
219 /*
220 *-----------------------------------------------------------------
221 * check command source
222 *-----------------------------------------------------------------
223 */
224 if( ! cmh_IsVldCmdSrc (srcId) )
225 {
226 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
227 return ( AT_FAIL );
228 }
229
230 /*
231 *-----------------------------------------------------------------
232 * check if command executable
233 *-----------------------------------------------------------------
234 */
235 if(!cmhSMS_checkSIM ())
236 return AT_FAIL;
237
238 /*
239 *-----------------------------------------------------------------
240 * fill in parameters
241 *-----------------------------------------------------------------
242 */
243 *service = smsShrdPrm.CSMSservice;
244 *mt = smsShrdPrm.CSMSmt;
245 *mo = smsShrdPrm.CSMSmo;
246 *bm = smsShrdPrm.CSMSbm;
247
248 return ( AT_CMPL );
249 }
250
251 /*
252 +--------------------------------------------------------------------+
253 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
254 | STATE : code ROUTINE : qAT_PlusCMGF |
255 +--------------------------------------------------------------------+
256
257 PURPOSE : This is the functional counterpart to the +CMGF?
258 AT command which returns the current settings of the
259 message format.
260
261 <mode>: indicates the message format
262 */
263 GLOBAL T_ACI_RETURN qAT_PlusCMGF ( T_ACI_CMD_SRC srcId,
264 T_ACI_CMGF_MOD* mode )
265 {
266 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
267
268 TRACE_FUNCTION ("qAT_PlusCMGF ()");
269
270
271 /*
272 *-----------------------------------------------------------------
273 * check command source
274 *-----------------------------------------------------------------
275 */
276 if( ! cmh_IsVldCmdSrc (srcId) )
277 {
278 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
279 return ( AT_FAIL );
280 }
281
282 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
283
284 /*
285 *-----------------------------------------------------------------
286 * fill in parameters
287 *-----------------------------------------------------------------
288 */
289 *mode = pSMSSetPrm -> CMGFmode;
290
291 return ( AT_CMPL );
292 }
293
294 /*
295 +--------------------------------------------------------------------+
296 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
297 | STATE : code ROUTINE : qAT_PercentSMBS |
298 +--------------------------------------------------------------------+
299
300 PURPOSE : This is the functional counterpart to the %SMBS?
301 <mode>: indicates whether presenting of both text and pdu modes is enabled
302 */
303 #ifdef FF_MMI_RIV
304 GLOBAL T_ACI_RETURN qAT_PercentSMBS ( T_ACI_CMD_SRC srcId,
305 T_ACI_PERC_SMBS_MOD *mode )
306 {
307 TRACE_FUNCTION ("qAT_PercentSMBS ()");
308
309 /* check command source */
310 if( ! cmh_IsVldCmdSrc (srcId) )
311 {
312 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
313 return ( AT_FAIL );
314 }
315
316 /* fill in parameters */
317 *mode = smsShrdPrm.perccmgf_smbs_mode;
318
319 return ( AT_CMPL );
320 }
321 #endif /* #ifdef FF_MMI_RIV */
322
323 /*
324 +--------------------------------------------------------------------+
325 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
326 | STATE : code ROUTINE : qAT_PlusCSCA |
327 +--------------------------------------------------------------------+
328
329 PURPOSE : This is the functional counterpart to the +CSCA?
330 AT command which returns the current settings of the
331 service center address.
332
333 <sca>: service center address
334 <tosca>: type of service center address
335 */
336 GLOBAL T_ACI_RETURN qAT_PlusCSCA ( T_ACI_CMD_SRC srcId,
337 CHAR* sca,
338 T_ACI_TOA* tosca )
339 {
340 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
341
342 TRACE_FUNCTION ("qAT_PlusCSCA ()");
343
344 /*
345 *-----------------------------------------------------------------
346 * check command source
347 *-----------------------------------------------------------------
348 */
349 if(!cmh_IsVldCmdSrc (srcId) AND (srcId NEQ OWN_SAT))
350 {
351 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
352 return( AT_FAIL );
353 }
354
355 /*
356 *-----------------------------------------------------------------
357 * check if command executable
358 *-----------------------------------------------------------------
359 */
360 if(!cmhSMS_checkSIM ())
361 return AT_FAIL;
362
363 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
364
365 /*
366 *-----------------------------------------------------------------
367 * fill in parameters
368 *-----------------------------------------------------------------
369 */
370 tosca -> ton = cmhSMS_getTon ( pSMSSetPrm -> sca.ton );
371 tosca -> npi = cmhSMS_getNpi ( pSMSSetPrm -> sca.npi );
372
373 cmhSMS_getAdrStr ( sca,
374 MAX_SMS_NUM_LEN - 1,
375 pSMSSetPrm -> sca.num,
376 pSMSSetPrm -> sca.c_num );
377
378 return ( AT_CMPL );
379 }
380
381 /*
382 +--------------------------------------------------------------------+
383 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
384 | STATE : code ROUTINE : qAT_PlusCNMI |
385 +--------------------------------------------------------------------+
386
387 PURPOSE : This is the functional counterpart to the +CNMI?
388 AT command which returns the current settings of the
389 new message indication parameter.
390
391 <mt>: indication routing for SMS-DELIVER
392 <bm>: indication routing for CBM
393 <ds>: indication routing for SMS-STATUS-REPORT
394 */
395 GLOBAL T_ACI_RETURN qAT_PlusCNMI ( T_ACI_CMD_SRC srcId,
396 T_ACI_CNMI_MT* mt,
397 T_ACI_CNMI_BM* bm,
398 T_ACI_CNMI_DS* ds)
399 {
400 TRACE_FUNCTION ("qAT_PlusCNMI ()");
401
402
403 /*
404 *-----------------------------------------------------------------
405 * check command source
406 *-----------------------------------------------------------------
407 */
408 if(!cmh_IsVldCmdSrc (srcId))
409 {
410 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
411 return( AT_FAIL );
412 }
413
414 /*
415 *-----------------------------------------------------------------
416 * check if command executable
417 *-----------------------------------------------------------------
418 */
419 if(!cmhSMS_checkSIM ())
420 return AT_FAIL;
421
422 /*
423 *-----------------------------------------------------------------
424 * fill in parameters
425 *-----------------------------------------------------------------
426 */
427 *mt = smsShrdPrm.CNMImt;
428 *bm = smsShrdPrm.CNMIbm;
429 *ds = smsShrdPrm.CNMIds;
430
431 return ( AT_CMPL );
432 }
433
434 /*
435 +--------------------------------------------------------------------+
436 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
437 | STATE : code ROUTINE : qAT_PlusCSCB |
438 +--------------------------------------------------------------------+
439
440 PURPOSE : This is the functional counterpart to the +CSCB?
441 AT command which returns the current selected cell
442 broadcast message types.
443
444 <mode>: acception mode
445 <mids>: message identifiers
446 <dcss>: data coding schemes
447 */
448 GLOBAL T_ACI_RETURN qAT_PlusCSCB ( T_ACI_CMD_SRC srcId,
449 T_ACI_CSCB_MOD* mode,
450 USHORT* mids,
451 UBYTE* dcss)
452 {
453
454 TRACE_FUNCTION ("qAT_PlusCSCB ()");
455
456 /*
457 *-----------------------------------------------------------------
458 * check command source
459 *-----------------------------------------------------------------
460 */
461 if(!cmh_IsVldCmdSrc (srcId))
462 {
463 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
464 return( AT_FAIL );
465 }
466
467 /*
468 *-----------------------------------------------------------------
469 * check if command executable
470 *-----------------------------------------------------------------
471 */
472 if(!cmhSMS_checkSIM ())
473 return AT_FAIL;
474
475 /*
476 *-----------------------------------------------------------------
477 * fill in parameters
478 *-----------------------------------------------------------------
479 */
480 memcpy ( ( CHAR * ) mids, ( CHAR * ) smsShrdPrm.cbmPrm.msgId,
481 sizeof ( smsShrdPrm.cbmPrm.msgId ) );
482
483 memcpy ( ( CHAR * ) dcss, ( CHAR * ) smsShrdPrm.cbmPrm.dcsId,
484 sizeof ( smsShrdPrm.cbmPrm.dcsId ) );
485
486 if (smsShrdPrm.cbmPrm.cbmMode NEQ CBCH_IGNORE)
487 *mode = CSCB_MOD_Accept;
488 else
489 *mode = CSCB_MOD_NotAccept;
490
491 return ( AT_CMPL );
492 }
493
494
495 #ifdef FF_HOMEZONE
496 /*
497 +--------------------------------------------------------------------+
498 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
499 | STATE : code ROUTINE : qAT_PercentCBHZ |
500 +--------------------------------------------------------------------+
501
502 PURPOSE : This is the functional counterpart to the %CBHZ?
503 AT command which returns the current selected homezone
504 parameters.
505
506 <mode> : acctivation mode
507 <dcs> : data coding scheme for homezone period
508 <timeout>: timeout period for homezone CBM
509 */
510 GLOBAL T_ACI_RETURN qAT_PercentCBHZ ( T_ACI_CMD_SRC srcId,
511 T_ACI_CBHZ_MOD* mode,
512 T_ACI_CS* dcs,
513 UBYTE* timeout)
514 {
515
516 TRACE_FUNCTION ("qAT_PercentCBHZ()");
517
518 /*
519 *-----------------------------------------------------------------
520 * check command source
521 *-----------------------------------------------------------------
522 */
523 if(!cmh_IsVldCmdSrc (srcId))
524 {
525 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
526 return( AT_FAIL );
527 }
528
529 /*
530 *-----------------------------------------------------------------
531 * check if command executable
532 *-----------------------------------------------------------------
533 */
534 if(!cmhSMS_checkSIM ())
535 return AT_FAIL;
536
537 /*
538 *-----------------------------------------------------------------
539 * fill in parameters
540 *-----------------------------------------------------------------
541 */
542 *mode = smsShrdPrm.cbmPrm.hzMode;
543 *dcs = smsShrdPrm.cbmPrm.hzDcs;
544 *timeout = smsShrdPrm.cbmPrm.hzTimeout;
545
546 return ( AT_CMPL );
547 }
548
549 #endif /* FF_HOMEZONE */
550
551 /*
552 +--------------------------------------------------------------------+
553 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
554 | STATE : code ROUTINE : qAT_PlusCMMS |
555 +--------------------------------------------------------------------+
556
557 PURPOSE : This is the functional counterpart to the +CMMS?
558 AT command which returns the current mode setting.
559
560 <mode>: mode for +CMMS
561
562 */
563 GLOBAL T_ACI_RETURN qAT_PlusCMMS ( T_ACI_CMD_SRC srcId,
564 UBYTE* mode)
565 {
566
567
568 TRACE_FUNCTION ("qAT_PlusCMMS ()");
569
570 /*
571 *-----------------------------------------------------------------
572 * check command source
573 *-----------------------------------------------------------------
574 */
575 if(!cmh_IsVldCmdSrc (srcId))
576 {
577 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
578 return( AT_FAIL );
579 }
580
581 *mode = smsShrdPrm.CMMSmode;
582
583 return ( AT_CMPL );
584 }
585
586
587
588
589
590 /*==== EOF ========================================================*/