comparison src/g23m-aci/aci/cmh_smsq.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_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 return( AT_FAIL );
99 }
100
101 /*
102 *-----------------------------------------------------------------
103 * check if command executable
104 *-----------------------------------------------------------------
105 */
106 if(!cmhSMS_checkSIM ())
107 return AT_FAIL;
108
109 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
110
111 /*
112 *-----------------------------------------------------------------
113 * fill in parameters
114 *-----------------------------------------------------------------
115 */
116 *fo = pSMSSetPrm -> msgType;
117
118 *vprel = pSMSSetPrm -> vpRel;
119
120 if (vpabs)
121 cmhSMS_setVpabsCmh ( vpabs, &pSMSSetPrm -> vpAbs );
122
123 if (vpenh)
124 cmhSMS_setVpenhCmh ( vpenh, &pSMSSetPrm -> vpEnh );
125
126 *pid = pSMSSetPrm -> pid;
127 *dcs = pSMSSetPrm -> dcs;
128
129 return ( AT_CMPL );
130 }
131
132 /*
133 +--------------------------------------------------------------------+
134 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
135 | STATE : code ROUTINE : qAT_PlusCPMS |
136 +--------------------------------------------------------------------+
137
138 PURPOSE : This is the functional counterpart to the +CPMS?
139 AT command which returns the current settings and usage
140 of the memory for writing, reading, ... of SMS.
141
142 <mem1>: memory information, reading, deleting
143 <mem2>: memory information, writing, sending
144 <mem3>: memory information, storing
145 */
146 GLOBAL T_ACI_RETURN qAT_PlusCPMS ( T_ACI_CMD_SRC srcId )
147 {
148 T_ACI_RETURN ret; /* AT response code */
149
150
151 TRACE_FUNCTION ("qAT_PlusCPMS ()");
152
153 /*
154 *-----------------------------------------------------------------
155 * check if command executable
156 *-----------------------------------------------------------------
157 */
158 if(!cmhSMS_checkAccess (srcId, &ret))
159 return ret;
160
161 if (!cmh_set_delayed_call (qAT_PlusCPMS_delayed, &qAT_PlusCPMS_buffer))
162 return AT_BUSY;
163
164 /*
165 *-----------------------------------------------------------------
166 * Fills the T_ACI_SMS_STOR_OCC structure with data from the
167 * shared parameter buffer (used mem, total mem).
168 *-----------------------------------------------------------------
169 */
170 qAT_PlusCPMS_buffer.srcId = srcId;
171 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m1, smsShrdPrm.mem1 );
172 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m2, smsShrdPrm.mem2 );
173 cmhSMS_setStorOcc ( &qAT_PlusCPMS_buffer.m3, smsShrdPrm.mem3 );
174
175 #ifdef FF_ATI
176 cpmsCallType = QAT_CALL;
177 #endif /* FF_ATI */
178 TRACE_EVENT("delayed return requested: 100 ms");
179 cmh_start_delayed_call (100);
180
181 return( AT_EXCT );
182 }
183
184 /*
185 +--------------------------------------------------------------------+
186 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
187 | STATE : code ROUTINE : qAT_PlusCPMS |
188 +--------------------------------------------------------------------+
189
190 PURPOSE : This is the functional counterpart to the +CPMS?
191 AT command which returns the current settings and usage
192 of the memory for writing, reading, ... of SMS.
193
194 <sim_total>: memory information, total available in SIM
195 <sim_used>: memory information, Used in SIM
196 <me_total>: memory information, total available in ME
197 <me_used> memory information, Used in ME
198 */
199 /* provide immediate return in case of reading */
200 GLOBAL T_ACI_RETURN qAT_PlusCPMS_ext ( T_ACI_CMD_SRC srcId, UBYTE *sim_total, UBYTE *sim_used, UBYTE *me_total, UBYTE *me_used )
201 {
202 TRACE_FUNCTION ("qAT_PlusCPMS_ext()");
203
204 *sim_total = smsShrdPrm.aci_sms_parameter.simTotal;
205 *sim_used = smsShrdPrm.aci_sms_parameter.simUsed;
206 *me_total = smsShrdPrm.aci_sms_parameter.meTotal;
207 *me_used = smsShrdPrm.aci_sms_parameter.meUsed;
208
209 TRACE_EVENT_P4("sim_total = %d, sim_used = %d, me_total = %d, me_used = %d", *sim_total , *sim_used, *me_total, *me_used);
210 return AT_CMPL;
211 }
212
213 /* function for delivering delayed rAT_PlusCPMS callback */
214 LOCAL UCHAR qAT_PlusCPMS_delayed (void* arg)
215 {
216 struct qAT_PlusCPMS_buffer* p = (struct qAT_PlusCPMS_buffer*) arg;
217 TRACE_EVENT("delayed delivery of RAT_CPMS after qAT_PlusCPMS");
218 R_AT ( RAT_CPMS, p->srcId ) ( &p->m1, &p->m2, &p->m3 );
219 R_AT ( RAT_OK, p->srcId ) ( AT_CMD_CPMS );
220 return FALSE; /* single-shot */
221 }
222
223 /*
224 +--------------------------------------------------------------------+
225 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
226 | STATE : code ROUTINE : qAT_PlusCSMS |
227 +--------------------------------------------------------------------+
228
229 PURPOSE : This is the functional counterpart to the +CSMS?
230 AT command which returns the current settings of the
231 message service.
232
233 <service>: message service
234 <mt>: mobile terminated messages
235 <mo>: mobile originated messages
236 <bm>: broadcast type messages
237 */
238 GLOBAL T_ACI_RETURN qAT_PlusCSMS ( T_ACI_CMD_SRC srcId,
239 T_ACI_CSMS_SERV *service,
240 T_ACI_CSMS_SUPP *mt,
241 T_ACI_CSMS_SUPP *mo,
242 T_ACI_CSMS_SUPP *bm )
243 {
244 TRACE_FUNCTION ("qAT_PlusCSMS ()");
245
246 /*
247 *-----------------------------------------------------------------
248 * check command source
249 *-----------------------------------------------------------------
250 */
251 if( ! cmh_IsVldCmdSrc (srcId) )
252 {
253 return ( AT_FAIL );
254 }
255
256 /*
257 *-----------------------------------------------------------------
258 * check if command executable
259 *-----------------------------------------------------------------
260 */
261 if(!cmhSMS_checkSIM ())
262 return AT_FAIL;
263
264 /*
265 *-----------------------------------------------------------------
266 * fill in parameters
267 *-----------------------------------------------------------------
268 */
269 *service = smsShrdPrm.CSMSservice;
270 *mt = smsShrdPrm.CSMSmt;
271 *mo = smsShrdPrm.CSMSmo;
272 *bm = smsShrdPrm.CSMSbm;
273
274 return ( AT_CMPL );
275 }
276
277 /*
278 +--------------------------------------------------------------------+
279 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
280 | STATE : code ROUTINE : qAT_PlusCMGF |
281 +--------------------------------------------------------------------+
282
283 PURPOSE : This is the functional counterpart to the +CMGF?
284 AT command which returns the current settings of the
285 message format.
286
287 <mode>: indicates the message format
288 */
289 GLOBAL T_ACI_RETURN qAT_PlusCMGF ( T_ACI_CMD_SRC srcId,
290 T_ACI_CMGF_MOD* mode )
291 {
292 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
293
294 TRACE_FUNCTION ("qAT_PlusCMGF ()");
295
296
297 /*
298 *-----------------------------------------------------------------
299 * check command source
300 *-----------------------------------------------------------------
301 */
302 if( ! cmh_IsVldCmdSrc (srcId) )
303 {
304 return ( AT_FAIL );
305 }
306
307 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
308
309 /*
310 *-----------------------------------------------------------------
311 * fill in parameters
312 *-----------------------------------------------------------------
313 */
314 *mode = pSMSSetPrm -> CMGFmode;
315
316 return ( AT_CMPL );
317 }
318
319 /*
320 +--------------------------------------------------------------------+
321 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
322 | STATE : code ROUTINE : qAT_PercentSMBS |
323 +--------------------------------------------------------------------+
324
325 PURPOSE : This is the functional counterpart to the %SMBS?
326 <mode>: indicates whether presenting of both text and pdu modes is enabled
327 */
328 #ifdef FF_MMI_RIV
329 GLOBAL T_ACI_RETURN qAT_PercentSMBS ( T_ACI_CMD_SRC srcId,
330 T_ACI_PERC_SMBS_MOD *mode )
331 {
332 TRACE_FUNCTION ("qAT_PercentSMBS ()");
333
334 /* check command source */
335 if( ! cmh_IsVldCmdSrc (srcId) )
336 {
337 return ( AT_FAIL );
338 }
339
340 /* fill in parameters */
341 *mode = smsShrdPrm.perccmgf_smbs_mode;
342
343 return ( AT_CMPL );
344 }
345 #endif /* #ifdef FF_MMI_RIV */
346
347 /*
348 +--------------------------------------------------------------------+
349 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
350 | STATE : code ROUTINE : qAT_PlusCSCA |
351 +--------------------------------------------------------------------+
352
353 PURPOSE : This is the functional counterpart to the +CSCA?
354 AT command which returns the current settings of the
355 service center address.
356
357 <sca>: service center address
358 <tosca>: type of service center address
359 */
360 GLOBAL T_ACI_RETURN qAT_PlusCSCA ( T_ACI_CMD_SRC srcId,
361 CHAR* sca,
362 T_ACI_TOA* tosca )
363 {
364 T_SMS_SET_PRM * pSMSSetPrm; /* points to SMS parameter set */
365
366 TRACE_FUNCTION ("qAT_PlusCSCA ()");
367
368 /*
369 *-----------------------------------------------------------------
370 * check command source
371 *-----------------------------------------------------------------
372 */
373 if(srcId NEQ (T_ACI_CMD_SRC)OWN_SRC_SAT)
374 {
375 if(!cmh_IsVldCmdSrc (srcId))
376 {
377 return( AT_FAIL );
378 }
379 }
380 /*
381 *-----------------------------------------------------------------
382 * check if command executable
383 *-----------------------------------------------------------------
384 */
385 if(!cmhSMS_checkSIM ())
386 return AT_FAIL;
387
388 pSMSSetPrm = smsShrdPrm.pSetPrm[srcId];
389
390 /*
391 *-----------------------------------------------------------------
392 * fill in parameters
393 *-----------------------------------------------------------------
394 */
395 tosca -> ton = cmhSMS_getTon ( pSMSSetPrm -> sca.ton );
396 tosca -> npi = cmhSMS_getNpi ( pSMSSetPrm -> sca.npi );
397
398 cmhSMS_getAdrStr ( sca,
399 MAX_SMS_NUM_LEN - 1,
400 pSMSSetPrm -> sca.num,
401 pSMSSetPrm -> sca.c_num );
402
403 return ( AT_CMPL );
404 }
405
406 /*
407 +--------------------------------------------------------------------+
408 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
409 | STATE : code ROUTINE : qAT_PlusCNMI |
410 +--------------------------------------------------------------------+
411
412 PURPOSE : This is the functional counterpart to the +CNMI?
413 AT command which returns the current settings of the
414 new message indication parameter.
415
416 <mt>: indication routing for SMS-DELIVER
417 <bm>: indication routing for CBM
418 <ds>: indication routing for SMS-STATUS-REPORT
419 */
420 GLOBAL T_ACI_RETURN qAT_PlusCNMI ( T_ACI_CMD_SRC srcId,
421 T_ACI_CNMI_MT* mt,
422 T_ACI_CNMI_BM* bm,
423 T_ACI_CNMI_DS* ds)
424 {
425 TRACE_FUNCTION ("qAT_PlusCNMI ()");
426
427
428 /*
429 *-----------------------------------------------------------------
430 * check command source
431 *-----------------------------------------------------------------
432 */
433 if(!cmh_IsVldCmdSrc (srcId))
434 {
435 return( AT_FAIL );
436 }
437
438 /*
439 *-----------------------------------------------------------------
440 * check if command executable
441 *-----------------------------------------------------------------
442 */
443 if(!cmhSMS_checkSIM ())
444 return AT_FAIL;
445
446 /*
447 *-----------------------------------------------------------------
448 * fill in parameters
449 *-----------------------------------------------------------------
450 */
451 *mt = smsShrdPrm.CNMImt;
452 *bm = smsShrdPrm.CNMIbm;
453 *ds = smsShrdPrm.CNMIds;
454
455 return ( AT_CMPL );
456 }
457
458 /*
459 +--------------------------------------------------------------------+
460 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
461 | STATE : code ROUTINE : qAT_PlusCSCB |
462 +--------------------------------------------------------------------+
463
464 PURPOSE : This is the functional counterpart to the +CSCB?
465 AT command which returns the current selected cell
466 broadcast message types.
467
468 <mode>: acception mode
469 <mids>: message identifiers
470 <dcss>: data coding schemes
471 */
472 GLOBAL T_ACI_RETURN qAT_PlusCSCB ( T_ACI_CMD_SRC srcId,
473 T_ACI_CSCB_MOD* mode,
474 USHORT* mids,
475 UBYTE* dcss)
476 {
477
478 TRACE_FUNCTION ("qAT_PlusCSCB ()");
479
480 /*
481 *-----------------------------------------------------------------
482 * check command source
483 *-----------------------------------------------------------------
484 */
485 if(!cmh_IsVldCmdSrc (srcId))
486 {
487 return( AT_FAIL );
488 }
489
490 /*
491 *-----------------------------------------------------------------
492 * check if command executable
493 *-----------------------------------------------------------------
494 */
495 if(!cmhSMS_checkSIM ())
496 return AT_FAIL;
497
498 /*
499 *-----------------------------------------------------------------
500 * fill in parameters
501 *-----------------------------------------------------------------
502 */
503 memcpy ( ( CHAR * ) mids, ( CHAR * ) smsShrdPrm.cbmPrm.msgId,
504 sizeof ( smsShrdPrm.cbmPrm.msgId ) );
505
506 memcpy ( ( CHAR * ) dcss, ( CHAR * ) smsShrdPrm.cbmPrm.dcsId,
507 sizeof ( smsShrdPrm.cbmPrm.dcsId ) );
508
509 if (smsShrdPrm.cbmPrm.cbmMode NEQ CBCH_IGNORE)
510 *mode = CSCB_MOD_Accept;
511 else
512 *mode = CSCB_MOD_NotAccept;
513
514 return ( AT_CMPL );
515 }
516
517
518 #ifdef FF_HOMEZONE
519 /*
520 +--------------------------------------------------------------------+
521 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
522 | STATE : code ROUTINE : qAT_PercentCBHZ |
523 +--------------------------------------------------------------------+
524
525 PURPOSE : This is the functional counterpart to the %CBHZ?
526 AT command which returns the current selected homezone
527 parameters.
528
529 <mode> : acctivation mode
530 <dcs> : data coding scheme for homezone period
531 <timeout>: timeout period for homezone CBM
532 */
533 GLOBAL T_ACI_RETURN qAT_PercentCBHZ ( T_ACI_CMD_SRC srcId,
534 T_ACI_CBHZ_MOD* mode,
535 T_ACI_CS* dcs,
536 UBYTE* timeout)
537 {
538
539 TRACE_FUNCTION ("qAT_PercentCBHZ()");
540
541 /*
542 *-----------------------------------------------------------------
543 * check command source
544 *-----------------------------------------------------------------
545 */
546 if(!cmh_IsVldCmdSrc (srcId))
547 {
548 return( AT_FAIL );
549 }
550
551 /*
552 *-----------------------------------------------------------------
553 * check if command executable
554 *-----------------------------------------------------------------
555 */
556 if(!cmhSMS_checkSIM ())
557 return AT_FAIL;
558
559 /*
560 *-----------------------------------------------------------------
561 * fill in parameters
562 *-----------------------------------------------------------------
563 */
564 *mode = (T_ACI_CBHZ_MOD)smsShrdPrm.cbmPrm.hzMode;
565 *dcs = (T_ACI_CS)smsShrdPrm.cbmPrm.hzDcs;
566 *timeout = smsShrdPrm.cbmPrm.hzTimeout;
567
568 return ( AT_CMPL );
569 }
570
571 #endif /* FF_HOMEZONE */
572
573 #ifdef REL99
574 /*
575 +--------------------------------------------------------------------+
576 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
577 | STATE : code ROUTINE : qAT_PercentCMGRS |
578 +--------------------------------------------------------------------+
579
580 PURPOSE : This is the functional counterpart to the %CMGRS?
581 AT command which returns the current settings of the
582 auto retransmission flag.
583
584 */
585 GLOBAL T_ACI_RETURN qAT_PercentCMGRS ( T_ACI_CMD_SRC srcId,
586 UBYTE *auto_rep_flag )
587 {
588 TRACE_FUNCTION ("qAT_PercentCMGRS ()");
589
590 /*
591 *-----------------------------------------------------------------
592 * check command source
593 *-----------------------------------------------------------------
594 */
595 if( ! cmh_IsVldCmdSrc (srcId) )
596 {
597 return ( AT_FAIL );
598 }
599
600 /*
601 *-----------------------------------------------------------------
602 * check if command executable
603 *-----------------------------------------------------------------
604 */
605 if(!cmhSMS_checkSIM ())
606 return AT_FAIL;
607
608 /*
609 *-----------------------------------------------------------------
610 * fill in parameters
611 *-----------------------------------------------------------------
612 */
613 *auto_rep_flag = smsShrdPrm.auto_repeat_flag;
614
615 return ( AT_CMPL );
616 }
617 #endif
618
619 /*
620 +--------------------------------------------------------------------+
621 | PROJECT : GSM-PS (6147) MODULE : CMH_SMSQ |
622 | STATE : code ROUTINE : qAT_PlusCMMS |
623 +--------------------------------------------------------------------+
624
625 PURPOSE : This is the functional counterpart to the +CMMS?
626 AT command which returns the current mode setting.
627
628 <mode>: mode for +CMMS
629
630 */
631 GLOBAL T_ACI_RETURN qAT_PlusCMMS ( T_ACI_CMD_SRC srcId,
632 UBYTE* mode)
633 {
634
635
636 TRACE_FUNCTION ("qAT_PlusCMMS ()");
637
638 /*
639 *-----------------------------------------------------------------
640 * check command source
641 *-----------------------------------------------------------------
642 */
643 if(!cmh_IsVldCmdSrc (srcId))
644 {
645 return( AT_FAIL );
646 }
647
648 *mode = smsShrdPrm.CMMSmode;
649
650 return ( AT_CMPL );
651 }
652
653
654
655
656
657 /*==== EOF ========================================================*/