update tizen source
[framework/messaging/msg-service.git] / test_app / MsgTestSetting.cpp
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 *          Sangkoo Kim <sangkoo.kim@samsung.com>
9 *          Seunghwan Lee <sh.cat.lee@samsung.com>
10 *          SoonMin Jung <sm0415.jung@samsung.com>
11 *          Jae-Young Lee <jy4710.lee@samsung.com>
12 *          KeeBum Kim <keebum.kim@samsung.com>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
21 *
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
28 *
29 */
30
31
32 /*==================================================================================================
33                                          INCLUDE FILES
34 ==================================================================================================*/
35 #include <iostream>
36 #include <string>
37 #include <stdlib.h>
38 using namespace std;
39
40 #include "MapiSetting.h"
41 #include "MsgTestSetting.h"
42 #include "main.h"
43
44 /*==================================================================================================
45                                      FUNCTION IMPLEMENTATION
46 ==================================================================================================*/
47 void MsgTestSettingMain(MSG_HANDLE_T hMsgHandle)
48 {
49         if (hMsgHandle == NULL)
50         {
51                 MSG_DEBUG("Handle is NULL");
52                 return;
53         }
54
55         char menu[2];
56
57         do
58         {
59                 system ("clear");
60
61                 print("======================================");
62                 print("============ Setting Menu ============");
63                 print("======================================");
64                 print("[1] General Options");
65                 print("[2] SMS Send Options");
66                 print("[3] SMSC List");
67                 print("[4] MMS Send Options");
68                 print("[5] MMS Recv Options");
69                 print("[6] MMS Style Options");
70                 print("[7] Push Msg Options");
71                 print("[8] CB Msg Options");
72                 print("[0] Voice Mail Option");
73                 print("[A] Msg Size Option");
74                 print("[B] Back");
75                 print("======================================");
76
77                 print("Input : ");
78
79                 memset(menu, 0x00, sizeof(menu));
80                 cin.getline(menu, 2);
81
82                 MsgSelectMenu(hMsgHandle, menu);
83         }
84         while (strcmp(menu, "B"));
85 }
86
87
88 void MsgSelectMenu(MSG_HANDLE_T hMsgHandle, char *pMenu)
89 {
90         if (!strcmp(pMenu, "1"))
91         {
92                 MsgTestGeneralOpt(hMsgHandle);
93         }
94         else if (!strcmp(pMenu, "2"))
95         {
96                 MsgTestSMSSendOpt(hMsgHandle);
97         }
98         else if (!strcmp(pMenu, "3"))
99         {
100                 MsgTestSMSCList(hMsgHandle);
101         }
102         else if (!strcmp(pMenu, "4"))
103         {
104                 MsgTestMMSSendOpt(hMsgHandle);
105         }
106         else if (!strcmp(pMenu, "5"))
107         {
108                 MsgTestMMSRecvOpt(hMsgHandle);
109         }
110         else if (!strcmp(pMenu, "6"))
111         {
112                 MsgTestMMSStyleOpt(hMsgHandle);
113         }
114         else if (!strcmp(pMenu, "7"))
115         {
116                 MsgTestPushMsgOpt(hMsgHandle);
117         }
118         else if (!strcmp(pMenu, "8"))
119         {
120                 MsgTestCBMsgOpt(hMsgHandle);
121         }
122         else if (!strcmp(pMenu, "0"))
123         {
124                 MsgTestVoiceMailOpt(hMsgHandle);
125         }
126         else if (!strcmp(pMenu, "A"))
127         {
128                 MsgTestMsgSizeOpt(hMsgHandle);
129         }
130 }
131
132
133 void MsgTestGeneralOpt(MSG_HANDLE_T hMsgHandle)
134 {
135         MSG_ERROR_T err = MSG_SUCCESS;
136
137         char menu[2];
138         char strPrint [512];
139
140         MSG_SETTING_S setting;
141
142         do
143         {
144                 memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_GENERAL_OPT_S));
145
146                 setting.type = MSG_GENERAL_OPT;
147
148                 err = msg_get_config(hMsgHandle, &setting);
149
150                 system ("clear");
151
152                 print("======================================");
153                 print("=========== General Option ===========");
154                 print("======================================");
155
156                 memset(strPrint, 0x00, sizeof(strPrint));
157                 snprintf(strPrint, sizeof(strPrint), "Keep a Copy : [%d]", setting.option.generalOpt.bKeepCopy);
158                 print(strPrint);
159
160                 memset(strPrint, 0x00, sizeof(strPrint));
161                 snprintf(strPrint, sizeof(strPrint), "Alert Tone : [%d]", setting.option.generalOpt.alertTone);
162                 print(strPrint);
163
164                 print("======================================");
165                 print("================ Menu ================");
166                 print("[U] Update Options");
167                 print("[B] Back");
168                 print("======================================");
169
170                 print("Input : ");
171
172                 memset(menu, 0x00, sizeof(menu));
173                 cin.getline(menu, 2);
174
175                 if (!strcmp(menu, "U"))
176                 {
177                         memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_GENERAL_OPT_S));
178
179                         setting.type = MSG_GENERAL_OPT;
180
181                         setting.option.generalOpt.bKeepCopy = true;
182                         setting.option.generalOpt.alertTone = MSG_ALERT_TONE_ONCE;
183                 }
184                 else if (!strcmp(menu, "B"))
185                 {
186                         break;
187                 }
188                 else
189                 {
190                         continue;
191                 }
192
193                 err = msg_set_config(hMsgHandle, &setting);
194
195                 if (err == MSG_SUCCESS)
196                         print("Setting Config Data is OK!");
197                 else
198                         print("Setting Config Data is failed!");
199         }
200         while (1);
201 }
202
203
204 void MsgTestSMSSendOpt(MSG_HANDLE_T hMsgHandle)
205 {
206         MSG_ERROR_T err = MSG_SUCCESS;
207
208         char menu[2];
209         char strPrint [512];
210
211         MSG_SETTING_S setting;
212
213         do
214         {
215                 memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_SMS_SENDOPT_S));
216
217                 setting.type = MSG_SMS_SENDOPT;
218
219                 err = msg_get_config(hMsgHandle, &setting);
220
221                 system ("clear");
222
223                 print("======================================");
224                 print("=========== SMS Send Option ===========");
225                 print("======================================");
226
227                 memset(strPrint, 0x00, sizeof(strPrint));
228                 snprintf(strPrint, sizeof(strPrint), "DCS : [%d]", setting.option.smsSendOpt.dcs);
229                 print(strPrint);
230
231                 memset(strPrint, 0x00, sizeof(strPrint));
232                 snprintf(strPrint, sizeof(strPrint), "Network Selection : [%d]", setting.option.smsSendOpt.netMode);
233                 print(strPrint);
234
235                 memset(strPrint, 0x00, sizeof(strPrint));
236                 snprintf(strPrint, sizeof(strPrint), "Reply Path : [%d]", setting.option.smsSendOpt.bReplyPath);
237                 print(strPrint);
238
239                 memset(strPrint, 0x00, sizeof(strPrint));
240                 snprintf(strPrint, sizeof(strPrint), "Delivery Report : [%d]", setting.option.smsSendOpt.bDeliveryReport);
241                 print(strPrint);
242
243                 memset(strPrint, 0x00, sizeof(strPrint));
244                 snprintf(strPrint, sizeof(strPrint), "Save Storage : [%d]", setting.option.smsSendOpt.saveStorage);
245                 print(strPrint);
246
247                 print("======================================");
248                 print("================ Menu ================");
249                 print("[U] Update Options");
250                 print("[B] Back");
251                 print("======================================");
252
253                 print("Input : ");
254
255                 memset(menu, 0x00, sizeof(menu));
256                 cin.getline(menu, 2);
257
258                 if (!strcmp(menu, "U"))
259                 {
260                         memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_SMS_SENDOPT_S));
261
262                         setting.type = MSG_SMS_SENDOPT;
263
264                         setting.option.smsSendOpt.dcs = MSG_ENCODE_AUTO;
265                         setting.option.smsSendOpt.netMode = MSG_SMS_NETWORK_CS_ONLY;
266                         setting.option.smsSendOpt.bReplyPath = false;
267                         setting.option.smsSendOpt.bDeliveryReport = true;
268                         setting.option.smsSendOpt.saveStorage = MSG_SMS_SAVE_STORAGE_PHONE;
269                 }
270                 else if (!strcmp(menu, "B"))
271                 {
272                         break;
273                 }
274                 else
275                 {
276                         continue;
277                 }
278
279                 err = msg_set_config(hMsgHandle, &setting);
280
281                 if (err == MSG_SUCCESS)
282                         print("Setting Config Data is OK!");
283                 else
284                         print("Setting Config Data is failed!");
285         }
286         while (1);
287 }
288
289
290 void MsgTestSMSCList(MSG_HANDLE_T hMsgHandle)
291 {
292         MSG_ERROR_T err = MSG_SUCCESS;
293
294         char menu[2];
295         char strPrint [512];
296
297         MSG_SETTING_S setting;
298
299         do
300         {
301                 memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_SMSC_LIST_S));
302
303                 setting.type = MSG_SMSC_LIST;
304
305                 err = msg_get_config(hMsgHandle, &setting);
306
307                 system ("clear");
308
309                 print("======================================");
310                 print("============== SMSC List ==============");
311                 print("======================================");
312
313                 memset(strPrint, 0x00, sizeof(strPrint));
314                 snprintf(strPrint, sizeof(strPrint), "Total Count : [%d]", setting.option.smscList.totalCnt);
315                 print(strPrint);
316
317                 memset(strPrint, 0x00, sizeof(strPrint));
318                 snprintf(strPrint, sizeof(strPrint), "Selected SMSC : [%d]", setting.option.smscList.selected);
319                 print(strPrint);
320
321                 for (int i = 0; i < setting.option.smscList.totalCnt; i++)
322                 {
323                         print("======================================");
324
325                         memset(strPrint, 0x00, sizeof(strPrint));
326                         snprintf(strPrint, sizeof(strPrint), "SMSC Name : [%s]", setting.option.smscList.smscData[i].name);
327                         print(strPrint);
328
329                         memset(strPrint, 0x00, sizeof(strPrint));
330                         snprintf(strPrint, sizeof(strPrint), "SMSC Address : [%s]", setting.option.smscList.smscData[i].smscAddr.address);
331                         print(strPrint);
332
333                         memset(strPrint, 0x00, sizeof(strPrint));
334                         snprintf(strPrint, sizeof(strPrint), "SMSC PID : [%d]", setting.option.smscList.smscData[i].pid);
335                         print(strPrint);
336
337                         memset(strPrint, 0x00, sizeof(strPrint));
338                         snprintf(strPrint, sizeof(strPrint), "SMSC VAL PERIOD : [%d]", setting.option.smscList.smscData[i].valPeriod);
339                         print(strPrint);
340
341                         memset(strPrint, 0x00, sizeof(strPrint));
342                         snprintf(strPrint, sizeof(strPrint), "SMSC TON : [%d]", setting.option.smscList.smscData[i].smscAddr.ton);
343                         print(strPrint);
344
345                         memset(strPrint, 0x00, sizeof(strPrint));
346                         snprintf(strPrint, sizeof(strPrint), "SMSC NPI : [%d]", setting.option.smscList.smscData[i].smscAddr.npi);
347                         print(strPrint);
348                 }
349
350                 print("======================================");
351                 print("================ Menu ================");
352                 print("[A] Add New SMSC");
353                 print("[U] Update SMSC");
354                 print("[D] Delete SMSC");
355                 print("[B] Back");
356                 print("======================================");
357
358                 print("Input : ");
359
360                 memset(menu, 0x00, sizeof(menu));
361                 cin.getline(menu, 2);
362
363                 if (!strcmp(menu, "A"))
364                 {
365                         continue;
366                 }
367                 else if (!strcmp(menu, "U"))
368                 {
369                         memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_SMSC_LIST_S));
370
371                         setting.type = MSG_SMSC_LIST;
372
373                         setting.option.smscList.selected = 0;
374                         setting.option.smscList.totalCnt = 1;
375                         setting.option.smscList.smscData[0].pid = MSG_PID_TEXT;
376                         setting.option.smscList.smscData[0].valPeriod = MSG_VAL_MAXIMUM;
377                         snprintf(setting.option.smscList.smscData[0].name, SMSC_NAME_MAX, "%s", "SMS Centre 1");
378
379                         setting.option.smscList.smscData[0].smscAddr.ton = MSG_TON_INTERNATIONAL;
380                         setting.option.smscList.smscData[0].smscAddr.npi = MSG_NPI_ISDN;
381                         snprintf(setting.option.smscList.smscData[0].smscAddr.address, SMSC_ADDR_MAX, "%s", "1111");
382                 }
383                 else if (!strcmp(menu, "D"))
384                 {
385                         continue;
386                 }
387                 else if (!strcmp(menu, "B"))
388                 {
389                         break;
390                 }
391                 else
392                 {
393                         continue;
394                 }
395
396                 err = msg_set_config(hMsgHandle, &setting);
397
398                 if (err == MSG_SUCCESS)
399                         print("Setting Config Data is OK!");
400                 else
401                         print("Setting Config Data is failed!");
402         }
403         while (1);
404 }
405
406
407 void MsgTestMMSSendOpt(MSG_HANDLE_T hMsgHandle)
408 {
409         MSG_ERROR_T err = MSG_SUCCESS;
410
411         char menu[2];
412         char strPrint [512];
413
414         MSG_SETTING_S setting;
415
416         do
417         {
418                 memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_SENDOPT_S));
419
420                 setting.type = MSG_MMS_SENDOPT;
421
422                 err = msg_get_config(hMsgHandle, &setting);
423
424                 system ("clear");
425
426                 print("======================================");
427                 print("=========== MMS Send Option ===========");
428                 print("======================================");
429
430                 memset(strPrint, 0x00, sizeof(strPrint));
431                 snprintf(strPrint, sizeof(strPrint), "Msg Class : [%d]", setting.option.mmsSendOpt.msgClass);
432                 print(strPrint);
433
434                 memset(strPrint, 0x00, sizeof(strPrint));
435                 snprintf(strPrint, sizeof(strPrint), "Priority : [%d]", setting.option.mmsSendOpt.priority);
436                 print(strPrint);
437
438                 memset(strPrint, 0x00, sizeof(strPrint));
439                 snprintf(strPrint, sizeof(strPrint), "Expiry Time : [%d]", setting.option.mmsSendOpt.expiryTime);
440                 print(strPrint);
441
442                 memset(strPrint, 0x00, sizeof(strPrint));
443                 snprintf(strPrint, sizeof(strPrint), "Delivery Time : [%d]", setting.option.mmsSendOpt.deliveryTime);
444                 print(strPrint);
445
446                 memset(strPrint, 0x00, sizeof(strPrint));
447                 snprintf(strPrint, sizeof(strPrint), "Custom Delivery Time : [%d]", setting.option.mmsSendOpt.customDeliveryTime);
448                 print(strPrint);
449
450                 memset(strPrint, 0x00, sizeof(strPrint));
451                 snprintf(strPrint, sizeof(strPrint), "Sender Visibility : [%d]", setting.option.mmsSendOpt.bSenderVisibility);
452                 print(strPrint);
453
454                 memset(strPrint, 0x00, sizeof(strPrint));
455                 snprintf(strPrint, sizeof(strPrint), "Delivery Report : [%d]", setting.option.mmsSendOpt.bDeliveryReport);
456                 print(strPrint);
457
458                 memset(strPrint, 0x00, sizeof(strPrint));
459                 snprintf(strPrint, sizeof(strPrint), "Read Reply : [%d]", setting.option.mmsSendOpt.bReadReply);
460                 print(strPrint);
461
462                 memset(strPrint, 0x00, sizeof(strPrint));
463                 snprintf(strPrint, sizeof(strPrint), "Keep Copy : [%d]", setting.option.mmsSendOpt.bKeepCopy);
464                 print(strPrint);
465
466                 memset(strPrint, 0x00, sizeof(strPrint));
467                 snprintf(strPrint, sizeof(strPrint), "Body Replying : [%d]", setting.option.mmsSendOpt.bBodyReplying);
468                 print(strPrint);
469
470                 memset(strPrint, 0x00, sizeof(strPrint));
471                 snprintf(strPrint, sizeof(strPrint), "Hide Recipients : [%d]", setting.option.mmsSendOpt.bHideRecipients);
472                 print(strPrint);
473
474                 memset(strPrint, 0x00, sizeof(strPrint));
475                 snprintf(strPrint, sizeof(strPrint), "Reply Charging : [%d]", setting.option.mmsSendOpt.replyCharging);
476                 print(strPrint);
477
478                 memset(strPrint, 0x00, sizeof(strPrint));
479                 snprintf(strPrint, sizeof(strPrint), "Reply Charging Deadline : [%d]", setting.option.mmsSendOpt.replyChargingDeadline);
480                 print(strPrint);
481
482                 memset(strPrint, 0x00, sizeof(strPrint));
483                 snprintf(strPrint, sizeof(strPrint), "Reply Charging Size : [%d]", setting.option.mmsSendOpt.replyChargingSize);
484                 print(strPrint);
485
486                 memset(strPrint, 0x00, sizeof(strPrint));
487                 snprintf(strPrint, sizeof(strPrint), "Creation Mode : [%d]", setting.option.mmsSendOpt.creationMode);
488                 print(strPrint);
489
490                 print("======================================");
491                 print("================ Menu ================");
492                 print("[U] Update Options");
493                 print("[B] Back");
494                 print("======================================");
495
496                 print("Input : ");
497
498                 memset(menu, 0x00, sizeof(menu));
499                 cin.getline(menu, 2);
500
501                 if (!strcmp(menu, "U"))
502                 {
503                         memset(&setting, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_SENDOPT_S));
504
505                         setting.type = MSG_MMS_SENDOPT;
506
507                         setting.option.mmsSendOpt.msgClass = MSG_CLASS_AUTO;
508                         setting.option.mmsSendOpt.priority = MSG_MESSAGE_PRIORITY_NORMAL;
509                         setting.option.mmsSendOpt.expiryTime = MSG_EXPIRY_TIME_1DAY;
510                         setting.option.mmsSendOpt.deliveryTime = MSG_DELIVERY_TIME_IMMEDIATLY;
511                         setting.option.mmsSendOpt.customDeliveryTime = 0;
512                         setting.option.mmsSendOpt.bSenderVisibility = false;
513                         setting.option.mmsSendOpt.bDeliveryReport = true;
514                         setting.option.mmsSendOpt.bReadReply = false;
515                         setting.option.mmsSendOpt.bKeepCopy = false;
516                         setting.option.mmsSendOpt.bBodyReplying = false;
517                         setting.option.mmsSendOpt.bHideRecipients = false;
518                         setting.option.mmsSendOpt.replyCharging = MSG_REPLY_CHARGING_NONE;
519                         setting.option.mmsSendOpt.replyChargingDeadline = 0;
520                         setting.option.mmsSendOpt.replyChargingSize = 0;
521                         setting.option.mmsSendOpt.creationMode = MSG_CREATION_MODE_FREE;
522                 }
523                 else if (!strcmp(menu, "B"))
524                 {
525                         break;
526                 }
527                 else
528                 {
529                         continue;
530                 }
531
532                 err = msg_set_config(hMsgHandle, &setting);
533
534                 if (err == MSG_SUCCESS)
535                         print("Setting Config Data is OK!");
536                 else
537                         print("Setting Config Data is failed!");
538         }
539         while (1);
540 }
541
542
543 void MsgTestMMSRecvOpt(MSG_HANDLE_T hMsgHandle)
544 {
545         MSG_ERROR_T err = MSG_SUCCESS;
546
547         char menu[2];
548         char strPrint [512];
549
550         MSG_SETTING_S setOption;
551         MSG_SETTING_S getOption;
552
553         do
554         {
555                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_RECVOPT_S));
556
557                 getOption.type = MSG_MMS_RECVOPT;
558
559                 err = msg_get_config(hMsgHandle, &getOption);
560
561                 system ("clear");
562
563                 print("======================================");
564                 print("=========== MMS Recv Option ===========");
565                 print("======================================");
566
567                 memset(strPrint, 0x00, sizeof(strPrint));
568                 snprintf(strPrint, sizeof(strPrint), "Home Network : [%d]", getOption.option.mmsRecvOpt.homeNetwork);
569                 print(strPrint);
570
571                 memset(strPrint, 0x00, sizeof(strPrint));
572                 snprintf(strPrint, sizeof(strPrint), "Abroad Network : [%d]", getOption.option.mmsRecvOpt.abroadNetwok);
573                 print(strPrint);
574
575                 memset(strPrint, 0x00, sizeof(strPrint));
576                 snprintf(strPrint, sizeof(strPrint), "Read Receipt : [%d]", getOption.option.mmsRecvOpt.readReceipt);
577                 print(strPrint);
578
579                 memset(strPrint, 0x00, sizeof(strPrint));
580                 snprintf(strPrint, sizeof(strPrint), "Delivery Receipt : [%d]", getOption.option.mmsRecvOpt.bDeliveryReceipt);
581                 print(strPrint);
582
583                 memset(strPrint, 0x00, sizeof(strPrint));
584                 snprintf(strPrint, sizeof(strPrint), "Reject Unknown : [%d]", getOption.option.mmsRecvOpt.bRejectUnknown);
585                 print(strPrint);
586
587                 memset(strPrint, 0x00, sizeof(strPrint));
588                 snprintf(strPrint, sizeof(strPrint), "Reject Advertisement : [%d]", getOption.option.mmsRecvOpt.bRejectAdvertisement);
589                 print(strPrint);
590
591                 print("======================================");
592                 print("================ Menu ================");
593                 print("[U] Update Options");
594                 print("[B] Back");
595                 print("======================================");
596
597                 print("Input : ");
598
599                 memset(menu, 0x00, sizeof(menu));
600                 cin.getline(menu, 2);
601
602                 if (!strcmp(menu, "U"))
603                 {
604                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_RECVOPT_S));
605
606                         setOption.type = MSG_MMS_RECVOPT;
607
608                         setOption.option.mmsRecvOpt.homeNetwork = MSG_HOME_AUTO_DOWNLOAD;
609                         setOption.option.mmsRecvOpt.abroadNetwok = MSG_ABROAD_RESTRICTED;
610                         setOption.option.mmsRecvOpt.readReceipt = false;
611                         setOption.option.mmsRecvOpt.bDeliveryReceipt = true;
612                         setOption.option.mmsRecvOpt.bRejectUnknown = false;
613                         setOption.option.mmsRecvOpt.bRejectAdvertisement = false;
614
615                         err = msg_set_config(hMsgHandle, &setOption);
616
617                         if (err == MSG_SUCCESS)
618                                 print("Setting Config Data is OK!");
619                         else
620                                 print("Setting Config Data is failed!");
621                 }
622                 else if (!strcmp(menu, "B"))
623                 {
624                         break;
625                 }
626                 else
627                 {
628                         continue;
629                 }
630         }
631         while (1);
632 }
633
634
635 void MsgTestMMSStyleOpt(MSG_HANDLE_T hMsgHandle)
636 {
637         MSG_ERROR_T err = MSG_SUCCESS;
638
639         char menu[2];
640         char strPrint [512];
641
642         MSG_SETTING_S setOption;
643         MSG_SETTING_S getOption;
644
645         do
646         {
647                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_STYLEOPT_S));
648
649                 getOption.type = MSG_MMS_STYLEOPT;
650
651                 err = msg_get_config(hMsgHandle, &getOption);
652
653                 system ("clear");
654
655                 print("======================================");
656                 print("=========== MMS Style Option ===========");
657                 print("======================================");
658
659                 memset(strPrint, 0x00, sizeof(strPrint));
660                 snprintf(strPrint, sizeof(strPrint), "Font Size : [%d]", getOption.option.mmsStyleOpt.fontSize);
661                 print(strPrint);
662
663                 memset(strPrint, 0x00, sizeof(strPrint));
664                 snprintf(strPrint, sizeof(strPrint), "Font Style (Bold) : [%d]", getOption.option.mmsStyleOpt.bFontStyleBold);
665                 print(strPrint);
666
667                 memset(strPrint, 0x00, sizeof(strPrint));
668                 snprintf(strPrint, sizeof(strPrint), "Font Style (Italic) : [%d]", getOption.option.mmsStyleOpt.bFontStyleItalic);
669                 print(strPrint);
670
671                 memset(strPrint, 0x00, sizeof(strPrint));
672                 snprintf(strPrint, sizeof(strPrint), "Font Style (Underline) : [%d]", getOption.option.mmsStyleOpt.bFontStyleUnderline);
673                 print(strPrint);
674
675                 memset(strPrint, 0x00, sizeof(strPrint));
676                 snprintf(strPrint, sizeof(strPrint), "Font Color (Red) : [%d]", getOption.option.mmsStyleOpt.fontColorRed);
677                 print(strPrint);
678
679                 memset(strPrint, 0x00, sizeof(strPrint));
680                 snprintf(strPrint, sizeof(strPrint), "Font Color (Green) : [%d]", getOption.option.mmsStyleOpt.fontColorGreen);
681                 print(strPrint);
682
683                 memset(strPrint, 0x00, sizeof(strPrint));
684                 snprintf(strPrint, sizeof(strPrint), "Font Color (Blue) : [%d]", getOption.option.mmsStyleOpt.fontColorBlue);
685                 print(strPrint);
686
687                 memset(strPrint, 0x00, sizeof(strPrint));
688                 snprintf(strPrint, sizeof(strPrint), "Font Color (Hue) : [%d]", getOption.option.mmsStyleOpt.fontColorHue);
689                 print(strPrint);
690
691                 memset(strPrint, 0x00, sizeof(strPrint));
692                 snprintf(strPrint, sizeof(strPrint), "BG Color (Red) : [%d]", getOption.option.mmsStyleOpt.bgColorRed);
693                 print(strPrint);
694
695                 memset(strPrint, 0x00, sizeof(strPrint));
696                 snprintf(strPrint, sizeof(strPrint), "BG Color (Green) : [%d]", getOption.option.mmsStyleOpt.bgColorGreen);
697                 print(strPrint);
698
699                 memset(strPrint, 0x00, sizeof(strPrint));
700                 snprintf(strPrint, sizeof(strPrint), "BG Color (Blue) : [%d]", getOption.option.mmsStyleOpt.bgColorBlue);
701                 print(strPrint);
702
703                 memset(strPrint, 0x00, sizeof(strPrint));
704                 snprintf(strPrint, sizeof(strPrint), "BG Color (Hue) : [%d]", getOption.option.mmsStyleOpt.bgColorHue);
705                 print(strPrint);
706
707                 memset(strPrint, 0x00, sizeof(strPrint));
708                 snprintf(strPrint, sizeof(strPrint), "Page Duration : [%d]", getOption.option.mmsStyleOpt.pageDur);
709                 print(strPrint);
710
711                 memset(strPrint, 0x00, sizeof(strPrint));
712                 snprintf(strPrint, sizeof(strPrint), "Page Custom Duration : [%d]", getOption.option.mmsStyleOpt.pageCustomDur);
713                 print(strPrint);
714
715                 memset(strPrint, 0x00, sizeof(strPrint));
716                 snprintf(strPrint, sizeof(strPrint), "Page Duration Manual : [%d]", getOption.option.mmsStyleOpt.pageDurManual);
717                 print(strPrint);
718
719                 print("======================================");
720                 print("================ Menu ================");
721                 print("[U] Update Options");
722                 print("[B] Back");
723                 print("======================================");
724
725                 print("Input : ");
726
727                 memset(menu, 0x00, sizeof(menu));
728                 cin.getline(menu, 2);
729
730                 if (!strcmp(menu, "U"))
731                 {
732                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MMS_STYLEOPT_S));
733
734                         setOption.type = MSG_MMS_STYLEOPT;
735
736                         setOption.option.mmsStyleOpt.fontSize = 30;
737                         setOption.option.mmsStyleOpt.bFontStyleBold = true;
738                         setOption.option.mmsStyleOpt.bFontStyleItalic = true;
739                         setOption.option.mmsStyleOpt.bFontStyleUnderline = false;
740                         setOption.option.mmsStyleOpt.fontColorRed = 0;
741                         setOption.option.mmsStyleOpt.fontColorGreen = 0;
742                         setOption.option.mmsStyleOpt.fontColorBlue = 0;
743                         setOption.option.mmsStyleOpt.fontColorHue = 255;
744                         setOption.option.mmsStyleOpt.bgColorRed = 255;
745                         setOption.option.mmsStyleOpt.bgColorGreen = 255;
746                         setOption.option.mmsStyleOpt.bgColorBlue = 255;
747                         setOption.option.mmsStyleOpt.bgColorHue = 255;
748                         setOption.option.mmsStyleOpt.pageDur = 2;
749                         setOption.option.mmsStyleOpt.pageCustomDur = 0;
750                         setOption.option.mmsStyleOpt.pageDurManual = 0;
751
752                         err = msg_set_config(hMsgHandle, &setOption);
753
754                         if (err == MSG_SUCCESS)
755                                 print("Setting Config Data is OK!");
756                         else
757                                 print("Setting Config Data is failed!");
758                 }
759                 else if (!strcmp(menu, "B"))
760                 {
761                         break;
762                 }
763                 else
764                 {
765                         continue;
766                 }
767         }
768         while (1);
769 }
770
771
772 void MsgTestPushMsgOpt(MSG_HANDLE_T hMsgHandle)
773 {
774         MSG_ERROR_T err = MSG_SUCCESS;
775
776         char menu[2];
777         char strPrint [512];
778
779         MSG_SETTING_S setOption;
780         MSG_SETTING_S getOption;
781
782         do
783         {
784                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_PUSHMSG_OPT_S));
785
786                 getOption.type = MSG_PUSHMSG_OPT;
787
788                 err = msg_get_config(hMsgHandle, &getOption);
789
790                 system ("clear");
791
792                 print("======================================");
793                 print("=========== Push Msg Option ===========");
794                 print("======================================");
795
796                 memset(strPrint, 0x00, sizeof(strPrint));
797                 snprintf(strPrint, sizeof(strPrint), "Receive Option : [%d]", getOption.option.pushMsgOpt.bReceive);
798                 print(strPrint);
799
800                 memset(strPrint, 0x00, sizeof(strPrint));
801                 snprintf(strPrint, sizeof(strPrint), "Service Load : [%d]", getOption.option.pushMsgOpt.serviceType);
802                 print(strPrint);
803
804                 print("======================================");
805                 print("================ Menu ================");
806                 print("[U] Update Options");
807                 print("[B] Back");
808                 print("======================================");
809
810                 print("Input : ");
811
812                 memset(menu, 0x00, sizeof(menu));
813                 cin.getline(menu, 2);
814
815                 if (!strcmp(menu, "U"))
816                 {
817                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_PUSHMSG_OPT_S));
818
819                         setOption.type = MSG_PUSHMSG_OPT;
820
821                         setOption.option.pushMsgOpt.bReceive = false;
822                         setOption.option.pushMsgOpt.serviceType = MSG_PUSH_SERVICE_PROMPT;
823
824                         err = msg_set_config(hMsgHandle, &setOption);
825
826                         if (err == MSG_SUCCESS)
827                                 print("Setting Config Data is OK!");
828                         else
829                                 print("Setting Config Data is failed!");
830                 }
831                 else if (!strcmp(menu, "B"))
832                 {
833                         break;
834                 }
835                 else
836                 {
837                         continue;
838                 }
839         }while (1);
840 }
841
842
843 void MsgTestCBMsgOpt(MSG_HANDLE_T hMsgHandle)
844 {
845         MSG_ERROR_T err = MSG_SUCCESS;
846
847         char menu[2];
848         char strPrint [512];
849
850         MSG_SETTING_S setOption;
851         MSG_SETTING_S getOption;
852
853         do
854         {
855                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_CBMSG_OPT_S));
856
857                 getOption.type = MSG_CBMSG_OPT;
858
859                 err = msg_get_config(hMsgHandle, &getOption);
860
861                 system ("clear");
862
863                 print("======================================");
864                 print("=========== CB Msg Option ===========");
865                 print("======================================");
866
867                 memset(strPrint, 0x00, sizeof(strPrint));
868                 snprintf(strPrint, sizeof(strPrint), "Receive : [%d]", getOption.option.cbMsgOpt.bReceive);
869                 print(strPrint);
870
871                 memset(strPrint, 0x00, sizeof(strPrint));
872                 snprintf(strPrint, sizeof(strPrint), "All Channel : [%d]", getOption.option.cbMsgOpt.bAllChannel);
873                 print(strPrint);
874
875                         memset(strPrint, 0x00, sizeof(strPrint));
876                 snprintf(strPrint, sizeof(strPrint), "Channel Count : [%d]", getOption.option.cbMsgOpt.channelData.channelCnt);
877                         print(strPrint);
878
879                 for (int i = 0; i < getOption.option.cbMsgOpt.channelData.channelCnt; i++)
880                 {
881                         memset(strPrint, 0x00, sizeof(strPrint));
882                         snprintf(strPrint, sizeof(strPrint), "Channel Activate : [%d]", getOption.option.cbMsgOpt.channelData.channelInfo[i].bActivate);
883                         print(strPrint);
884
885                         memset(strPrint, 0x00, sizeof(strPrint));
886                         snprintf(strPrint, sizeof(strPrint), "Channel ID : [%d]", getOption.option.cbMsgOpt.channelData.channelInfo[i].id);
887                         print(strPrint);
888
889                         memset(strPrint, 0x00, sizeof(strPrint));
890                         snprintf(strPrint, sizeof(strPrint), "Channel Name : [%s]", getOption.option.cbMsgOpt.channelData.channelInfo[i].name);
891                         print(strPrint);
892                 }
893
894                 for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
895                 {
896                         memset(strPrint, 0x00, sizeof(strPrint));
897                         snprintf(strPrint, sizeof(strPrint), "Language[%d] : [%d]", i, getOption.option.cbMsgOpt.bLanguage[i]);
898                         print(strPrint);
899                 }
900
901                 print("======================================");
902                 print("================ Menu ================");
903                 print("[U] Update Options");
904                 print("[B] Back");
905                 print("======================================");
906
907                 print("Input : ");
908
909                 memset(menu, 0x00, sizeof(menu));
910                 cin.getline(menu, 2);
911
912                 if (!strcmp(menu, "U"))
913                 {
914                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_CBMSG_OPT_S));
915
916                         setOption.type = MSG_CBMSG_OPT;
917
918                         setOption.option.cbMsgOpt.bReceive = true;
919                         setOption.option.cbMsgOpt.bAllChannel = true;
920
921                         setOption.option.cbMsgOpt.channelData.channelCnt = 3;
922
923                         setOption.option.cbMsgOpt.channelData.channelInfo[0].bActivate = true;
924                         setOption.option.cbMsgOpt.channelData.channelInfo[0].id = 10;
925                         memset(setOption.option.cbMsgOpt.channelData.channelInfo[0].name, 0x00, CB_CHANNEL_NAME_MAX+1);
926                         strncpy(setOption.option.cbMsgOpt.channelData.channelInfo[0].name, "CB MSG", CB_CHANNEL_NAME_MAX);
927
928                         setOption.option.cbMsgOpt.channelData.channelInfo[1].bActivate = true;
929                         setOption.option.cbMsgOpt.channelData.channelInfo[1].id = 50;
930                         memset(setOption.option.cbMsgOpt.channelData.channelInfo[1].name, 0x00, CB_CHANNEL_NAME_MAX+1);
931                         strncpy(setOption.option.cbMsgOpt.channelData.channelInfo[1].name, "CB TEST", CB_CHANNEL_NAME_MAX);
932
933                         setOption.option.cbMsgOpt.channelData.channelInfo[2].bActivate = false;
934                         setOption.option.cbMsgOpt.channelData.channelInfo[2].id = 60;
935                         memset(setOption.option.cbMsgOpt.channelData.channelInfo[2].name, 0x00, CB_CHANNEL_NAME_MAX+1);
936
937 //                      memcpy(&setOption.option.cbMsgOpt.channelData, &getOption.option.cbMsgOpt.channelData, sizeof(MSG_CB_CHANNEL_S));
938
939                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_ALL] = false;
940                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_ENG] = true;
941                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_GER] = false;
942                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_FRE] = false;
943                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_ITA] = false;
944                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_NED] = false;
945                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_SPA] = false;
946                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_POR] = false;
947                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_SWE] = false;
948                         setOption.option.cbMsgOpt.bLanguage[MSG_CBLANG_TYPE_TUR] = false;
949
950                         err = msg_set_config(hMsgHandle, &setOption);
951
952                         if (err == MSG_SUCCESS)
953                                 print("Setting Config Data is OK!");
954                         else
955                                 print("Setting Config Data is failed!");
956                 }
957                 else if (!strcmp(menu, "B"))
958                 {
959                         break;
960                 }
961                 else
962                 {
963                         continue;
964                 }
965         }while (1);
966 }
967
968
969 void MsgTestVoiceMailOpt(MSG_HANDLE_T hMsgHandle)
970 {
971         MSG_ERROR_T err = MSG_SUCCESS;
972
973         char menu[2];
974         char strPrint [512];
975
976         MSG_SETTING_S setOption;
977         MSG_SETTING_S getOption;
978
979         do
980         {
981                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_VOICEMAIL_OPT_S));
982
983                 getOption.type = MSG_VOICEMAIL_OPT;
984
985                 err = msg_get_config(hMsgHandle, &getOption);
986
987                 system ("clear");
988
989                 print("======================================");
990                 print("=========== Voice Mail Option ===========");
991                 print("======================================");
992
993                 memset(strPrint, 0x00, sizeof(strPrint));
994                 snprintf(strPrint, sizeof(strPrint), "Voice Mail Number : [%s]", getOption.option.voiceMailOpt.mailNumber);
995                 print(strPrint);
996
997                 print("======================================");
998                 print("================ Menu ================");
999                 print("[U] Update Options");
1000                 print("[B] Back");
1001                 print("======================================");
1002
1003                 print("Input : ");
1004
1005                 memset(menu, 0x00, sizeof(menu));
1006                 cin.getline(menu, 2);
1007
1008                 if (!strcmp(menu, "U"))
1009                 {
1010                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_VOICEMAIL_OPT_S));
1011
1012                         setOption.type = MSG_VOICEMAIL_OPT;
1013
1014                         memset(setOption.option.voiceMailOpt.mailNumber, 0x00, sizeof(MAX_PHONE_NUMBER_LEN));
1015                         strncpy(setOption.option.voiceMailOpt.mailNumber, "11111", MAX_PHONE_NUMBER_LEN);
1016
1017                         err = msg_set_config(hMsgHandle, &setOption);
1018
1019                         if (err == MSG_SUCCESS)
1020                                 print("Setting Config Data is OK!");
1021                         else
1022                                 print("Setting Config Data is failed!");
1023                 }
1024                 else if (!strcmp(menu, "B"))
1025                 {
1026                         break;
1027                 }
1028                 else
1029                 {
1030                         continue;
1031                 }
1032         }while (1);
1033 }
1034
1035
1036 void MsgTestMsgSizeOpt(MSG_HANDLE_T hMsgHandle)
1037 {
1038         MSG_ERROR_T err = MSG_SUCCESS;
1039
1040         char menu[2];
1041         char strPrint [512];
1042
1043         MSG_SETTING_S setOption;
1044         MSG_SETTING_S getOption;
1045
1046         do
1047         {
1048                 memset(&getOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MSGSIZE_OPT_S));
1049
1050                 getOption.type = MSG_MSGSIZE_OPT;
1051
1052                 err = msg_get_config(hMsgHandle, &getOption);
1053
1054                 system ("clear");
1055
1056                 memset(strPrint, 0x00, sizeof(strPrint));
1057                 snprintf(strPrint, sizeof(strPrint), "Message Size : [%d]", getOption.option.msgSizeOpt.nMsgSize);
1058                 print(strPrint);
1059
1060                 print("======================================");
1061                 print("================ Menu ================");
1062                 print("[U] Update Options");
1063                 print("[B] Back");
1064                 print("======================================");
1065
1066                 print("Input : ");
1067
1068                 memset(menu, 0x00, sizeof(menu));
1069                 cin.getline(menu, 2);
1070
1071                 if (!strcmp(menu, "U"))
1072                 {
1073                         memset(&setOption, 0x00, sizeof(MSG_OPTION_TYPE_T)+sizeof(MSG_MSGSIZE_OPT_S));
1074
1075                         setOption.type = MSG_MSGSIZE_OPT;
1076
1077                         setOption.option.msgSizeOpt.nMsgSize = 100;
1078
1079                         err = msg_set_config(hMsgHandle, &setOption);
1080
1081                         if (err == MSG_SUCCESS)
1082                                 print("Setting Config Data is OK!");
1083                         else
1084                                 print("Setting Config Data is failed!");
1085                 }
1086                 else if (!strcmp(menu, "B"))
1087                 {
1088                         break;
1089                 }
1090                 else
1091                 {
1092                         continue;
1093                 }
1094         }while (1);
1095 }
1096