custom_ems_context.h
11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
*
* Filename:
* ---------
* custom_ems_context.h
*
* Project:
* --------
* MAUI Project
*
* Description:
* ------------
* This file is used to define the EMS maximum segment number.
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifndef _CUSTOM_EMS_CONTEXT_H
#define _CUSTOM_EMS_CONTEXT_H
/*========================================================================
* CAUTION !! CAUTION !! CAUTION !! CAUTION !! CAUTION !! CAUTION !!
*
* Please DO NOT modify below setting.
*
* CAUTION !! CAUTION !! CAUTION !! CAUTION !! CAUTION !! CAUTION !!
*======================================================================= */
#include "ems.h"
#include "kal_general_types.h"
#include "kal_public_defs.h"
#if defined(PLUTO_MMI)
#define EMS_MAX_EMS_DATA (3)
#else
#if defined(__EMS_NON_STD_7BIT_CHAR__) || defined(__UNIFIED_MESSAGE_BACKGROUND_SEND_SUPPORT__)
#define EMS_MAX_EMS_DATA (3)
#else
#define EMS_MAX_EMS_DATA (2)
#endif
#endif
#if ( !defined(__L1_STANDALONE__) && !defined(__MAUI_BASIC__))
typedef kal_uint16 (*EMS_CONCAT_MSG_REF_FUNCTION)(void);
typedef kal_uint16 (*EMS_CONVERT_NON_STD_CHARS_CALLBACK)(kal_uint8, kal_uint8);
typedef kal_uint16 (*EMS_CONVERT_NL_TO_UCS2_CALLBACK)(EMSNationalLanguage lang,
kal_uint8 *input,
kal_uint8 *output,
kal_uint16 len,
kal_uint8 SegNum);
typedef kal_uint16 (*EMS_CONVERT_UCS2_TO_NL_CALLBACK)(EMSNationalLanguage lang,
kal_uint8 *input,
kal_uint8 *output,
kal_uint16 len,
kal_uint8 SegNum);
/*The following two pointer is for EMS Compression to alloc/free the temporary buffer.
So if the caller of EMSLib, in return the caller should supply EMS method to get temporary buffer */
typedef void *(*EMS_COMPRESS_MEM_ALLOC)(kal_uint32 mem_size);
typedef void (*EMS_COMPRESS_MEM_FREE)(void *mem_ptr);
/* Following are used for the IE which may cross segment, */
/* i.e. Compression or Extended Object. */
/* For MT case: */
/* If it occurs missed segment condition, all pending variables */
/* and buffer will be freed. The IE will be ignored. */
/* For MO case: */
/* The buffer is used as temp buffer of extended object before compression or packed. */
#ifndef __ULC_SLIM_EMS__
typedef struct
{
kal_bool BufType; /* Is there pending IE existed. */
kal_uint16 BufLen; /* MT: IE(buffer) length. Get from IE information. */
/* MO: total extend IE length in buffer */
kal_uint16 BufOffset; /* MT: existed data length in buffer */
/* MO: data length already packed */
kal_uint8 *BufPtr; /* Buffer for IE data */
}EMSPendingBuff;
typedef struct
{
kal_uint32 footer;
}EMSPduBuffFooter;
typedef struct EMSPduBuffMB_struct
{
struct EMSPduBuffMB_struct *next;
EMSObject *obj;
kal_uint16 buff_size;
kal_uint8 ref_count;
kal_uint8 padding;
}EMSPduBuffMB;
typedef struct
{
kal_uint16 pool_size; /* pool size */
kal_uint8 *pool_ptr; /* start of pool */
kal_uint8 *end_ptr; /* end ptr of block buffer */
kal_uint8 *free_ptr; /* start ptr of free buffer */
struct EMSPduBuffMB_struct *head; /* head of used buffer */
struct EMSPduBuffMB_struct *tail; /* tail of used buffer */
}EMSPduMemPool;
#endif
typedef struct
{
#ifndef __ULC_SLIM_EMS__
/* used when packing EMS data into TP-UD(s) */
kal_uint16 totalTxtFmtOctet; /* total text fmt object octet number */
kal_uint16 totalObjOctet; /* total object octet number, exclude extended object */
kal_uint16 totalExtObjOctet; /* total Extended Object octet number */
kal_uint8 numOfEMSObject;
kal_uint8 numOfExtObject;
#endif
kal_uint8 MaxLenPerSeg;/* 160 if dcs is GSM7-bit;
* 140 otherwise */
kal_uint8 MaxUsableLen;/* exclude concatenated ie */
kal_uint8 ConcatHdrLen;
kal_uint8 CurrentConcatMsgRef;
kal_uint16 baseTextOffset;
kal_uint16 textOffset;
kal_uint8 numSegment;
kal_uint8 SetEditSegment;
#ifndef __ULC_SLIM_EMS__
kal_uint8 NumFinishedObject;
kal_bool notFinishedObjectNeedProcessed;
void *notFinishedObject;
#endif
kal_uint8 **TPUD;
kal_uint8 *TPUDLen;
kal_uint8 *UDHL;
#ifdef __EMS_REL5__
kal_uint16 CompressIELen; /* The Compress IE length, include 3 byte header info. */
kal_bool needReCompress; /* Is there pending IE existed. */
kal_bool forceCompress; /* force to compress. */
/* used when unpacking EMS data from TP_UD */
kal_uint8 UnpackSegNum; /* Buffer for IE data */
kal_bool MissSegInCrossIE;/* does missing segment occur in cross segment IE. */
kal_uint8 ObjDistIndCount;
kal_uint8 ExtObjRefNum;
kal_bool isObjSwitched;
kal_uint8 RefNumOfSwitchObj;
EMSPendingBuff PBuff;
#endif
kal_uint8 error; /* ref to EMSTATUS */
} EMSInternalData;
typedef struct
{
EMSInternalData internalData[EMS_MAX_EMS_DATA]; /* internal Data */
#ifndef __ULC_SLIM_EMS__
EMSPduMemPool pdu_mem_pool[EMS_MAX_EMS_DATA];
kal_bool pdu_mem_footer;
#endif
kal_bool isInit; /* initialize or not */
#ifndef __ULC_SLIM_EMS__
kal_bool isCompressSupp; /* Support Compress or not */
#endif
kal_uint8 activeEMSDataID; /* store active EMS Data id */
kal_bool isEMSDataUsed[EMS_MAX_EMS_DATA]; /* record which EMS Data is used */
kal_uint8 max_seg_num;
kal_uint8 max_ems_data;
kal_uint16 concat_msg_ref;
#ifndef __ULC_SLIM_EMS__
kal_uint16 max_obj_num;
#endif
kal_uint8 *textBuffer[EMS_MAX_EMS_DATA]; /* text buffer */
kal_uint8 *oridcs[EMS_MAX_EMS_DATA]; /* oridcs buffer */
#ifndef __ULC_SLIM_EMS__
void *mem_pool_buff[EMS_MAX_EMS_DATA];
#endif
EMS_CONCAT_MSG_REF_FUNCTION concat_msg_ref_func;
EMS_CONVERT_NON_STD_CHARS_CALLBACK non_std_char_callback;
EMS_CONVERT_NL_TO_UCS2_CALLBACK convert_NL_to_UCS2;
EMS_CONVERT_UCS2_TO_NL_CALLBACK convert_UCS2_to_NL;
#ifdef __EMS_REL5__
EMS_COMPRESS_MEM_ALLOC ems_mem_alloc;
EMS_COMPRESS_MEM_FREE ems_mem_free;
#endif
#ifndef __ULC_SLIM_EMS__
#ifndef EMS_ON_WIN32
KAL_ADM_ID EMSPoolID[EMS_MAX_EMS_DATA];
#endif
#endif
} EMSContext;
extern EMSContext ems_cntx_g;
/* =========================================== */
extern kal_bool ems_is_support_non_std_char(void);
extern kal_uint8 ems_max_ems_data(void);
extern kal_uint8 ems_max_seg_num(void);
extern kal_uint16 ems_obj_buff_size_per_seg(void);
extern kal_uint8 *ems_get_miss_seg_str(kal_uint16 *str_len);
extern kal_uint8 *ems_get_text_buff_ptr(kal_uint8 ems_id);
extern kal_uint8 *ems_get_oridcs_buff_ptr(kal_uint8 ems_id);
extern kal_uint8 *ems_get_TPUDLen_ptr(kal_uint8 ems_id);
extern kal_uint8 *ems_get_UDHL_ptr(kal_uint8 ems_id);
/* EMS buffer pool */
/* !! VERY IMPORTANT: user pointer shall 4-byte alignment !! */
#ifndef __SLIM_EMS__
#ifdef __EMS_REL5__
extern void *ems_get_pdu_mem_pool_info(kal_uint8 ems_id, kal_uint16 *size);
#endif
extern void *ems_get_mem_pool_ptr(kal_uint8 ems_id);
#endif /* __SLIM_EMS__ */
#endif /* ( !defined(__L1_STANDALONE__) && !defined(__MAUI_BASIC__)) */
#endif /* _CUSTOM_EMS_CONTEXT_H */