SSCOperate.c 53.7 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 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744
/*****************************************************************************
*  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:
 * ---------
 * SSCStringProcess.C
 *
 * Project:
 * --------
 *   PlutoMMI
 *
 * Description:
 * ------------
 *   To handle the ssc string.
 *
 * 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!
 *
 * 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!!
 *============================================================================
 ****************************************************************************/

#include "MMI_features.h"
#include "MMIDataType.h"
#include "SSCResDef.h"
#include "idleGprot.h"
#include "alertScreen.h"
#include "mmi_rp_srv_phb_def.h"
#include "mmi_frm_events_gprot.h"
#include "wgui_categories_text_viewer.h"
#include "GlobalResDef.h"
#include "mmi_frm_history_gprot.h"
#include "GlobalConstants.h"
#include "wgui_categories_util.h"
#include "mmi_msg_struct.h"
#include "stack_msgs.h"
#include "Unicodexdcl.h"
#include "mmi_frm_queue_gprot.h"
#include "app_ltlcom.h"
#include "stack_config.h"
#include "kal_general_types.h"
#include "string.h"
#include "DebugInitDef_Int.h"
#include "MMI_trc_Int.h"
#include "mmi_frm_input_gprot.h"
#include "mmi_frm_nvram_gprot.h"
#include "custom_mmi_default_value.h"
#ifdef __MMI_ENGINEER_MODE__
#include "mmi_rp_app_engineermode1_def.h"
#endif
#include "wgui_categories_list.h"
#include "DialerCuiGprot.h"
#include "Gui_effect_oem.h"

#if defined(__TOPWELL_BASE_BUG__)
#include "TimerEvents.h"
#endif


#ifdef __COSMOS_MMI_PACKAGE__
extern void vcp_dialer_popup(WCHAR *str);
extern void vcp_dialer_imei_pupup(WCHAR *str, void *scr);
extern void *mmi_ssc_main_screen_g;
#endif

#define MAX_IMEISV_DISPLAY_LEN 33       /* including null-terminator */
#define MAX_IMEI_LEN 16
#define MAX_IMEISV_LEN  2

#if defined(CFG_MMI_IMEISV_SUPPORT) && ((CFG_MMI_IMEISV_SUPPORT == __ON__)||(CFG_MMI_IMEISV_SUPPORT == __AUTO__))
	#ifndef __MMI_IMEISV_SUPPORT__
	#define __MMI_IMEISV_SUPPORT__
	#endif
#endif


#ifdef __MMI_IMEISV_SUPPORT__
static CHAR gstrIMEI[MAX_IMEISV_DISPLAY_LEN * MMI_MAX_SIM_NUM * ENCODING_LENGTH];
#else
static CHAR gstrIMEI[((MAX_IMEI_LEN + 1) * MMI_MAX_SIM_NUM + 1)* ENCODING_LENGTH];
#endif

static void mmi_ssc_handle_imei(module_type dest_mod,PsIntFuncPtr funcPtr);


#define IMEI_SSC_PROCESSING

/*****************************************************************************
 * FUNCTION
 *  mmi_ssc_show_imei
 * DESCRIPTION
 *  Display IMEI Number
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_ssc_show_imei(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __COSMOS_MMI_PACKAGE__
    vcp_dialer_imei_pupup((WCHAR *)gstrIMEI, mmi_ssc_main_screen_g);
#else
    mmi_frm_scrn_enter(mmi_frm_group_get_active_id(), SCR_ENTER_SSC, NULL, mmi_ssc_show_imei, MMI_FRM_FULL_SCRN);

#ifdef __MMI_IMEISV_SUPPORT__
    ShowCategory7Screen(
        SSC_SCR_IMEI_CAPTION_ID,
        0,
        0,
        0,
        STR_GLOBAL_BACK,
        0,
        (U8*) gstrIMEI,
        NULL);
#else /* __MMI_IMEISV_SUPPORT__ */ 
    ShowCategory152Screen(
        SSC_SCR_IMEI_CAPTION_ID, 
        0, 
        0, 
        0, 
        STR_GLOBAL_BACK, 
        0, 
        (U8*) gstrIMEI, 
        NULL);
#endif /* __MMI_IMEISV_SUPPORT__ */ 

    /* Delete previous one because it might be shown from idle dialpad and then
       from call management dial pad. */

#ifdef __TOPWELL_BASE_BUG__ //xiaonan 显示IMEI号界面有弹出框时显示bug
//NONE 
#else
#ifdef __MMI_IMEISV_SUPPORT__
	kal_mem_set(gstrIMEI,0,MAX_IMEISV_DISPLAY_LEN * MMI_MAX_SIM_NUM * ENCODING_LENGTH);
#else
	kal_mem_set(gstrIMEI,0,((MAX_IMEI_LEN + 1) * MMI_MAX_SIM_NUM + 1)* ENCODING_LENGTH);
#endif
#endif

    SetRightSoftkeyFunction(mmi_frm_scrn_close_active_id, KEY_EVENT_UP);
#endif /* __COSMOS_MMI_PACKAGE__ */
}


static MMI_BOOL mmi_ssc_set_imei(void *buf)
{
    U8 tempbufimei[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH];
	#ifdef __MMI_IMEISV_SUPPORT__
	U8 tempbufsvn[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH];
	#endif
	//U8 tempbuf[(MAX_IMEI_LEN + 1) * ENCODING_LENGTH];
    mmi_nw_get_imei_rsp_struct *imeiresponse = (mmi_nw_get_imei_rsp_struct*) buf;
        
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_frm_clear_protocol_event_handler(MSG_ID_MMI_NW_GET_IMEI_RSP, NULL);
     
    if (imeiresponse->result == 1)
    {
    #if 0
    #ifdef __ASCII
/* under construction !*/
    #endif 
/* under construction !*/
    #ifdef __UCS2_ENCODING
    #ifdef __MMI_IMEISV_SUPPORT__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
    #else /* __MMI_IMEISV_SUPPORT__ */ 
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
    #endif /* __MMI_IMEISV_SUPPORT__ */
    #endif /* __UCS2_ENCODING */
	#else
	
     #ifdef __UCS2_ENCODING
		mmi_asc_to_ucs2((CHAR*) tempbufimei, (CHAR*) imeiresponse->imei);
	 
       #ifdef __MMI_IMEISV_SUPPORT__
		mmi_asc_to_ucs2((CHAR*) tempbufsvn, (CHAR*) imeiresponse->svn);
		kal_wsprintf((WCHAR *) gstrIMEI,"%wIMEI:%w\nSVN:%w\n",gstrIMEI,tempbufimei,tempbufsvn);
		#else
		kal_wsprintf((WCHAR *) gstrIMEI,"%wIMEI:%w\n",gstrIMEI,tempbufimei);
		#endif
	#endif
		
	#endif

        return MMI_TRUE;
    }
    else
    {
        return MMI_FALSE;
    }
}


static void mmi_ssc_send_imei_get_ilm(module_type dest_mod)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MYQUEUE Message;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    Message.oslMsgId = MSG_ID_MMI_NW_GET_IMEI_REQ;
    Message.oslDataPtr = NULL;
    Message.oslPeerBuffPtr = NULL;
    Message.oslSrcId = MOD_MMI;
    Message.oslDestId = dest_mod;
    OslMsgSendExtQueue(&Message);
}

#if (MMI_MAX_SIM_NUM >= 2)
#if (MMI_MAX_SIM_NUM >= 3)
#if (MMI_MAX_SIM_NUM >= 4)
static void mmi_ssc_get_sim4_imei_rsp(void *buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_ssc_set_imei(buf);
    mmi_ssc_show_imei();
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
#endif
static void mmi_ssc_get_sim3_imei_rsp(void *buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_ssc_set_imei(buf);
#if (MMI_MAX_SIM_NUM >= 4)
    //mmi_ssc_get_sim4_imei_req();
    mmi_ssc_handle_imei(MOD_L4C_4,mmi_ssc_get_sim4_imei_rsp);	 

#else
    mmi_ssc_show_imei();
#endif
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
#endif
static U8 mmi_ssc_get_sim2_imei_rsp(void *buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_ssc_set_imei(buf);
#if (MMI_MAX_SIM_NUM >= 3)
    //mmi_ssc_get_sim3_imei_req();
    mmi_ssc_handle_imei(MOD_L4C_3,mmi_ssc_get_sim3_imei_rsp);	 

#else
    mmi_ssc_show_imei();
#endif
    return 1;
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
#endif


/*****************************************************************************
 * FUNCTION
 *  mmi_ssc_get_imei_rsp
 * DESCRIPTION
 *  Response handler fn of request to get IMEI number.
 * PARAMETERS
 *  buf     [?]     
 * RETURNS
 *  void
 *****************************************************************************/
static U8 mmi_ssc_get_imei_rsp(void *buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_ssc_set_imei(buf);
#if (MMI_MAX_SIM_NUM >= 2)
    //mmi_ssc_get_sim2_imei_req();
    mmi_ssc_handle_imei(MOD_L4C_2,mmi_ssc_get_sim2_imei_rsp);	 
    
#else
    mmi_ssc_show_imei();
#endif
    return 1;
}

static void scrn_dummy_entry()
{
	if (mmi_frm_scrn_enter(SCR_ID_DUMMY, SCR_ID_DUMMY, (FuncPtr)NULL, (FuncPtr)scrn_dummy_entry, MMI_FRM_FULL_SCRN))
    {    
		mmi_show_dummy_scrn();
    }
}

static void mmi_ssc_handle_imei(module_type dest_mod,PsIntFuncPtr funcPtr)
{
	mmi_ssc_send_imei_get_ilm(dest_mod);
    SetProtocolEventHandler(funcPtr,MSG_ID_MMI_NW_GET_IMEI_RSP);
}

	
/*****************************************************************************
 * FUNCTION
 *  SSCHandleIMEI
 * DESCRIPTION
 *  Send req to get the IMEI number
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void SSCHandleIMEI(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifndef __COSMOS_MMI_PACKAGE__
	mmi_frm_group_create_ex(GRP_ID_ROOT, SCR_ID_DUMMY, NULL, NULL, MMI_FRM_NODE_SMART_CLOSE_FLAG);
	scrn_dummy_entry();
#endif
    ClearInputEventHandler(MMI_DEVICE_ALL); /* send message and wait response in the same screen and no input can be accepted */

#ifdef __TOPWELL_BASE_BUG__ //xiaonan 显示IMEI号界面有弹出框时显示bug
    memset(gstrIMEI, 0x00, sizeof(gstrIMEI));
#else
    //memset(gstrIMEI, 0x00, sizeof(gstrIMEI));
#endif
	mmi_ssc_handle_imei(MOD_L4C,mmi_ssc_get_imei_rsp);   
}


#if defined(__TOPWELL_MMI_MODIFY_IMEI_BY_USER__)//wm
#include "InlineCuiGprot.h"
#include "mmi_rp_app_uiframework_def.h"
#include "nvram_data_items.h"
#include "ImeiSrvGprot.h"
extern void mmi_custom_imei_write_record(void);
extern void topwell_power_off_for_other_app(void);
#define CUSTOM_IMEI_LEN 16 

typedef struct
{
    U8 IMEI1[CUSTOM_IMEI_LEN*2];   /* IMEI1 */
    U8 IMEI2[CUSTOM_IMEI_LEN*2];   /* IMEI2 */
}mmi_custom_imei_setting_struct;

typedef struct
{
    kal_uint8 imei[8];
    kal_uint8 svn;
    kal_uint8 pad;
}custom_imei_edit_struct;

static mmi_custom_imei_setting_struct g_cust_imei_user_data;
static MMI_ID g_mmi_custom_imei_grp_id = GRP_ID_INVALID;

typedef enum
{
	MMI_CUSTOM_IMEI1_CAPTION = CUI_INLINE_ITEM_ID_BASE + 1,
	MMI_CUSTOM_IMEI1_CONTENT,
	
	MMI_CUSTOM_IMEI2_CAPTION,
	MMI_CUSTOM_IMEI2_CONTENT
	
}custom_imei_edit_inline_enum;

static cui_inline_item_text_edit_struct cust_imei_code_content =
{
    0,
    0,
    CUSTOM_IMEI_LEN,
    IMM_INPUT_TYPE_NUMERIC,
    0,
    NULL
};

static const cui_inline_item_caption_struct g_ssc_cust_imei_caption1 = 
{
    STR_ID_CUST_IMEI1
};
static const cui_inline_item_caption_struct g_ssc_cust_imei_caption2 = 
{
    STR_ID_CUST_IMEI2
};

static const cui_inline_set_item_struct g_custom_imei_data[] =
{
    {MMI_CUSTOM_IMEI1_CAPTION, CUI_INLINE_ITEM_TYPE_CAPTION, NULL, &g_ssc_cust_imei_caption1},
    {MMI_CUSTOM_IMEI1_CONTENT, CUI_INLINE_ITEM_TYPE_TEXT_EDIT, 0, &cust_imei_code_content},

    {MMI_CUSTOM_IMEI2_CAPTION, CUI_INLINE_ITEM_TYPE_CAPTION, NULL, &g_ssc_cust_imei_caption2},
    {MMI_CUSTOM_IMEI2_CONTENT, CUI_INLINE_ITEM_TYPE_TEXT_EDIT, 0, &cust_imei_code_content},

};

static const cui_inline_struct g_custom_imei_inline =
{
    sizeof(g_custom_imei_data) / sizeof(cui_inline_set_item_struct),
    SSC_SCR_IMEI_CAPTION_ID,
    NULL,
    CUI_INLINE_SCREEN_DEFAULT_TEXT | CUI_INLINE_SCREEN_DISABLE_DONE,
    NULL,
    g_custom_imei_data
};
/*****************************************************************************
 * FUNCTION
 *  mmi_custom_imei_highlight_hdlr
 * DESCRIPTION
 *  mmi_custom_imei_highlight_hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_custom_imei_highlight_hdlr(cui_event_inline_notify_struct *evt)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 custom_imei_code[CUSTOM_IMEI_LEN*2+1] = {0};
    U16 item_id = evt->item_id;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if((item_id == MMI_CUSTOM_IMEI1_CONTENT)||(item_id == MMI_CUSTOM_IMEI2_CONTENT))
	{
		cui_inline_get_value(g_mmi_custom_imei_grp_id, 
								  MMI_CUSTOM_IMEI1_CONTENT, 
								  custom_imei_code);
        
        memcpy(g_cust_imei_user_data.IMEI1, custom_imei_code, sizeof(custom_imei_code));

        cui_inline_get_value(g_mmi_custom_imei_grp_id, 
                                      MMI_CUSTOM_IMEI2_CONTENT, 
                                      custom_imei_code);
            
        memcpy(g_cust_imei_user_data.IMEI2, custom_imei_code, sizeof(custom_imei_code));

	}
   
}
/*****************************************************************************
 * FUNCTION
 *  mmi_custom_imei_read_record
 * DESCRIPTION
 *  mmi_custom_imei_read_record
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_custom_imei_read_record(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 imei1_buff[CUSTOM_IMEI_LEN*2]={0};
    U8 imei2_buff[CUSTOM_IMEI_LEN*2]={0};
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
	/*if(!g_cust_imei_user_data)
    {   
	    g_cust_imei_user_data = OslMalloc(sizeof(mmi_custom_imei_setting_struct));
    }*/
        
    memset(&g_cust_imei_user_data, 0, sizeof(mmi_custom_imei_setting_struct));
    
	if(srv_imei_get_imei(MMI_SIM1, imei1_buff, CUSTOM_IMEI_LEN))
	{
        memcpy((char *)g_cust_imei_user_data.IMEI1, (char *)imei1_buff, sizeof(imei1_buff));
	}

    if(srv_imei_get_imei2(imei2_buff, CUSTOM_IMEI_LEN))
	{
        memcpy((char *)g_cust_imei_user_data.IMEI2, (char *)imei2_buff, sizeof(imei2_buff));
	}

}
/*****************************************************************************
 * FUNCTION
 *  mmi_custom_imei_poweroff
 * DESCRIPTION
 *  mmi_custom_imei_poweroff
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_custom_imei_poweroff(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_popup_display_simple((WCHAR*)GetString(STR_ID_CUST_IMEI_POWEROFF_ALERT), MMI_EVENT_NOT_AVAILABLE, GRP_ID_ROOT, NULL);
    gui_start_timer(3000, topwell_power_off_for_other_app); 
}
/*****************************************************************************
 * FUNCTION
 *  mmi_custom_imei_write_record
 * DESCRIPTION
 *  mmi_custom_imei_write_record
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_custom_imei_write_record(void)
{

    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 imeiascbuff_1[MAX_IMEISV_DISPLAY_LEN*2];
    U8 imeiascbuff_2[MAX_IMEISV_DISPLAY_LEN*2];
    U8 theloop = 0;
    PS8 numberbuff;
    custom_imei_edit_struct imeibuff[2];
    S32 result1,result2;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(imeiascbuff_1,0,MAX_IMEISV_DISPLAY_LEN*2);
    memset(imeiascbuff_2,0,MAX_IMEISV_DISPLAY_LEN*2);
    memset(&imeibuff,0,sizeof(custom_imei_edit_struct)*2);

    mmi_ucs2_to_asc((char *) imeiascbuff_1, (char *) g_cust_imei_user_data.IMEI1);
    mmi_ucs2_to_asc((char *) imeiascbuff_2, (char *) g_cust_imei_user_data.IMEI2);

    if((strlen(imeiascbuff_1) != SRV_IMEI_MAX_LEN)||(strlen(imeiascbuff_2) != SRV_IMEI_MAX_LEN))
    {
        mmi_popup_display_simple((WCHAR*)GetString(STR_ID_CUST_IMEI_LEN), MMI_EVENT_NOT_AVAILABLE, GRP_ID_ROOT, NULL);
        return;
    }
    
    while(theloop<7)
    {
        numberbuff = imeiascbuff_1+theloop*2;
        imeibuff[0].imei[theloop] = (numberbuff[1]-'0')*0x10 + (numberbuff[0]-'0');
        theloop++;
    }
    imeibuff[0].imei[7] = imeiascbuff_1[14]-'0';
    imeibuff[0].pad = 0;
    imeibuff[0].svn = 0;
    theloop = 0;
    while(theloop<7)
    {
        numberbuff = imeiascbuff_2+theloop*2;
        imeibuff[1].imei[theloop] = (numberbuff[1]-'0')*0x10 + (numberbuff[0]-'0');
        theloop++;
    }
    imeibuff[1].imei[7] = imeiascbuff_2[14]-'0';
    imeibuff[1].pad = 0;
    imeibuff[1].svn = 0;
    result1 = WriteRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 1, &imeibuff[0], sizeof(custom_imei_edit_struct));
    result2 = WriteRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 2, &imeibuff[1], sizeof(custom_imei_edit_struct));
    
    if((result1>0)&&(result2>0))
    {
        mmi_custom_imei_poweroff();
    }
    
}

/*****************************************************************************
 * FUNCTION
 *  topwell_mmi_custom_imei_proc
 * DESCRIPTION
 *  topwell_mmi_custom_imei_proc
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static mmi_ret mmi_custom_imei_proc(mmi_event_struct *evt)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
	cui_menu_event_struct *menu_evt = (cui_menu_event_struct*)evt;
	mmi_menu_id hilight_menu = menu_evt->highlighted_menu_id;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

	switch (menu_evt->evt_id)
	{
    	case EVT_ID_CUI_MENU_LIST_ENTRY:
    		break;

        case EVT_ID_CUI_MENU_CLOSE_REQUEST:
    		{
    			mmi_group_event_struct *event = (mmi_group_event_struct*)evt;
                if(g_mmi_custom_imei_grp_id != GRP_ID_INVALID)
                    g_mmi_custom_imei_grp_id = GRP_ID_INVALID;
    			cui_inline_close(event->sender_id);
    		}
		    break;    

    	case EVT_ID_CUI_INLINE_NOTIFY:
    		{
    			cui_event_inline_notify_struct *inline_evt = (cui_event_inline_notify_struct*)evt;
                mmi_custom_imei_highlight_hdlr(inline_evt);
    		}
    		break;
     
    	
    	case EVT_ID_CUI_INLINE_SUBMIT:
            {
                mmi_custom_imei_write_record();
            }
    		break;
    	
    	case EVT_ID_CUI_INLINE_ABORT:
            {
                mmi_group_event_struct *event = (mmi_group_event_struct*)evt;
                if(g_mmi_custom_imei_grp_id != GRP_ID_INVALID)
                    g_mmi_custom_imei_grp_id = GRP_ID_INVALID;
                cui_inline_close(event->sender_id);
            }
    		break;
            
        case EVT_ID_CUI_INLINE_GROUP_DEINIT:
            {
                //if(g_cust_imei_user_data!=0)
                //OslMfree(g_cust_imei_user_data);
            }
            break;
    		
    	default:
    		break;
	}

	return MMI_RET_OK;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_custom_imei_setting_entry
 * DESCRIPTION
 *  mmi_custom_imei_setting_entry
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_custom_imei_setting_entry(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    cui_inline_struct inline_data;
    U8 cust_imei_code_inline_data1[CUSTOM_IMEI_LEN*2] = {0};
    U8 cust_imei_code_inline_data2[CUSTOM_IMEI_LEN*2] = {0};   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/    
	g_mmi_custom_imei_grp_id = cui_inline_create(GRP_ID_IMEI_SETTING,&g_custom_imei_inline);
    
    if (g_mmi_custom_imei_grp_id != GRP_ID_INVALID)
    {
        
		mmi_asc_to_ucs2((CHAR *) cust_imei_code_inline_data1,(CHAR *) g_cust_imei_user_data.IMEI1);
		mmi_asc_to_ucs2((CHAR *) cust_imei_code_inline_data2,(CHAR *) g_cust_imei_user_data.IMEI2);
		cui_inline_set_value(g_mmi_custom_imei_grp_id, MMI_CUSTOM_IMEI1_CONTENT, cust_imei_code_inline_data1);
        cui_inline_set_value(g_mmi_custom_imei_grp_id, MMI_CUSTOM_IMEI2_CONTENT, cust_imei_code_inline_data2);
        cui_inline_run (g_mmi_custom_imei_grp_id);
	}

}
/*****************************************************************************
 * FUNCTION
 *  topwell_mmi_custom_imei_launch
 * DESCRIPTION
 *  topwell_mmi_custom_imei_launch
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_custom_imei_launch(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/  
    mmi_custom_imei_read_record();
    mmi_frm_group_create_ex(
                            GRP_ID_ROOT,
                            GRP_ID_IMEI_SETTING,
                            mmi_custom_imei_proc,
                            NULL,
                            MMI_FRM_NODE_SMART_CLOSE_FLAG);
    
    mmi_custom_imei_setting_entry();


}
#endif/*__TOPWELL_MMI_MODIFY_IMEI_BY_USER__*/


#ifdef __TOPWELL_MMI_DEAFULT_DUAL_DIFF_IMEI__//wm
#include "nvram_data_items.h"

#define DF_IMEI1	L"135790246811220"
#define DF_IMEI2	L"135790246811221"

typedef struct
{
    kal_uint8 imei[8];
    kal_uint8 svn;
    kal_uint8 pad;
}custom_diff_imei_edit_struct;

void mmi_default_diff_imei_write_record(void)
{

    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 imeiascbuff_1[MAX_IMEISV_DISPLAY_LEN*2];
    U8 imeiascbuff_2[MAX_IMEISV_DISPLAY_LEN*2];
    U8 theloop = 0;
    PS8 numberbuff;
    custom_diff_imei_edit_struct imeibuff[2];
    S32 result1,result2; 
	
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(imeiascbuff_1,0,MAX_IMEISV_DISPLAY_LEN*2);
    memset(imeiascbuff_2,0,MAX_IMEISV_DISPLAY_LEN*2);
    memset(&imeibuff,0,sizeof(custom_diff_imei_edit_struct)*2);

    ReadRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 1, &imeibuff[0], sizeof(custom_diff_imei_edit_struct));
    ReadRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 1, &imeibuff[1], sizeof(custom_diff_imei_edit_struct));

    if ((0xFF == imeibuff[0].pad) && (0xFF == imeibuff[1].pad))
    {    
        mmi_ucs2_to_asc((char *) imeiascbuff_1, (char *) DF_IMEI1);
        mmi_ucs2_to_asc((char *) imeiascbuff_2, (char *) DF_IMEI2);

        
        while(theloop<7)
        {
            numberbuff = imeiascbuff_1+theloop*2;
            imeibuff[0].imei[theloop] = (numberbuff[1]-'0')*0x10 + (numberbuff[0]-'0');
            theloop++;
        }
        imeibuff[0].imei[7] = imeiascbuff_1[14]-'0';
        imeibuff[0].pad = 1;
        imeibuff[0].svn = 0;
        theloop = 0;
        while(theloop<7)
        {
            numberbuff = imeiascbuff_2+theloop*2;
            imeibuff[1].imei[theloop] = (numberbuff[1]-'0')*0x10 + (numberbuff[0]-'0');
            theloop++;
        }
        imeibuff[1].imei[7] = imeiascbuff_2[14]-'0';
        imeibuff[1].pad = 2;
        imeibuff[1].svn = 0;
        result1 = WriteRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 1, &imeibuff[0], sizeof(custom_diff_imei_edit_struct));
        result2 = WriteRecordSlim(NVRAM_EF_IMEI_IMEISV_LID, 2, &imeibuff[1], sizeof(custom_diff_imei_edit_struct));
    }

}
#endif
#define SSC_COMMON_FUNCTION
/*****************************************************************************
 * FUNCTION
 *  Serial_num
 * DESCRIPTION
 *  Stub fn to return Serial Number
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
CHAR* Serial_num()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return "123456789012340";
}


void mmi_ssc_popup(WCHAR *str, mmi_event_notify_enum type)
{
#ifdef __COSMOS_MMI_PACKAGE__
    vcp_dialer_popup(str);
#else
    mmi_popup_display_simple(
            str,
            type,
            GRP_ID_ROOT,
            NULL);
#endif
}

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif

#define SOFT_VERSION_SSC_PROCESSING
#ifdef __MMI_FACTORY_MODE__ 
extern void EntryFMVersionSummaryMenu(void);
#if defined(__TOPWELL_BASE_BUG__)   // __TOPWELL_MMI_EXTERN_VERSION__
extern void EntryFMVersionSummaryMenuExt(void);
#endif
#endif
/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_software_version_summary
 * DESCRIPTION
 *  Display sofeware version.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_software_version_summary(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
#ifdef __MMI_FACTORY_MODE__ 
    EntryFMVersionSummaryMenu();
#else /* __MMI_FACTORY_MODE__ */ 
    mmi_idle_display();

    mmi_ssc_popup(
        get_string(SSC_SCR_FACTORY_MODE_STR_ID),
        MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}

#if defined(__TOPWELL_BASE_BUG__)   // __TOPWELL_MMI_EXTERN_VERSION__
void mmi_SSC_handle_software_version_summary_ext(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryFMVersionSummaryMenuExt();
}
#endif

#ifdef __TOPWELL_MMI_SAR_CODE_INQUIRE__
void mmi_SSC_handle_sar_code(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
#ifdef __MMI_FACTORY_MODE__ 
    EntryFMSARCode();
#else /* __MMI_FACTORY_MODE__ */ 
    mmi_idle_display();

    mmi_ssc_popup(
        get_string(SSC_SCR_FACTORY_MODE_STR_ID),
        MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}
#endif

#if !defined(__TOPWELL_DRV_DEVICE_ID_NOT_CHECK__)  //zds add 20130819
void mmi_SSC_handle_drv_device_summary(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryFMDEVICESummaryMenu();
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}

void mmi_SSC_handle_drv_device_all_lcd(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryFMAllDeviceLcdMenu();
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}

void mmi_SSC_handle_drv_device_all_cam(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryFMAllDeviceCamMenu();
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}
#endif

#ifndef __TOPWELL_MMI_NONE_VERSION_BRANCH__
void mmi_SSC_handle_Version_Branch_summary(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryVersionBranchSummaryMenu();
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}
#endif

#ifdef __TOPWELL_MMI_FACTORYMODE_TEST_RESULT__
extern U8 g_is_qsttest_result_fix;
extern void mmi_fm_quick_fix_test_report_fix(void);
extern void mmi_fm_quick_fix_test_report_unfix(void);

void mmi_SSC_handle_quick_test_summary(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryQuicktestResultSummaryMenu();        
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}
#endif

#ifdef __TOPWELL_MMI_NOKIA_VERSION_DEMO__
void mmi_SSC_handle_Version_Nokia_summary(void)
{
#ifdef __MMI_FACTORY_MODE__ 
        EntryVersionNokiaVersionSummaryMenu();
#else /* __MMI_FACTORY_MODE__ */ 
        mmi_idle_display();
    
        mmi_ssc_popup(
            get_string(SSC_SCR_FACTORY_MODE_STR_ID),
            MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}
#endif

#if !defined(__TOPWELL_HW_VIB_LIFT_NO_TEST__)
extern void VibratorOn(void);
extern void VibratorOff(void);

static void mmi_SSC_handle_keep_going_vib_timer_on(void);
static void mmi_SSC_handle_keep_going_vib_timer_off(void);

 U8 g_vib_flag = 0;


static void mmi_SSC_handle_keep_going_vib_timer_off(void)
{
    StopTimer(TIMER_ID_HW_TEST_LIFT);
    VibratorOff();
    if(g_vib_flag)   
    {
        StartTimer(TIMER_ID_HW_TEST_LIFT, 1000, mmi_SSC_handle_keep_going_vib_timer_on);   
    }
}

static void mmi_SSC_handle_keep_going_vib_timer_on(void)
{
    StopTimer(TIMER_ID_HW_TEST_LIFT);
    if(g_vib_flag) 
    {    
        VibratorOn(); 
        StartTimer(TIMER_ID_HW_TEST_LIFT, 1000, mmi_SSC_handle_keep_going_vib_timer_off);       
    }
    else
    {
        VibratorOff();      
    }
}
 

/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_keep_vib
 * DESCRIPTION
 *  Keep test vib all the time 
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_keep_going_vib(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(!g_vib_flag)
    {
        g_vib_flag = 1;
        mmi_SSC_handle_keep_going_vib_timer_on();         
        mmi_ssc_popup(get_string(STR_GLOBAL_ON),MMI_EVENT_INFO);
    }
    else
    {
        g_vib_flag = 0;
        VibratorOff();   
        StopTimer(TIMER_ID_HW_TEST_LIFT);
        mmi_ssc_popup(get_string(STR_GLOBAL_OFF),MMI_EVENT_INFO);
    }
        
}
#endif

#if !defined(__TOPWELL_HW_RECEIVER_LIFT_NO_TEST__)
extern void mmi_receiver_life_test(MMI_BOOL flag);
U8 topwell_receiver_test_flag = 0;
static U8 topwell_test_on_off_flag = 0;

void mmi_SSC_handle_keep_going_receiver_on(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (topwell_receiver_test_flag)
    {
        StopTimer(TIMER_ID_HW_TEST_LIFT);

	 if (0 == topwell_test_on_off_flag)
	 {
	 	topwell_test_on_off_flag = 1;
	 	mmi_receiver_life_test(MMI_TRUE);	
		StartTimer(TIMER_ID_HW_TEST_LIFT, 3000, mmi_SSC_handle_keep_going_receiver_on);   
	 }
	 else
	 {
	 	topwell_test_on_off_flag = 0;
	 	mmi_receiver_life_test(MMI_FALSE);
		StartTimer(TIMER_ID_HW_TEST_LIFT, 100, mmi_SSC_handle_keep_going_receiver_on);   
	 }       
    }
    else
    {
        StopTimer(TIMER_ID_HW_TEST_LIFT);   
    }
}

/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_keep_going_receiver
 * DESCRIPTION
 *  Keep test vib all the time 
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_keep_going_receiver(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(!topwell_receiver_test_flag)
    {
        topwell_receiver_test_flag = 1;
        mmi_SSC_handle_keep_going_receiver_on();        
        mmi_ssc_popup(get_string(STR_GLOBAL_ON),MMI_EVENT_INFO);        
    }
    else
    {
        topwell_receiver_test_flag = 0;
        StopTimer(TIMER_ID_HW_TEST_LIFT);        
        mmi_receiver_life_test(MMI_FALSE);        
        mmi_ssc_popup(get_string(STR_GLOBAL_OFF),MMI_EVENT_INFO);
    }     
}
#endif


#if defined(__TOPWELL_BASE_BUG__)
#if !defined(__TOPWELL_MMI_NOT_LEFT_TEST__)

extern void mmi_life_test_menu_entry(void);

void mmi_SSC_handle_all_life_test(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_life_test_menu_entry();   
}
#endif
#endif

#if !defined(__TOPWELL_HW_SPEAKER_LIFT_NO_TEST__)
extern void mmi_speaker_life_test(MMI_BOOL flag);
U8 topwell_speaker_test_flag = 0;
static U8 topwell_speaker_test_on_off_flag = 0;

void mmi_SSC_handle_keep_going_speaker_on(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (topwell_speaker_test_flag)
    {
        StopTimer(TIMER_ID_HW_TEST_LIFT);

	 if (0 == topwell_speaker_test_on_off_flag)
	 {
	 	topwell_speaker_test_on_off_flag = 1;
	 	mmi_speaker_life_test(MMI_TRUE);	
		StartTimer(TIMER_ID_HW_TEST_LIFT, 3000, mmi_SSC_handle_keep_going_speaker_on);   
	 }
	 else
	 {
	 	topwell_speaker_test_on_off_flag = 0;
	 	mmi_speaker_life_test(MMI_FALSE);
		StartTimer(TIMER_ID_HW_TEST_LIFT, 100, mmi_SSC_handle_keep_going_speaker_on);   
	 }       
    }
    else
    {
        StopTimer(TIMER_ID_HW_TEST_LIFT);   
    }
}

/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_keep_going_receiver
 * DESCRIPTION
 *  Keep test vib all the time 
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_keep_going_speaker(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(!topwell_speaker_test_flag)
    {
        topwell_speaker_test_flag = 1;
        mmi_SSC_handle_keep_going_speaker_on();        
        mmi_ssc_popup(get_string(STR_GLOBAL_ON),MMI_EVENT_INFO);        
    }
    else
    {
        topwell_speaker_test_flag = 0;
        StopTimer(TIMER_ID_HW_TEST_LIFT);        
        mmi_speaker_life_test(MMI_FALSE);        
        mmi_ssc_popup(get_string(STR_GLOBAL_OFF),MMI_EVENT_INFO);
    }     
}
#endif



#define HW_VERSION_SSC_PROCESSING
#ifdef __MMI_HW_VERSION__
extern char *release_hw_ver(void);

/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_hardware_version
 * DESCRIPTION
 *  Execute the sofeware version dispaly
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_hardware_version(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    CHAR strHWVersionNo[(MAX_SW_VER_LEN + 1) * ENCODING_LENGTH];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset(strHWVersionNo, 0, sizeof(strHWVersionNo));
#ifdef __ASCII
    strcpy(strHWVersionNo, (CHAR*) release_hw_ver());
#endif 

#ifdef __UCS2_ENCODING
    mmi_asc_n_to_ucs2(strHWVersionNo, (CHAR*) release_hw_ver(), MAX_SW_VER_LEN);
#endif 

    EntryNewScreen(SCR_ENTER_HW_VERSION, NULL, mmi_SSC_handle_hardware_version, NULL);

    ShowCategory7Screen(SSC_SCR_HW_VERSION_CAPTION_ID, 0, STR_GLOBAL_OK, 0, 0, 0, (PU8) strHWVersionNo, NULL);

    SetLeftSoftkeyFunction(mmi_idle_display, KEY_EVENT_UP);
}
#endif /* __MMI_HW_VERSION__ */


#define FACTORY_MODE_SSC_PROCESSING
#define MAX_SW_VER_LEN   30

#ifdef __MMI_ENGINEER_MODE__ 
extern void mmi_em_pre_entry_engineermode_menu(void);
#endif

#ifdef __MMI_FACTORY_MODE__
extern void EntryFMMenu(void);
extern void EntryFMMenuAutoTest(void);

#ifdef __MMI_FM_LCD_CONTRAST__
extern void EntryFMLCDContrastMenuHdlr(void);
#endif

#endif /* __MMI_FACTORY_MODE__ */ 

#ifdef __MMI_FM_LCD_CONTRAST__
/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_LCD_contrast_setting
 * DESCRIPTION
 *  Display LCD Contrast Setting screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_LCD_contrast_setting(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#ifdef __MMI_FACTORY_MODE__ 
    EntryFMLCDContrastMenuHdlr();
#else /* __MMI_FACTORY_MODE__ */ 
    mmi_idle_display();

    mmi_ssc_popup(
        get_string(SSC_SCR_FACTORY_MODE_STR_ID),
        MMI_EVENT_FAILURE);
#endif /* __MMI_FACTORY_MODE__ */ 
}


#endif /* __MMI_FM_LCD_CONTRAST__ */

#define DISABLE_SSC_PROCESSING
#ifndef __MMI_SSC_SLIM__
extern U8 ssc_disable_flag;

/*****************************************************************************
 * FUNCTION
 *  SSCHandleDisable
 * DESCRIPTION
 *  SSC disable for shipment
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void SSCHandleDisable(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    //S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!ssc_disable_flag)
    {
        ssc_disable_flag = MMI_TRUE;
        //WriteValue(NVRAM_SSC_DISABLE_FLAG, &ssc_disable_flag, DS_BYTE, &error);
        WriteValueSlim(NVRAM_SSC_DISABLE_FLAG, &ssc_disable_flag, DS_BYTE);

        mmi_idle_display();
        mmi_ssc_popup(
            get_string(STR_GLOBAL_DONE),
            MMI_EVENT_SUCCESS);
    }
}

#endif


#define VENUS_SSC_PROCESSING
#ifdef __VENUS_UI_ENGINE__
extern void vtst_rt_main_entry(void);
/*****************************************************************************
 * FUNCTION
 *  mmi_SSC_handle_venus_UI_test
 * DESCRIPTION
 *  SSC handler for Venus UI Test
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_SSC_handle_venus_UI_test(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* enter Venus UI testbed screen */
    vtst_rt_main_entry();
}
#endif

#ifdef __MMI_EM_PROFILING_VENUS_DEBUG_PANEL__
static U8 debug_panel_enabled = 0;
/*****************************************************************************
 * FUNCTION
 *  mmi_ssc_venus_debug_panel_hilite_hdlr(
 * DESCRIPTION
 *  SSC handler for Venus UI Debug Panel
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_ssc_venus_debug_panel_hilite_hdlr(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    debug_panel_enabled = (index == 0) ? 1 : 0;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ssc_venus_debug_panel_done
 * DESCRIPTION
 *  SSC handler for Venus UI Debug Panel
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_ssc_venus_debug_panel_done(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    WriteValue(NVRAM_VENUS_DEBUG_PANEL_ENABLE, &debug_panel_enabled, DS_BYTE, &error);
    if (error == NVRAM_WRITE_SUCCESS)
    {
        mmi_popup_display_simple(get_string(STR_GLOBAL_DONE), MMI_EVENT_SUCCESS, GRP_ID_ROOT, NULL);
    }
    else
    {
        mmi_popup_display_simple(get_string(STR_GLOBAL_FAILED), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
    }
    mmi_frm_scrn_close(GRP_ID_ROOT, SCR_ENTER_SSC);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ssc_handle_venus_debug_panel
 * DESCRIPTION
 *  SSC handler for Venus UI Debug Panel
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ssc_venus_debug_panel(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    PU8 items[2];
    U8* gui_buffer;
    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!mmi_frm_scrn_enter(GRP_ID_ROOT, SCR_ENTER_SSC, NULL, mmi_ssc_venus_debug_panel, MMI_FRM_FULL_SCRN))
    {
        return;
    }

    ReadValue(NVRAM_VENUS_DEBUG_PANEL_ENABLE, &debug_panel_enabled, DS_BYTE, &error);
    items[0] = (PU8)GetString(STR_GLOBAL_ON);
    items[1] = (PU8)GetString(STR_GLOBAL_OFF);
    gui_buffer = mmi_frm_scrn_get_active_gui_buf();
    RegisterHighlightHandler(mmi_ssc_venus_debug_panel_hilite_hdlr);
    ShowCategory36Screen(
        STR_ID_EM_PROFILING_VENUS_DEBUG_PANEL,
        0,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        2,
        (PU8*)items,
        debug_panel_enabled ? 0 : 1,
        gui_buffer);
    EnableCenterSoftkey(0, IMG_GLOBAL_COMMON_CSK);
    SetLeftSoftkeyFunction(mmi_ssc_venus_debug_panel_done, KEY_EVENT_UP);
    SetRightSoftkeyFunction(mmi_frm_scrn_close_active_id, KEY_EVENT_UP);
}
#endif /* __MMI_EM_PROFILING_VENUS_DEBUG_PANEL__ */