custom_imps_config.c
6.24 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
/*****************************************************************************
* 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) 2001
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* custom_imps_config.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* The file contains IMPS configuration default value.
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------*/
#ifdef __IMPS__
#include "kal_general_types.h"
#include "kal_public_api.h"
#include "fs_type.h"
#include "fs_func.h"
#include "stdio.h"
#include "custom_imps_config.h"
#include "mmi2imps_struct.h"
kal_uint8 imps_directory[10];
kal_uint8 imps_client_id[IMPS_MAX_URL_LEN]= {"http://www.mtk.com/impsapp"};
const imps_accepted_content_type_struct imps_content_type[] =
{
/*Note:Per SPEC,mime type must not be text/plain here*/
{"image/*", 204800/*must less than max_push_len*/, 0, 0},
{"audio/*", 204800, 0, 0},
{"video/*", 204800, 0, 0},
{"text/x-vcard", 2048, 0, 0},
{"text/x-vcalendar", 2048, 0, 0},
/*Don't remove this line! Add elements before it */
{"",0,0,0}
};
const imps_my_client_info_struct imps_pa_client_info =
{
KAL_FALSE,/*any_content*/
"eng",/*lang:Three-letter language code as specified in[ISO639-2].*/
512,/*accepted_text_len:must be less than 1024,because the max ctrl_buff size is 2K (utf8->UCS2)*/
307200,/*max_push_len*/
(imps_accepted_content_type_struct*)imps_content_type
};
static imps_version_option_struct imps_version_option[] =
{
/* if server support 1.3, then log in server with 1.3 namespace */
//{IMPS_CSP_VERSION_13, 0},
/* if server support 1.2, then log in server with 1.2 namespace */
{IMPS_CSP_VERSION_12, 0},
/* if server do not support 1.3 and 1.2 or VersionDiscovery primtive,
then use 1.1 name space to log in server. set @force to 1
*/
{IMPS_CSP_VERSION_11, 1},
/* end flag of version option */
{0, 0}
};
const imps_custom_client_capability_struct imps_client_capability =
{
307200,
0x06,//IMPS_SUPPORTED_BEARER_WSP|IMPS_SUPPORTED_BEARER_HTTP
307200,
0x0b,//IMPS_CIR_METHOD_WAPSMS|IMPS_CIR_METHOD_WAPUDP|IMPS_CIR_METHOD_STCP
IMPS_CLIENT_ID_TYPE_URL_RANDOM,//IMPS_CLIENT_ID_TYPE_URL_RANDOM
(kal_uint8*)imps_client_id,
(kal_uint8*)IMPS_DEFAULT_HEADER,
(kal_uint8*)IMPS_OBJECT_HEADER,
(imps_my_client_info_struct*)&imps_pa_client_info,
30*KAL_TICKS_1_SEC, /* 30s: default timeout period defined in WV CSP V1.2 */
#if defined(__OP11__)
7 * 60, /* puzzling Orange spec. order this */
#else
240, /* Default Time-To-Live value, count by second */
#endif
#ifdef IMPS_WV13_ENHANCEMENT
IMPS_DELIVERY_METHOD_PUSH,
IMPS_DIGEST_SCHEMA_MD5, /* IMPS_DIGEST_SCHEMA_MD5|IMPS_DIGEST_SCHEMA_SHA|IMPS_DIGEST_SCHEMA_ALL */
#endif
2, /* retry times in login */
imps_version_option,
5 /* bear fallback timer, second */
};
const imps_custom_client_capability_struct * imps_client_capability_p = &imps_client_capability;
void imps_custom_work_directory(void)
{
kal_int32 fd;
kal_wchar ucs2_folder[IMPS_MAX_FILE_PATH_LEN];
/*Create folders(@imps,@imps\image) in system drive*/
kal_wsprintf(ucs2_folder, "%s", "Z:\\@imps\\");
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
fd = FS_CreateDir(ucs2_folder);
}
else
{
FS_Close(fd);
}
/*image*/
kal_wsprintf(ucs2_folder,"%s%s","Z:\\@imps\\",IMPS_STATUS_CONTENT_FOLDER);
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
FS_CreateDir(ucs2_folder);
}
else
{
FS_Close(fd);
}
#ifdef IMPS_IN_LARGE_STORAGE
/*Create folders(imps) in user drive*/
sprintf((char*)imps_directory, "%c%s",IMPS_APP_DISK,":\\imps\\");
kal_wsprintf(ucs2_folder, "%s", imps_directory);
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
fd = FS_CreateDir(ucs2_folder);
FS_SetAttributes((unsigned short*)ucs2_folder,FS_ATTR_DIR|FS_ATTR_HIDDEN);
}
else
{
FS_Close(fd);
}
#else
strcpy((char*)imps_directory,"Z:\\@imps\\");
#endif
/*reply*/
kal_wsprintf(ucs2_folder, "%s%s", imps_directory, IMPS_HTTP_REPLY_FOLDER);
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
FS_CreateDir(ucs2_folder);
}
else
{
FS_Close(fd);
}
/*user*/
kal_wsprintf(ucs2_folder, "%s%s", imps_directory, IMPS_USER_CONTENT_FOLDER);
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
FS_CreateDir(ucs2_folder);
}
else
{
FS_Close(fd);
}
/*Received*/
kal_wsprintf(ucs2_folder, "%c:\\%w", IMPS_PUBLIC_DRV, IMPS_DEFAULT_FILE_PATH);
fd = FS_Open(ucs2_folder, FS_OPEN_DIR | FS_READ_ONLY);
if (fd < 0)
{
FS_CreateDir(ucs2_folder);
}
else
{
FS_Close(fd);
}
}
/*****************************************************************************
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*****************************************************************************/
void imps_custom_get_session_cookie(const char* user_id, char* session_cookie, int session_cookie_len)
{
kal_uint32 now = 0;
int j, i;
kal_get_time(&now);
j = sprintf(session_cookie, "MTK%d", now);
for (i = 0; user_id[i] && j < session_cookie_len - 1; i++, j++)
{
session_cookie[j] = user_id[i];
}
session_cookie[j] = 0;
}
#endif