blob: 44455c1d90b9ac8d1c3ecd6980e001a73a92f19d [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include "message.h"
2#include "zte_web_rest.h"
3#include "zte_web_pbm.h"
4#include "zte_web_sms.h"
5//#include "SMS_main.h"
6
7
8/*lint -e123*/
9int websXMLPostHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, char_t *url, char_t *path, char_t *query)
10{
11 //int result = 0;
12 //char_t *cmd = NULL;
13 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:START!"); /*lint !e26*/
14 if (NULL == wp ) {
15 slog(MISC_PRINT, SLOG_ERR, "wp is null!"); /*lint !e26*/
16 return 1;
17 }
18 if (NULL == urlPrefix || NULL == webDir || NULL == url || NULL == path || NULL == query) {
19 slog(MISC_PRINT, SLOG_ERR, "In put is null!"); /*lint !e26*/
20 websError(wp, 200, T("websXMLPostHandler:input is NULL"));
21 return 1;
22 }
23 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:middle!"); /*lint !e26*/
24
25#if 0
26 cmd = websGetVar(wp, T("action_process"), T(""));
27 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->action_process:[%s]", cmd); /*lint !e26*/
28 cmd = websGetVar(wp, T("goformId"), T(""));
29 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->goformid:[%s]", cmd); /*lint !e26*/
30 cmd = websGetVar(wp, T("cmd"), T(""));
31 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->cmd:[%s]", cmd); /*lint !e26*/
32
33 cmd = websGetVar(wp, T("xml_tag"), T(""));
34 slog(MISC_PRINT, SLOG_DEBUG, "[websXMLPostHandler]:websGetVar->setdata:[%s]", cmd); /*lint !e26*/
35 websWrite(wp, T("liuyingnan:xml_tag:%s\n"), cmd);
36#endif
37
38 zte_xml_switch_handler(wp);
39 return 0;
40}
41
42
43void zte_xml_switch_handler(webs_t wp)
44{
45 char_t *action = NULL;
46 char_t *zte_goform_id = NULL;
47
xf.libdd93d52023-05-12 07:10:14 -070048 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler>>wp->path]:%s\n", wp->query); /*lint !e26 !e1013*/
lh9ed821d2023-04-07 01:36:19 -070049 zte_goform_id = websGetVar(wp, T("goformId"), T(""));
50 action = websGetVar(wp, T("action_process"), T(""));
xf.libdd93d52023-05-12 07:10:14 -070051 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler>>test websGetVar]:%s\n", zte_goform_id); /*lint !e26*/
52 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler>>action]:%s\n", action); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070053 if (0 == strcmp(action, "get")) {
54
55 zte_goform_get_cmd_process(wp,T(""),T("")); /*lint !e1013*/
xf.libdd93d52023-05-12 07:10:14 -070056 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler]:get action end\n"); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070057 return;
58 } else if (0 == strcmp(action, "set")) {
59 zte_goform_set_cmd_process(wp,T(""),T(""));/*lint !e1013*/
xf.libdd93d52023-05-12 07:10:14 -070060 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler]:set action end\n"); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070061 return;
62 } else {
xf.libdd93d52023-05-12 07:10:14 -070063 slog(MISC_PRINT, SLOG_DEBUG, "[xml_switch_handler]:Can not find action\n"); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070064 return;
65 }
66
67}
68#if 0 //for kw
69void zte_change_wp_query(webs_t wp, char_t *xml_str)
70{
71 //char goformId[50] = {0};
72 //char getData[500] = {0};
73 //char setData[500] = {0};
74 //char action[20] = {0};
75 ezxml_root_t root = NULL;
76 ezxml_t xml = NULL;
77 ezxml_t action_tag = NULL;
78
79 root = (ezxml_root_t)ezxml_parse_str(xml_str, strlen(xml_str));
80 xml = & (root->xml);
81 if(xml == NULL)
82 return;
xf.libdd93d52023-05-12 07:10:14 -070083 //slog(MISC_PRINT,SLOG_DEBUG,"[change_wp_query_new]:xml->name:%s",xml->name);/*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070084 action_tag = xml->child;
85
86 if (! action_tag) {
xf.libdd93d52023-05-12 07:10:14 -070087 slog(MISC_PRINT, SLOG_DEBUG, "[change_wp_query_new]:action_tag is NULL or the xml_str is not full!"); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070088 //zte_write_result_to_web(wp,"action_tag is NULL!");
89 return;
90 } else {
91 while (action_tag) {
xf.libdd93d52023-05-12 07:10:14 -070092 slog(MISC_PRINT, SLOG_DEBUG, "[change_wp_query_new]:name:%s", action_tag->name); /*lint !e26*/
93 slog(MISC_PRINT, SLOG_DEBUG, "[change_wp_query_new]:text:%s", action_tag->txt); /*lint !e26*/
lh9ed821d2023-04-07 01:36:19 -070094 websSetVar(wp, action_tag->name, action_tag->txt);
95 action_tag = action_tag->sibling;
96 }
97
98 }
99
100 return;
101}
102#endif
103
104void zte_rest_result_write(webs_t wp, char_t *result)
105{
106 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
107 websWrite(wp, T("<data>\n"));
108 websWrite(wp, T("<result>%s</result>\n"), result);
109 websWrite(wp, T("</data>\n"));
110 websWrite(wp, T("\n"));
111}
112
113void zte_rest_cmd_write(webs_t wp, char_t *name, char_t *value, int r_flag)
114{
115 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
116 websWrite(wp, T("<%s>%s</%s>\n"), name, value, name);
117 } else {
118 if (r_flag == 1) {
119 websWrite(wp, T("\"%s\":\"%s\","), name, value);
120 } else {
121 websWrite(wp, T("\"%s\":\"%s\""), name, value);
122 }
123 }
124}
125
126void zte_rest_cmd_write_int(webs_t wp, char_t *name, int value, int r_flag)
127{
128 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
129 websWrite(wp, T("<%s>%d</%s>\n"), name, value, name);
130 } else {
131 if (r_flag == 1) {
132 websWrite(wp, T("\"%s\":\"%d\","), name, value);
133 } else {
134 websWrite(wp, T("\"%s\":\"%d\""), name, value);
135 }
136 }
137}
138
139void zte_rest_cmd_write_head(webs_t wp)
140{
141 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
142 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
143 websWrite(wp, T("<data>\n"));
144 } else {
145 websWrite(wp, T("{"));
146 }
147}
148
149void zte_rest_cmd_write_foot(webs_t wp)
150{
151 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
152 websWrite(wp, T("</data>\n"));
153 } else {
154 websWrite(wp, T("}"));
155 }
156}
157
158void zte_rest_get_pbm_data_head(webs_t wp)
159{
160 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
161 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
162 websWrite(wp, T("<data>\n"));
163 } else {
164 (void)websWrite(wp, T("{\"%s\":["), PBM_DATA);
165 }
166}
167
168void zte_rest_get_pbm_data_foot(webs_t wp)
169{
170 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
171 websWrite(wp, T("</data>\n"));
172 } else {
173 (void)websWrite(wp, T("]}"));
174 }
175}
176
177
178void zte_rest_get_pbm_data_sim_start(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index)
179{
180 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
181 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
182 websWrite(wp, T("<data>\n"));
183 websWrite(wp, T("<%s>\n"), PBM_DATA);
184 websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
185 websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
186 websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
187 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
188 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
189 websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
190 websWrite(wp, T("</%s>\n"), PBM_DATA);
191 } else {
192 (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\"}"), \
193 PBM_DATA, PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
194 PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
195 PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
196 PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
197 PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
198 PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type);
199 }
200}
201
202void zte_rest_get_pbm_data_sim(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag)
203{
204 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
205 websWrite(wp, T("<%s>\n"), PBM_DATA);
206 websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
207 websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
208 websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
209 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
210 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
211 websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
212 websWrite(wp, T("</%s>\n"), PBM_DATA);
213 } else {
214 if (tag == 1) {
215 websWrite(wp, T(","));
216 }
217 (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\"}"), \
218 PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
219 PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
220 PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
221 PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
222 PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
223 PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type);
224 }
225
226}
227
228
229
230
231void zte_rest_get_pbm_data_other_start(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index)
232{
233 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
234 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
235 websWrite(wp, T("<data>\n"));
236 websWrite(wp, T("<%s>\n"), PBM_DATA);
237 websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
238 websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
239 websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
240 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
241 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
242 websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
243 websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, PBM_ANR);
244 websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, PBM_ANR1);
245 websWrite(wp, T("<%s>%s</%s>\n"), PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, PBM_EMAIL);
246 websWrite(wp, T("<%s>%s</%s>\n"), PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, PBM_SNE);
247 websWrite(wp, T("<%s>%s</%s>\n"), PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group, PBM_GROUP);
248 websWrite(wp, T("</%s>\n"), PBM_DATA);
249 } else {
250 (void)websWrite(wp, T("{\"%s\":[{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\""\
251 ",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\"}"), \
252 PBM_DATA, PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
253 PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
254 PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
255 PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
256 PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
257 PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, \
258 PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, \
259 PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, \
260 PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, \
261 PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, \
262 PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group);
263 }
264}
265
266
267void zte_rest_get_pbm_data_other(webs_t wp, zte_pbm_query_resp_s_type *p_pbm_query_result, int index, int tag)
268{
269 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
270 websWrite(wp, T("<%s>\n"), PBM_DATA);
271 websWrite(wp, T("<%s>%d</%s>\n"), PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, PBM_ID);
272 websWrite(wp, T("<%s>%d</%s>\n"), PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, PBM_INDEX);
273 websWrite(wp, T("<%s>%d</%s>\n"), PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, PBM_LOCATION);
274 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, PBM_NAME);
275 websWrite(wp, T("<%s>%s</%s>\n"), PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, PBM_NUMBER);
276 websWrite(wp, T("<%s>%d</%s>\n"), PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, PBM_TYPE);
277 websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, PBM_ANR);
278 websWrite(wp, T("<%s>%s</%s>\n"), PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, PBM_ANR1);
279 websWrite(wp, T("<%s>%s</%s>\n"), PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, PBM_EMAIL);
280 websWrite(wp, T("<%s>%s</%s>\n"), PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, PBM_SNE);
281 websWrite(wp, T("<%s>%s</%s>\n"), PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group, PBM_GROUP);
282 websWrite(wp, T("</%s>\n"), PBM_DATA);
283 } else {
284 if (tag == 1) {
285 websWrite(wp, T(","));
286 }
287 (void)websWrite(wp, T("{\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%d\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%d\""\
288 ",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\"}"), \
289 PBM_ID, (*p_pbm_query_result).data[index].zte_pbm_id, \
290 PBM_INDEX, (*p_pbm_query_result).data[index].zte_pbm_index, \
291 PBM_LOCATION, (*p_pbm_query_result).data[index].zte_pbm_location, \
292 PBM_NAME, (*p_pbm_query_result).data[index].zte_pbm_name, \
293 PBM_NUMBER, (*p_pbm_query_result).data[index].zte_pbm_number, \
294 PBM_TYPE, (*p_pbm_query_result).data[index].zte_pbm_type, \
295 PBM_ANR, (*p_pbm_query_result).data[index].zte_pbm_anr, \
296 PBM_ANR1, (*p_pbm_query_result).data[index].zte_pbm_anr1, \
297 PBM_EMAIL, (*p_pbm_query_result).data[index].zte_pbm_email, \
298 PBM_SNE, (*p_pbm_query_result).data[index].zte_pbm_sne, \
299 PBM_GROUP, (*p_pbm_query_result).data[index].zte_pbm_group);
300 }
301}
302
303void zte_rest_get_sms_data_head(webs_t wp)
304{
305 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
306 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
307 websWrite(wp, T("<data>\n"));
308 } else {
309 (void)websWrite(wp, T("{\"%s\":["), SMS_MESSAGES);
310 }
311}
312
313void zte_rest_get_sms_data_foot(webs_t wp)
314{
315 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
316 websWrite(wp, T("</data>\n"));
317 } else {
318 (void)websWrite(wp, T("]}"));
319 }
320}
321
322void zte_rest_get_bro_data_head(webs_t wp)
323{
324 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
325 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
326 websWrite(wp, T("<data>\n"));
327 } else {
328 (void)websWrite(wp, T("{\"%s\":"), SMS_MESSAGES);
329 }
330}
331void zte_rest_get_bro_data_foot(webs_t wp)
332{
333 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
334 websWrite(wp, T("</data>\n"));
335 } else {
336 (void)websWrite(wp, T("}"));
337 }
338}
339
340
341void zte_rest_get_sms_data(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag)
342{
343 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
xf.libdd93d52023-05-12 07:10:14 -0700344 slog(MISC_PRINT, SLOG_DEBUG, "rest_get_sms_data WEBS_XML_CLIENT_REQUEST");
lh9ed821d2023-04-07 01:36:19 -0700345 char *tmp_num = NULL;
346 char pbm_name[100] = {0};
347 int len = 0;
348 len = strlen(p_sms_query_result->data[i].number);
349 slog(MISC_PRINT, SLOG_DEBUG, "len=%d", len);
350 slog(MISC_PRINT, SLOG_DEBUG, "p_sms_query_result->data[i].number=%s", p_sms_query_result->data[i].number);
351 if (len > NUMBER_SIZE) {
352 tmp_num = p_sms_query_result->data[i].number + (len - NUMBER_SIZE);
353 } else {
354 tmp_num = p_sms_query_result->data[i].number;
355 }
356 slog(MISC_PRINT, SLOG_DEBUG, "tmp_num=%s", tmp_num);
357 memset(pbm_name, 0, sizeof(pbm_name));
358 zte_libpbm_get_name_by_number(tmp_num, pbm_name);
359 slog(MISC_PRINT, SLOG_DEBUG, "pbm_name=%s", pbm_name);
360 websWrite(wp, T("<%s>\n"), SMS_MESSAGES);
361 websWrite(wp, T("<%s>%s</%s>\n"), SMS_ID, (*p_sms_query_result).data[i].id, SMS_ID);
362 websWrite(wp, T("<%s>%s</%s>\n"), SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_NUMBER);
363 websWrite(wp, T("<%s>%s</%s>\n"), SMS_NAME, pbm_name, SMS_NAME);
364 websWrite(wp, T("<%s>%s</%s>\n"), SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, SMS_CONTENT);
365 websWrite(wp, T("<%s>%s</%s>\n"), SMS_TAG, (*p_sms_query_result).data[i].tag, SMS_TAG);
366 websWrite(wp, T("<%s>%s,%s,%s,%s,%s,%s,%s</%s>\n"), SMS_DATE, (*p_sms_query_result).data[i].date.year, \
367 (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
368 (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
369 (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, SMS_DATE);
370 websWrite(wp, T("<%s>%s</%s>\n"), SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id, SMS_DRAFT_GROUP_ID);
371 websWrite(wp, T("</%s>\n"), SMS_MESSAGES);
372 } else {
373 if (tag == 1) {
374 websWrite(wp, T(","));
375 }
376 (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\",\"%s\":\"%s\"}"), \
377 SMS_ID, (*p_sms_query_result).data[i].id, \
378 SMS_NUMBER, (*p_sms_query_result).data[i].number, \
379 SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
380 SMS_TAG, (*p_sms_query_result).data[i].tag, \
381 SMS_DATE, (*p_sms_query_result).data[i].date.year, \
382 (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
383 (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
384 (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, \
385 SMS_DRAFT_GROUP_ID, (*p_sms_query_result).data[i].draft_group_id);
386 }
387
388}
389
390void zte_rest_sms_parameter(webs_t wp, zte_wms_parameter_info_s_type sms_parameter_info)
391{
392 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
393 websWrite(wp, T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"));
394 websWrite(wp, T("<data>\n"));
395 websWrite(wp, T("<%s>%s</%s>\n"), SMS_PARAMETER_SCA, sms_parameter_info.sca, SMS_PARAMETER_SCA);
396 websWrite(wp, T("<%s>%d</%s>\n"), SMS_PARAMETER_MEM_STORE, sms_parameter_info.mem_store, SMS_PARAMETER_MEM_STORE);
397 websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_VALIDITY_PERIOD, sms_parameter_info.tp_validity_period, SMS_PARAMETER_VALIDITY_PERIOD);
398 websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_STATUS_REPORT, sms_parameter_info.status_report_on, SMS_PARAMETER_STATUS_REPORT);
399 websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_SEND_RETRY, sms_parameter_info.sendfail_retry_on, SMS_PARAMETER_SEND_RETRY);
400 websWrite(wp, T("<%s>%u</%s>\n"), SMS_PARAMETER_OUTDATE_DELETE, sms_parameter_info.outdate_delete_on, SMS_PARAMETER_OUTDATE_DELETE);
401 websWrite(wp, T("<%s>%s</%s>\n"), SMS_PARAMETER_DEFAULT_STORE, sms_parameter_info.default_store, SMS_PARAMETER_DEFAULT_STORE);
402 websWrite(wp, T("</data>\n"));
403 } else {
404 (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%d\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%u\",\"%s\":\"%s\"}"), \
405 SMS_PARAMETER_SCA, sms_parameter_info.sca, \
406 SMS_PARAMETER_MEM_STORE, sms_parameter_info.mem_store, \
407 SMS_PARAMETER_VALIDITY_PERIOD, sms_parameter_info.tp_validity_period, \
408 SMS_PARAMETER_STATUS_REPORT, sms_parameter_info.status_report_on, \
409 SMS_PARAMETER_SEND_RETRY, sms_parameter_info.sendfail_retry_on, \
410 SMS_PARAMETER_OUTDATE_DELETE, sms_parameter_info.outdate_delete_on, \
411 SMS_PARAMETER_DEFAULT_STORE, sms_parameter_info.default_store);
412 }
413}
414
415void zte_rest_sms_status_rpt(webs_t wp, zte_sms_query_result *p_sms_query_result, int i, int tag)
416{
417 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
418 websWrite(wp, T("<%s>\n"), SMS_MESSAGES);
419 websWrite(wp, T("<%s>%s</%s>\n"), SMS_ID, (*p_sms_query_result).data[i].id, SMS_ID);
420 websWrite(wp, T("<%s>%s</%s>\n"), SMS_NUMBER, (*p_sms_query_result).data[i].number, SMS_NUMBER);
421 websWrite(wp, T("<%s>%s</%s>\n"), SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, SMS_CONTENT);
422 websWrite(wp, T("<%s>%s</%s>\n"), SMS_TAG, (*p_sms_query_result).data[i].tag, SMS_TAG);
423 websWrite(wp, T("<%s>%s,%s,%s,%s,%s,%s,%s</%s>\n"), SMS_DATE, (*p_sms_query_result).data[i].date.year, \
424 (*p_sms_query_result).data[i].date.month, (*p_sms_query_result).data[i].date.day, \
425 (*p_sms_query_result).data[i].date.hour, (*p_sms_query_result).data[i].date.min, \
426 (*p_sms_query_result).data[i].date.sec, (*p_sms_query_result).data[i].date.timezone, SMS_DATE);
427 websWrite(wp, T("</%s>\n"), SMS_MESSAGES);
428 } else {
429 if (tag == 1) {
430 websWrite(wp, T(","));
431 }
432 (void)websWrite(wp, T("{\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s\",\"%s\":\"%s,%s,%s,%s,%s,%s,%s\"}"), \
433 SMS_ID, (*p_sms_query_result).data[i].id, \
434 SMS_NUMBER, (*p_sms_query_result).data[i].number, \
435 SMS_CONTENT, (*p_sms_query_result).data[i].sms_content, \
436 SMS_DATE, (*p_sms_query_result).data[i].date.year, (*p_sms_query_result).data[i].date.month, \
437 (*p_sms_query_result).data[i].date.day, (*p_sms_query_result).data[i].date.hour, \
438 (*p_sms_query_result).data[i].date.min, (*p_sms_query_result).data[i].date.sec, \
439 (*p_sms_query_result).data[i].date.timezone);
440 }
441}
442
443
444void zte_rest_boradcast_data(webs_t wp, zte_wms_cell_bro_s_type *p_bro_query_result)
445{
446 if (wp->flags & WEBS_XML_CLIENT_REQUEST) {
447 websWrite(wp, T("<%s>%s</%s>\n"), SMS_MESSAGES, (*p_bro_query_result).content, SMS_MESSAGES);
448 } else {
449 (void)websWrite(wp, T("\"%s\""), (*p_bro_query_result).content);
450 }
451}
452
453
454
455
456
457
458
459
460
461