comparison src/g23m-aci/aci/conc_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 : $Workfile::
4 | Modul : CONC_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 : SMS Concatenation Handler
18 +-----------------------------------------------------------------------------
19 */
20
21
22
23 #ifndef CONC_SMS_H
24 #define CONC_SMS_H
25
26 /* for target tests of Conc. SMS define _CONC_TESTING_ */
27 /*#ifndef _CONC_TESTING_
28 #define _CONC_TESTING_
29 #endif*/
30
31
32 /*==== CONSTANTS ==================================================*/
33
34 #define SMS_IEI_CONC_8BIT 0x00
35 #define SMS_IEI_CONC_16BIT 0x08
36
37
38 #define L_UNCOMP_8BIT_DATA 140
39 #define L_UNCOMP_7BIT_DATA 160
40 #define L_UNCOMP_8BIT_DATA_CONC 134
41 #define L_UNCOMP_7BIT_DATA_CONC 153
42
43 /* only for test purposes */
44 #define L_UNCOMP_8BIT_DATA_TST 14
45 #define L_UNCOMP_7BIT_DATA_TST 16
46 #define L_UNCOMP_8BIT_DATA_CONC_TST 13
47 #define L_UNCOMP_7BIT_DATA_CONC_TST 15
48
49 #define COMMAND_TYPE_DELETE 0x02
50
51 #define CONC_MAX_SEGS 10 /* maximum number of segment in one conc. SMS */
52
53 /* max number of conc. SMs in segment buffer and assembly buffer */
54 #define MAX_BUF_ELEMS 5
55
56 /* max number of conc. SMs in concatenation buf */
57 #define MAX_CONC_BUF_ELEMS 30
58
59
60 #define CONC_UDH_LEN 6
61
62 #define MAX_SEG_TOTAL 120
63
64 /* detection modes for SMS_getSMSType */
65 #define MODE1 1
66 #define MODE2 2
67 #define MODE3 3
68
69
70 /*==== TYPES ======================================================*/
71
72 #define SET_CONC \
73 {concShrdPrm.isConcatenated = TRUE;}
74
75 #define UNSET_CONC \
76 {concShrdPrm.isConcatenated = FALSE;}
77
78 #define ISSET_CONC \
79 (concShrdPrm.isConcatenated EQ TRUE)
80
81
82 #ifdef _CONC_TESTING_
83 #define SET_OWNBUF_CONC \
84 if (concShrdPrm.isConcatenated) ownBuf = CMD_SRC_LCL;
85 #else
86 #define SET_OWNBUF_CONC
87 #endif
88
89
90 typedef enum /* for init functions */
91 {
92 CONC_ERROR = -1, /* concatenation error */
93 CONC_NOT_NEEDED, /* no concatenation needed */
94 CONC_NEEDED /* concatenation needed */
95 } T_CONC_INIT_RETURN;
96
97
98 typedef enum /* for collect function */
99 {
100 CONC_ERR_UNKN, /* concatenation error unknown */
101 CONC_ERR_BUF_FULL, /* buffer full */
102 CONC_CONTINUED, /* concatenation continued */
103 CONC_COMPLETED /* concatenation completed */
104 } T_CONC_ASSEMBLY_RETURN;
105
106
107 typedef enum
108 {
109 UNKNOWN = -1,
110 NORMAL,
111 CONCATE,
112 VOICEMAIL,
113 NORMAL_IND_CSMS
114 } T_SMS_TYPE;
115
116
117 typedef struct /* data buffer for Assembly of Concat. SMS */
118 {
119 UBYTE in_use;
120 USHORT ref_num;
121 CHAR address[MAX_SMS_ADDR_DIG+1];
122 UBYTE next_exp_num;
123 UBYTE segs_left;
124 UBYTE seg_count;
125 T_SM_DATA_EXT data;
126 }
127 T_SM_ASSEMBLY;
128
129 typedef struct /* segment buffer for Concat. SMS */
130 {
131 UBYTE in_use;
132 USHORT ref_num;
133 CHAR address[MAX_SMS_ADDR_DIG+1];
134 T_ACI_LIST *list;
135 }
136 T_SEG_BUF;
137
138 typedef struct /* one segment buffer element for Concat. SMS */
139 {
140 UBYTE seq_num;
141 UBYTE rec_num;
142 UBYTE status; /* in CMH format */
143 T_SM_DATA_EXT data;
144 }
145 T_SEG_BUF_ELEM;
146
147 typedef struct /* concatenated buffer for Concat. SMS */
148 {
149 UBYTE in_use;
150 USHORT ref_num;
151 CHAR address[MAX_SMS_ADDR_DIG+1];
152 UBYTE max_num;
153 T_ACI_LIST *list;
154 }
155 T_CONC_BUF;
156
157 typedef struct /* one concatenated buffer element for Concat. SMS */
158 {
159 UBYTE seq_num;
160 UBYTE rec_num;
161 UBYTE status; /* in CMH format */
162 UBYTE mem;
163 }
164 T_CONC_BUF_ELEM;
165
166
167 typedef struct
168 {
169 CHAR da[MAX_SMS_ADDR_DIG+1];
170 CHAR *p_da;
171 T_ACI_TOA toda;
172 T_ACI_TOA *p_toda;
173 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
174 UBYTE skipStoSent;
175 } T_CONC_CMSS;
176
177 typedef struct
178 {
179 CHAR da[MAX_SMS_ADDR_DIG+1];
180 CHAR *p_da;
181 T_ACI_TOA toda;
182 T_ACI_TOA *p_toda;
183 T_SM_DATA_EXT data;
184 USHORT offset; /* byte offset in a conc. SM */
185 CHAR sca[MAX_SMS_ADDR_DIG+1];
186 CHAR *p_sca;
187 T_ACI_TOA tosca;
188 T_ACI_TOA *p_tosca;
189 SHORT isReply;
190 USHORT sent_bytes;
191 } T_CONC_CMGS;
192
193 typedef struct
194 {
195 UBYTE command_count;
196 UBYTE fo;
197 UBYTE ct;
198 UBYTE pid;
199 CHAR da[MAX_SMS_ADDR_DIG+1];
200 CHAR *p_da;
201 T_ACI_TOA toda;
202 T_ACI_TOA *p_toda;
203 T_SM_DATA_EXT data; /* user data */
204 } T_CONC_CMGC;
205
206 typedef struct
207 {
208 UBYTE rdMode;
209 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
210 } T_CONC_CMGR;
211
212 typedef struct
213 {
214 CHAR da[MAX_SMS_ADDR_DIG+1];
215 CHAR *p_da;
216 T_ACI_TOA toda;
217 T_ACI_TOA *p_toda;
218 UBYTE stat;
219 UBYTE msg_ref;
220 T_SM_DATA_EXT data; /* user data */
221 USHORT offset; /* byte offset in a conc. SM */
222 CHAR sca[MAX_SMS_ADDR_DIG+1];
223 CHAR *p_sca;
224 T_ACI_TOA tosca;
225 T_ACI_TOA *p_tosca;
226 SHORT isReply;
227 USHORT sent_bytes;
228 } T_CONC_CMGW;
229
230 typedef struct
231 {
232 USHORT ref_num; /* ref. number of the current conc. buffer */
233 CHAR *address;
234 UBYTE error_count;
235 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
236 } T_CONC_CMGD;
237
238
239
240
241
242 typedef struct /* Shared Parameter for Concat. SMS */
243 {
244 UBYTE max_sms_len; /* max. length of one SM segment */
245 UBYTE srcId; /* current source ID */
246 UBYTE first_mr; /* message ref. of the first sent segment */
247 UBYTE sentSegs; /* number of successfully sent segments,for "+CMGC"*/
248 UBYTE isConcatenated;
249 UBYTE concTesting;
250 UBYTE l_uncomp8bit_data;
251 UBYTE l_uncomp7bit_data;
252 UBYTE l_uncomp8bit_data_conc;
253 UBYTE l_uncomp7bit_data_conc;
254 UBYTE mem_store;
255 UBYTE elem_count; /* total number of CSMS segments */
256
257 struct
258 {
259 UBYTE ref_num; /* conc. SM reference number */
260 UBYTE max_num; /* max. number of SMs in one conc. message */
261 UBYTE seq_num; /* sequence number of the current SM */
262 } udh;
263
264 struct
265 {
266 USHORT RefNum;
267 UBYTE MaxNum;
268 UBYTE SeqNum[CONC_MAX_SEGS];
269 UBYTE RecNum[CONC_MAX_SEGS];
270 UBYTE MemType[CONC_MAX_SEGS];
271 BOOL Conc_Full;
272 UBYTE Numsegs;
273 } full;
274
275 union
276 {
277 T_CONC_CMSS concCMSS;
278 T_CONC_CMGS concCMGS;
279 T_CONC_CMGC concCMGC;
280 T_CONC_CMGR concCMGR;
281 T_CONC_CMGW concCMGW;
282 T_CONC_CMGD concCMGD;
283 } specPrm;
284 }
285 T_CONC_SHRD_PRM;
286
287
288 #ifdef TI_PS_FF_CONC_SMS
289 /****************************** FUNCTIONS ********************************/
290
291
292 /* Init Functions */
293
294 EXTERN T_CONC_INIT_RETURN concSMS_initSendFromMem ( T_ACI_CMD_SRC srcId,
295 UBYTE *index,
296 CHAR* da,
297 T_ACI_TOA* toda );
298
299 EXTERN T_CONC_INIT_RETURN concSMS_initReadFromMem ( T_ACI_CMD_SRC srcId,
300 UBYTE index,
301 T_ACI_SMS_READ rdMode );
302
303 EXTERN T_CONC_INIT_RETURN concSMS_initDeleteFromMem ( T_ACI_CMD_SRC srcId,
304 UBYTE index );
305
306 EXTERN T_CONC_INIT_RETURN concSMS_initSend ( T_ACI_SM_DATA* tar_data,
307 T_ACI_UDH_DATA* udh,
308 T_ACI_CMD_SRC srcId,
309 CHAR* da,
310 T_ACI_TOA* toda,
311 T_SM_DATA_EXT* src_data,
312 CHAR* sca,
313 T_ACI_TOA* tosca,
314 SHORT isReply,
315 UBYTE alphabet );
316
317 EXTERN T_CONC_INIT_RETURN concSMS_initStoreInMem ( T_ACI_SM_DATA* tar_data,
318 T_ACI_UDH_DATA* udh,
319 T_ACI_CMD_SRC srcId,
320 SHORT index,
321 CHAR* address,
322 T_ACI_TOA* toa,
323 T_ACI_SMS_STAT stat,
324 UBYTE msg_ref,
325 T_SM_DATA_EXT* src_data,
326 CHAR* sca,
327 T_ACI_TOA* tosca,
328 SHORT isReply,
329 UBYTE alphabet );
330
331 EXTERN T_CONC_INIT_RETURN concSMS_initCommand ( T_ACI_CMD_SRC srcId,
332 SHORT fo,
333 SHORT ct,
334 SHORT pid,
335 SHORT mn,
336 CHAR* da,
337 T_ACI_TOA* toda,
338 T_ACI_CMD_DATA* data );
339
340
341
342 /* Callback Functions */
343
344 EXTERN void rConcSMS_PlusCMSS (UBYTE mr, UBYTE numSeg);
345
346 EXTERN void rConcSMS_PlusCMGS (UBYTE mr, UBYTE numSeg);
347
348 EXTERN void rConcSMS_PlusCMGR (T_ACI_CMGL_SM* sm,
349 T_ACI_CMGR_CBM* cbm);
350
351 EXTERN void rConcSMS_PlusCMGW (UBYTE index, UBYTE numSeg, UBYTE mem);
352
353 EXTERN void rConcSMS_PlusCMGD ();
354
355 EXTERN void rConcSMS_PlusCMGC (UBYTE mr);
356
357 EXTERN void rConcSMS_PercentCMGMDU (void);
358
359 /* Error Callback Functions */
360
361 EXTERN void rConcSMS_PlusCMS_CMSS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
362 T_EXT_CMS_ERROR *conc_error);
363
364 EXTERN void rConcSMS_PlusCMS_CMGS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
365 T_EXT_CMS_ERROR *conc_error);
366
367 EXTERN void rConcSMS_PlusCMS_CMGW (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
368 T_EXT_CMS_ERROR *conc_error);
369
370 EXTERN void rConcSMS_PlusCMS_CMGD (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
371 T_EXT_CMS_ERROR *conc_error);
372 #endif /* TI_PS_FF_CONC_SMS */
373
374
375 EXTERN void concSMS_Init();
376
377 EXTERN void concSMS_clearIncompleteMsg();
378
379 EXTERN void concSMS_delAllIncompleteMsg();
380
381 EXTERN void concSMS_AddtoconcBuff();
382
383 EXTERN T_SMS_TYPE SMS_getSMSType ( T_ACI_UDH_DATA* udh, char *address, UBYTE detMode);
384
385 EXTERN UBYTE concSMS_GetFirstIndex ( USHORT msg_ref, CHAR* address );
386
387 /* provide mem_type as well */
388 EXTERN T_CONC_BUF_ELEM *concSMS_GetFirstIndex_ext ( USHORT msg_ref, CHAR* address );
389
390 EXTERN USHORT concSMS_GetMsgRef ( T_ACI_CMGL_SM *sm );
391
392 EXTERN T_CONC_ASSEMBLY_RETURN concSMS_Collect ( T_SM_DATA_EXT *data_conc,
393 T_ACI_CMGL_SM *sm,
394 UBYTE isStored,
395 T_ACI_SMS_STOR mem );
396
397 #ifdef TI_PS_FF_CONC_SMS
398 EXTERN void rConcSMS_PercentCMGR (T_ACI_CMGL_SM* sm,
399 T_ACI_CMGR_CBM* cbm);
400 #endif /* TI_PS_FF_CONC_SMS */
401
402
403
404 #ifdef CONC_SMS_C
405
406 GLOBAL T_CONC_SHRD_PRM concShrdPrm;
407 #else
408
409 EXTERN T_CONC_SHRD_PRM concShrdPrm;
410 #endif /* CONC_SMS_C */
411
412 EXTERN void concSMS_DeleteConcList();
413 EXTERN BOOL concSMS_concBufferAvail();
414
415 #endif