SmsSrvGprot.h 150 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 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173
/*****************************************************************************
*  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:
 * ---------
 *  SmsSrvGProt.h
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *  SMS Service Global prototype declaration
 *
 * 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!
 * 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!
 *
 * 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!!
 *============================================================================
 *****************************************************************************/
#ifndef __SRV_SMS_GPROT_H__
#define __SRV_SMS_GPROT_H__

#include "MMI_features.h"
#include "MMIDataType.h"
#include "kal_general_types.h"
#include "custom_mmi_default_value.h"
#include "ps_public_enum.h"
#include "stack_config.h"
#include "customer_ps_inc.h"
#include "nvram_common_defs.h"
#include "mmi_rp_srv_sms_def.h"
#include "CloudSrvGprot.h"

#ifdef __cplusplus
extern "C"
{
#endif

/* The max number of  SMS segment */
#ifdef __EMS_NON_STD_7BIT_CHAR__
#define SRV_SMS_MAX_SEG             (((MMI_SMS_MAX_MSG_SEG * 153) + 66) / 67)
#else /* __EMS_NON_STD_7BIT_CHAR__ */
#define SRV_SMS_MAX_SEG             MMI_SMS_MAX_MSG_SEG
#endif /* __EMS_NON_STD_7BIT_CHAR__ */

#define SRV_SMS_MAX_CLOUD_RECIPIENTS_NUM 4


/* The max number of  SMS profile */
#define SRV_SMS_MAX_LFOUR_PROFILES      4

/* The number of SMS common setting */
#define SRV_SMS_COMMON_SETTING_NUM      3

/* The max length of SMS profile name */
#define SRV_SMS_MAX_PROFILE_NAME_LEN    30

#ifdef __MMI_MSG_REL4_SUPPORT__
/* The max number of voicemail */
#define SRV_SMS_MAX_MAILBOX_NUM         SMSAL_MAX_MAILBOX_NUM
/* The max number of Multiple Subscriber Profile */
#define SRV_SMS_MAX_MSP_NUM             SMSAL_MAX_MSP_NUM                
#else /* __MMI_MSG_REL4_SUPPORT__ */ 
/* The max number of voicemail */
#ifdef __MMI_SMS_VOICEMAIL_SLIM__
#define SRV_SMS_MAX_MAILBOX_NUM         1 
#else
#define SRV_SMS_MAX_MAILBOX_NUM         2
#endif
#endif /* __MMI_MSG_REL4_SUPPORT__ */

 /* The max length of SMS number */
#define SRV_SMS_MAX_ADDR_LEN            21

/* The length of SMS preview text */
#ifdef __MSG_SMS_EMAIL_SUPPORT__
#define SRV_SMS_MSG_INFO_CONTENT_LEN   (61 + 19)
#elif defined(__COSMOS_MMI_PACKAGE__) /* COSMOS */
#define SRV_SMS_MSG_INFO_CONTENT_LEN   40
#else /* __MSG_SMS_EMAIL_SUPPORT__ */
#define SRV_SMS_MSG_INFO_CONTENT_LEN   19
#endif /* __MSG_SMS_EMAIL_SUPPORT__ */

#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
#define SRV_SMS_TCARD_MSG_INFO_CONTENT_LEN   19
#endif

/* The invalid message id */
#define SRV_SMS_INVALID_MSG_ID              0xFFFF
 /* The invalid list index */
#define SRV_SMS_INVALID_LIST_INDEX          0xFFFF

#define SRV_SMS_INVALID_HANDLE              NULL

/* The max number of SMS status report */
#ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
#define SRV_SMS_MAX_STATUS_REPORT_NUM       (NVRAM_EF_SRV_SMS_STATUS_REPORT_TOTAL)
#else /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */
#define SRV_SMS_MAX_STATUS_REPORT_NUM       (0)                        
#endif /* __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__ */

#ifdef __SRV_SMS_TEMPLATE__
/* The Maximum pre defined template number */
#ifdef __SRV_SMS_PREDEFINED_TEMPLATE__
#define SRV_SMS_TEMPLATE_PREDEFINED_NUM             (NVRAM_SMS_MAX_PD_TEMPLATE_NUM)
#else /* __SRV_SMS_PREDEFINED_TEMPLATE__ */
#define SRV_SMS_TEMPLATE_PREDEFINED_NUM             0
#endif /* __SRV_SMS_PREDEFINED_TEMPLATE__ */

/* The Maximum user defined template number */
#ifdef __SRV_SMS_USERDEFINED_TEMPLATE__
#define SRV_SMS_TEMPLATE_USERDEFINED_NUM             (NVRAM_SMS_MAX_UD_TEMPLATE_NUM)
#else /* __SRV_SMS_USERDEFINED_TEMPLATE__ */
#define SRV_SMS_TEMPLATE_USERDEFINED_NUM             0
#endif /* __SRV_SMS_USERDEFINED_TEMPLATE__ */

/* The invalid template ID */
#define SRV_SMS_TEMPLATE_INVALIDE_ID        0XFFFF
/* The Maximum template content character number */
#define SRV_SMS_TEMPLATE_MAX_CHAR_NUM        (NVRAM_SMS_TEMPLATE_MAX_CHAR_NUM)
/* The Maximum template record size */
#define SRV_SMS_TEMPLATE_RECORD_SIZE        (NVRAM_SMS_TEMPLATE_RECORD_SIZE)
/* The Maximum template number */
#define SRV_SMS_TEMPLATE_TOTAL_NUM          (SRV_SMS_TEMPLATE_PREDEFINED_NUM + SRV_SMS_TEMPLATE_USERDEFINED_NUM)
#endif /* __SRV_SMS_TEMPLATE__ */

#define SRV_SMS_SMS_SIM_TO_MMI(sms_sim)     (mmi_sim_enum)((sms_sim) & 0x00FF)
#define SRV_SMS_MMI_SIM_TO_SMS(mmi_sim)     (srv_sms_sim_enum)((mmi_sim) | (MMI_GSM))

/***************************************************************************** 
 * Typedef 
 *****************************************************************************/
typedef void* SMS_HANDLE;   /* SMS handle, be used send or save SMS */


/****************************************************/
/*                                                  */
/*               Enum                               */
/*                                                  */
/****************************************************/

typedef enum
{
    SRV_SMS_BACKUP_RESTORE_CLOUD,//for cloud
    SRV_SMS_BACKUP_RESTORE_TCARD,//for T card
    SRV_SMS_BACKUP_RESTORE_TYPE_TOTAL    
} srv_sms_backup_restore_type_enum;
/* SMS bearer Type */
typedef enum
{
    SRV_SMS_PREFER_GPRS,    /* Prefer GPRS */
    SRV_SMS_PREFER_GSM,     /* Prefer GSM */
    SRV_SMS_GSM_ONLY        /* GSM only */
} srv_sms_bearer_enum;


/* SMS Box List Type, a message list is used to listed a set of SMS in UI folder */
typedef enum
{
    SRV_SMS_BOX_NONE         = 0x00,    /* None */
    SRV_SMS_BOX_INBOX        = 0x01,    /* Inbox, listed all SMS received from network */
    SRV_SMS_BOX_OUTBOX       = 0x02,    /* Outbox, listed all SMS sent to network, (or to be sent to network if don't support Unsent list) */
    SRV_SMS_BOX_DRAFTS       = 0x04,    /* Drafts, listed all draft SMS */
    SRV_SMS_BOX_UNSENT       = 0x08,    /* Unsent, listed all SMS to be sent to network, and they have been sent failed once */
    SRV_SMS_BOX_SIM          = 0x10,    /* SIM Box, listed all SMS from SIM Card */
    SRV_SMS_BOX_ARCHIVE      = 0x20,    /* Archive Box, listed all SMS from Archive folder in phone */

    SRV_SMS_BOX_RESERVED     = 0x40,    /* Reserved */

    SRV_SMS_BOX_REPORT       = 0x80     /* Report Box, listed all status report of sent message */
} srv_sms_box_enum;


/* SMS Folder Type */
typedef enum
{
    SRV_SMS_FOLDER_DEFAULT,     /* Default folder; The SMS stored in the SIM card or NVRAM is considered as default message.
                                 * These SMS are considered as storage in the default folder */
    SRV_SMS_FOLDER_ARCHIVE,     /* Archive folder; The storage of the archive SMS is different with the default message,
                                 * they are stored as file in Archive folder. */

    SRV_SMS_FODLER_TOTAL
} srv_sms_folder_enum;

/* SMS Status Type */
typedef enum
{
    SRV_SMS_STATUS_NONE         = 0x00,     /* None. If a SMS node's status is NONE, it means this SMS node is unused. */ 
    SRV_SMS_STATUS_UNREAD       = 0x01,     /* Unread. SMS received by MS from network, to be read. */
    SRV_SMS_STATUS_READ         = 0x02,     /* Read. SMS received by MS from network, have been read. */
    SRV_SMS_STATUS_SENT         = 0x04,     /* Sent. MS originating SMS, have been sent to network. */
    SRV_SMS_STATUS_UNSENT       = 0x08,     /* Unsent. MS originating SMS, to be sent to network, have been sent failed once. */
    SRV_SMS_STATUS_DRAFT        = 0x10,     /* Draft. MS originating SMS, draft SMS, hasn¡¯t try to send yet. */
    SRV_SMS_STATUS_UNSUPPORTED  = 0x20      /* Unsupported. If a SMS node's status is Unsupported, it means this SMS can¡¯t be displayed. */
} srv_sms_status_enum;


/* Message Type Indicator (Reference SPEC 3GPP TS 23.040, Clause 9.2.3.1) */
typedef enum
{
   SRV_SMS_MTI_DELIVER          = 0x00,     /* Deliver */
   SRV_SMS_MTI_DELIVER_REPORT   = 0x00,     /* Deliver report*/
   SRV_SMS_MTI_SUBMIT           = 0x01,     /* Submit */
   SRV_SMS_MTI_SUBMIT_REPORT    = 0x01,     /* Submit report */
   SRV_SMS_MTI_STATUS_REPORT    = 0x02,     /* Status report */
   SRV_SMS_MTI_COMMAND          = 0x02,     /* Command */   
   SRV_SMS_MTI_RESERVED         = 0x03      /* Reserved */ 
} srv_sms_mti_enum;


/* Message Storage Type, This type is used to distinguish the SMS is from SIM card or phone */
typedef enum
{
    SRV_SMS_STORAGE_ME,             /* Phone storage */
    SRV_SMS_STORAGE_SIM,            /* SIM Card */
    SRV_SMS_STORAGE_TCARD,            /* TCard */

    SRV_SMS_STORAGE_UNSPECIFIC      /* Unspecific Storage. This enum is used for saving SMS if caller don't care the storage.
                                     * If supported SIM box, it will be saved to phone, otherwise, it will be saved to the preferred storage 
                                     * (If preferred storage (Phone or SIM Card) is full, saved to another storage). */
} srv_sms_storage_enum;


/* Message Storage Type, This type is used to distinguish the SMS is from SIM card or phone */
typedef enum
{
    SRV_SMS_FILTER_ME = 0x01,             /* Phone storage */
    SRV_SMS_FILTER_SIM = 0x02,            /* SIM Card */
    SRV_SMS_FILTER_TCARD = 0x04,            /* TCard */

    SRV_SMS_FILTER_ALL = SRV_SMS_FILTER_ME | SRV_SMS_FILTER_SIM | SRV_SMS_FILTER_TCARD
} srv_sms_filter_enum;

/* SIM Card Type */
typedef enum
{
    SRV_SMS_SIM_1 = MMI_GSM | MMI_SIM1,     /* SIM Card 1, the SIM card inserted in the slot 1 */
    SRV_SMS_SIM_2 = MMI_GSM | MMI_SIM2,     /* SIM Card 2, the SIM card inserted in the slot 2 */

    SRV_SMS_SIM_3 = MMI_GSM | MMI_SIM3,     /* SIM Card 3, the SIM card inserted in the slot 3 */


    SRV_SMS_SIM_4 = MMI_GSM | MMI_SIM4,     /* SIM Card 4, the SIM card inserted in the slot 4 */


    SRV_SMS_SIM_TOTAL
} srv_sms_sim_enum;


/* SMS Class Type (Reference SPEC 3GPP TS 23.038, Clause 4) */
typedef enum
{
    SRV_SMS_CLASS_0  = 0x00,        /* Class 0. Class 0. When receive a Class 0 SMS, we don't stored it, 
                                     * only show it in the idle screen immediately (If the phone is in idle) */ 
    SRV_SMS_CLASS_1  = 0x01,        /* Class 1. Default meaning: ME-specific*/
    SRV_SMS_CLASS_2  = 0x02,        /* Class 2. (U)SIM specific message. When receive a Class 2 SMS, we will stored it into SIM Card first,
                                     * if only the SIM card is full, we will return an unspecific error to network. */
    SRV_SMS_CLASS_3  = 0x03,        /* Class 3. Default meaning: TE specific */

    SRV_SMS_CLASS_UNSPECIFIED       /* Unspecified. Consider as no class meaning */
} srv_sms_class_enum;


/* Validity-Period, Relative format (Reference SPEC 3GPP TS 23.040, Clause 9.2.3.12) */
typedef enum
{
    SRV_SMS_VP_1_HR     = 11,       /* 1 Hour */
    SRV_SMS_VP_6_HR     = 71,       /* 6 Hours */
    SRV_SMS_VP_12_HR    = 143,      /* 12 Hours */
    SRV_SMS_VP_24_HR    = 167,      /* 24 Hours */
    SRV_SMS_VP_72_HR    = 169,      /* 3 Days */
    SRV_SMS_VP_1_WEEK   = 173,      /* 1 Weeks */
    SRV_SMS_VP_MAX      = 255       /* Max */
} srv_sms_vp_enum;


/* SMS DCS Tpye, Character sets of the Data Coding Scheme (DCS) (Reference SPEC 3GPP TS 23.038, Clause 4). */
typedef enum
{
    SRV_SMS_DCS_7BIT        = 0x00, /* GSM 7 bit default alphabet */
    SRV_SMS_DCS_8BIT        = 0x04, /* 8 bit data */
    SRV_SMS_DCS_UCS2        = 0x08, /* UCS2 (16bit) */
    SRV_SMS_DCS_RESERVED    = 0x0c  /* Reserved */
} srv_sms_dcs_enum;


/* SMS Protocol Identifier  (Reference SPEC 3GPP TS 23.040, Clause 9.2.3.9) */
typedef enum
{
    SRV_SMS_PID_DEFAULT             = 0x00, /* Text SMS */
    SRV_SMS_PID_EMAIL               = 0x32, /* Internet Electronic Mail */

    SRV_SMS_PID_TYPE_0              = 0x40, /* Short Message Type 0 */
    SRV_SMS_PID_REPLACE_TYPE_1      = 0x41, /* Replace Short Message Type 1 */
    SRV_SMS_PID_REPLACE_TYPE_2      = 0x42, /* Replace Short Message Type 2 */
    SRV_SMS_PID_REPLACE_TYPE_3      = 0x43, /* Replace Short Message Type 3 */
    SRV_SMS_PID_REPLACE_TYPE_4      = 0x44, /* Replace Short Message Type 4 */
    SRV_SMS_PID_REPLACE_TYPE_5      = 0x45, /* Replace Short Message Type 5 */
    SRV_SMS_PID_REPLACE_TYPE_6      = 0x46, /* Replace Short Message Type 6 */
    SRV_SMS_PID_REPLACE_TYPE_7      = 0x47, /* Replace Short Message Type 7 */

    SRV_SMS_PID_RETURN_CALL_MSG     = 0x5F, /* Return Call Message */
    SRV_SMS_PID_ANSI_136_RDATA      = 0x7C, /* ANSI-136 R-DATA */
    SRV_SMS_PID_ME_DOWNLOAD         = 0x7D, /* ME Data Download */
    SRV_SMS_PID_ME_DE_PERSONAL      = 0x7E, /* ME De-personalization Short Message */
    SRV_SMS_PID_SIM_DOWNLOAD        = 0x7F, /* (U)SIM Data Download */

    SRV_SMS_PID_RESERVED                    /* Reserved */
} srv_sms_pid_enum;


/* SMS Action Type */
typedef enum
{
    SRV_SMS_ACTION_NONE,                /* None */
    SRV_SMS_ACTION_SEND,                /* Send SMS */
    SRV_SMS_ACTION_READ,                /* Read SMS */
    SRV_SMS_ACTION_DELETE,              /* Delete SMS */
    SRV_SMS_ACTION_SAVE,                /* Save SMS */
    SRV_SMS_ACTION_UPDATE,              /* Update SMS */
    SRV_SMS_ACTION_COPY,                /* Copy SMS */
    SRV_SMS_ACTION_MOVE,                /* Move SMS */
    SRV_SMS_ACTION_QUERY,               /* Query SMS */
    SRV_SMS_ACTION_CHANGE_STATUS,       /* Change a SMS's status */
    SRV_SMS_ACTION_COPY_TO_ARCHIVE,     /* Copy a Inbox/Sent SMS to Archive folder */
    SRV_SMS_ACTION_MOVE_TO_ARCHIVE,     /* Move a Inbox/Sent SMS to Archive folder */
    SRV_SMS_ACTION_COPY_FROM_ARCHIVE,   /* Move an archive SMS to original folder(Inbox/Sent) */
    SRV_SMS_ACTION_MOVE_FROM_ARCHIVE,   /* Move an archive SMS to original folder(Inbox/Sent) */
    SRV_SMS_ACTION_GET_CONTENT,         /* Get list displayed content of SMS */
    SRV_SMS_ACTION_GET_SIM_NUM,         /* Get the number of SIM Card SMS */
    SRV_SMS_ACTION_GET_REPLY_PATH,      /* Get the reply path of a SMS */
    SRV_SMS_ACTION_CREATE_LIST,         /* Creat Box List */
    SRV_SMS_ACTION_BACKUP,              //for sms backup
    SRV_SMS_ACTION_RESTORE,             //for sms backup

    SRV_SMS_ACTION_CB_GET_MODE,         /* Get Cell Broadcast's setting (Receive Mode/Channels/Languages) information from L4 */
    SRV_SMS_ACTION_CB_SET_MODE,         /* Set Cell Broadcast's setting information to L4  */
    SRV_SMS_ACTION_CB_GET_RECEIVE_MODE, /* Get Cell Broadcast's receive mode */
    SRV_SMS_ACTION_CB_SUBSCRIBE,        /* Subscribe Cell broadcast service */
    SRV_SMS_ACTION_CB_GET_CHNL,         /* Get Cell Broadcast's channel information */
    SRV_SMS_ACTION_CB_ADD_CHNL,         /* Add a new Cell Broadcast channel entry */
    SRV_SMS_ACTION_CB_DELETE_CHNL,      /* Delete a Cell Broadcast channel entry */
    SRV_SMS_ACTION_CB_UPDATE_CHNL,      /* Update a Cell Broadcast channel entry */
    SRV_SMS_ACTION_CB_GET_LANG,         /* Get Cell Broadcast's lanaguage information */
    SRV_SMS_ACTION_CB_SELECT_LANG,      /* Subscibe a Cell Broadcast channel */

    SRV_SMS_BTMAPC_OP_NONE,
    SRV_SMS_BTMAPC_OP_CONN, 
    SRV_SMS_BTMAPC_OP_DISCONN,
    SRV_SMS_BTMAPC_OP_CHANGE_STATUS,
    SRV_SMS_BTMAPC_OP_CHANGE_FOLDER,
    SRV_SMS_BTMAPC_OP_DELETE_MSG, 
    SRV_SMS_BTMAPC_OP_SEND_MSG,
    SRV_SMS_BTMAPC_OP_READ_MSG,
    SRV_SMS_BTMAPC_OP_GET_MSG,
    SRV_SMS_ACTION_TOTAL    
} srv_sms_action_enum;


/* SMS Cause Tpye */
typedef enum
{
	  
	  SRV_SMS_CAUSE_CLOUD_ERROR = (-1),     

    SRV_SMS_CAUSE_CLOUD_NO_MEMORY     = (-4),
    SRV_SMS_CAUSE_CLOUD_FS_ERROR        = (-5),
    SRV_SMS_CAUSE_CLOUD_NWK_ERROR       = (-6),
    SRV_SMS_CAUSE_CLOUD_BUSY            = (-8),
    SRV_SMS_CAUSE_CLOUD_LOGOUT          = (-9),
    SRV_SMS_CAUSE_CLOUD_NO_NEED_SYNC    = (-10),
    SRV_SMS_CAUSE_CLOUD_ACCT_ERROR      = (-11),
    SRV_SMS_CAUSE_CLOUD_NO_STORAGE      = (-12),
    SRV_SMS_CAUSE_CLOUD_DISK_FULL       = (-13),
    SRV_SMS_BTMAPC_OP_SUCC          = (-100), 
    SRV_SMS_BTMAPC_OP_FAIL          = (-200),
    SRV_SMS_CAUSE_NO_ERROR          = 0,

    /* Reference TS 27.005 Clause 3.2.5, For AT Command and MMI */
    SRV_SMS_CAUSE_ME_FAILURE        = 300,      /* ME failure */
    SRV_SMS_CAUSE_OP_NOT_ALLOWED    = 302,      /* Operation not allowed */
    SRV_SMS_CAUSE_OP_NOT_SUPPORTED  = 303,      /* Operation not supported */
    SRV_SMS_CAUSE_INVALID_PDU_PARA  = 304,      /* Invalid PDU mode parameter */
    SRV_SMS_CAUSE_INVALID_TEXT_PARA = 305,      /* Invalid text mode parameter */
    SRV_SMS_CAUSE_SIM_NOT_INSERTED  = 310,      /* (U)SIM not inserted */
    SRV_SMS_CAUSE_SIM_FAILURE       = 313,      /* (U)SIM failure */
    SRV_SMS_CAUSE_MEMORY_FAILURE    = 320,      /* Memory failure */
    SRV_SMS_CAUSE_INVALID_MEM_INDEX = 321,      /* Invalid memory index */
    SRV_SMS_CAUSE_MEM_FULL          = 322,      /* Memory full */
    SRV_SMS_CAUSE_SCA_UNKNOWN       = 330,      /* SMSC address unknown */

    /* MMI Defined Error Codes */
    SRV_SMS_CAUSE_NOT_READY         = 341,      /* SMS servicer not ready */
    SRV_SMS_CAUSE_SEND_BUSY,                    /* SMS servicer busy for sending SMS */
    SRV_SMS_CAUSE_SEND_ABORT,                   /* Send abort */
    SRV_SMS_CAUSE_MEM_INSUFFICIENT,             /* Memory insufficient */
    SRV_SMS_CAUSE_DATA_INVALID,                 /* SMS content invalid*/
    SRV_SMS_CAUSE_DATA_EXCEED,                  /* SMS content exceed*/
    SRV_SMS_CAUSE_NUMBER_EMPTY,                 /* SMS number empty*/
    SRV_SMS_CAUSE_NUMBER_INVALID,               /* SMS number invalid */
    SRV_SMS_CAUSE_SC_EMPTY,                     /* SMS service center is empty*/
    SRV_SMS_CAUSE_SC_INVALID,                   /* SMS service center invalid*/
    SRV_SMS_CAUSE_FDL_FAIL,                     /* FDN check failed */
    SRV_SMS_CAUSE_AT_CONFLICT,                  /* AT commond conflict */
    SRV_SMS_CAUSE_OP_CONFLICT,                  /* Operation conflict */
    SRV_SMS_CAUSE_EMAIL_NO_SPACE,               /* No space to handle email SMS */
    SRV_SMS_CAUSE_FS_ERROR,                     /* File system error */
    SRV_SMS_CAUSE_IN_USB_MODE,                  /* USB mode error */
    SRV_SMS_CAUSE_ARCH_FILE_NOT_EXIST,          /* Archive file not exist */
    SRV_SMS_CAUSE_ABORT,                        /* Abort an action */
    SRV_SMS_CAUSE_TCARD_NOT_AVAILABLE,          /* FOR tcard sms only */






    SRV_SMS_CAUSE_CB_NOT_READY,                 /* Cell Broadcast service not ready */
    SRV_SMS_CAUSE_CB_CHNL_DUPLICATED,           /* Duplicated channel */
    SRV_SMS_CAUSE_CB_CHNL_NOT_EXISTED,          /* Channel not exist */
    SRV_SMS_CAUSE_CB_CHNL_FULL,                 /* Channel full */
    SRV_SMS_CAUSE_CB_LANG_NOT_EXISTED,          /* Language not exist */

    SRV_SMS_CAUSE_UNKNOWN_ERROR     = 500,       /* Unknown error */
    SRV_SMS_CAUSE_ERROR_FDN_ENABLED     = L4C_FDN_CHECK_FAIL  /* FDN fail */
} srv_sms_cause_enum;

/* SMS Parameter Flag. If a flag is set, it means the corresponding parameter (or member of a structure data) is existed or to be used. */
typedef enum
{
    SRV_SMS_PARA_NONE            = 0x00000000,  /* None */

    SRV_SMS_PARA_NUM             = 0x00000001,  /* SMS Number */
    SRV_SMS_PARA_SCA             = 0x00000002,  /* SC Address */
    SRV_SMS_PARA_PID             = 0x00000004,  /* Protocol identifier(PID) */
    SRV_SMS_PARA_DCS             = 0x00000008,  /* DCS */
    SRV_SMS_PARA_VP              = 0x00000010,  /* Validity-Period */
    SRV_SMS_PARA_STATUS_REPORT   = 0x00000020,  /* Sstatus report request flag */
    SRV_SMS_PARA_REPLY_PATH      = 0x00000040,  /* Reply path flag */
    SRV_SMS_PARA_PORT            = 0x00000080,  /* Port number */
    SRV_SMS_PARA_CLASS           = 0x00000100,  /* SMS class type */
    SRV_SMS_PARA_MMS             = 0x00000200,  /* More Message to Send (MMS) flag */
    SRV_SMS_PARA_FO              = 0x00000400,  /* First Octet (FO) */

    SRV_SMS_PARA_STATUS          = 0x00000800,  /* SMS Status type */
    SRV_SMS_PARA_SIM_ID          = 0x00001000,  /* SIM Card ID */
    SRV_SMS_PARA_STORAGE_TYPE    = 0x00002000,  /* Storage Type */
    SRV_SMS_PARA_TIMESTAMP       = 0x00004000,  /* Timestamp, received, sent or saved time of a SMS */
    SRV_SMS_PARA_CONTENT         = 0x00008000,  /* Content */

    SRV_SMS_PARA_CONTENT_EMS     = 0x00010000,  /* EMS Data format content, stored in the EMS Data buffer, this flag only for SMS application internal using. */
    SRV_SMS_PARA_CONTENT_BUFF    = 0x00020000,  /* Text or 8 bit Data content, stored in buffer */
    SRV_SMS_PARA_CONTENT_FILE    = 0x00040000,  /* Text or 8 bit Data content, stored in file */

    SRV_SMS_PARA_MSG_REF         = 0x00080000,  /* Message reference of submited SMS */
    SRV_SMS_PARA_DELIVERY_STATUS = 0x00100000,  /* Deliver status */
    SRV_SMS_PARA_RESEND_COUNT    = 0x00200000,  /* Unsend Message's Resend Count */
    SRV_SMS_PARA_ORI_8BIT_DATA   = 0x00400000   /* If DCS is 8Bit, when read SMS, it will return the original data */

} srv_sms_para_enum;


/* SMS Query Flag.
 * This type is used in the structure srv_sms_query_struct, to specify which the corresponding parameter (member) is used as a query condition. */
typedef enum
{
    SRV_SMS_QUERY_NONE          = 0x0000,       /* None */
    SRV_SMS_QUERY_STATUS        = 0x0001,       /* SMS status */
    SRV_SMS_QUERY_MTI           = 0x0002,       /* MTI(Message-Type-Indicator) */
    SRV_SMS_QUERY_STORAGE_TYPE  = 0x0004,       /* Storage type */
    SRV_SMS_QUERY_SIM_ID        = 0x0008,       /* SIM Card ID */
    SRV_SMS_QUERY_PID           = 0x0010,       /* Protocol identifier(PID) */
    SRV_SMS_QUERY_TIMESTAMP     = 0x0020,       /* Timestamp, received, sent or saved time of a SMS */
    SRV_SMS_QUERY_NUMBER        = 0x0040,       /* SMS number */
    SRV_SMS_QUERY_CONTENT       = 0x0080,       /* SMS content */

    SRV_SMS_QUERY_RESERVED      = 0x0100        /* Reserved */
} srv_sms_query_enum;


/* SMS Sort Type.
 * This type is used in the structure srv_sms_query_struct to specify which property we use to sort on. */
typedef enum
{
    SRV_SMS_SORT_NONE,              /* None. If the sort type is NONE, the order of messages is sorted by message ID. */
    SRV_SMS_SORT_TIMESTAMP,         /* Timestamp, received, sent or saved time of a SMS. */
    SRV_SMS_SORT_MSG_TYPE,          /* Message type. Don't supported in current version. */
    SRV_SMS_SORT_STORAGE_TYPE,      /* Storage type. Don't supported in current version. */
    SRV_SMS_SORT_NUMBER,            /* SMS number. Don't supported in current version. */
    SRV_SMS_SORT_CONTENT,           /* SMS content. Don't supported in current version. */
    SRV_SMS_SORT_PID,               /* Protocol identifier (PID). Don't supported in current version. */
    SRV_SMS_SORT_SIM_ID             /* SIM Card ID. Don't supported in current version. */
} srv_sms_sort_enum;


/* SMS Sorting Order Type. This type is used in the structure srv_sms_query_struct. */
typedef enum
{
    SRV_SMS_ORDER_DEFAULT,  /* Default order. It is depended on the sort flag. For timestamp, the default order is ascending */
    SRV_SMS_ORDER_ASC,      /* Ascending Order (Upper to lower) */
    SRV_SMS_ORDER_DESC      /* Descending Order (Lower to upper) */
} srv_sms_order_enum;

/* Memory status type. This type is used to indicate which storage memory is full/available/exceeded. */
typedef enum
{
    SRV_SMS_MEM_NONE        = 0x00,    /* None */
    SRV_SMS_MEM_ME_ONLY     = 0x01,    /* ME Only */
    SRV_SMS_MEM_SIM_ONLY    = 0x02,    /* SIM Only */
    SRV_SMS_MEM_NORMAL      = 0x03,     /* ME and SIM */
    SRV_SMS_MEM_TCARD_ONLY    = 0x04
} srv_sms_mem_enum;

#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 !*/
/* 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 !*/
/* 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

/* SMS send Type */
typedef enum
{
    SRV_SMS_BG_SEND         = 0x00,     /* SMS be put to sent queue to wait send, not save SMS to sent or outbox */
    SRV_SMS_BG_SAVE_SEND    = 0x01,     /* SMS be put to sent queue to wait send, and save SMS to sent(sent successfully) or outbox(sent failed) */
    SRV_SMS_FG_SEND         = 0x02,     /* SMS will sent directly, not enter send queue */
    SRV_SMS_SEND_ENUM_END
} srv_sms_send_type_enum;


/* SMS send commond Type */
typedef enum
{
    SRV_SMS_CMD_ENQUIRY,                /* Enquiry previous send SMS */
    SRV_SMS_CMD_CANCEL_STATUS_REPORT,   /* Cancel Status Report Request relating to previously submitted short message */
    SRV_SMS_CMD_DELETE_PREVIOUS_SMS,    /* Delete previously submitted Short Message */
    SRV_SMS_CMD_ENABLE_STATUS_REPORT,   /* Enable Status Report Request relating to previously submitted short message */
    SRV_SMS_CMD_TYPE_ENUM_END
} srv_sms_command_type_enum;

typedef enum
{
    SRV_SMS_SPEC_SEND_NONE = 0x0000,
    SRV_SMS_SPEC_SEND_SCA = 0x0001,
    SRV_SMS_SPEC_SEND_VP = 0x0002,
    SRV_SMS_SPEC_SEND_PID = 0x0004,
    SRV_SMS_SPEC_SEND_STATUS_REPORT = 0x0010,
    SRV_SMS_SPEC_SEND_REPLY_PATH = 0x0020,
    SRV_SMS_SPEC_SEND_WITHOUT_ICON = 0x0040,
    SRV_SMS_SPEC_SEND_COUNTER_WITHOUT_CHANGE = 0x0080,
    SRV_SMS_SPEC_SEND_NOT_ALLOW_SC_EMPTY = 0x0100,
    SRV_SMS_SPEC_SEND_ABORT = 0x0200
} srv_sms_specify_send_para_enum;

/* SMS background send stuas */
typedef enum
{
    SRV_SMS_SEND_INVALID,       /* Invalid stuas */
    SRV_SMS_SEND_WAITING,       /* Waiting stuas */
    SRV_SMS_SEND_FAIL,          /* Sent failed stuas */
    SRV_SMS_SEND_SENDING,       /* Sending stuas */
    SRV_SMS_SEND_SUCCESS,       /* Sent successfully  stuas */

    SRV_SMS_SEND_END
} srv_sms_send_status_enum;

/* For SMS setting */
typedef enum
{
    SRV_SMS_PROFILE_NAME = 0x01,
    SRV_SMS_PROFILE_SCA = 0x02,
    SRV_SMS_PROFILE_VP = 0x04,
    SRV_SMS_PROFILE_PID = 0x08,
    SRV_SMS_PROFILE_EMAILSC = 0x10,
    SRV_SMS_COMMON_STATUS_REPORT = 0x20,
    SRV_SMS_COMMON_REPLY_PATH = 0x40,
    SRV_SMS_COMMON_CONNECTION = 0x80,
    SRV_SMS_SETTING_PARA_END
} srv_sms_setting_para_enum;

/* For SMS setting */
typedef enum
{
    SRV_SMS_GET_PROFILE_LIST,       /* get */
    SRV_SMS_SET_ACTIVE_PROFILE,     /* set U8 index */
    SRV_SMS_EDIT_SC_ADDR,           /* set srv_sms_edit_sc_struct, get U8 sc_addr[] */
    SRV_SMS_ACTIVE_SC_ADDR,         /* set U8 sc_addr[], get */
    SRV_SMS_ACTIVE_EMAIL_SC_ADDR,   /* set U8 email_sc_addr[], get */
    SRV_SMS_PROFILE_DETAIL,         /* set srv_sms_profile_struct, get U8 index */
    SRV_SMS_COMMON_SETTINGS,        /* set U8 setting[], get */
    SRV_SMS_GET_MEMORY_STATUS,      /* get srv_sms_memory_status_struct */
    SRV_SMS_PRE_STORAGE,            /* set U8 storage, get */
    SRV_SMS_PRE_BEARER,             /* set U8 bearer, get */
    SRV_SMS_MAILBOX_INFO,           /* set srv_sms_mailbox_struct, get */
    SRV_SMS_MBI,                    /* set srv_sms_set_mbi_struct, get */
    SRV_SMS_MSP,                    /* set U8 select_index, get */
    SRV_SMS_VOICEMAIL_NUM,          /* set srv_sms_mailbox_struct, get */
    SRV_SMS_SET_MSG_WAITING,        /* set srv_sms_msg_waiting_struct */
    //SRV_SMS_NON_STD_7BIT_CHAR,      /* Set srv_sms_miscell_setting_enum */
    SRV_SMS_PROFILE_DETAIL_PARTIAL,     /* set srv_sms_profile_struct*/

    SRV_SMS_FILE_ALL
} srv_sms_setting_type_enum;

/* Voice mail status */
typedef enum
{
    SRV_SMS_VOICEMAIL_STATE_NONE,   /* none staus */
    SRV_SMS_VOICEMAIL_SET_NUM,      /* Set Voice mail Number */
    SRV_SMS_VOICEMAIL_GET_NUM       /* Get Voice mail Number */
} srv_sms_voicemail_state_enum;

/* SMS counter */
typedef enum
{
    SRV_SMS_COUNT_SENT = 0,     /* SMS counter ID: sent SMS*/
    SRV_SMS_COUNT_RECV,         /* SMS counter ID: received SMS */

    SRV_SMS_COUNT_TOTAL
} srv_sms_count_type_enum;

/* SMS AT commond type. (Reference SPEC 3GPP TS 27.005) */
typedef enum
{
    SRV_SMS_AT_CMD_NONE,    /* None */
    SRV_SMS_AT_CMD_CMGR,    /* GMGR, read a SMS */
    SRV_SMS_AT_CMD_CMGL,    /* CMGL, list all SMS with same status */
    SRV_SMS_AT_CMD_CMGD,    /* GMGD, delete a SMS */
    SRV_SMS_AT_CMD_CMGW,    /* CMGW, Write a new SMS */
    SRV_SMS_AT_CMD_EQSI,    /* EQSI, query SMS memory status */
    SRV_SMS_AT_CMD_CGSMS,   /* CGSMS, specify the service bearer */
    SRV_SMS_AT_CMD_CSAS,    /* CSAS, save setting*/

    SRV_SMS_AT_CMD_TOTAL
} srv_sms_at_cmd_enum;

/* SMS Status Report's Status */
typedef enum
{
    SRV_SMS_SRS_NONE,               /* None staus */
    SRV_SMS_SRS_PENDING,            /* Pending, the status report is not received completely */
    SRV_SMS_SRS_SUCC,               /* Sent successfully */
    SRV_SMS_SRS_FAILED,             /* Sent failed */

    SRV_SMS_SRS_INVALID     = 255
} srv_sms_sr_status_enum;

#ifdef __SRV_SMS_TEMPLATE__
typedef enum
{
    SRV_SMS_TEMPLATE_RESULT_OK, /* operation success*/
    SRV_SMS_TEMPLATE_REACH_MAX_NUM, /* operation failed becasue of reach max template number */
    SRV_SMS_TEMPLATE_CONTENT_EMPTY, /* operation failed becasue of content empty */
    SRV_SMS_TEMPLATE_CONTENT_EXCEED, /* operation failed becasue of content too large */
    SRV_SMS_TEMPLATE_FAIL_UNKNOW /* operation failed becasue of content to long */
} srv_sms_template_result;

typedef enum
{
    SRV_SMS_TEMPLATE_NONE = 0, /* none */
    SRV_SMS_TEMPLATE_USER_DEFINED, /* User defined template */
    SRV_SMS_TEMPLATE_PRE_DEFINED, /* Pre defined template */
    SRV_SMS_TEMPLATE_TOTAL
} srv_sms_template_type_enum;
#endif /* __SRV_SMS_TEMPLATE__ */

/* SMS Operation Callback Data Structure */
typedef struct
{
    MMI_BOOL result;                /* Result of the operation: MMI_TRUE: success; MMI_FALSE: failed */
    srv_sms_action_enum action;     /* Action to indicate the operation type(read/save/Delete...), refer to srv_sms_action_enum */
    srv_sms_cause_enum cause;       /* Cause failed, only valid result be MMI_FALSE, refer to srv_sms_cause_enum */
    void *action_data;              /* Callback data, refer to  srv_sms_xxx_cb_struct, ex. read callback data struct: srv_sms_read_msg_cb_struct*/
    void *user_data;                /* User data */
} srv_sms_callback_struct;

/* SMS Event Structure */
typedef struct
{
    MMI_EVT_PARAM_HEADER
    void *event_info;               /* Event information data. For each event's event infomation structure,
                                     * refer the discription of each event in enum srv_sms_event_enum. */
} srv_sms_event_struct;

typedef struct _srv_sms_addr_struct
{
    srv_sms_status_enum status;
    WCHAR address[SRV_SMS_MAX_ADDR_LEN + 1];
    struct _srv_sms_addr_struct *next;
} srv_sms_addr_struct;

/* Message Data Struture */
typedef struct
{
    srv_sms_status_enum status;         /* SMS status, refer to srv_sms_status_enum */
    srv_sms_mti_enum mti;               /* MTI, refer to srv_sms_mti_enum */
    U8 tp_st;                           /* TP-Status, for Status Report. 
                                         * If the SMS is status report (mti is SRV_SMS_MTI_STATUS_REPORT), this value should be set. */
    srv_sms_folder_enum folder_id;      /* Folder ID, refer to srv_sms_folder_enum */

    S8 number[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];    /* SMS number */

    srv_sms_para_enum para_flag;        /* Parameter flag to indicate which members below is used, refer to srv_sms_para_enum */

    void *content_ems;                  /* buffer fo EMS content, valid only when set flag SRV_SMS_PARA_CONTENT_EMS */
    S8 *content_file_path;              /* file path for SMS content, valid only when set flag SRV_SMS_PARA_CONTENT_FILE. */
    S8 *content_buff;                   /* buffer for SMS content, valid only when set flag SRV_SMS_PARA_CONTENT_BUFF. */
    U16 content_buff_size;              /* buffer size of content_buff */
    U16 content_size;                   /* The real size of the content in the content buffer */

    srv_sms_sim_enum sim_id;            /* SIM Card ID, refer to srv_sms_sim_enum */
    srv_sms_storage_enum storage_type;  /* Storage type, refer to srv_sms_storage_enum */

    MMI_BOOL is_with_obj;               /* flag of whether SMS include EMS object */

    srv_sms_pid_enum pid;               /* Protocol identifier,  refer to srv_sms_pid_enum */
    srv_sms_vp_enum vp;                 /* Validity-Period, refer to srv_sms_vp_enum */

    MMI_BOOL status_report;             /* Status report request or indication flag*/
    MMI_BOOL reply_path;                /* Reply path flag */

    srv_sms_dcs_enum dcs;               /* DCS, refer to srv_sms_dcs_enum */
    srv_sms_class_enum msg_class;       /* Class type, refer to srv_sms_class_enum */

    S8 sc_address[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];    /* SMS Service Center address */

    U16 src_port;                       /* Source port, valid only when set flag SRV_SMS_PARA_PORT. */
    U16 dest_port;                      /* Destination port, valid only when set flag SRV_SMS_PARA_PORT. */

    MYTIME timestamp;                   /* Timestamp, time of recieved, saved, sent SMS */
} srv_sms_msg_data_struct;

/* Read Message Callback Data Structure */
typedef struct
{
    srv_sms_msg_data_struct *msg_data;  /* SMS data information, it is a pointer from caller. Refer to srv_sms_msg_data_struct. */
} srv_sms_read_msg_cb_struct;

/* Add Message Callback Data Structure */
typedef struct
{
    U16 msg_id;             /* Saved SMS's message ID */
} srv_sms_save_msg_cb_struct;

/* Update Message Callback Data Structure */
typedef struct
{
    void *dummy;            /* dummy, not be used */
} srv_sms_update_msg_cb_struct;

/* Delete Message Callback Data Structure */
typedef struct
{
    void *dummy;            /* dummy, not be used */
} srv_sms_delete_msg_cb_struct;

/* Delete Message Array Callback Data Structure */
typedef struct
{
    U16 total_num;          /* Total number of SMS to be deleted */
    U16 delete_num;         /* Total number of SMS be deleted */
    U16 *succ_msg_list;     /* Buffer included all message ID be deleled successfully */
} srv_sms_delete_msg_array_cb_struct;

/* Delete Message Bitmap Callback Data Structure */
typedef struct
{
    U16 deleted_num;        /* Total number of SMS to be deleted */
    U16 bitmap_size;        /* Size of deleted_msg_bitmap */
    U8 *deleted_msg_bitmap; /* Bitmap array include all message ID be deleted */
} srv_sms_delete_msg_bitmap_cb_struct;

/* Copy Message Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
} srv_sms_copy_msg_cb_struct;

/* Move Message Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
} srv_sms_move_msg_cb_struct;

/* Copy Message to Archive Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
    S32 fs_error;           /* file system error, valid only when resule is MMI_FALSE in srv_sms_callback_struct */
} srv_sms_copy_msg_to_archive_cb_struct;

/* Move Message to Archive Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
    S32 fs_error;           /* file system error, valid only when resule is MMI_FALSE in srv_sms_callback_struct */
} srv_sms_move_msg_to_archive_cb_struct;

/* Copy Message From Archive Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
    S32 fs_error;           /* file system error, valid only when resule is MMI_FALSE in srv_sms_callback_struct */
} srv_sms_copy_msg_from_archive_cb_struct;

/* Move Archive Message to Default Folder Callback Data Structure */
typedef struct
{
    U16 dest_msg_id;        /* Desination message ID */
} srv_sms_move_archive_msg_cb_struct;

/* Change Message Status Callback Data Structure */
typedef struct
{
    void *dummy;            /* dummy, not be used */
} srv_sms_change_msg_status_cb_struct;


/* Change Message Status Callback Data Structure */
typedef struct
{
    S8 address[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
    S8 content[(SRV_SMS_MSG_INFO_CONTENT_LEN + 1) * ENCODING_LENGTH]; /* the content of SMS */
} srv_sms_get_msg_content_async_cb_struct;

/* Change Message Status Callback Data Structure */
typedef struct
{
    U16 deleted_msg_num;    /* The number of SMS be deteled */
} srv_sms_delete_msg_list_cb_struct;

/* Copy Msg List Callback Data Structure */
typedef struct
{
    U16 copied_msg_num;     /* The number of SMS be copied */
} srv_sms_copy_msg_list_cb_struct;

/* Move Msg List Callback Data Structure */
typedef struct
{
    U16 moved_msg_num;      /* The number of SMS be moved */
} srv_sms_move_msg_list_cb_struct;

/* Send Msg Callback Data Structure */
typedef struct
{
    U8 total_seg;                   /* Toal segment number of sent SMS */
    U8 msg_ref[SRV_SMS_MAX_SEG];    /* Message reference list of the submited PDUs */
    U16 report_id;                  /* Status Report ID related to a status report entry */
} srv_sms_send_msg_cb_struct;

/* Memory Status Structure */
typedef struct
{
    U16 me_total;           /* Total number of SMS in phone memory */
    U16 me_used;            /* Used number of SMS in phone memory */
    U16 sim_total;          /* Total number of SMS in SIM1 memory */
    U16 sim_used;           /* Used number of SMS in SIM1 memory */
#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
    U16 tcard_total;          /* Total number of SMS in SIM1 memory */
    U16 tcard_used;           /* Used number of SMS in SIM1 memory */
#endif
} srv_sms_memory_status_struct;

/* Query Data Structure */
typedef struct
{
    srv_sms_query_enum query_flag;      /* Query flag, refer to srv_sms_query_enum. indicate which atrributes below will be used to as query condition */
    srv_sms_sort_enum sort_flag;        /* Sort flag,, refer to srv_sms_sort_enum. indicating which type need to be sorted, refer to  srv_sms_sort_enum*/
    srv_sms_order_enum order_flag;      /* Order flag, refer to srv_sms_order_enum.indicating which order type be used, refer to srv_sms_order_enum */
    /* The Parameter folder_id is neccessary */
    srv_sms_folder_enum folder_id;      /* SMS folder id be query, refer to srv_sms_folder_enum */
    srv_sms_status_enum status;         /* SMS stauts, refer to srv_sms_status_enum. */ 
    srv_sms_storage_enum storage_type;  /* Storage type, refer to srv_sms_query_enum. */
    srv_sms_mti_enum mti;               /* MTI, refer to srv_sms_mti_enum. */
    srv_sms_pid_enum pid;               /* Protocol identifier, refer to srv_sms_pid_enum. */
    srv_sms_sim_enum sim_id;            /* SIM Card ID,  refer to srv_sms_storage_enum. */
    S8 number[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];            /* message number, only valid (query_flag&SRV_SMS_QUERY_NUMBER) is MMI_TRUE */
    S8 content[(SRV_SMS_MSG_INFO_CONTENT_LEN + 1) * ENCODING_LENGTH];   /* message content, only valid (query_flag&SRV_SMS_QUERY_CONTENT) is MMI_TRUE */
    MYTIME upper_time;                  /* Upper time, only valid when set flag SRV_SMS_QUERY_TIMESTAMP. */
    MYTIME lower_time;                  /* Lower time, only valid when set flag SRV_SMS_QUERY_TIMESTAMP. */
} srv_sms_query_struct;

/* Query Message Callback Data Structure */
typedef struct
{
    U16 msg_num;        /* the number of SMS be query */
    U16 *msg_id_list;   /* the SMS id list of SMS be query */
} srv_sms_query_msg_cb_struct;

/* Message Information Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;            /* SIM Card ID, refer to srv_sms_sim_enum */
    srv_sms_status_enum status;         /* SMS status, refer to srv_sms_status_enum */
    srv_sms_folder_enum folder_id;      /* Folder ID, refer to srv_sms_folder_enum */
    srv_sms_storage_enum storage_type;  /* Storage type, refer to srv_sms_storage_enum */
    srv_sms_pid_enum pid;               /* Protocol identifier, refer to srv_sms_pid_enum */
    srv_sms_sr_status_enum sr_status;   /* the sent status, refer to srv_sms_sr_status_enum */
    S8 number[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];            /* SMS number */
    S8 content[(SRV_SMS_MSG_INFO_CONTENT_LEN + 1) * ENCODING_LENGTH];   /* The content for list display */
    MYTIME timestamp;                   /* Timestamp, time of recieved, saved, sent SMS */
} srv_sms_msg_info_struct;

/* SMS Status Report Entry's Information structure */
typedef struct
{
    srv_sms_sr_status_enum status;  /* Status of status report, refer to srv_sms_sr_status_enum */
    U8 total_seg;                   /* Total segment number of SMS */
    U8 succ_num;                    /* Success segment numebr a SMS */
    U8 fail_num;                    /* Failded segment numebr a SMS */
    srv_sms_sim_enum sim_id;        /* SIM Card ID, refer to srv_sms_sim_enum */
    WCHAR number[SRV_SMS_MAX_ADDR_LEN + 1];     /* SMS address */
    U32 sec_timestamp;              /* UTC time, time of latest received status report or the creation time of a status report entry */
    MYTIME timestamp;               /* UI time */
} srv_sms_status_report_struct;

/* Message Update Event Data Structure */
typedef struct
{
    MMI_BOOL is_sms_ready;      /* Flag to indciate whether sms service is ready or not */
} srv_sms_event_sms_ready_struct;

#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
typedef struct
{
    MMI_BOOL is_tsms_ready;      /* Flag to indciate whether tcard service is ready or not */
} srv_sms_event_tsms_ready_struct;



typedef struct
{
    MMI_BOOL is_tcard_avail;      /* Flag to indciate whether tcard avail */
	MMI_BOOL is_phone_full;
	MMI_BOOL is_tcard_full;
	srv_sms_storage_enum pref_storage_type;
	srv_sms_storage_enum save_to_type;
} srv_sms_event_for_memory_status_struct;

#endif
/* Message New SMS Interrupt Event Callback Data Structure */
typedef struct
{
    U16 msg_id;         /* Message ID */
    U8  *content;       /* Conent of New Message */
    void *msg_data;     /* Detail information of new SMS, refer to srv_sms_new_msg_struct */
} srv_sms_event_new_sms_struct;

/* Message New status report Interrupt Event Callback Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;                    /* SIM card ID, refer to srv_sms_sim_enum */
    U16 report_id;                              /* Status report entry ID */
    srv_sms_status_report_struct report_data;   /* The data of status report , refer to srv_sms_status_report_struct */
} srv_sms_event_new_status_report_struct;

/* AT Command IND Event Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;        /* SIM card ID, refer to srv_sms_sim_enum */
    srv_sms_at_cmd_enum cmd_type;   /* AT command type, refer to srv_sms_at_cmd_enum */
} srv_sms_event_at_cmd_ind_struct;


/* SIM Refresh Event Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;        /* SIM card ID, refer to srv_sms_sim_enum */
} srv_sms_event_sim_refresh_struct;

/* Memory Full Event Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;        /* SIM card ID, refer to srv_sms_sim_enum */
    srv_sms_mem_enum mem_type;      /* Memory type, refer to srv_sms_mem_enum */
} srv_sms_event_mem_full_struct;

/* Memory available Event Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;        /* SIM card ID, refer to srv_sms_sim_enum */
    srv_sms_mem_enum mem_type;      /* Memory type, refer to srv_sms_mem_enum */
} srv_sms_event_mem_available_struct;

/* Memory Exceed Event Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;        /* SIM card ID, refer to srv_sms_sim_enum */
    srv_sms_mem_enum mem_type;      /* Memory type, refer to srv_sms_mem_enum */
} srv_sms_event_mem_exceed_struct;

/* Add Msg Event Data Structure */
typedef struct
{
    U16 msg_id;                         /* Message ID */
    srv_sms_msg_info_struct msg_info;   /* The message's base information, refer to srv_sms_msg_info_struct */
} srv_sms_event_add_struct;

/* Delete Msg Event Data Structure */
typedef struct
{
    U16 msg_id;                         /* Message ID */
    srv_sms_msg_info_struct msg_info;   /* The message's base information, refer to srv_sms_msg_info_struct */
} srv_sms_event_delete_struct;

/* Update Msg Event Data Structure */
typedef struct
{
    U16 msg_id;                             /* Message ID */
    srv_sms_para_enum change_para_flag;     /* Flag to indicate which information (parameter in the message information structure) is updated */
    srv_sms_msg_info_struct old_msg_info;   /* Original message information, refer to srv_sms_msg_info_struct */
    srv_sms_msg_info_struct new_msg_info;   /* New message information, refer to srv_sms_msg_info_struct */
} srv_sms_event_update_struct;

/* Clear message folder Event Data Structure */
typedef struct
{
    srv_sms_folder_enum folder_id;          /* Folder id, refer to srv_sms_folder_enum */
} srv_sms_event_clear_folder_struct;

/* Hide Box List Event Data Structure */
typedef struct
{
    MMI_BOOL is_hidden;
    srv_sms_box_enum list_type;          /* box_list, refer to srv_sms_box_enum */
} srv_sms_event_hide_list_struct;

/* new message waitting Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;                /* SIM card ID */
    void *msg_data;                         /* Message waiting information data, it is a void pointor to structure mmi_sms_msg_waiting_ind_struct data */
} srv_sms_event_msg_waitting_struct;

/* update idle status bar sending icon Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;    /* SIM card ID */
    MMI_BOOL is_show;           /* Flag of whether to show sending icon */
} srv_sms_event_update_sending_icon_struct;

/* update idle status bar sending icon Structure */
typedef struct
{
    U16 msg_id;                 /* Message ID */
    MMI_BOOL is_send_abort;     /* Is status change because send abort */
    srv_sms_send_status_enum status; /* Send status, refer to srv_sms_send_status_enum */
} srv_sms_event_update_unsent_msg_status_struct;

/* EVT_ID_SRV_SMS_ADD_REPORT event info Structure */
typedef struct
{
    U16 report_id;      /* Status report Entry ID */
    srv_sms_status_report_struct report_info;
} srv_sms_event_add_report_struct;

/* EVT_ID_SRV_SMS_DEL_REPORT event info Structure */
typedef struct
{
    U16 report_id;      /* Status report Entry ID */
    srv_sms_status_report_struct report_info;
} srv_sms_event_del_report_struct;

/* EVT_ID_SRV_SMS_UPDATE_REPORT event info Structure */
typedef struct
{
    U16 report_id;      /* Status report Entry ID */
    srv_sms_status_report_struct report_info;
} srv_sms_event_update_report_struct;

/* EVT_ID_SRV_SMS_ADD_TEMPLATE event info Structure */
typedef struct
{
    U16 template_id;      /* SMS template Entry ID */
    U16 list_index;
} srv_sms_event_add_template_struct;

/* EVT_ID_SRV_SMS_DEL_TEMPLATE event info Structure */
typedef struct
{
    U16 template_id;      /* SMS template Entry ID */
    U16 list_index;
} srv_sms_event_del_template_struct;

/* new Message Data Structure */
typedef struct
{
    U16 msg_id;                             /* Message ID */
    srv_sms_sim_enum sim_id;                /* SIM card ID, refer to  srv_sms_sim_enum */

    U16 ref;                                /* concatenated message reference */
    U8 total_seg;                           /* Total segments */
    U8 seg;                                 /* Segment sequence */

    U8 fo;                                  /* First octet */
    U8 mti;                                 /* MTI, refer to sms_srv_mti_enum */
    U8 dcs;                                 /* DCS, refer to sms_srv_dcs_enum */
    U8 pid;                                 /* Protocol identifier, refer to sms_srv_pid_enum */

    U8 data[1];                             /* Content */
    srv_sms_storage_enum storage_type;      /* Storage type, refer to srv_sms_storage_enum */

    U8 number[SRV_SMS_MAX_ADDR_LEN + 1];    /* SMS number */
    U8 sc_number[SRV_SMS_MAX_ADDR_LEN + 1]; /* SMS service center address */

    U16 dest_port;                          /* Destination port number */
    U16 src_port;                           /* Source port */
    U16 message_len;                        /* The length of SMS content */
    MYTIME timestamp;                       /* Timestamp */
} srv_sms_new_msg_struct;

/* Send simple port Message Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;    /* SIM card ID */
    U16 src_port;               /* Source port number */
    U16 dest_port;              /* Destination port number */
    U16 content_size;           /* Buffer size of content buffer, count by byte */
    S8 *number;                 /* Number, UCS format */
    S8 *content_buff;           /* Content buffer, UCS2 format */
    S8 *content_file_path;      /* Path name of the file which stored the SMS content */
} srv_sms_send_port_data_struct;

/* SMS setting structure */
typedef struct
{
    WCHAR profile_name[SRV_SMS_MAX_PROFILE_NAME_LEN + 1];
    S8 sc_addr[SRV_SMS_MAX_ADDR_LEN + 1];   /* SC address */
    srv_sms_vp_enum vp;                     /* Validity period */
    srv_sms_pid_enum pid;                   /* Protocol identifier */
    MMI_BOOL status_report;                 /* Status report request flag */
    MMI_BOOL reply_path;                    /* Reply path request flag */
} srv_sms_setting_struct;

/* To List Profile informaiton structure */
typedef struct
{
    U8 cur_req_profile_no;  /* Current request to get profile index information */
    U8 cur_max_ps_profiles; /* Total profiles number */
    U8 profile_name[SRV_SMS_MAX_LFOUR_PROFILES][(SRV_SMS_MAX_PROFILE_NAME_LEN *ENCODING_LENGTH) + ENCODING_LENGTH]; /* Profiles' name */
    U8 profile_name_len;    /* Maximum profile name length */
} srv_sms_profile_list_struct;

/* Total Profiles' detail informaiton structure */
typedef struct
{
    S32 vp_index;           /* Validity period index */
    S32 msg_type_index;     /* Message protocol identifier index */
    U8 profile_name[(SRV_SMS_MAX_PROFILE_NAME_LEN *ENCODING_LENGTH) + ENCODING_LENGTH]; /* Profile name */
    U8 profile_name_dcs;    /* Dcs of profile name */
    U8 profile_index;       /* Current Profile index */
    U8 sc_addr[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];                           /* Sc address */
#ifdef __MMI_MESSAGES_SMS_EMAIL__
    U8 email_addr[(SRV_SMS_MAX_ADDR_LEN * ENCODING_LENGTH) + ENCODING_LENGTH];          /* Email sc address */
#endif
} srv_sms_profile_struct;

/* Total Profiles' detail informaiton structure */
typedef struct
{
    U8 vp_index;           /* Validity period index */
    U8 msg_type_index;     /* Message protocol identifier index */
    U16 profile_name[SRV_SMS_MAX_PROFILE_NAME_LEN + 1]; /* Profile name */
    U8 profile_name_dcs;    /* Dcs of profile name */
    U8 profile_index;       /* Current Profile index */
    U8 sc_addr[SRV_SMS_MAX_ADDR_LEN + 1];                           /* Sc address */
#ifdef __MMI_MESSAGES_SMS_EMAIL__
    U8 email_addr[SRV_SMS_MAX_ADDR_LEN + 1];          /* Email sc address */
#endif
    U8 para; /* srv_sms_setting_para_enum */
} srv_sms_profile_ext_struct;

/* Set voicemail informaiton structure */
typedef struct
{
    U8 mailbox_name[(SRV_SMS_MAX_PROFILE_NAME_LEN *ENCODING_LENGTH) + ENCODING_LENGTH];  /* Voicemail name */
    U8 mailbox_name_dcs;    /* Voicemail name dcs */
    U8 malbox_name_len;     /* Maximum voicemail name length */
    U8 mailbox_number_len;  /* Maximum voicemail address length */
    U8 mailbox_index;       /* Current edit voicemail index */
    U8 mailbox_address[(MAX_CC_ADDR_LEN *ENCODING_LENGTH) + ENCODING_LENGTH];   /* Current edit voicemail address */
    U8 is_support_r4;       /* Support R4 or not */
    U8 default_index;       /* Default voicemail index */
} srv_sms_mailbox_edit_struct;

/* Total voicemail information structure */
typedef struct
{
    U16 dumy_align;         /* Only for align U16 */
    U8 p_mailbox_name[SRV_SMS_MAX_MAILBOX_NUM][(SRV_SMS_MAX_PROFILE_NAME_LEN + 1) *ENCODING_LENGTH];    /* Voicemail name */
    U8 p_mailbox_number[SRV_SMS_MAX_MAILBOX_NUM][(MAX_CC_ADDR_LEN +1 ) *ENCODING_LENGTH];               /* Voicemail address */
    U8 mailbox_name_dcs[SRV_SMS_MAX_MAILBOX_NUM]; /* Voicemail name dcs */
    U8 mailbox_name_len;    /* Maximum voicemail name length */
    U8 mailbox_number_len;  /* Maximum voicemail address length */
    U8 mailbox_number;      /* Total voicemail number */
#ifdef __MMI_MSG_REL4_SUPPORT__
    U8 is_support_r4;       /* Support R4 or not */
    U8 default_index;       /* Default voicemail index */
#endif /* __MMI_MSG_REL4_SUPPORT__ */ 
} srv_sms_mailbox_struct;

/* Set cc address structure */
typedef struct
{
    U8 sc_addr[(SRV_SMS_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];   /* Sc address */
    U8 index;       /* Profile index */
} srv_sms_edit_sc_struct;

/* Message waiting information Structure */
typedef struct
{
    U8 line_no;     /* line number */
    U8 waiting_num; /* message waiting number of this type */
    U8 ind_type;    /* Message waiting indication type */
} srv_sms_msg_waiting_struct;

/* Service request UI to send a SMS Structure */
typedef struct
{
    S8 number[SRV_SMS_MAX_ADDR_LEN + 1];    /* Send sms recipeint address */
    srv_sms_sim_enum sim_id;                /* SIM Card ID */
    U16 content_buff_size;                  /* Buffer size of content_buffer, count by byte */
    U16 *content_buff;                      /* Content buffer, UCS2 format */
} srv_sms_event_api_send_msg_struct;

/* SMS counter update Data Structure */
typedef struct
{
    srv_sms_sim_enum sim_id;    /* SIM Card ID*/
    void *msg_data;             /* message data */
} srv_sms_event_msg_counter_update_struct;

#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
typedef struct
{
    srv_sms_box_enum msg_box_type;
    srv_sms_storage_enum src_storage;
    srv_sms_storage_enum dest_storage;
    srv_sms_sim_enum sim_id;
} srv_sms_copy_move_tcard_struct;
#endif
#ifdef __SMS_CLOUD_SUPPORT__
typedef struct
{
    srv_sms_box_enum box_type;
    srv_sms_backup_restore_type_enum backup_restore_type;   /* where to backup or restore the sms */
    srv_cloud_set_opt_acct_info_struct *account_info;       /* account info */
} srv_sms_backup_restore_info_struct;

typedef struct
{
   srv_sms_box_enum box_type;
   srv_sms_action_enum action;
   U32 result;
   U16 cur_index;
   U16 Total_number;
} srv_sms_event_backup_restore_struct;
#endif
/*****************************************************************************
 * <GROUP  CallBackFunctions>
 *
 * FUNCTION
 *  SrvSmsCallbackFunc
 * DESCRIPTION
 *  SMS Service Callback function type.
 *  All SMS asynchronous operation is used callback mechanism to return the result. 
 * PARAMETERS
 * callback_data    [IN]   Callback result data, refer to  srv_sms_callback_struct.
 * RETURNS
 *  void
*****************************************************************************/
typedef void(*SrvSmsCallbackFunc)(srv_sms_callback_struct* callback_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 *
 * FUNCTION
 *  SrvSmsEventFunc
 * DESCRIPTION
 *  SMS Service interal event callback function. for interal using
 * PARAMETERS
 * event_data    [IN]   Event data, refer to srv_sms_event_struct
 * RETURNS
 *  MMI_BOOL    
*****************************************************************************/
typedef MMI_BOOL(*SrvSmsEventFunc)(srv_sms_event_struct* event_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_sms_ready
 * DESCRIPTION
 *  Check whether the SMS is ready.
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_sms_ready(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_sms_busy
 * DESCRIPTION
 *  Check wheter the SMS storage is busy for Reading, Saving, Deleting, Updating, etc.
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_sms_busy(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_read_msg
 * DESCRIPTION
 *  1. Read Message's Data, included message status, number, content and other attributes
 *     (Storage Type, SIM Card, Profile element, etc.) indicated by the flag;
 *  2. The buffer to save the content should be provided by caller.
 *  3. The Callback Action Data Structure is srv_sms_read_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  change_status   :   [IN]        Whether change the UNREAD Msg to READ
 *  msg_data        :   [IN/OUT]    Message Data For Filling back read data
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_read_msg(
                    U16 msg_id,
                    MMI_BOOL change_status,
                    srv_sms_msg_data_struct* msg_data,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_save_handle
 * DESCRIPTION
 *  Get a SMS_HANDLE For Saving or Updating Message
 * PARAMETERS
 *  void
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_get_save_handle(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_save_msg
 * DESCRIPTION
 *  1. Save a new message to SMS Storage.
 *  2. The Callers need to get a SMS save handle by API srv_sms_get_save_handle() first,
 *     then they can call the seting API (srv_sms_set_content() etc.) to set the parameters
 *     they concerned.
 *  3. If Caller specify those parameters (Status, Address, Content, SIM Card, Storage Type,
 *     Profile element, we will use them, otherwise, it will user the defaut value (If the 
 *     parameters is in the SMS setting, it will use the setting's value as defaut).
 *  4. The Callback Action Data Struct is srv_sms_save_msg_cb_struct.
 * PARAMETERS
 *  save_handle     :   [IN]        Save Handle
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_save_msg(
                SMS_HANDLE save_handle,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_msg
 * DESCRIPTION
 *  1. Delete an existed message;
 *  2. If the message is not existed, the result is FALSE;
 *  3. The Callback Action Data Structure is srv_sms_delete_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_delete_msg(
                    U16 msg_id,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_msg_bitmap
 * DESCRIPTION
 *  1. Delete the messages indicated by the msg_bitmap;
 *  2. The Callback Action Data Structure is srv_sms_delete_msg_bitmap_cb_struct;
 * PARAMETERS
 *  msg_bitmap      :   [IN]        The bitmap of the Message IDs
 *  byte_size       :   [IN]        The byte number of the msg_bitmap
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_delete_msg_bitmap(
                    U8 msg_bitmap[],
                    U16 byte_size,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg
 * DESCRIPTION
 *  1. Copy a existed message to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_copy_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  dest_storage    :   [IN]        Destination storage
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_copy_msg(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg
 * DESCRIPTION
 *  1. Copy a existed message to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_copy_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  dest_storage    :   [IN]        Destination storage
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_copy_msg_ext(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    srv_sms_sim_enum dest_sim_id,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg
 * DESCRIPTION
 *  1. Move a existed message to the destination storage, the original message 
 *     will be deleted after moved successfully;
 *  2. The Callback Action Data Structure is srv_sms_move_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  dest_storage    :   [IN]        Destination storage
 *  sim_id          :   [IN]        Destination SIM Card
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_move_msg(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg
 * DESCRIPTION
 *  1. Move a existed message to the destination storage, the original message 
 *     will be deleted after moved successfully;
 *  2. The Callback Action Data Structure is srv_sms_move_msg_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  dest_storage    :   [IN]        Destination storage
 *  sim_id          :   [IN]        Destination SIM Card
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_move_msg_ext(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    srv_sms_sim_enum sim_id,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_move_msg_to_archive
 * DESCRIPTION
 *  1. Move a existed message to Archive,  the original message 
 *     will be deleted after moved successfully;
 *  2. The Callback Action Data Structure is srv_sms_move_msg_to_archive_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_move_msg_to_archive(
                U16 msg_id,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg_to_archive
 * DESCRIPTION
 *  1. Copy a existed default folder message to Archive folder;
 *  2. The Callback Action Data Structure is srv_sms_copy_to_archive_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_copy_msg_to_archive(
                    U16 msg_id,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg_from_archive
 * DESCRIPTION
 *  1. Copy a existed Archive message to Default Folder.
 *  2. The Callback Action Data Structure is srv_sms_move_archive_msg_cb_struct;
 * PARAMETERS
 *  msg_id         :    [IN]        Message ID
 *  dest_storage   :    [IN]        Dest storage type
 *  callback_func  :    [IN]        Callback Function
 *  user_data      :    [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
 extern SMS_HANDLE srv_sms_copy_msg_from_archive(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_move_archive_msg
 * DESCRIPTION
 *  1. Move a existed Archive message to Default Folder, the original message 
 *     will be deleted after moved;
 *  2. The Callback Action Data Structure is srv_sms_move_archive_msg_cb_struct;
 * PARAMETERS
 *  msg_id         :    [IN]        Message ID
 *  dest_storage   :    [IN]        Dest storage type
 *  callback_func  :    [IN]        Callback Function
 *  user_data      :    [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
 extern SMS_HANDLE srv_sms_move_archive_msg(
                    U16 msg_id,
                    srv_sms_storage_enum dest_storage,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_change_msg_status
 * DESCRIPTION
 *  1. Change message's status;
 *  2. The Callback Action Data Structure is srv_sms_change_msg_status_cb_struct;
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  status          :   [IN]        Destination Status
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_change_msg_status(
                    U16 msg_id,
                    srv_sms_status_enum status,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_memory_status
 * DESCRIPTION
 *  Get SMS Memory status, if the sms is not ready, the result will be FALSE.
 * PARAMETERS
 *  status_data     :   [IN/OUT]    Memory Status Data Buffer
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_get_memory_status(srv_sms_sim_enum sim_id, srv_sms_memory_status_struct* status_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_query_msg
 * DESCRIPTION
 *  1. Query the messages with some properties.
 *  2. The caller can set the query_flag, and the corresponding paramenters of
 *     the propertied they wanted. The folder ID is mandatory in the current version;
 *  3. The caller also can specify the sort flag, in the current version, we only 
 *     support sorting by timestamp.
 *  4. The Callback Action Data Structure is srv_sms_query_msg_cb_struct;
 * PARAMETERS
 *  query_data      :   [IN]        Query Data
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_query_msg(
                srv_sms_query_struct* query_data,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_sort_msg
 * DESCRIPTION
 *  1. Sort the messages list.
 *  2. In the current version, we only support sorting by timestamp.
 * PARAMETERS
 *  msg_id_array    :   [IN]        Message ID Array
 *  msg_num         :   [IN]        Message Number
 *  sort_flag       :   [IN]        Sorting Type Flag
 *  order_flag      :   [IN]        Ordering Flag
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_sort_msg(
                U16* msg_id_array,
                U16 msg_num,
                srv_sms_sort_enum sort_flag,
                srv_sms_order_enum order_flag);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_asc_address
 * DESCRIPTION
 *  Get Message's Address (ASCII Format)
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  S8*
 *****************************************************************************/
extern const char* srv_sms_get_msg_asc_address(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_address
 * DESCRIPTION
 *  Get Message's Address (ASCII Format)
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  ucs2_addr_buff  :   [IN]        ucs2 address
 * RETURNS
 *  S8*
 *****************************************************************************/
extern void srv_sms_get_msg_address(U16 msg_id, char* ucs2_addr_buff);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_multi_addr_num
 * DESCRIPTION
 *  Get Message's mutli Address's number
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_msg_addr_num(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_multi_addr
 * DESCRIPTION
 *  Get Message's Address
 * PARAMETERS
 *  addr_buff       :   [IN]        ucs2 address buffer
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  S8*
 *****************************************************************************/
extern void srv_sms_get_msg_multi_addr(
                WCHAR* addr_buff,
                srv_sms_status_enum* send_status,
                U16 msg_id,
                U16 addr_index);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_content
 * DESCRIPTION
 *  Get Message's Content For List Display.
 *  This API only for SMS application Internal Using
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  S8*
 *****************************************************************************/
extern const char* srv_sms_get_msg_content(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_content_async
 * DESCRIPTION
 *  1. Get Message's Content (For List display) async(The Content is returned in
 *     the callback function).
 *  2. This API is only for This API only for SMS application Internal Using.
 *  3. The Callback Action Data Structure is srv_sms_get_msg_content_async_cb_struct.
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern SMS_HANDLE srv_sms_get_msg_content_async(
                    U16 msg_id,
                    SrvSmsCallbackFunc callback_func,
                    void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_timestamp
 * DESCRIPTION
 *  Get Message's Timestamp (MTTIME Format)
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 *  timestamp       :   [OUT]       Timestamp
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_get_msg_timestamp(U16 msg_id, MYTIME* timestamp);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_timestamp_utc_sec
 * DESCRIPTION
 *  Get Message's timestamp (UTC Second format)
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  U32
 *****************************************************************************/
extern U32 srv_sms_get_msg_timestamp_utc_sec(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_storage_type
 * DESCRIPTION
 *  Get Message's Storage Tpye
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  srv_sms_storage_enum
 *****************************************************************************/
extern srv_sms_storage_enum srv_sms_get_msg_storage_type(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_folder_id
 * DESCRIPTION
 *  Get Message's folder ID
 * PARAMETERS
 *  msg_id          :   [IN]        Message ID
 * RETURNS
 *  srv_sms_folder_enum
 *****************************************************************************/
extern srv_sms_folder_enum srv_sms_get_msg_folder_id(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_pid
 * DESCRIPTION
 *  Get Message's PID (Protocol Identifier)
 * PARAMETERS
 *  msg_id      :   [IN]    Message ID
 * RETURNS
 *  srv_sms_pid_enum
 *****************************************************************************/
extern srv_sms_pid_enum srv_sms_get_msg_pid(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_status
 * DESCRIPTION
 *  Get Message's Status
 * PARAMETERS
 *  msg_id      :   [IN]        Message ID
 * RETURNS
 *  srv_sms_status_enum
 *****************************************************************************/
extern srv_sms_status_enum srv_sms_get_msg_status(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_mti
 * DESCRIPTION
 *  Get Message's MTI (Message Type Indication)
 * PARAMETERS
 *  msg_id       :   [IN]        Message ID
 * RETURNS
 *  srv_sms_mti_enum
 *****************************************************************************/
extern srv_sms_mti_enum srv_sms_get_msg_mti(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_sim_id
 * DESCRIPTION
 *  Get Message's SIM Card ID
 * PARAMETERS
 *  msg_id      :    [IN]        Message ID
 * RETURNS
 *  srv_sms_sim_enum
 *****************************************************************************/
extern srv_sms_sim_enum srv_sms_get_msg_sim_id(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_port
 * DESCRIPTION
 *  Get Message's Destination Port Number
 * PARAMETERS
 *  msg_id          [IN]        Message ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_msg_port(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_size
 * DESCRIPTION
 *  Get Message's size, only for SMS application internal using
 * PARAMETERS
 *  msg_id      :    [IN]        Message ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_msg_size(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_delivery_status
 * DESCRIPTION
 *  Get sent Message's delivery status
 * PARAMETERS
 *  msg_id  :   [IN]    message id
 * RETURNS
 *  srv_sms_sr_status_enum
 *****************************************************************************/
extern srv_sms_sr_status_enum srv_sms_get_delivery_status(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_msg_exist
 * DESCRIPTION
 *  Check Wether the message is existed
 * PARAMETERS
 *  msg_id      :    [IN]        Message ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_msg_exist(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_msg_complete
 * DESCRIPTION
 *  Check whether the message is completed
 * PARAMETERS
 *  msg_id      :    [IN]        Message ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_msg_complete(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_unread_sms_num
 * DESCRIPTION
 *  Get Unread Message's number
 * PARAMETERS
 *  void
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_unread_sms_num(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_unread_sim_sms_num
 * DESCRIPTION
 *  Get Unread SIM Box Message's number
 * PARAMETERS
 *  void
 * RETURNS
 *  U16
 *****************************************************************************/
 extern U16 srv_sms_get_unread_sim_sms_num(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_id
 * DESCRIPTION
 *  Get message ID of the message in the box list
 * PARAMETERS
 *  msg_box_type   : [IN]        Message Box List Type
 *  list_index     : [IN]        The position of message in the Box List
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_msg_id(srv_sms_box_enum msg_box_type, U16 list_index);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_list_size
 * DESCRIPTION
 *  Get number of the messages in a box list
 * PARAMETERS
 *  msg_box_type   : [IN]        Message Box List Type
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_list_size(srv_sms_box_enum msg_box_type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_list_type
 * DESCRIPTION
 *  Get a message(with specific status, storage tpye, folder type)'s Box the Box List Type
 * PARAMETERS
 *  status         : [IN]        Message Status
 *  storage_type   : [IN]        Storage Type
 *  folder_id      : [IN]        Folder Type
 * RETURNS
 *  srv_sms_box_enum
 *****************************************************************************/
extern srv_sms_box_enum srv_sms_get_list_type(
                            srv_sms_status_enum status,
                            srv_sms_storage_enum storage_type,
                            srv_sms_folder_enum folder_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_list_index
 * DESCRIPTION
 *  Get position (list index) and box list type of the message
 * PARAMETERS
 *  msg_box_type  :  [OUT]       Message Box List type
 *  msg_id        :  [IN]        Message ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_msg_list_index(srv_sms_box_enum* msg_box_type, U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_msg_list
 * DESCRIPTION
 *  1. Delete all of the messages in the Message Box List.
 *  2. The Callback Action Data Structure is srv_sms_delete_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  sim_id          :   [IN]        SIM card id
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_delete_msg_list(
                srv_sms_box_enum msg_box_type,
                srv_sms_sim_enum sim_id,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_msg_list_ex
 * DESCRIPTION
 *  1. Delete all of the messages in the Message Box List.
 *  2. The Callback Action Data Structure is srv_sms_delete_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  sim_id          :   [IN]        SIM card id
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_delete_msg_list_ex(
                    srv_sms_box_enum msg_box_type,
                    srv_sms_sim_enum sim_id,
                    SrvSmsCallbackFunc callback_func,
                    void* user_data);
/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg_list
 * DESCRIPTION
 *  1. Copy all of the messages in the Message Box List to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_copy_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  dest_storage    :   [IN]        Destination Storage
 *  sim_id          :   [IN]        SIM Card ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_copy_msg_list(
                srv_sms_box_enum msg_box_type,
                srv_sms_storage_enum dest_storage,
                srv_sms_sim_enum sim_id,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_move_msg_list
 * DESCRIPTION
 *  1. Move all of the messages in the Message Box List to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_move_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  dest_storage    :   [IN]        Destination Storage
 *  sim_id          :   [IN]        SIM Card ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_move_msg_list(
                srv_sms_box_enum msg_box_type,
                srv_sms_storage_enum dest_storage,
                srv_sms_sim_enum sim_id,
                SrvSmsCallbackFunc callback_func,
                void* user_data);


#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_msg_list
 * DESCRIPTION
 *  1. Copy all of the messages in the Message Box List to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_copy_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  dest_storage    :   [IN]        Destination Storage
 *  sim_id          :   [IN]        SIM Card ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_copy_msg_list_tcard(
                srv_sms_copy_move_tcard_struct *act_cntx,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_move_msg_list
 * DESCRIPTION
 *  1. Move all of the messages in the Message Box List to the destination storage;
 *  2. The Callback Action Data Structure is srv_sms_move_msg_list_cb_struct.
 * PARAMETERS
 *  msg_box_type    :   [IN]        Message Box List Type
 *  dest_storage    :   [IN]        Destination Storage
 *  sim_id          :   [IN]        SIM Card ID
 *  callback_func   :   [IN]        Callback Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_move_msg_list_tcard(
                srv_sms_copy_move_tcard_struct *act_cntx,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_tcard_valid
 * DESCRIPTION
 *  Check whether the tcard is valid.
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_tcard_valid(void);

#endif
/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_msg_recent_event_flag
 * DESCRIPTION
 *  Get Message's recent event flag
 * PARAMETERS
 *  msg_id      :   [IN]        Message ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_get_msg_recent_event_flag(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_clear_msg_recent_event_flag
 * DESCRIPTION
 *  Clear Message Recent Event Flag
 * PARAMETERS
 *  msg_id      :   [IN]        Message ID
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_clear_msg_recent_event_flag(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_clear_all_sms_recent_event_flag
 * DESCRIPTION
 *  Clear All SMS Recent Event Flag
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_clear_all_sms_recent_event_flag(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_interrupt_event_handler
 * DESCRIPTION
 *  Set Interrupt Event Handler of the Event
 * PARAMETERS
 *  event_id        :   [IN]        Event ID
 *  event_func      :   [IN]        Event Handler Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_interrupt_event_handler(
                U16 event_id,
                SrvSmsEventFunc event_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_clear_interrupt_event_handler
 * DESCRIPTION
 *  Clear Interrupt Event Handler of the Event
 * PARAMETERS
 *  event_id        :   [IN]        Event ID
 *  event_func      :   [IN]        Event Handler Function
 *  user_data       :   [IN]        User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_clear_interrupt_event_handler(
                U16 event_id,
                SrvSmsEventFunc event_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_malloc_ems_data
 * DESCRIPTION
 *  1. Allocate an EMSData Buffer (need to cast it to type EMSData)
 *  2. This API is for SMS application Internal Using
 * PARAMETERS
 *  void
 * RETURNS
 *  void*
 *****************************************************************************/
extern void* srv_sms_malloc_ems_data(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_free_ems_data
 * DESCRIPTION
 *  1. Free an EMSData Buffer
 *  2. This API is for SMS application Internal Using
 * PARAMETERS
 *  ems_buff    :    [IN]        EMS Buffer
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_free_ems_data(void* ems_buff);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_reset_ems_data
 * DESCRIPTION
 *  Reset EMSData Buffer
 *  This API is for SMS application Internal Using
 * PARAMETERS
 *  ems_data    :    [IN]        EMS Data   
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_reset_ems_data(void *ems_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_copy_ems_data
 * DESCRIPTION
 *  Copy EMSData Buffer to Destination EMS Buffer
 *  This API is for SMS application Internal Using
 * PARAMETERS
 *  dest_ems_data   :    [IN]        Destination EMS Data
 *  src_ems_data    :    [IN]        Source EMS Data
 * RETURNS
 *  MMI_BOOL    
 *****************************************************************************/
extern MMI_BOOL srv_sms_copy_ems_data(void* dest_ems_data, void* src_ems_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_write_ems_data_to_file
 * DESCRIPTION
 *  1. Write an EMSData Buffer to File;
 *  2. If the return value is less than zero, it result is FALSE, otherwise it is TRUE.
 *  3. This API is for SMS application Internal Using
 * PARAMETERS
 *  file_path   :    [IN]    File Path (UCS2 Format)
 *  ems_data    :    [IN]    EMS Data Buffer
 *  fs_error    :    [OUT]   File System Error
 * RETURNS
 *  S32
 *****************************************************************************/
extern S32 srv_sms_write_ems_data_to_file(char *file_path, void *ems_data, S32* fs_error);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_read_ems_data_from_file
 * DESCRIPTION
 *  1. Read an EMSData From File
 *  2. If the return value is less than zero, it result is FALSE, otherwise it is TRUE.
 *  3. This API is for SMS application Internal Using
 * PARAMETERS
 *  ems_data     :   [IN]    EMS Data Buffer
 *  file_path    :   [IN]    File Path (UCS2 Format)
 *  fs_error     :   [OUT]   File System Error
 * RETURNS
 *  S32
 *****************************************************************************/
extern S32 srv_sms_read_ems_data_from_file(void *ems_data, char *file_path, S32* fs_error);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_ucs2_text_msg
 * DESCRIPTION
 *  Send SMS only with content, number and sim id
 *  This API is a simple mode to request service to send SMS
 * PARAMETERS
 *  ucs2_content    :    [IN]    Send SMS content buffer, all are ucs2 charachters        
 *  ucs2_number     :    [IN]    Recipient buffer, numbers are ucs2 charachters     
 *  sim_id          :    [IN]    SIM Card ID    
 *  callback_func   :    [IN]    Callback function    
 *  user_data       :    [IN]    User data     
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_send_ucs2_text_msg(
                char *ucs2_content,
                char *ucs2_number,
                srv_sms_sim_enum sim_id,
                SrvSmsCallbackFunc callback_func,
                void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_asc_text_msg
 * DESCRIPTION
 *  Send SMS only with content, number and sim id
 *  This API is a simple mode to request service to send SMS
 * PARAMETERS
 *  asc_content     :    [IN]    Send SMS content buffer, all are ASCII charachters           
 *  asc_number      :    [IN]    Recipient buffer, numbers are ASCII charachters         
 *  sim_id          :    [IN]    SIM Card ID          
 *  callback_func   :    [IN]    Callback function        
 *  user_data       :    [IN]    User data         
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_send_asc_text_msg(
                char *asc_content,
                char *asc_number,
                srv_sms_sim_enum sim_id,
                SrvSmsCallbackFunc callback_func,
                void *user_data);


/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_data_msg
 * DESCRIPTION
 *  Send port SMS
 *  This API is a simple mode to request service to send port SMS
 * PARAMETERS
 *  send_data       :    [IN]    Send SMS's data information    
 *  callback_func   :    [IN]    Callback function        
 *  user_data       :    [IN]    User data         
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_send_data_msg(
                srv_sms_send_port_data_struct *send_data,
                SrvSmsCallbackFunc callback_func,
                void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_send_handle
 * DESCRIPTION
 *  1. send a new message by SMS HANDLE
 *  2. The Callers need to get a SMS send handle by API srv_sms_get_send_handle() first,
 *     then they can call the seting API (srv_sms_set_content() etc.) to set the parameters
 *     they concerned. Then Call srv_sms_send_msg()to start to send SMS.
 *  3. If Caller specify those parameters (Status, Address, Content, SIM Card, Storage Type,
 *     Profile element, we will use them, otherwise, it will use the defaut value (If the 
 *     parameters is in the SMS setting, it will use the setting's value as defaut).
 *  4. The Callback Action Data is: S8 number[SRV_SMS_MAX_ADDR_LEN + 1].
 * PARAMETERS
 *  Void
 * RETURNS
 *  SMS_HANDLE
 *****************************************************************************/
extern SMS_HANDLE srv_sms_get_send_handle(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_msg
 * DESCRIPTION
 *  Send SMS using SMS_HANDLE
 *  This sms handle is initialized after srv_sms_get_send_handle(),
 *  Send informations are set by calling srv_sms_set_xxx().
 * PARAMETERS
 *  send_handle     :   [IN]    SMS send hanlde
 *  callback_func   :   [IN]    Callback function        
 *  user_data       :   [IN]    User data 
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_send_msg(SMS_HANDLE send_handle, SrvSmsCallbackFunc callback_func, void *user_data);


/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_send_action_busy
 * DESCRIPTION
 *  Check if forground send busy, corresponding send type is SRV_SMS_FG_SEND
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_send_action_busy(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_bg_send_action_busy
 * DESCRIPTION
 *  Check if background send busy, corresponding send type is SRV_SMS_BG_SEND
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_bg_send_action_busy(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_address
 * DESCRIPTION
 *  Set SMS send or save handle's recipient address
 * PARAMETERS
 *  sms_handle  :   [IN]    SMS hanlde
 *  ucs2_addr   :   [IN]    UCS2 Address  
 * RETURNS
 *  void
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_address(SMS_HANDLE sms_handle, char *ucs2_addr);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_append_address
 * DESCRIPTION
 *  When support mutli-address, we can use this API to append an address into a message. 
 * PARAMETERS
 *  sms_handle  :   [IN]    SMS hanlde
 *  ucs2_addr   :   [IN]    UCS2 Address
 *  status      :   [IN]    Send Status of this address
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_append_address(
                SMS_HANDLE sms_handle,
                WCHAR* ucs2_addr,
                srv_sms_status_enum status);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_content
 * DESCRIPTION
 *  set content.
 *  1>  The default content will consider as UCS2 text; And its default 
 *      DCS is UCS2;
 *  2>  If set the DCS as GSM Default 7Bit, we will change the DCS to UCS2 when 
 *      the content contains UCS2 characters. But if caller specify the DCS 
 *      to UCS2, we willn't change DCS even if the content don't contain UCS2
 *      characters.
 *  3>  If you want the specify the DCS, you need to call API srv_sms_set_content_dcs()
 *      to set the DCS. 
 *  4>  For the 8Bit DCS (SRV_SMS_DCS_8BIT), must set 8bit content, the content will be considered 
 *      as binary Data.
 *  5>  For the 7Bit DCS (SRV_SMS_DCS_7BIT), must set 7Bit content buffer.
 *  6>  Content size is buffer size, size of Bytes.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  content_buff   :   [IN]    S8 content_buff[content_size + ENCODING_LENGTH], content dcs is ucs2
 *  content_size   :   [IN]    size of Bytes  
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_content(SMS_HANDLE sms_handle, char *content_buff, U16 content_size);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_content_dcs
 * DESCRIPTION
 *  Specify the content's DCS.
 *  If DCS is 8BIT (SRV_SMS_DCS_8BIT), the content will be considered as binary Data,
 *  otherwise, the content is a text buffer.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  dcs            :   [IN]    srv_sms_dcs_enum   
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_content_dcs(SMS_HANDLE sms_handle, srv_sms_dcs_enum dcs);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_content_text_file
 * DESCRIPTION
 *  set content file path,file path dcs is UCS2, but file content default is 7BIT characters. 
 *  If content is UCS2 or 8BIT characters, must use srv_sms_set_content_dcs() set DCS, 
 *  otherwise no need set DCS.
 * PARAMETERS
 *  sms_handle          :   [IN]    SMS hanlde
 *  content_file_path   :   [IN]    file path     
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_content_file(SMS_HANDLE sms_handle, char *content_file_path);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_content_ems
 * DESCRIPTION
 *  set content with EMS buffer.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  content_ems    :   [IN]    it is a EMS_DATA buffer      
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_content_ems(SMS_HANDLE sms_handle, void *content_ems);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_data_port
 * DESCRIPTION
 *  Set data port number.
 *  IF send port SMS, need set port number.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  src_port       :   [IN]    Source port number   
 *  dest_port      :   [IN]    Dest port number
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_data_port(SMS_HANDLE sms_handle, U16 src_port, U16 dest_port);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_sim_id
 * DESCRIPTION
 *  Set SIM card ID. If open dual sim must set this information.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  sim_id         :   [IN]    SIM Card ID   
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_sim_id(SMS_HANDLE sms_handle, srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_status_report
 * DESCRIPTION
 *  Specify if need message status report.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  is_set         :   [IN]    on or off       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_status_report(SMS_HANDLE sms_handle, MMI_BOOL is_set);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_sc_address
 * DESCRIPTION
 *  Specify message sc address.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  sc_addr        :   [IN]    sc address
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_sc_address(SMS_HANDLE sms_handle, char* sc_addr);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_pid
 * DESCRIPTION
 *  Specify message protocol identifier.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  pid            :   [IN]    protocol identifier        
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_pid(SMS_HANDLE sms_handle, srv_sms_pid_enum pid);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_vp
 * DESCRIPTION
 *  Specify message validity period.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  vp             :   [IN]    validity period       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_vp(SMS_HANDLE sms_handle, srv_sms_vp_enum vp);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_class_type
 * DESCRIPTION
 *  Specify message class type.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  class_type     :   [IN]    Message Class Type       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_class_type(SMS_HANDLE sms_handle, srv_sms_class_enum class_type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_set_reply_path
 * DESCRIPTION
 *  Specify message if need reply path.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  is_set         :   [IN]    on or off       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_reply_path(SMS_HANDLE sms_handle, MMI_BOOL is_set);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_reply_msg_id
 * DESCRIPTION
 *  If this send or save is a reply action, need set reply message id
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  reply_msg_id   :   [IN]    reply message id       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_reply_msg_id(SMS_HANDLE sms_handle, U16 reply_msg_id);

/*****************************************************************************
 * FUNCTION
 * srv_sms_set_send_type
 * DESCRIPTION
 * Specify send message way. 
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  type           :   [IN]    send message way      
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_send_type(SMS_HANDLE sms_handle, srv_sms_send_type_enum type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_mms
 * DESCRIPTION
 *  Set more message to send parameter
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  is_mms         :   [IN]    more message to send         
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_mms(SMS_HANDLE sms_handle, MMI_BOOL is_mms);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_not_allow_empty_sc
 * DESCRIPTION
 *  Set not allow Sc address empty. IF SC address empty, send fail directly.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde               
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_not_allow_empty_sc(SMS_HANDLE sms_handle);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_no_sending_icon
 * DESCRIPTION
 *  Specify service will not send event of showing sending status icon to UI 
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde              
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_no_sending_icon(SMS_HANDLE sms_handle);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_counter_without_change
 * DESCRIPTION
 *  Specify after send SMS success, SMS counter will not increase.
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde               
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_counter_without_change(SMS_HANDLE sms_handle);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_status
 * DESCRIPTION
 *  Set message status
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  status         :   [IN]    SMS status
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_status(SMS_HANDLE sms_handle, srv_sms_status_enum status);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_save_timestamp
 * DESCRIPTION
 *  Only for Save message
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  timestamp      :   [IN]    time stamp
 * RETURNS
 *  
 *****************************************************************************/
extern void srv_sms_set_save_timestamp(SMS_HANDLE sms_handle, MYTIME* timestamp);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_storage_type
 * DESCRIPTION
 *  Set Storage Type, only for Save or Update Message
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde
 *  storage_type   :   [IN]    storage type   
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_storage_type(SMS_HANDLE sms_handle, srv_sms_storage_enum storage_type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_abort_send
 * DESCRIPTION
 *  Abort send message with sms handle which is got by srv_sms_get_send_handle().
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde     
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_abort_send(SMS_HANDLE sms_handle);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_clear_send_callback
 * DESCRIPTION
 *  clear Ap's callback function, then if abort, will not callback any result to AP
 * PARAMETERS
 *  sms_handle     :   [IN]    SMS hanlde   
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_clear_send_callback(SMS_HANDLE sms_handle);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_send_action_pending
 * DESCRIPTION
 *  check if corresponding send way busy
 * PARAMETERS
 *  type     :   [IN]    send sms way 
 * RETURNS
 *  void
 *****************************************************************************/
MMI_BOOL srv_sms_check_send_action_pending(srv_sms_send_type_enum type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_dst_number
 * DESCRIPTION
 *  check if the number is valid
 * PARAMETERS
 *  num     :    [IN]        Dst number
 *  numLen  :    [IN]        Number length
 * RETURNS
 *  return true if number is valid, else return false
 *****************************************************************************/
extern MMI_BOOL srv_sms_check_dst_number(U8 *num, U8 numLen);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_sc_number
 * DESCRIPTION
 *  check if the SMS SC is valid
 * PARAMETERS
 *  num     :    [IN]        SC number
 *  numLen  :    [IN]        SC number length
 * RETURNS
 *  return true if number is valid, else return false
 *****************************************************************************/
extern BOOL srv_sms_check_sc_number(U8 *num, U8 numLen);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_hide_send_sms_menu_item
 * DESCRIPTION
 *  Check Ap if need hide send sms memu
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_hide_send_sms_menu_item(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_dst_number
 * DESCRIPTION
 *  check if the number is valid
 * PARAMETERS
 *  ucs2_num   :      [IN]         number
 * RETURNS
 *  return true if number is valid, else return false
 *****************************************************************************/
extern MMI_BOOL srv_sms_check_ucs2_number(char* ucs2_num);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_cur_segment
 * DESCRIPTION
 *  set the current used segment
 * PARAMETERS
 *  ems_data  :   [IN]   EMD_DATA*
 *  sim_id    :   [IN]   SIM Card ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_set_cur_segment(void *ems_data, srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_setting_para
 * DESCRIPTION
 *  Get corresponding type setting information.
 * PARAMETERS
 *  type            :   [IN]    SMS setting type
 *  get_data        :   [IN]    data buffer of caller allocated    
 *  sim_id          :   [IN]    SIM Card ID
 *  callback_func   :   [IN]    Callback function        
 *  user_data       :   [IN]    User data 
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_get_setting_para(
                    srv_sms_setting_type_enum type,
                    void* get_data,
                    srv_sms_sim_enum sim_id,
                    SrvSmsCallbackFunc callback_func,
                    void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_setting_para
 * DESCRIPTION
 *  Set corresponding type setting information.
 *  Only set SRV_SMS_LONG_SMS_DYNAMIC_SEG and SRV_SMS_SAVE_SENT_SMS can return right
 *  value, others will always return MMI_TRUE.
 * PARAMETERS
 *  type            :   [IN]    SMS setting type
 *  set_data        :   [IN]    data buffer of caller allocated    
 *  sim_id          :   [IN]    SIM Card ID
 *  callback_func   :   [IN]    Callback function        
 *  user_data       :   [IN]    User data 
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_setting_para(
                    srv_sms_setting_type_enum type,
                    void* set_data,
                    srv_sms_sim_enum sim_id,
                    SrvSmsCallbackFunc callback_func,
                    void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_default_setting
 * DESCRIPTION
 *  Get default SMS setting information
 * PARAMETERS
 *  sim_id          :   [IN]    SIM Card ID
 * RETURNS
 *  srv_sms_setting_struct
 *****************************************************************************/
extern const srv_sms_setting_struct* srv_sms_get_default_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_email_sc_address
 * DESCRIPTION
 *  Used to get active email sc address
 * PARAMETERS
 *  void
 * RETURNS
 *  S8*
 *****************************************************************************/
extern const char* srv_sms_get_email_sc_address(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_mailbox_name
 * DESCRIPTION
 *  Find name correspond to number.
 *  If find name correspond to number, return MMI_TRUE; else if not find, return MMI_FALSE.
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 *  ucs2_num  :   [IN]     U16 *ucs2_num[(MAX_CC_ADDR_LEN +1]
 *  ucs2_name :   [OUT]    The buffer need caller molloc and free,U16 *ucs2_name[SRV_SMS_MAX_PROFILE_NAME_LEN + 1]                         
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_get_mailbox_name(srv_sms_sim_enum sim_id, U16 *ucs2_num, U16 *ucs2_name);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_r4_support
 * DESCRIPTION
 *  Check if support R4
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_check_r4_support(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_actived_profile_pid
 * DESCRIPTION
 *  Get active profile protocol identifier
 * PARAMETERS
 *  void
 * RETURNS
 *  U8
 *****************************************************************************/
extern U8 srv_sms_get_actived_profile_pid(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_mailbox_setting
 * DESCRIPTION
 *  Get mailbox mailbox setting information
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  srv_sms_mailbox_struct
 *****************************************************************************/
extern const srv_sms_mailbox_struct* srv_sms_get_mailbox_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_7bit_setting
 * DESCRIPTION
 *  Check if 7bit character setting is on or off
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_7bit_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_7bit_setting
 * DESCRIPTION
 *  Set 7bit character setting as on or off
 * PARAMETERS
 *  is_set    :   [IN]     on or off 7bit character setting
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_7bit_setting(MMI_BOOL is_set, srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_save_sent_sms_setting
 * DESCRIPTION
 *  Check if save sent message is on or off
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL    
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_save_sent_sms_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_save_sent_sms_setting
 * DESCRIPTION
 *  Set save sent message as on or off
 * PARAMETERS
 *  isSave    :   [IN]     on or off save sent message
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL  srv_sms_set_save_sent_sms_setting(MMI_BOOL isSave, srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_highlight_view_setting
 * DESCRIPTION
 *  Check if hightlight viewer is on or off
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_highlight_view_setting(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_highlight_view_setting
 * DESCRIPTION
 *  Set hightlight viewer as on or off
 * PARAMETERS
 *  is_set    :   [IN]     on or off hightlight viewer
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_highlight_view_setting(MMI_BOOL is_set);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_long_sms_dynamic_seg
 * DESCRIPTION
 *  Check if send long text message is on or off
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_long_sms_dynamic_seg_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_long_sms_dynamic_seg_setting
 * DESCRIPTION
 *  Set send long text message as on or off
 * PARAMETERS
 *  flag      :   [IN]     on or off send long text message
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_long_sms_dynamic_seg_setting(MMI_BOOL flag, srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_delivery_report_setting
 * DESCRIPTION
 *  Check if delivery report is on or off
 * PARAMETERS
 *  sim_id    :   [IN]     SIM Card ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_delivery_report_setting(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_sms_valid
 * DESCRIPTION
 *  Check if SMS is valid
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_sms_valid(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_unsent_msg_status
 * DESCRIPTION
 *  Get outbox unsent message status when open background send from storage
 * PARAMETERS
 *  msg_id    :   [IN]     message id
 * RETURNS
 *  srv_sms_send_status_enum
 *****************************************************************************/
extern srv_sms_send_status_enum srv_sms_get_unsent_msg_status(U16 msg_id);

#ifdef __SRV_SMS_BACKGROUND_SEND_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_unsent_msg_status
 * DESCRIPTION
 *  Set unsent message status when open background send from storage
 * PARAMETERS
 *  msg_id    :   [IN]     message id
 *  status    :   [IN]     unsent message's send status
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_unsent_msg_status(U16 msg_id, srv_sms_send_status_enum status);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_unsent_msg_status_ext
 * DESCRIPTION
 *  This API used for send/cancle outbox unsent message (background send from storage).
 * PARAMETERS
 *  msg_id          :   [IN]     message id
 *  status          :   [IN]     unsent message's send status
 *  callback        :   [IN]     Callback function        
 *  user_data       :   [IN]     User data 
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_unsent_msg_status_ext(U16 msg_id, srv_sms_send_status_enum status, SrvSmsCallbackFunc callback, void *user_data);
#endif /* __SRV_SMS_BACKGROUND_SEND_SUPPORT__ */

/* DOM-NOT_FOR_SDK-BEGIN */
/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_prefer_storage
 * DESCRIPTION
 *  Get SMS prefer storage
 *  Only CMCC project support dual SIM with single sim set, other project all sim use same setting
 * PARAMETERS
 *  sim_id   :  [IN]   sms sim  id     
 * RETURNS
 *  void
 *****************************************************************************/
extern srv_sms_storage_enum srv_sms_get_prefer_storage(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_prefer_storage
 * DESCRIPTION
 *  Set SMS prefer storage
 *  Only CMCC project support dual SIM with single sim set, other project all sim use same setting
 * PARAMETERS
 *  type        :  [IN]   storage type     
 *  sim_id      :  [IN]   sms sim  id
 * RETURNS
 *  void
 *****************************************************************************/
extern MMI_BOOL srv_sms_set_prefer_storage(srv_sms_storage_enum type, srv_sms_sim_enum sim_id);


#ifdef __SRV_SMS_TCARD_STORAGE_SUPPORT__
extern srv_sms_filter_enum srv_sms_get_storage_filter(void);
extern MMI_BOOL srv_sms_set_storage_filter(srv_sms_filter_enum filter);
#endif


#if defined(__MMI_OP11_HOMESCREEN__) || defined(__MMI_OP12_TOOLBAR__) || defined(__MMI_VUI_HOMESCREEN__)
/*****************************************************************************
 * FUNCTION
 *  srv_sms_set_voicemail_time
 * DESCRIPTION
 *  Set voicemail information to NVRAM
 * PARAMETERS
 *  line_no   :  [IN]   line number     
 *  time      :  [IN]   receive voicemail time
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_set_voicemail_time(U8 line_no, MYTIME *time);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_voicemail_time
 * DESCRIPTION
 *  Get voicemail information to NVRAM
 * PARAMETERS
 *  line_no   :  [IN]   line number     
 *  time      :  [IN]   receive voicemail time       
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_get_voicemail_time(U8 line_no, MYTIME *time);
#endif /* defined(__MMI_OP11_HOMESCREEN__) || defined(__MMI_OP12_TOOLBAR__) || defined(__MMI_VUI_HOMESCREEN__)*/ 

/* DOM-NOT_FOR_SDK-END */


/*****************************************************************************
 * FUNCTION
 *  srv_sms_reset_sms_counter
 * DESCRIPTION
 *  sms common reset counter value
 * PARAMETERS
 *  sim_id          :   [IN]     SIM Card ID
 *  sms_count_type  :   [IN]     SMS counter type
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_reset_sms_counter(srv_sms_sim_enum sim_id,  srv_sms_count_type_enum sms_count_type);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_sms_counter
 * DESCRIPTION
 *  sms common get counter value
 * PARAMETERS
 *  sim_id          :   [IN]     SIM Card ID
 *  sms_count_type  :   [IN]     SMS counter type
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_sms_counter(srv_sms_sim_enum sim_id, srv_sms_count_type_enum sms_count_type);


/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_sms_segment_number
 * DESCRIPTION
 *  This function is used to get number of segments of SMS message.
 * PARAMETERS
 *  UCS2_count             :     [IN]        UCS2 character number
 *  char_count             :     [IN]        Character (GSM-7Bit and UCS2) total number
 *  extension_char_count   :     [IN]        GSM-7Bit extension character number      
 * RETURNS
 *  void
 *****************************************************************************/
extern U8 srv_sms_get_sms_segment_number(U16 UCS2_count, U16 char_count, U16 extension_char_count);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_last_segment_remaining
 * DESCRIPTION
 *  This function is used to get number of remaining characters of last segment.
 * PARAMETERS
 *  UCS2_count             :     [IN]        UCS2 character number
 *  char_count             :     [IN]        Character (GSM-7Bit and UCS2) total number
 *  extension_char_count   :     [IN]        GSM-7Bit extension character number
 * RETURNS
 *  void
 *****************************************************************************/
extern U8 srv_sms_get_last_segment_remaining(U16 UCS2_count, U16 char_count, U16 extension_char_count);

/*****************************************************************************
* FUNCTION
*  srv_sms_get_usable_text_len
* DESCRIPTION
*  This function is used to get number of max characters of SMS message.
* PARAMETERS
*  dcs          :   [IN]      data code scheme
* RETURNS
*  U16  number of max characters
*****************************************************************************/
extern U16 srv_sms_get_usable_text_len(U8 dcs);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_event_api_send_msg
 * DESCRIPTION
 *  This API is only used by UCM send sms(reject by SMS).
 * PARAMETERS
 *  msg_data    :    [IN]      send message information
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_event_api_send_msg(srv_sms_event_api_send_msg_struct *msg_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_check_ucs2
 * DESCRIPTION
 *  Check whether the DCS of text buffer is UCS2.
 *  If all of the characters in the text buffer is in GSM 7Bit character sets,
 *  the DCS is GSM 7Bit, otherwise the DCS is UCS2.
 *  return MMI_TRUE if UCS2 characters exists, else return MMI_FALSE
 * PARAMETERS
 *  ucs2_text_buff   :    [IN]    text buff (Unicode Format)
 *  char_num         :    [IN]    Character number 
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_check_ucs2(char* ucs2_text_buff, U16 char_num);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_encode_no_sandard_char
 * DESCRIPTION
 *  Encode two byte to a non-standard character
 * PARAMETERS
 *  high_byte    :   [IN]    High Byte
 *  low_byte     :   [IN]    Low Byte
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_encode_no_sandard_char(U8 high_byte, U8 low_byte);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_no_standard_character
 * DESCRIPTION
 *  check whether a character is non_standard GSM 7Bit character
 * PARAMETERS
 *  ucs2_char    :   [IN]    UCS2 Character
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_no_standard_character(U16 ucs2_char);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_add_escape_char
 * DESCRIPTION
 *  Added '0x1b' before extionsion char.
 *  Caller must make sure the dest_buff size is at least 
 *  twice more than src_buff size.
 * PARAMETERS
 *  dest_buff    :   [OUT]       dest buffer 
 *  src_buff     :   [IN]        source buffer
 *  char_num     :   [IN]        Number of char in srcBuffer
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_add_escape_char(char* dest_buff, char* src_buff, U16 char_num);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_remove_escape_char
 * DESCRIPTION
 *  remove '0x1b' before extionsion char
 * PARAMETERS
 *  dest_buff    :   [OUT]       dest buffer 
 *  src_buff     :   [IN]        source buffer
 *  char_num     :   [IN]        Number of char in srcBuffer
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_remove_escape_char(char* dest_buff, char* src_buff, U16 char_num);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_count_extension_char
 * DESCRIPTION
 *  count the number of extension characters in buff
 * PARAMETERS
 *  buff        :    [IN]      content buffer  
 *  char_num    :    [IN]      character number  
 * RETURNS
 *  U32 number of extension characters in buff
 *****************************************************************************/
extern U32 srv_sms_count_extension_char(char* buff, U32 char_num);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_reg_port
 * DESCRIPTION
 *  This API is used by AP to register port number
 * PARAMETERS
 *  port_num    :   [IN]    port number
 *  sim_id      :   [IN]    SIM Card ID
 *  callback    :   [IN]    Event Handler Function
 *  user_data   :   [IN]    User Data
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_reg_port(
                U16 port_num,
                srv_sms_sim_enum sim_id,
                SrvSmsEventFunc callback,
                void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_unreg_port
 * DESCRIPTION
 *  This API is used by AP to deregister port number
 * PARAMETERS
 *  port_num    :   [IN]    port number
 *  sim_id      :   [IN]    SIM Card ID
 *  callback    :   [IN]    Event Handler Function
 *  user_data   :   [IN]    User Data
 * RETURNS
 *  void*
 *****************************************************************************/
extern void* srv_sms_unreg_port(
                U16 port_num,
                srv_sms_sim_enum sim_id,
                SrvSmsEventFunc callback,
                void *user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_dest_module
 * DESCRIPTION
 *  
 * PARAMETERS
 *  msg_id    :     [IN]        message id       
 * RETURNS
 *  module_type
*****************************************************************************/
module_type srv_sms_get_dest_module(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_sim_refresh_hdlr
 * DESCRIPTION
 *  SIM Refresh Handler
 * PARAMETERS
 *  sim_id     :     [IN]    SIM Card ID
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_sim_refresh_hdlr(srv_sms_sim_enum sim_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_send_from_storage_schedule
 * DESCRIPTION
 *  Schedule to send outbox unsent message (background send from storage).
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_send_from_storage_schedule(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_format_archive
 * DESCRIPTION
 *  Remove all files in Archive folder
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_format_archive(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_status_report
 * DESCRIPTION
 *  Delete a status report entry in Report Box
 * PARAMETERS
 *  report_id   :   [IN]    report id
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_delete_status_report(U16 report_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_delete_all_status_report
 * DESCRIPTION
 *  Delete all status report entry in Report Box
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
extern MMI_BOOL srv_sms_delete_all_status_report(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_info
 * DESCRIPTION
 *  Get a status reprot entry's information
 * PARAMETERS
 *  data        :   [IN]    Status report information, refer to srv_sms_status_report_struct
 *  report_id   :   [IN]    Status report entry ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_get_report_info(srv_sms_status_report_struct *data, U16 report_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_sim_id
 * DESCRIPTION
 *  Get one status report's sim id
 * PARAMETERS
 *  report_id   :   [IN]    Status report entry ID
 * RETURNS
 *  srv_sms_sim_enum
 *****************************************************************************/
extern srv_sms_sim_enum srv_sms_get_report_sim_id(U16 report_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_number
 * DESCRIPTION
 *  Get one status report's number by report id
 * PARAMETERS
 *  report_id   :   [IN]    Status report entry ID
 *  number      :   [IN]    address
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_get_report_number(U16 report_id, WCHAR* number);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_list_size
 * DESCRIPTION
 *  Get status report's total number
 * PARAMETERS
 *  void
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_report_list_size(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_id
 * DESCRIPTION
 *  Get status report id by list index
 * PARAMETERS
 *  list_index  :   [IN]    list index
 * RETURNS
 *  void
 *****************************************************************************/
extern U16 srv_sms_get_report_id(U16 list_index);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_report_id
 * DESCRIPTION
 *  Get status report's list index by its report id 
 * PARAMETERS
 *  report_id   :   [IN]    Status report entry ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_get_report_list_index(U16 report_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_report_id_to_msg_id
 * DESCRIPTION
 *  Convert a status report entry ID to a message ID
 * PARAMETERS
 *  report_id   :   [IN]    Status report entry ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_report_id_to_msg_id(U16 report_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_msg_id_to_report_id
 * DESCRIPTION
 *  Convert a message ID to a status report entry ID
 * PARAMETERS
 *  msg_id   :   [IN]    Message ID
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_msg_id_to_report_id(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_is_report_msg
 * DESCRIPTION
 *  Check whether a message is status report
 * PARAMETERS
 *  msg_id   :   [IN]    Message ID
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_is_report_msg(U16 msg_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_abort
 * DESCRIPTION
 *  1. Abort an action (Read/Send/Save, etc); 
 *     In current version, it is only can abort a read action.
 *  2. The abort is a async operation, and it may be failed. The result is returned
 *     in the callback function of the aborted action(ex. Read).
 *     If the result is FALSE, and the cause is SRV_SMS_CAUSE_ABORT. it means the
 *     abort is success. Otherwise, the abort is failed.
 *  3. The callback function of the aborted action (Read/Send/Save, etc) will be called even if abort it.
 * PARAMETERS
 *  handle  :   [IN]    Handle of an action
 * RETURNS
 *  void
 *****************************************************************************/
extern void srv_sms_abort(
                SMS_HANDLE handle,
                SrvSmsCallbackFunc callback_func,
                void* user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_get_user_data
 * DESCRIPTION
 *  Get a Handle's user data of an action
 * PARAMETERS
 *  handle      [IN]        SMS_HANDLE
 * RETURNS
 *  void*
 *****************************************************************************/
extern void* srv_sms_get_user_data(SMS_HANDLE handle);
extern S32 srv_sms_sim_id_to_index(srv_sms_sim_enum sim_id, MMI_BOOL *is_valid_sim);

#ifdef __SMS_CLOUD_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  srv_sms_backup_msg
 * DESCRIPTION
 *  to backup sms
 * PARAMETERS
 *  box_type: [in] the box to backup
 *  backup_restore_info: [in] the dest and the account info
 *  SrvSmsCallbackFunc: [in] callback
 *  user_data: [in] user_data
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern SMS_HANDLE  srv_sms_backup_msg (
                        srv_sms_backup_restore_info_struct backup_restore_info,
                        SrvSmsCallbackFunc func_callback,
                        void* user_data);
                                            
/*****************************************************************************
 * FUNCTION
 *  srv_sms_restore_msg
 * DESCRIPTION
 *  to backup sms
 * PARAMETERS
 *  backup_restore_info: [in] the dest and the account info
 *  SrvSmsCallbackFunc: [in] callback
 *  user_data: [in] user_data
 * RETURNS
 *  SMS_HANDLE  
 *****************************************************************************/
extern SMS_HANDLE  srv_sms_restore_msg (
                        srv_sms_backup_restore_info_struct backup_restore_info,
                        SrvSmsCallbackFunc,
                        void* user_data);

                        
/*****************************************************************************
 * FUNCTION
 *  srv_sms_abort_cloud
 * DESCRIPTION
 *  to abort backup/restore sms
 * PARAMETERS
 *  backup_restore_info: [in] the dest and the account info
 *  SrvSmsCallbackFunc: [in] callback
 *  user_data: [in] user_data
 * RETURNS
 *  SMS_HANDLE  
 *****************************************************************************/
extern void srv_sms_abort_cloud(
        SMS_HANDLE handle,
        SrvSmsCallbackFunc callback_func,
        void* user_data);



extern MMI_BOOL srv_sms_is_need_to_backup(void);
#endif

#ifdef __SRV_SMS_TEMPLATE__
/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_get_list_size
 * DESCRIPTION
 *  current template total number
 * PARAMETERS
 *  void
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_template_get_list_size(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_is_full
 * DESCRIPTION
 *  Check if template rich max number
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_template_is_full(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_get_id
 * DESCRIPTION
 *  get template id by list index
 * PARAMETERS
 *  list_index  :   [IN]    list index
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_template_get_id(U16 list_index);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_get_list_index
 * DESCRIPTION
 *  get template list index by template id
 * PARAMETERS
 *  template_id  :   [IN]    template id
 * RETURNS
 *  U16
 *****************************************************************************/
extern U16 srv_sms_template_get_list_index(U16 template_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_get_max_content_char_num
 * DESCRIPTION
 *  get template's max content char number
 * PARAMETERS
 *  void
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern U16 srv_sms_template_get_max_content_char_num(void);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_get_type
 * DESCRIPTION
 *  get current template type srv_sms_template_type_enum
 * PARAMETERS
 *  template_id  :   [IN]    template id
 * RETURNS
 *  srv_sms_template_type_enum
 *****************************************************************************/
extern srv_sms_template_type_enum srv_sms_template_get_type(U16 template_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_read
 * DESCRIPTION
 *  read template content
 * PARAMETERS
 *  template_id        :   [IN]    template id
 *  content_buff       :   [OUT]    content_buff provide by caller
 *  content_buff_size  :   [OUT]    buffer byte size
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_template_read(U16 template_id, WCHAR *content_buff, U16 content_buff_size);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_save
 * DESCRIPTION
 *  save content as template
 * PARAMETERS
 *  content_buff       :   [IN]    content_buff provide by caller
 *  content_buff_size  :   [IN]    buffer byte size
 * RETURNS
 *  srv_sms_template_result
 *****************************************************************************/
extern srv_sms_template_result srv_sms_template_save(const WCHAR *content, U16 content_buff_len);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_delete
 * DESCRIPTION
 *  delete template by template id
 * PARAMETERS
 *  template_id        :   [IN]    template id
 * RETURNS
 *  MMI_BOOL
 *****************************************************************************/
extern MMI_BOOL srv_sms_template_delete(U16 template_id);

/*****************************************************************************
 * FUNCTION
 *  srv_sms_template_replace
 * DESCRIPTION
 *  save Edited template
 * PARAMETERS
 *  template_id        :   [IN]    template id
 *  content_buff       :   [IN]    content_buff provide by caller
 *  content_buff_size  :   [IN]    buffer byte size
 * RETURNS
 *  srv_sms_template_result
 *****************************************************************************/
extern srv_sms_template_result srv_sms_template_replace(U16 template_id, const WCHAR *content, U16 content_buff_len);
#endif /* __SRV_SMS_TEMPLATE__ */

#ifdef __cplusplus
}
#endif

#endif /* __SRV_SMS_GPROT_H__ */