comparison src/g23m-aci/aci/cmh_sms.h @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_SMS
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 : Definitions for the command handler of the
18 | short message service.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_SMS_H
23 #define CMH_SMS_H
24
25 #include "psa_sms.h"
26
27 /*==== CONSTANTS ==================================================*/
28
29 /* for the following constants see GSM 11.11, chapter 10.3.3 */
30 #define STAT_MASK 0x07
31 #define REC_UNREAD 0x03 /* message received by MS from network */
32 /* message to be read */
33 #define REC_READ 0x01 /* message received by MS from network */
34 /* message read */
35 #define STO_UNSENT 0x07 /* MS originating message */
36 /* message to be sent */
37 #define STO_SENT 0x05 /* MS originating message */
38 /* message sent to the network */
39
40 /* TP-Validity-Period-Format (TP-VPF) */
41 #define VPF_MASK 0x18
42 #define VPF_NOT_PRESENT 0x00
43 #define VPF_RELATIVE 0x10
44 #define VPF_ABSOLUTE 0x18
45 #define VPF_ENHANCED 0x08
46
47
48 #define SMS_CMH_MAX_START_IDX (255)
49
50 #define MIN_SMS_PRM_LEN 28
51 #define MAX_SMS_PRM_ADDR_OCTETS 10 /* = MAX_SMS_ADDR_DIG/2 */
52 #define SIM_SMSP_V_DEST 0x01
53 #define SIM_SMSP_V_SCA 0x02
54 #define SIM_SMSP_V_PID 0x04
55 #define SIM_SMSP_V_DCS 0x08
56 #define SIM_SMSP_V_VPREL 0x10
57
58 /*
59 * Value constants for bcd
60 */
61 #define BCD_ASTSK 0xa /* ( */
62 #define BCD_PND 0xb /* # */
63 #define BCD_A 0xc /* a */
64 #define BCD_B 0xd /* b */
65 #define BCD_C 0xe /* c */
66 #define BCD_RES 0xf /* reserved */
67
68 /*==== TYPES ======================================================*/
69
70 /*typedef struct
71 {
72 UBYTE npi : 4;
73 UBYTE ton : 3;
74 UBYTE ext : 1;
75 } T_TON_NPI;*/
76
77 typedef struct
78 {
79 UBYTE length;
80 UBYTE ton_npi;
81 UBYTE addr[MAX_SMS_PRM_ADDR_OCTETS];
82 } T_RP_ADDRESS;
83
84 typedef struct
85 {
86 UBYTE no_bcd;
87 UBYTE ton_npi;
88 UBYTE addr[MAX_SMS_PRM_ADDR_OCTETS];
89 } T_TP_ADDRESS;
90
91 typedef struct
92 {
93 UBYTE par_ind;
94 UBYTE dest_no_bcd;
95 UBYTE dest_ton_npi;
96 UBYTE dest_addr[MAX_SMS_PRM_ADDR_OCTETS];
97 UBYTE sca_length;
98 UBYTE sca_ton_npi;
99 UBYTE sca_addr[MAX_SMS_PRM_ADDR_OCTETS];
100 UBYTE pid;
101 UBYTE dcs;
102 UBYTE vp_rel;
103 } T_ACI_SMS_SIM_PARAMS;
104
105 typedef struct
106 {
107 UBYTE lowerMSB;
108 UBYTE lowerLSB;
109 UBYTE upperMSB;
110 UBYTE upperLSB;
111 } T_ACI_CBM_SIM_MID_RANGE;
112
113 typedef struct
114 {
115 UBYTE MSB;
116 UBYTE LSB;
117 } T_ACI_CBM_SIM_MID_LIST;
118
119
120 /********************************************************************
121 *
122 * SMS Profile for FFS
123 *
124 ********************************************************************/
125
126
127 #define MAX_FFS_SMSPRFLS 4
128
129 #define FFS_SMSPRFL_PATH "/gsm/sms"
130
131 #define FFS_SMSPRFL_FNAME01 "/gsm/sms/smsprfl01"
132 #define FFS_SMSPRFL_FNAME02 "/gsm/sms/smsprfl02"
133 #define FFS_SMSPRFL_FNAME03 "/gsm/sms/smsprfl03"
134 #define FFS_SMSPRFL_FNAME04 "/gsm/sms/smsprfl04"
135
136 #define SIZE_FFS_SMSPRFL_SCA 20
137 #define SIZE_FFS_SMSPRFL_MIDS 40
138 #define SIZE_FFS_SMSPRFL_DCSS 20
139 #define SIZE_FFS_SMSPRFL_VPABS 15
140 #define SIZE_FFS_SMSPRFL_VPENH 15
141
142 #define FFS_SMSPRFL_VLD 0x00
143 #define FFS_SMSPRFL_INVLD 0xFF
144
145 typedef struct ffs_EFsmsprfl_Type /* SMS Profile */
146 {
147 UBYTE vldFlag; /* Valid Flag */
148 UBYTE CSCAsca[SIZE_FFS_SMSPRFL_SCA]; /* Service Center Address */
149 UBYTE CSCAlenSca; /* Length of Service Center Address */
150 UBYTE CSCAton; /* Type of Number */
151 UBYTE CSCAnpi; /* Numbering Plan Identification */
152 UBYTE CSCBmode; /* Mode */
153 UBYTE CSCBmids[SIZE_FFS_SMSPRFL_MIDS]; /* Message Identifier */
154 UBYTE CSCBdcss[SIZE_FFS_SMSPRFL_DCSS]; /* Data Coding Schemes */
155 UBYTE CSMPfo; /* First Octet */
156 UBYTE CSMPvprel; /* Validity Period Relative */
157 UBYTE CSMPvpabs[SIZE_FFS_SMSPRFL_VPABS]; /* Validity Period Absolute */
158 UBYTE CSMPvpenh[SIZE_FFS_SMSPRFL_VPENH]; /* Validity Period Enhanced */
159 UBYTE CSMPpid; /* Protocol Identifier */
160 UBYTE CSMPdcs; /* Data Coding Scheme */
161 UBYTE IMSI[MAX_IMSI]; /* IMSI */
162 } T_ACI_FFS_SMSPRFL;
163
164 #define SIZE_FSS_SMSPRFL ( SIZE_FFS_SMSPRFL_SCA + \
165 SIZE_FFS_SMSPRFL_MIDS + \
166 SIZE_FFS_SMSPRFL_DCSS + \
167 SIZE_FFS_SMSPRFL_VPABS + \
168 MAX_IMSI + \
169 SIZE_FFS_SMSPRFL_VPENH + 9 )
170
171 /*==== Global Declaration =================================================*/
172 #ifdef CMH_SMSR_C
173 GLOBAL T_ACI_SMS_STAT cmglStat = SMS_STAT_All;
174 #else
175 EXTERN T_ACI_SMS_STAT cmglStat;
176 #endif /* CMH_SMSR_C */
177
178 /*==== PROTOTYPES =================================================*/
179
180 EXTERN UBYTE cmhSMS_getNType ( T_ACI_TOA_TON ton );
181 EXTERN BOOL cmhSMS_findPrflId ( UBYTE critrerium,
182 void *elem );
183 EXTERN T_ACI_TOA_TON
184 cmhSMS_getTon ( UBYTE ntype );
185 EXTERN UBYTE cmhSMS_getNPlan ( T_ACI_TOA_NPI npi );
186 EXTERN T_ACI_TOA_NPI
187 cmhSMS_getNpi ( UBYTE nplan );
188 EXTERN BOOL cmhSMS_isVpabsVld ( T_ACI_VP_ABS* vpabs );
189 EXTERN BOOL cmhSMS_isVpenhVld ( T_ACI_VP_ENH* vpenh );
190 EXTERN void cmhSMS_setVpabsPsa ( T_tp_vp_abs* psaVp,
191 T_ACI_VP_ABS* cmhVp );
192 EXTERN void cmhSMS_setVpenhPsa ( T_tp_vp_enh* psaVp,
193 T_ACI_VP_ENH* cmhVp );
194 EXTERN void cmhSMS_setVpabsCmh ( T_ACI_VP_ABS* cmhVp,
195 T_tp_vp_abs* psaVp );
196 EXTERN void cmhSMS_setVpenhCmh ( T_ACI_VP_ENH* cmhVp,
197 T_tp_vp_enh* psaVp );
198 EXTERN UBYTE cmhSMS_getAdrStr ( CHAR* pStr,
199 UBYTE maxIdx,
200 UBYTE* pBcd,
201 UBYTE numDigits );
202 EXTERN void cmhSMS_getAdrBcd ( UBYTE* pBcd,
203 UBYTE* pNumDigits,
204 UBYTE maxDigits,
205 CHAR* pStr );
206 EXTERN T_ACI_RETURN cmhSMS_packAlphaNumAddr( CHAR* da,
207 T_tp_da* da_addr);
208 EXTERN BOOL cmhSMS_getMemPsa ( T_ACI_SMS_STOR inMem,
209 UBYTE* outMem );
210 EXTERN void cmhSMS_getMemCmh ( UBYTE inMem,
211 T_ACI_SMS_STOR* outMem );
212 EXTERN void cmhSMS_expdSmsPp ( UBYTE byte_offset,
213 UBYTE dcs,
214 UBYTE* source,
215 UBYTE source_len,
216 UBYTE* dest,
217 UBYTE* dest_len );
218 EXTERN void cmhSMS_rdcSmsPp ( UBYTE byte_offset,
219 UBYTE dcs,
220 UBYTE* source,
221 UBYTE source_len,
222 UBYTE* dest,
223 UBYTE* dest_len );
224 EXTERN void cmhSMS_expdSmsCb ( UBYTE dcs,
225 UBYTE* source,
226 UBYTE source_len,
227 UBYTE* dest,
228 UBYTE* dest_len );
229 EXTERN void cmhSMS_getStatCmh ( UBYTE inStat,
230 T_ACI_SMS_STAT* outStat );
231 EXTERN BOOL cmhSMS_getStatPsa ( T_ACI_SMS_STAT inStat,
232 UBYTE* outStat );
233 EXTERN CHAR* cmhSMS_setToaDef ( CHAR* number,
234 UBYTE* ntype,
235 UBYTE* nplan );
236 EXTERN SHORT cmhSMS_getTimezone ( UBYTE timezone );
237 EXTERN UBYTE cmhSMS_setTimezone ( SHORT timezone );
238 EXTERN void cmhSMS_setStorOcc ( T_ACI_SMS_STOR_OCC* outMem,
239 UBYTE inMem );
240 EXTERN SHORT cmhSMS_getNextEntry ( SHORT index,
241 T_ACI_SMS_STOR mem );
242 EXTERN UBYTE cmhSMS_getAlphabetPp ( UBYTE dcs );
243 EXTERN SHORT cmhSMS_InfoConfirm ( void );
244 EXTERN SHORT cmhSMS_CBMIndication ( T_MMI_CBCH_IND * mmi_cbch_ind );
245
246 EXTERN SHORT cmhSMS_SMSStatRpt ( T_MNSMS_STATUS_IND * mnsms_status_ind);
247 EXTERN SHORT cmhSMS_SMSMemory ( T_MNSMS_MESSAGE_IND * mnsms_message_ind);
248 EXTERN SHORT cmhSMS_SMSDeliver ( T_MNSMS_MESSAGE_IND * mnsms_message_ind );
249 EXTERN SHORT cmhSMS_Result ( T_MNSMS_REPORT_IND * mnsms_report_ind );
250 EXTERN SHORT cmhSMS_SMSInitState ( T_MNSMS_MESSAGE_IND * mnsms_message_ind );
251 EXTERN SHORT cmhSMS_SMSDelCnf ( T_MNSMS_DELETE_CNF * mnsms_delete_cnf );
252 EXTERN SHORT cmhSMS_SMRead ( T_MNSMS_READ_CNF * mnsms_read_cnf);
253 EXTERN SHORT cmhSMS_SMSStoCnf ( T_MNSMS_STORE_CNF * mnsms_store_cnf );
254 EXTERN SHORT cmhSMS_SMSSbmCnf ( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf );
255 EXTERN SHORT cmhSMS_SMSCmdCnf ( T_MNSMS_COMMAND_CNF * mnsms_command_cnf );
256 EXTERN SHORT cmhSMS_SMSErrorInd ( T_MNSMS_ERROR_IND * mnsms_error_ind );
257
258 #ifdef REL99
259 EXTERN SHORT cmhSMS_SMSSendProgInd ( T_MNSMS_SEND_PROG_IND * mnsms_send_prog_ind );
260 EXTERN SHORT cmhSMS_SMSRetransCnf ( T_MNSMS_RETRANS_CNF * mnsms_retrans_cnf );
261 #endif /* REL99 */
262
263 EXTERN void cmhSMS_SMSResumeCnf ( T_MNSMS_RESUME_CNF * mnsms_resume_cnf );
264 EXTERN void cmhSMS_SMSQueryCnf (T_MNSMS_QUERY_CNF * mnsms_query_cnf);
265
266 EXTERN void cmhSMS_WrCnfCSAS (SHORT aId);
267 EXTERN void cmhSMS_RdCnfCRES (SHORT aId);
268 EXTERN void cmhSMS_InitSMSP (SHORT aId);
269 EXTERN BOOL cmhSMS_checkSIM (void);
270 EXTERN BOOL cmhSMS_checkAccess (T_ACI_CMD_SRC srcId,
271 T_ACI_RETURN *ret);
272 EXTERN T_ACI_CMS_ERR cmhSMS_GetCmsFromSim ( USHORT errCode );
273 GLOBAL T_ACI_CMS_ERR cmhSMS_GetCmsFromSms ( USHORT errCode );
274 EXTERN void cmhSMS_ready ( void );
275 EXTERN SHORT cmhSMS_getPrfRge ( void );
276 EXTERN BOOL cmhSMS_GetPrmSIM (T_ACI_CMD_SRC srcId,
277 UBYTE *data,
278 int dataLen);
279 EXTERN BOOL cmhSMS_PutPrmSIM (T_ACI_CMD_SRC srcId,
280 UBYTE *data,
281 int maxDataLen);
282 EXTERN BOOL cmhSMS_GetCbmirSIM (T_ACI_CMD_SRC srcId,
283 UBYTE *data,
284 int dataLen);
285 EXTERN BOOL cmhSMS_PutCbmirSIM (T_ACI_CMD_SRC srcId,
286 UBYTE *data,
287 int maxDataLen);
288 EXTERN BOOL cmhSMS_GetCbmiSIM (T_ACI_CMD_SRC srcId,
289 UBYTE *data,
290 int dataLen);
291 EXTERN BOOL cmhSMS_PutCbmiSIM (T_ACI_CMD_SRC srcId,
292 UBYTE *data,
293 int maxDataLen);
294 #ifdef SIM_TOOLKIT
295 EXTERN BOOL cmhSMS_GetCbDtaDwnlSIM (T_ACI_CMD_SRC srcId,
296 UBYTE *data,
297 int dataLen);
298 #endif /* of SIM_TOOLKIT */
299
300
301 EXTERN UBYTE* cmhSMS_decodeMsg (T_sms_sdu *sms_sdu,
302 T_rp_addr* rp_addr,
303 UBYTE vt_mti);
304
305 EXTERN void cmhSMS_codeMsg (T_sms_sdu *sms_sdu,
306 UBYTE tp_vt_mti,
307 T_rp_addr* sc_addr,
308 UBYTE tp_mti,
309 UBYTE* decoded_pdu);
310
311 EXTERN BOOL cmhSMS_cpyDeliver (T_ACI_CMGL_SM * sm,
312 T_sms_sdu * sms_sdu);
313
314 EXTERN BOOL cmhSMS_cpySubmit (T_ACI_CMGL_SM * sm,
315 T_sms_sdu * sms_sdu);
316 /* Implements Measure # 110 */
317 EXTERN BOOL cmhSMS_cpyMsgIndReadCnf (T_ACI_CMGL_SM *sm,
318 UBYTE *status,
319 T_sms_sdu *sms_sdu,
320 UBYTE rec_num);
321 /* Implements measure 147,148, 149 */
322 EXTERN void cmhSMS_sendConfigureReq (BOOL v_cmms_val);
323 EXTERN BOOL cmhSMS_cpyStatInd (T_ACI_CDS_SM * sm,
324 T_MNSMS_STATUS_IND *mnsms_status_ind);
325
326 EXTERN void cmhSMS_getPhbEntry (UBYTE *buf,
327 T_ACI_PB_TEXT *alpha,
328 T_ACI_SMS_STAT status);
329
330 EXTERN void cmhSMS_codeDelRep (T_sms_sdu * sms_sdu,
331 T_rp_addr * sc_addr);
332
333 EXTERN UBYTE CodeRPAddress (UBYTE *buf,
334 UBYTE numDigits,
335 UBYTE ton,
336 UBYTE npi,
337 UBYTE *bcd);
338
339 EXTERN UBYTE CodeTPAddress (UBYTE *buf,
340 UBYTE numDigits,
341 UBYTE ton,
342 UBYTE npi,
343 UBYTE *bcd);
344
345 EXTERN UBYTE DecodeRPAddress (UBYTE *c_num,
346 UBYTE *ton,
347 UBYTE *npi,
348 UBYTE *bcd,
349 UBYTE *buf);
350
351 EXTERN UBYTE DecodeTPAddress (UBYTE *c_num,
352 UBYTE *ton,
353 UBYTE *npi,
354 UBYTE *bcd,
355 UBYTE *buf);
356
357 EXTERN void cmhSMS_fillTpSubmit(T_TP_SUBMIT* tp_submit,
358 T_ACI_CMD_SRC srcId,
359 UBYTE msgType,
360 UBYTE mr,
361 T_tp_da* da_addr,
362 T_ACI_SM_DATA* data,
363 UBYTE septets,
364 T_ACI_UDH_DATA* udh);
365
366 EXTERN void cmhSMS_fillTpDeliver(T_TP_DELIVER* tp_deliver,
367 T_ACI_CMD_SRC srcId,
368 UBYTE msgType,
369 T_tp_oa* oa_addr,
370 T_ACI_SM_DATA* data,
371 UBYTE septets,
372 T_ACI_UDH_DATA* udh );
373
374 EXTERN void cmhSMS_fillTpCommand(T_TP_COMMAND* tp_command,
375 UBYTE fo,
376 UBYTE ct,
377 UBYTE mr,
378 UBYTE pid,
379 UBYTE mn,
380 T_tp_da* da_addr,
381 T_ACI_CMD_DATA* data,
382 T_ACI_UDH_DATA* udh);
383
384 /* ACI-SPR-17004: RFU bits have to be ignored (GSM 11.11) */
385 EXTERN void cmhSMS_removeStatusRFUBits ( UBYTE* status );
386
387 EXTERN T_ACI_CPRSM_MOD cmhSMS_convertDeliverStatusToACI( UBYTE status );
388
389 #ifdef FF_CPHS
390 EXTERN BOOL cmhSMS_voice_mail_ind( T_sms_sdu *sms_sdu);
391 #endif /* FF_CPHS */
392
393 EXTERN void cmhSMS_resetMtDsCnmiParam(void);
394 EXTERN BOOL cmhSMS_storePduToSim( T_ACI_CMD_SRC srcId,
395 UBYTE stat,
396 T_ACI_SM_DATA *pdu );
397
398 EXTERN BOOL cmhSMS_SMSQueryType (T_sms_sdu *sms_sdu, UBYTE *msg_type);
399 EXTERN void cmhSMS_SendDelete_Req ( UBYTE index, UBYTE status );
400 #ifdef FF_CPHS_REL4
401 EXTERN BOOL cmhSMS_chk_SpclMsg( T_MNSMS_MESSAGE_IND *mnsms_message_ind );
402 #endif
403 #endif /* CMH_SMS_H */
404
405 /*==== EOF =======================================================*/