comparison g23m/condat/ms/src/aci/conc_sms.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
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 5
58
59
60 #define CONC_UDH_LEN 6
61
62 /*==== TYPES ======================================================*/
63
64 #define SET_CONC \
65 {concShrdPrm.isConcatenated = TRUE;}
66
67 #define UNSET_CONC \
68 {concShrdPrm.isConcatenated = FALSE;}
69
70 #define ISSET_CONC \
71 (concShrdPrm.isConcatenated EQ TRUE)
72
73
74 #ifdef _CONC_TESTING_
75 #define SET_OWNBUF_CONC \
76 if (concShrdPrm.isConcatenated) ownBuf = CMD_SRC_LCL;
77 #else
78 #define SET_OWNBUF_CONC
79 #endif
80
81
82 typedef enum /* for init functions */
83 {
84 CONC_ERROR = -1, /* concatenation error */
85 CONC_NOT_NEEDED, /* no concatenation needed */
86 CONC_NEEDED /* concatenation needed */
87 } T_CONC_INIT_RETURN;
88
89
90 typedef enum /* for collect function */
91 {
92 CONC_ERR_UNKN, /* concatenation error unknown */
93 CONC_ERR_BUF_FULL, /* buffer full */
94 CONC_CONTINUED, /* concatenation continued */
95 CONC_COMPLETED /* concatenation completed */
96 } T_CONC_ASSEMBLY_RETURN;
97
98
99 typedef enum
100 {
101 UNKNOWN = -1,
102 NORMAL,
103 CONCATE,
104 VOICEMAIL
105 } T_SMS_TYPE;
106
107
108 typedef struct /* data buffer for Assembly of Concat. SMS */
109 {
110 UBYTE in_use;
111 USHORT ref_num;
112 CHAR address[MAX_SMS_ADDR_DIG+1];
113 UBYTE next_exp_num;
114 UBYTE segs_left;
115 UBYTE seg_count;
116 T_SM_DATA_EXT data;
117 }
118 T_SM_ASSEMBLY;
119
120 typedef struct /* segment buffer for Concat. SMS */
121 {
122 UBYTE in_use;
123 USHORT ref_num;
124 CHAR address[MAX_SMS_ADDR_DIG+1];
125 T_ACI_LIST *list;
126 }
127 T_SEG_BUF;
128
129 typedef struct /* one segment buffer element for Concat. SMS */
130 {
131 UBYTE seq_num;
132 UBYTE rec_num;
133 UBYTE status; /* in CMH format */
134 T_SM_DATA_EXT data;
135 }
136 T_SEG_BUF_ELEM;
137
138 typedef struct /* concatenated buffer for Concat. SMS */
139 {
140 UBYTE in_use;
141 USHORT ref_num;
142 CHAR address[MAX_SMS_ADDR_DIG+1];
143 UBYTE max_num;
144 T_ACI_LIST *list;
145 }
146 T_CONC_BUF;
147
148 typedef struct /* one concatenated buffer element for Concat. SMS */
149 {
150 UBYTE seq_num;
151 UBYTE rec_num;
152 UBYTE status; /* in CMH format */
153 }
154 T_CONC_BUF_ELEM;
155
156
157 typedef struct
158 {
159 CHAR da[MAX_SMS_ADDR_DIG+1];
160 CHAR *p_da;
161 T_ACI_TOA toda;
162 T_ACI_TOA *p_toda;
163 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
164 UBYTE skipStoSent;
165 } T_CONC_CMSS;
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_SM_DATA_EXT data;
174 USHORT offset; /* byte offset in a conc. SM */
175 CHAR sca[MAX_SMS_ADDR_DIG+1];
176 CHAR *p_sca;
177 T_ACI_TOA tosca;
178 T_ACI_TOA *p_tosca;
179 SHORT isReply;
180 USHORT sent_bytes;
181 } T_CONC_CMGS;
182
183 typedef struct
184 {
185 UBYTE command_count;
186 UBYTE fo;
187 UBYTE ct;
188 UBYTE pid;
189 CHAR da[MAX_SMS_ADDR_DIG+1];
190 CHAR *p_da;
191 T_ACI_TOA toda;
192 T_ACI_TOA *p_toda;
193 T_SM_DATA_EXT data; /* user data */
194 } T_CONC_CMGC;
195
196 typedef struct
197 {
198 UBYTE rdMode;
199 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
200 } T_CONC_CMGR;
201
202 typedef struct
203 {
204 CHAR da[MAX_SMS_ADDR_DIG+1];
205 CHAR *p_da;
206 T_ACI_TOA toda;
207 T_ACI_TOA *p_toda;
208 UBYTE stat;
209 UBYTE msg_ref;
210 T_SM_DATA_EXT data; /* user data */
211 USHORT offset; /* byte offset in a conc. SM */
212 CHAR sca[MAX_SMS_ADDR_DIG+1];
213 CHAR *p_sca;
214 T_ACI_TOA tosca;
215 T_ACI_TOA *p_tosca;
216 SHORT isReply;
217 USHORT sent_bytes;
218 } T_CONC_CMGW;
219
220 typedef struct
221 {
222 USHORT ref_num; /* ref. number of the current conc. buffer */
223 CHAR *address;
224 UBYTE error_count;
225 T_ACI_LIST *currConcBufListElem; /* current element in concatenated buffer */
226 } T_CONC_CMGD;
227
228
229
230
231
232 typedef struct /* Shared Parameter for Concat. SMS */
233 {
234 UBYTE max_sms_len; /* max. length of one SM segment */
235 UBYTE srcId; /* current source ID */
236 UBYTE first_mr; /* message ref. of the first sent segment */
237 UBYTE sentSegs; /* number of successfully sent segments,for "+CMGC"*/
238 UBYTE isConcatenated;
239 UBYTE concTesting;
240 UBYTE l_uncomp8bit_data;
241 UBYTE l_uncomp7bit_data;
242 UBYTE l_uncomp8bit_data_conc;
243 UBYTE l_uncomp7bit_data_conc;
244
245 struct
246 {
247 UBYTE ref_num; /* conc. SM reference number */
248 UBYTE max_num; /* max. number of SMs in one conc. message */
249 UBYTE seq_num; /* sequence number of the current SM */
250 } udh;
251
252 struct
253 {
254 USHORT RefNum;
255 UBYTE MaxNum;
256 UBYTE SeqNum[CONC_MAX_SEGS];
257 UBYTE RecNum[CONC_MAX_SEGS];
258 BOOL Conc_Full;
259 UBYTE Numsegs;
260 } full;
261
262 union
263 {
264 T_CONC_CMSS concCMSS;
265 T_CONC_CMGS concCMGS;
266 T_CONC_CMGC concCMGC;
267 T_CONC_CMGR concCMGR;
268 T_CONC_CMGW concCMGW;
269 T_CONC_CMGD concCMGD;
270 } specPrm;
271 }
272 T_CONC_SHRD_PRM;
273
274
275
276 /****************************** FUNCTIONS ********************************/
277
278
279 /* Init Functions */
280
281 EXTERN T_CONC_INIT_RETURN concSMS_initSendFromMem ( T_ACI_CMD_SRC srcId,
282 UBYTE *index,
283 CHAR* da,
284 T_ACI_TOA* toda );
285
286 EXTERN T_CONC_INIT_RETURN concSMS_initReadFromMem ( T_ACI_CMD_SRC srcId,
287 UBYTE index,
288 T_ACI_SMS_READ rdMode );
289
290 EXTERN T_CONC_INIT_RETURN concSMS_initDeleteFromMem ( T_ACI_CMD_SRC srcId,
291 UBYTE index );
292
293 EXTERN T_CONC_INIT_RETURN concSMS_initSend ( T_ACI_SM_DATA* tar_data,
294 T_ACI_UDH_DATA* udh,
295 T_ACI_CMD_SRC srcId,
296 CHAR* da,
297 T_ACI_TOA* toda,
298 T_SM_DATA_EXT* src_data,
299 CHAR* sca,
300 T_ACI_TOA* tosca,
301 SHORT isReply,
302 UBYTE alphabet );
303
304 EXTERN T_CONC_INIT_RETURN concSMS_initStoreInMem ( T_ACI_SM_DATA* tar_data,
305 T_ACI_UDH_DATA* udh,
306 T_ACI_CMD_SRC srcId,
307 SHORT index,
308 CHAR* address,
309 T_ACI_TOA* toa,
310 T_ACI_SMS_STAT stat,
311 UBYTE msg_ref,
312 T_SM_DATA_EXT* src_data,
313 CHAR* sca,
314 T_ACI_TOA* tosca,
315 SHORT isReply,
316 UBYTE alphabet );
317
318 EXTERN T_CONC_INIT_RETURN concSMS_initCommand ( T_ACI_CMD_SRC srcId,
319 SHORT fo,
320 SHORT ct,
321 SHORT pid,
322 SHORT mn,
323 CHAR* da,
324 T_ACI_TOA* toda,
325 T_ACI_CMD_DATA* data );
326
327
328
329 /* Callback Functions */
330
331 EXTERN void rConcSMS_PlusCMSS (UBYTE mr, UBYTE numSeg);
332
333 EXTERN void rConcSMS_PlusCMGS (UBYTE mr, UBYTE numSeg);
334
335 EXTERN void rConcSMS_PlusCMGR (T_ACI_CMGL_SM* sm,
336 T_ACI_CMGR_CBM* cbm);
337
338 EXTERN void rConcSMS_PlusCMGW (UBYTE index, UBYTE numSeg);
339
340 EXTERN void rConcSMS_PlusCMGD ();
341
342 EXTERN void rConcSMS_PlusCMGC (UBYTE mr);
343
344 EXTERN void rConcSMS_PercentCMGMDU (void);
345
346 /* Error Callback Functions */
347
348 EXTERN void rConcSMS_PlusCMS_CMSS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
349 T_EXT_CMS_ERROR *conc_error);
350
351 EXTERN void rConcSMS_PlusCMS_CMGS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
352 T_EXT_CMS_ERROR *conc_error);
353
354 EXTERN void rConcSMS_PlusCMS_CMGW (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
355 T_EXT_CMS_ERROR *conc_error);
356
357 EXTERN void rConcSMS_PlusCMS_CMGD (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
358 T_EXT_CMS_ERROR *conc_error);
359
360
361
362 EXTERN void concSMS_Init();
363
364 EXTERN void concSMS_clearIncompleteMsg();
365
366 EXTERN void concSMS_delAllIncompleteMsg();
367
368 EXTERN void concSMS_AddtoconcBuff();
369
370 EXTERN T_SMS_TYPE SMS_getSMSType ( T_ACI_UDH_DATA* udh );
371
372 EXTERN UBYTE concSMS_GetFirstIndex ( USHORT msg_ref, CHAR* address );
373
374 EXTERN USHORT concSMS_GetMsgRef ( T_ACI_CMGL_SM *sm );
375
376 EXTERN T_CONC_ASSEMBLY_RETURN concSMS_Collect ( T_SM_DATA_EXT *data_conc,
377 T_ACI_CMGL_SM *sm,
378 UBYTE isStored );
379
380 EXTERN void rConcSMS_PercentCMGR (T_ACI_CMGL_SM* sm,
381 T_ACI_CMGR_CBM* cbm);
382
383
384
385
386 #ifdef CONC_SMS_C
387
388 GLOBAL T_CONC_SHRD_PRM concShrdPrm;
389 #else
390
391 EXTERN T_CONC_SHRD_PRM concShrdPrm;
392 #endif /* CONC_SMS_C */
393
394 EXTERN void concSMS_DeleteConcList();
395
396 #endif