comparison src/aci2/aci/cmh_sms.h @ 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_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 BOOL cmhSMS_getMemPsa ( T_ACI_SMS_STOR inMem,
207 UBYTE* outMem );
208 EXTERN void cmhSMS_getMemCmh ( UBYTE inMem,
209 T_ACI_SMS_STOR* outMem );
210 EXTERN void cmhSMS_expdSmsPp ( UBYTE byte_offset,
211 UBYTE dcs,
212 UBYTE* source,
213 UBYTE source_len,
214 UBYTE* dest,
215 UBYTE* dest_len );
216 EXTERN void cmhSMS_rdcSmsPp ( UBYTE byte_offset,
217 UBYTE dcs,
218 UBYTE* source,
219 UBYTE source_len,
220 UBYTE* dest,
221 UBYTE* dest_len );
222 EXTERN void cmhSMS_expdSmsCb ( UBYTE dcs,
223 UBYTE* source,
224 UBYTE source_len,
225 UBYTE* dest,
226 UBYTE* dest_len );
227 EXTERN void cmhSMS_getStatCmh ( UBYTE inStat,
228 T_ACI_SMS_STAT* outStat );
229 EXTERN BOOL cmhSMS_getStatPsa ( T_ACI_SMS_STAT inStat,
230 UBYTE* outStat );
231 EXTERN CHAR* cmhSMS_setToaDef ( CHAR* number,
232 UBYTE* ntype,
233 UBYTE* nplan );
234 EXTERN SHORT cmhSMS_getTimezone ( UBYTE timezone );
235 EXTERN UBYTE cmhSMS_setTimezone ( SHORT timezone );
236 EXTERN void cmhSMS_setStorOcc ( T_ACI_SMS_STOR_OCC* outMem,
237 UBYTE inMem );
238 EXTERN SHORT cmhSMS_getNextEntry ( SHORT index,
239 T_ACI_SMS_STOR mem );
240 EXTERN UBYTE cmhSMS_getAlphabetPp ( UBYTE dcs );
241 EXTERN UBYTE cmhSMS_getAlphabetCb ( UBYTE dcs );
242 EXTERN SHORT cmhSMS_InfoConfirm ( void );
243 EXTERN SHORT cmhSMS_CBMIndication ( T_MMI_CBCH_IND * mmi_cbch_ind );
244
245 EXTERN SHORT cmhSMS_SMSStatRpt ( T_MNSMS_STATUS_IND * mnsms_status_ind);
246 EXTERN SHORT cmhSMS_SMSMemory ( T_MNSMS_MESSAGE_IND * mnsms_message_ind);
247 EXTERN SHORT cmhSMS_SMSDeliver ( T_MNSMS_MESSAGE_IND * mnsms_message_ind );
248 EXTERN SHORT cmhSMS_Result ( T_MNSMS_REPORT_IND * mnsms_report_ind );
249 EXTERN SHORT cmhSMS_SMSInitState ( T_MNSMS_MESSAGE_IND * mnsms_message_ind );
250 EXTERN SHORT cmhSMS_SMSDelCnf ( T_MNSMS_DELETE_CNF * mnsms_delete_cnf );
251 EXTERN SHORT cmhSMS_SMRead ( T_MNSMS_READ_CNF * mnsms_read_cnf);
252 EXTERN SHORT cmhSMS_SMSStoCnf ( T_MNSMS_STORE_CNF * mnsms_store_cnf );
253 EXTERN SHORT cmhSMS_SMSSbmCnf ( T_MNSMS_SUBMIT_CNF * mnsms_submit_cnf );
254 EXTERN SHORT cmhSMS_SMSCmdCnf ( T_MNSMS_COMMAND_CNF * mnsms_command_cnf );
255 EXTERN SHORT cmhSMS_SMSErrorInd ( T_MNSMS_ERROR_IND * mnsms_error_ind );
256 EXTERN void cmhSMS_SMSResumeCnf ( T_MNSMS_RESUME_CNF * mnsms_resume_cnf );
257 EXTERN void cmhSMS_SMSQueryCnf (T_MNSMS_QUERY_CNF * mnsms_query_cnf);
258
259 EXTERN void cmhSMS_WrCnfCSAS (SHORT aId);
260 EXTERN void cmhSMS_RdCnfCRES (SHORT aId);
261 EXTERN void cmhSMS_InitSMSP (SHORT aId);
262 EXTERN BOOL cmhSMS_checkSIM (void);
263 EXTERN BOOL cmhSMS_checkAccess (T_ACI_CMD_SRC srcId,
264 T_ACI_RETURN *ret);
265 EXTERN T_ACI_CMS_ERR cmhSMS_GetCmsFromSim ( USHORT errCode );
266 GLOBAL T_ACI_CMS_ERR cmhSMS_GetCmsFromSms ( USHORT errCode );
267 EXTERN void cmhSMS_ready ( void );
268 EXTERN SHORT cmhSMS_getPrfRge ( void );
269 EXTERN BOOL cmhSMS_GetPrmSIM (T_ACI_CMD_SRC srcId,
270 UBYTE *data,
271 int dataLen);
272 EXTERN BOOL cmhSMS_PutPrmSIM (T_ACI_CMD_SRC srcId,
273 UBYTE *data,
274 int maxDataLen);
275 EXTERN BOOL cmhSMS_GetCbmirSIM (T_ACI_CMD_SRC srcId,
276 UBYTE *data,
277 int dataLen);
278 EXTERN BOOL cmhSMS_PutCbmirSIM (T_ACI_CMD_SRC srcId,
279 UBYTE *data,
280 int maxDataLen);
281 EXTERN BOOL cmhSMS_GetCbmiSIM (T_ACI_CMD_SRC srcId,
282 UBYTE *data,
283 int dataLen);
284 EXTERN BOOL cmhSMS_PutCbmiSIM (T_ACI_CMD_SRC srcId,
285 UBYTE *data,
286 int maxDataLen);
287 #ifdef SIM_TOOLKIT
288 EXTERN BOOL cmhSMS_GetCbDtaDwnlSIM (T_ACI_CMD_SRC srcId,
289 UBYTE *data,
290 int dataLen);
291 #endif /* of SIM_TOOLKIT */
292
293
294 EXTERN UBYTE* cmhSMS_decodeMsg (T_sms_sdu *sms_sdu,
295 T_rp_addr* rp_addr,
296 UBYTE vt_mti);
297
298 EXTERN void cmhSMS_codeMsg (T_sms_sdu *sms_sdu,
299 UBYTE tp_vt_mti,
300 T_rp_addr* sc_addr,
301 UBYTE tp_mti,
302 UBYTE* decoded_pdu);
303
304 EXTERN BOOL cmhSMS_cpyDeliver (T_ACI_CMGL_SM * sm,
305 T_sms_sdu * sms_sdu);
306
307 EXTERN BOOL cmhSMS_cpySubmit (T_ACI_CMGL_SM * sm,
308 T_sms_sdu * sms_sdu);
309
310 EXTERN BOOL cmhSMS_cpyMsgInd (T_ACI_CMGL_SM * sm,
311 T_MNSMS_MESSAGE_IND * mnsms_message_ind);
312
313 EXTERN BOOL cmhSMS_cpyReadCnf (T_ACI_CMGL_SM * sm,
314 T_MNSMS_READ_CNF * mnsms_read_cnf);
315
316 EXTERN BOOL cmhSMS_cpyStatInd (T_ACI_CDS_SM * sm,
317 T_MNSMS_STATUS_IND *mnsms_status_ind);
318
319 EXTERN void cmhSMS_getPhbEntry (UBYTE *buf,
320 T_ACI_PB_TEXT *alpha,
321 T_ACI_SMS_STAT status);
322
323 EXTERN void cmhSMS_codeDelRep (T_sms_sdu * sms_sdu,
324 T_rp_addr * sc_addr);
325
326 EXTERN UBYTE CodeRPAddress (UBYTE *buf,
327 UBYTE numDigits,
328 UBYTE ton,
329 UBYTE npi,
330 UBYTE *bcd);
331
332 EXTERN UBYTE CodeTPAddress (UBYTE *buf,
333 UBYTE numDigits,
334 UBYTE ton,
335 UBYTE npi,
336 UBYTE *bcd);
337
338 EXTERN UBYTE DecodeRPAddress (UBYTE *c_num,
339 UBYTE *ton,
340 UBYTE *npi,
341 UBYTE *bcd,
342 UBYTE *buf);
343
344 EXTERN UBYTE DecodeTPAddress (UBYTE *c_num,
345 UBYTE *ton,
346 UBYTE *npi,
347 UBYTE *bcd,
348 UBYTE *buf);
349
350 EXTERN void cmhSMS_fillTpSubmit(T_TP_SUBMIT* tp_submit,
351 T_ACI_CMD_SRC srcId,
352 UBYTE msgType,
353 UBYTE mr,
354 T_tp_da* da_addr,
355 T_ACI_SM_DATA* data,
356 UBYTE septets,
357 T_ACI_UDH_DATA* udh);
358
359 EXTERN void cmhSMS_fillTpDeliver(T_TP_DELIVER* tp_deliver,
360 T_ACI_CMD_SRC srcId,
361 UBYTE msgType,
362 T_tp_oa* oa_addr,
363 T_ACI_SM_DATA* data,
364 UBYTE septets,
365 T_ACI_UDH_DATA* udh );
366
367 EXTERN void cmhSMS_fillTpCommand(T_TP_COMMAND* tp_command,
368 UBYTE fo,
369 UBYTE ct,
370 UBYTE mr,
371 UBYTE pid,
372 UBYTE mn,
373 T_tp_da* da_addr,
374 T_ACI_CMD_DATA* data,
375 T_ACI_UDH_DATA* udh);
376
377 /* ACI-SPR-17004: RFU bits have to be ignored (GSM 11.11) */
378 EXTERN void cmhSMS_removeStatusRFUBits ( UBYTE* status );
379
380 EXTERN T_ACI_CPRSM_MOD cmhSMS_convertDeliverStatusToACI( UBYTE status );
381
382 #ifdef FF_CPHS
383 EXTERN BOOL cmhSMS_voice_mail_ind( T_sms_sdu *sms_sdu);
384 #endif /* FF_CPHS */
385
386 EXTERN void cmhSMS_resetMtDsCnmiParam(void);
387 EXTERN BOOL cmhSMS_storePduToSim( T_ACI_CMD_SRC srcId,
388 UBYTE stat,
389 T_ACI_SM_DATA *pdu );
390
391 EXTERN BOOL cmhSMS_SMSQueryType (T_sms_sdu *sms_sdu, UBYTE *msg_type);
392 EXTERN void cmhSMS_SendDelete_Req ( UBYTE index, UBYTE status );
393 #endif /* CMH_SMS_H */
394
395 /*==== EOF =======================================================*/