UmSrvGprot.h 51.9 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
/*****************************************************************************
*  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:
 * ---------
 * UMSrvGprot.h
 *
 * Project:
 * --------
 * MAUI
 *
 * Description:
 * ------------
 *
 *
 * 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!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *==============================================================================
 *******************************************************************************/
#ifndef UM_SRV_GPROT_H
#define UM_SRV_GPROT_H
#include "MMI_features.h"

/* This file is used by MMI task only, please use MMI type as possible */
#ifdef __UM_SUPPORT__
/**********  KAL Layer Header **************/
#include "kal_general_types.h"

/**********  MMI Layer Header **************/
#include "MMIDataType.h"
#include "mmi_res_range_def.h"
#include "customer_email_num.h"

#include "UmSrvDefs.h"

/*********************************
 *  structure
 ********************************************/

/* To identify a message */
typedef struct
{
    srv_um_msg_enum msg_type;                   /* message type */
    U32 msg_id;                                 /* message id */
} srv_um_msg_node_struct;

/* To identify a message box */
typedef struct
{
    srv_um_msg_enum msg_type;                   /* the message type in box */
    srv_um_msg_box_enum msg_box_type;           /* the type of box */
    srv_um_sim_enum sim_id;                     /* the sim id of messages */
} srv_um_box_identity_struct;

/* Filter used to get message list */
typedef struct
{
    srv_um_list_idx_enum idx_type;              /* the index data type */
    srv_um_sort_order_enum order;               /* the order of sorting */
#ifdef __SRV_UM_THREAD_MESSAGE_SUPPORT__
    srv_um_thread_id_struct thread_id;          /* messages in the thread */
#endif
} srv_um_list_filter_struct;

/* To identify a message list */
typedef struct
{
    srv_um_list_type_enum list_type;                        /* the type of list */
    srv_um_box_identity_struct msg_box;                     /* Message box  */
    srv_um_list_filter_struct filter;                       /* Sorting type */
    void *list;                                             /* Data list, may be srv_um_msg_node_struct or srv_um_thread_id_struct*/
    U16 msg_number;                                         /* Number of nodes */
} srv_um_list_cntx_struct;

/* This structure is used to specify thread information. */
typedef struct
{
    srv_um_thread_id_struct thread_id;       /* A identifier to indicate this message thread */
    srv_um_msg_node_struct list_head;        /* head of message list in this thread, normally is the neweset one */
//    U32 timestamp;                           /* timestamp of the list head */
//    srv_um_msg_link_list_struct *msg_list;   /* message list in this message thread */
    U16 total_msg_number;                    /* total message in this message thread */
    U16 unread_msg_number;                   /* unread message in this message thread */
} srv_um_thread_info_struct;

/*********************************
 *  Process Result Structure
 ********************************************/

/* The structure of "Get Message Number" result */
typedef struct
{
    S32 error;                              /* error code */
    srv_um_msg_enum msg_type;               /* message type */
    srv_um_sim_enum sim_id;                 /* sim id */
    U16 inbox_msg_number;                   /* inbox message number */
    U16 inbox_unread_msg_number;            /* inbox unread message number */
    U16 unsent_msg_number;                  /* message number in unsent box */
    U16 sent_msg_number;                    /* message number in sent box */
    U16 draft_msg_number;                   /* message number if draft box */
#ifdef __UNIFIED_MESSAGE_ARCHIVE_SUPPORT__
    U16 archive_msg_number;                 /* message number in archive box */
#endif
#ifdef __UNIFIED_MESSAGE_SIMBOX_SUPPORT__
    U16 sim_msg_number;                     /* message number in sim box */
#endif
#ifdef __MMI_UM_REPORT_BOX__
    U16 report_msg_number;                  /* message number in report box */
#endif
} srv_um_get_msg_num_result;

typedef struct
{
    S32 error;                                      /* error code */
    union
    {
        S32 msg_number;                                 /* message number */
        S32 thread_number;
    }n;
} srv_um_get_list_result;

/* The structure of "Get Message List" result */
typedef srv_um_get_list_result srv_um_get_msg_list_result;

/* The structure of "Get Message Info" result */
typedef struct
{
    S32 error;                                      /* error code */
    U16 no_of_success;                              /* number of success */
    U16 no_of_fail;                                 /* number of fail */
} srv_um_get_msg_info_result;

/* The structure of "Mark Several Operation" result */
typedef struct
{
    S32 error;                                      /* error code */
    U16 no_of_success;                              /* number of success */
    U16 no_of_fail;                                 /* number of fail */
} srv_um_mark_several_op_result;

/* The structure of "Traverse Message" result */
typedef struct
{
    S32 error;                                      /* error code */
    S32 msg_number;                                 /* message number */
} srv_um_traverse_msg_result;

/* The structure of "Get Thread List" result */
typedef srv_um_get_list_result srv_um_get_thread_list_result;

/* The structure of "Get Thread Info" result */
typedef struct
{
    S32 error;                                      /* error code */
    U16 no_of_success;                              /* number of success */
    U16 no_of_fail;                                 /* number of fail */
} srv_um_get_thread_info_result;

/* The structure of "Mark Several Thread Operation" result */
typedef struct
{
    S32 error;                                      /* error code */
    U16 no_of_success;                              /* number of success */
    U16 no_of_fail;                                 /* number of fail */
} srv_um_mark_several_thread_op_result;

/* The structure of "Delete Folder" result */
typedef struct
{
    S32 error;                                      /* error code */
    srv_um_box_identity_struct msg_box;             /* message box */
} srv_um_delete_folder_result;

typedef enum
{
    EVT_ID_SRV_UM_NOTIFY_READY = (SRV_UNIFIED_MESSAGE_BASE + 1),  /* Notify ready indication */
    EVT_ID_SRV_UM_NOTIFY_HIGHLIGHT_MSG,                           /* Notify highlight message indication */
    EVT_ID_SRV_UM_NOTIFY_REFRESH,                                 /* Notify refresh indication */
    EVT_ID_SRV_UM_TOTAL
} srv_um_event_enum;

/* event structure for EVT_ID_SRV_UM_NOTIFY_READY */
typedef struct
{
    MMI_EVT_PARAM_HEADER
    MMI_BOOL result;                        /* KAL_TRUE means ready; KAL_FALSE means initialization failure */
    srv_um_msg_enum msg_type;               /* Type of ready message */
} srv_um_notify_ready_evt_struct;

/* event structure for EVT_ID_SRV_UM_NOTIFY_HIGHLIGHT_MSG */
typedef struct
{
    MMI_EVT_PARAM_HEADER
    srv_um_msg_enum msg_type;           /* Type of message */
    srv_um_msg_box_enum msg_box_type;   /* Types of message boxes */
    U32 msg_id;
} srv_um_notify_highlight_msg_evt_struct;

/* event structure for EVT_ID_SRV_UM_NOTIFY_REFRESH */
typedef struct
{
    MMI_EVT_PARAM_HEADER
    srv_um_msg_enum msg_type;           /* Type of message */
    srv_um_msg_box_enum msg_box_type;   /* Types of message boxes */
    srv_um_refresh_enum refresh_type;       /* reason to send refresh indication, 0: unknown */
    U32 msg_id;                             /* which message is changed, 0: unknown */
    srv_um_addr_enum addr_type;             /* the address type, only used in new message */
    U16 address[SRV_UM_MAX_ADDR_LEN + 1];  /* sender address, only used in new message */
} srv_um_notify_refresh_evt_struct;

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_general_cb
 * DESCRIPTION
 *  Callback function to return the result
 * PARAMETERS
 *  pid:        [IN]   The process id
 *  rsp:        [IN]   The result
 *  user_data:  [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_general_cb) (S32 pid, void* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_msg_num_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Message Number"
 * PARAMETERS
 *  pid:        [IN]   The process id
 *  rsp:        [IN]   The result
 *  user_data:  [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_get_msg_num_cb) (S32 pid, srv_um_get_msg_num_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_list_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Message List"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_get_list_cb) (S32 pid, srv_um_get_list_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_msg_list_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Message List"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef srv_um_get_list_cb srv_um_get_msg_list_cb;

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_msg_info_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Message Information"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_get_msg_info_cb) (S32 pid, srv_um_get_msg_info_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_mark_several_op_cb
 * DESCRIPTION
 *  Callback function to return the result of "Mark Several Operation"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_mark_several_op_cb) (S32 pid, srv_um_mark_several_op_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_traverse_msg_cb
 * DESCRIPTION
 *  Callback function to return the result of "Traverse Message"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_traverse_msg_cb) (S32 pid, srv_um_traverse_msg_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_thread_list_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Thread List"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef srv_um_get_list_cb srv_um_get_thread_list_cb;

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_thread_info_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Thread Information"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_get_thread_info_cb) (S32 pid, srv_um_get_thread_info_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_mark_several_thread_op_cb
 * DESCRIPTION
 *  Callback function to return the result of "Mark Several Thread Operation"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_mark_several_thread_op_cb) (S32 pid, srv_um_mark_several_thread_op_result* rsp, S32 user_data);


/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_delete_folder_cb
 * DESCRIPTION
 *  Callback function to return the result of "Delete Folder"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_delete_folder_cb) (S32 pid, srv_um_delete_folder_result* rsp, S32 user_data);


/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_thread_list_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Message Thread List"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  para:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef srv_um_get_list_cb srv_um_get_thread_list_cb;

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_get_thread_info_cb
 * DESCRIPTION
 *  Callback function to return the result of "Get Thread Information"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_get_thread_info_cb) (S32 pid, srv_um_get_thread_info_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_mark_several_thread_op_cb
 * DESCRIPTION
 *  Callback function to return the result of "Mark Several Thread Operation"
 * PARAMETERS
 *  pid:     [IN]   The process id
 *  rsp:     [IN]   The result
 *  user_data:    [IN]   A paramter used by UI, the value shall be identical as the request
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
typedef S32 (*srv_um_mark_several_thread_op_cb) (S32 pid, srv_um_mark_several_thread_op_result* rsp, S32 user_data);

/*****************************************************************************
 * <GROUP  CallBackFunctions>
 * FUNCTION
 *  srv_um_list_notify_handler
 * DESCRIPTION
 *  Callback function to notify AP the list is changed. ex: release, clean
 * PARAMETERS
 *  event:           [IN]   Type of notification, SRV_UM_NOTIFY_LIST_RELEASED_IND or
 *                             SRV_UM_NOTIFY_LIST_CLEANED_IND
 *  list_cid:        [IN]   list cid
 *  user_data:       [IN]   User data
 * RETURNS
 *  void
 * RETURN VALUES
 *  void
 *****************************************************************************/
typedef void (*srv_um_notify_list_handler) (S32 event, S32 list_cid, S32 user_data);

/*********************************
 *  Blocking Interface
 ********************************************/

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_support_type
 * DESCRIPTION
 *  Check specific msg types are supported by UM.
 * PARAMETERS
 *  msg_type:       [IN]    Message type, bit mask
 * RETURNS
 *  a boolean value
 * RETURN VALUES
 *  MMI_TRUE:   all support
 *  MMI_FALSE:  only partial support
 *****************************************************************************/
extern MMI_BOOL srv_um_check_support_type(srv_um_msg_enum msg_type);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_ready_type
 * DESCRIPTION
 *  Check specific message types are ready or not.
 * PARAMETERS
 *  msg_type:       [IN]    Message type, bit mask
 * RETURNS
 *  a boolean value
 * RETURN VALUES
 *  MMI_TRUE:   all ready
 *  MMI_FALSE:  only partial ready
 *****************************************************************************/
extern MMI_BOOL srv_um_check_ready_type(srv_um_msg_enum msg_type);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_ready
 * DESCRIPTION
 *  Check if all msg types UM supports are ready
 * PARAMETERS
 *  void
 * RETURNS
 *  a boolean value
 * RETURN VALUES
 *  MMI_TRUE:   all ready
 *  MMI_FALSE:  only partial ready
 *****************************************************************************/
extern MMI_BOOL srv_um_check_ready(void);

/***********************************************************************************
  * FUNCTION
  *   srv_um_support_msg_type
  * Description
  *   This function is for application to get the message type that supported by UMS
  * Returns
  *   message types that are supported by UM, bit mask
  ***********************************************************************************/
extern srv_um_msg_enum srv_um_support_msg_type(void);

/***************************************************************************
  * FUNCTION
  *   srv_um_ready_msg_type
  * Description
  *   This function is for application to check if all the message is ready.
  * Returns
  *   message types that are ready, bit mask
  ***************************************************************************/
extern srv_um_msg_enum srv_um_ready_msg_type(void);

/*************************************************************************************
  * FUNCTION
  *   srv_um_clear_msg_info_cache
  * Description
  *   This function is for application to clear the message cache in UMS. In some
  *   situation, application need to clean the message cache or they may get old data.
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   0 :           Success
  *   Neg. Value :  Error code
  *
  *************************************************************************************/
extern S32 srv_um_clear_msg_info_cache(void);

/**************************************************************************************
  * FUNCTION
  *   srv_um_cancel_request
  * Description
  *   This function is for application to cancel the request they submit to UMS before.
  *   This function can be used for all the asynchoronous request. ex: srv_um_get_list
  *   or srv_um_get_msg_num ....
  * Parameters
  *   pid :  [IN] The process id
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   0 :           success
  *   Neg. Value :  error code
  *
  **************************************************************************************/
extern S32 srv_um_cancel_request(S32 pid);

/*****************************************************************************
 * FUNCTION
 *   srv_um_get_request_progress
 * Description
 *   This function is to get the progress of a request
 * Parameters
 *  pid :           [IN] The process id
 *  finish_number:  [OUT] number of finished item
 *  total_number:   [OUT] number of total items
 * Returns
 *  srv_um_result_enum
 *  Please check the total_number when you get the result. It may be zero
 *  in some special situation that we cannot get the information.
 * Return Values
 *   0 :           success
 *   Neg. Value :  error code
 *
 *****************************************************************************/
extern S32 srv_um_get_request_progress(S32 pid, S32 *finish_number, S32 *total_number);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_list
 * DESCRIPTION
 *  To get the message list or thread list. (Synchronize way)
 *  There are two alias API to avoid assigning the list type.
 *  srv_um_check_msg_list
 *  srv_um_check_thread_list
 * PARAMETERS
 *  list_type:          [IN]    type of list
 *  msg_box:            [IN]    The message box information
 *  filter:             [IN]    A filter to decide which message should be excluded
 *  cb_func:            [IN]    The callback function to notify the list is changed.
 *  user_data:          [IN]    A callback parameter in callback function
 *  list_cntx:          [OUT]   pionter to the list context
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  > 0: list context id
 *  = 0: impossible
 *  < 0: error
 *****************************************************************************/
extern S32 srv_um_check_list(
        srv_um_list_type_enum list_type,
        srv_um_box_identity_struct msg_box,
        srv_um_list_filter_struct *filter,
        srv_um_notify_list_handler cb_func,
        S32 user_data,
        srv_um_list_cntx_struct **list_cntx);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_msg_list
 * DESCRIPTION
 *  To get the mesage list. (Synchronize way)
 * PARAMETERS
 *  list_type:          [IN]    type of list
 *  msg_box:            [IN]    The message box information
 *  filter:             [IN]    A filter to decide which message should be excluded
 *  cb_func:            [IN]    The callback function to notify the list is changed.
 *  user_data:          [IN]    A callback parameter in callback function
 *  list_cntx:          [OUT]   pionter to the list context
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  > 0: list context id
 *  = 0: impossible
 *  < 0: error
 *****************************************************************************/
#define srv_um_check_msg_list(msg_box, filter, cb_func, user_data, list_cntx) \
            srv_um_check_list(SRV_UM_LIST_TYPE_MSG_NODE, msg_box, filter, cb_func, user_data, list_cntx)

/***************************************************************************************
  * \FUNCTION: srv_um_check_msg_info
  * Description
  *   Get the message detail information. UMS will check if the message listed in
  *   list_info exist in the cache. If all the data exist in the cache, it will return
  *   the message detail information directly. Otherwise, caller need to invoke
  *   srv_um_get_msg_info to trigger UMS to get the data.
  *   If all the data exist in the cache, unified message service will peek the message
  *   near the original request. And if the message near the original request do not
  *   exist in the cache, unified message service will try to get them back. This
  *   design is to decrease progressing screen for better user experience.
  *
  *   <img name="srv_um_check_msg_info-1" />
  * Parameters
  *   msg_box :         [IN] The message box information<p />
  *   msg_list :        [IN] The message list<p />
  *   list_info_size :  [IN] Size of message list<p />
  *   start_entry :     [IN] The start entry in message list to get<p />information<p />
  *   msg_number :      [IN] How much message to get<p />
  *   msg_info :        [OUT] A buffer contains message information
  * Returns
  *     srv_um_result_enum
  * Return Values
  *   0 :           Success<p />
  *   Neg. Value :  Error Code
  *
  ***************************************************************************************/
extern S32 srv_um_check_msg_info(
        srv_um_box_identity_struct msg_box,
        srv_um_msg_node_struct msg_list[],
        U16 list_info_size,
        U16 start_entry,
        U16 msg_number,
        srv_um_msg_info_struct msg_info[]);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_msg_info_by_ref
 * DESCRIPTION
 *  To get the message information but the UM service return the pointers in cache
 *  directly.
 * PARAMETERS
 *  msg_box:            [IN]    The message box information
 *  msg_list:           [IN]    The message list
 *  list_info_size:     [IN]    Size of message list
 *  start_entry:        [IN]    The start entry in message list to get information
 *  msg_number:         [IN]    How much message to get
 *  msg_info:           [OUT]   A pointer array contains message information pointers
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_check_msg_info_by_ref(
        srv_um_box_identity_struct msg_box,
        srv_um_msg_node_struct msg_list[],
        U16 list_info_size,
        U16 start_entry,
        U16 msg_number,
        srv_um_msg_info_struct *msg_info[]);

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_msg_num
 * DESCRIPTION
 *  currently, only can get all SIM in each box message number,
 *  please set sim_id = SRV_UM_SIM_ALL
 *  msg_type must has value, other wise no message number can be got.
 *  If need get all message type number, set msg_type = SRV_UM_MSG_ALL
 *  If return FALSE, data->error will indicate error casue using srv_um_result_enum
 *  and data->msg_type will indicate success got type message number
 * PARAMETERS
 *  void
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_check_msg_num(
            srv_um_sim_enum sim_id,
            srv_um_msg_enum msg_type,
            srv_um_get_msg_num_result *data);

#ifdef __UNIFIED_MESSAGE_MARK_SEVERAL_SUPPORT__
/*********************************************************************
  * FUNCTION
  *   srv_um_entry_mark_several_rsp
  * Description
  *   To send response message of MSG_ID_MMI_UM_ENTRY_MARK_SEVERAL_REQ
  * Parameters
  *   msg_box :  [IN] The message box information<p />
  *   result\ :  [IN] The result
  * Returns
  *     srv_um_result_enum
  *
  *********************************************************************/
extern S32 srv_um_entry_mark_several_rsp(srv_um_box_identity_struct msg_box, MMI_BOOL result);
#endif

/*********************************
 *  Non-Blocking Interface
 ********************************************/

/*************************************************************************************
  * FUNCTION
  *   srv_um_get_msg_num
  * Description
  *   This function get the number of message in each message box. Due to this is a
  *   non-blocking process, application needs to register a callback function. After
  *   UMS finishes this process, UMS would invoke the callback function and return the
  *   \result with srv_um_get_msg_num_result.
  * Parameters
  *   msg_type :  [IN] The message type, bit mask<p />
  *   sim_id :    [IN] The sim id, set as SRV_UM_SIM_ALL if no use.<p />
  *   cb_func :   [IN] The callback function when the response message back<p />
  *   user_data : [IN] A callback parameter in callback function<p />
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_num_cb
  *
  *   Callback Function Parameter: srv_um_get_msg_num_result
  *************************************************************************************/
extern S32 srv_um_get_msg_num(
        srv_um_msg_enum msg_type,
        srv_um_sim_enum sim_id,
        srv_um_get_msg_num_cb cb_func,
        S32 user_data);

/*************************************************************************************
  * FUNCTION
  *   srv_um_get_list
  * Description
  *   This function gets the whole list in a specific message box. Due to this
  *   is a non-blocking process, application needs to register a callback function.
  *   After UMS finishes this process, UMS would invoke the callback function and
  *   return the result
  *
  *   Note that if Caller need to release the buffer before UMS finish the request,
  *   Caller MUST cancel the request before release the buffer or UMS may corrupt the
  *   memory incident.
  * Parameters
  *   list_type:       [IN] type of list
  *   msg_box :        [IN] The message box information<p />
  *   filter :         [IN] A filter to decide which message should be excluded<p />
  *   cb_func :        [IN] The callback function when the response message back<p />
  *   user_data :      [IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible Value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_list_cb
  *   Callback Function Argument: srv_um_get_msg_list_result
  *************************************************************************************/
extern S32 srv_um_get_list(
        srv_um_list_type_enum list_type,
        srv_um_box_identity_struct msg_box,
        srv_um_list_filter_struct *filter,
        srv_um_get_msg_list_cb cb_func,
        S32 user_data);

/*************************************************************************************
  * FUNCTION
  *   srv_um_get_msg_list
  * Description
  *   This function gets the whole message list in a specific message box. Due to this
  *   is a non-blocking process, application needs to register a callback function.
  *   After UMS finishes this process, UMS would invoke the callback function and
  *   return the result
  *
  *   Note that if Caller need to release the buffer before UMS finish the request,
  *   Caller MUST cancel the request before release the buffer or UMS may corrupt the
  *   memory incident.
  * Parameters
  *   list_type:       [IN] type of list
  *   msg_box :        [IN] The message box information<p />
  *   filter :         [IN] A filter to decide which message should be excluded<p />
  *   cb_func :        [IN] The callback function when the response message back<p />
  *   user_data :      [IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible Value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_list_cb
  *   Callback Function Argument: srv_um_get_msg_list_result
  *************************************************************************************/
#define srv_um_get_msg_list(msg_box, filter, cb_func, user_data)    \
            srv_um_get_list(SRV_UM_LIST_TYPE_MSG_NODE, msg_box, filter, cb_func, user_data)

/*****************************************************************************
 * FUNCTION
 *  srv_um_release_list
 * DESCRIPTION
 *  To release a message list
 * PARAMETERS
 *  list_cntx:      [IN]   pionter to the list context
 *  out_of_date:    [IN]   the message list is out of data or not, if yes,
 *                         service will clean the message list or reserve it.
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  = 0: success
 *  < 0: error
 *****************************************************************************/
extern S32 srv_um_release_list(S32 list_cid, MMI_BOOL out_of_date);

/*****************************************************************************
 * FUNCTION
 *  srv_um_release_msg_list
 * DESCRIPTION
 *  To release a message list
 * PARAMETERS
 *  list_cntx:      [IN]   pionter to the list context
 *  out_of_date:    [IN]   the message list is out of data or not, if yes,
 *                         service will clean the message list or reserve it.
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  = 0: success
 *  < 0: error
 *****************************************************************************/
#define srv_um_release_msg_list(list_cid, out_of_date)  \
            srv_um_release_list(list_cid, out_of_date)

/***********************************************************************************
  * FUNCTION
  *   srv_um_get_msg_info
  * Description
  *   This function gets the message information. Due to this is a non-blocking
  *   process, application needs to register a callback function. After UMS finishes
  *   this process, UMS would invoke the callback function and return the result.
  * Parameters
  *   msg_box :     [IN] The message box information
  *   msg_list :    [IN] The message list need to get message information
  *   msg_number :  [IN] How much message to get message information
  *   cb_func :     [IN] The callback function when the response message back
  *   user_data :   [IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_info_cb
  *
  *   Callback Function Argument: srv_um_get_msg_info_result
  ***********************************************************************************/
extern S32 srv_um_get_msg_info (
    srv_um_box_identity_struct msg_box,
    srv_um_msg_node_struct msg_list[],
    U16 msg_number,
    srv_um_get_msg_info_cb cb_func,
    S32 user_data);

/*************************************************************************
  * FUNCTION
  *   srv_um_delete_folder
  * Description
  *   This function is for application to delete specific message box.
  * Parameters
  *   msg_box :  [IN] The message box information
  *   cb_func :  [IN] The callback function when the response message back
  *   user_data :[IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A serial number that can control the whole process
  *   0 :           Impossible value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_delete_folder_cb
  *
  *   Callback Function Argument: srv_um_delete_folder_result
  *************************************************************************/
extern S32 srv_um_delete_folder(
    srv_um_box_identity_struct msg_box,
    srv_um_delete_folder_cb cb_func,
    S32 user_data);

#ifdef __UNIFIED_MESSAGE_MARK_SEVERAL_SUPPORT__
/************************************************************************************
  * FUNCTION
  *   srv_um_mark_several_op
  * Description
  *   This function is for application to do some operation on multiple messages.
  * Parameters
  *   msg_box :        [IN] The message box information
  *   msg_list :       [IN] The message list to do mark several operation
  *   msg_list_size :  [IN] The size of message list
  *   mark_status :    [IN] The mark status of each message node in list. Each bit is
  *                    corresponed to one message node. The left-most bit (MSB) in
  *                    mark_status[0] is corresponded to the first message node. The
  *                    right-most bit (LSB) in mark_Status[0] is corresponed to 32th
  *                    message node.
  *   action_type :    [IN] The type of action
  *   cb_func :        [IN] The callback function when the response message back
  *   user_data :      [IN] a callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible Value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_mark_several_op_cb
  *
  *   Callback Function Argument: srv_um_mark_several_op_result
  ************************************************************************************/
extern S32 srv_um_mark_several_op(
    srv_um_box_identity_struct msg_box,
    srv_um_msg_node_struct msg_list[],
    U16 msg_list_size,
    U32 mark_status[],
    srv_um_mark_several_op_action_enum action_type,
    srv_um_mark_several_op_cb cb_func,
    S32 user_data);
#endif

#ifdef __SRV_UM_THREAD_MESSAGE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  srv_um_check_thread_list
 * DESCRIPTION
 *  To get the thread list. (Synchronize way)
 * PARAMETERS
 *  list_type:          [IN]    type of list
 *  msg_box:            [IN]    The message box information
 *  filter:             [IN]    A filter to decide which message should be excluded
 *  cb_func:            [IN]    The callback function to notify the list is changed.
 *  user_data:          [IN]    A callback parameter in callback function
 *  list_cntx:          [OUT]   pionter to the list context
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  > 0: list context id
 *  = 0: impossible
 *  < 0: error
 *****************************************************************************/
#define srv_um_check_thread_list(msg_box, filter, cb_func, user_data, list_cntx) \
            srv_um_check_list(SRV_UM_LIST_TYPE_THREAD, msg_box, filter, cb_func, user_data, list_cntx)

/*************************************************************************************
  * FUNCTION
  *   srv_um_get_thread_list
  * Description
  *   This function gets the whole thread list in a specific message box. Due to this
  *   is a non-blocking process, application needs to register a callback function.
  *   After UMS finishes this process, UMS would invoke the callback function and
  *   return the result
  *
  *   Note that if Caller need to release the buffer before UMS finish the request,
  *   Caller MUST cancel the request before release the buffer or UMS may corrupt the
  *   memory incident.
  * Parameters
  *   list_type:       [IN] type of list
  *   msg_box :        [IN] The message box information<p />
  *   filter :         [IN] A filter to decide which message should be excluded<p />
  *   cb_func :        [IN] The callback function when the response message back<p />
  *   user_data :      [IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible Value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_list_cb
  *   Callback Function Argument: srv_um_get_msg_list_result
  *************************************************************************************/
#define srv_um_get_thread_list(msg_box, filter, cb_func, user_data)    \
            srv_um_get_list(SRV_UM_LIST_TYPE_THREAD, msg_box, filter, cb_func, user_data)

/*****************************************************************************
 * FUNCTION
 *  srv_um_release_thread_list
 * DESCRIPTION
 *  To release a thread list
 * PARAMETERS
 *  list_cntx:      [IN]   pionter to the list context
 *  out_of_date:    [IN]   the message list is out of data or not, if yes,
 *                         service will clean the message list or reserve it.
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  = 0: success
 *  < 0: error
 *****************************************************************************/
#define srv_um_release_thread_list(list_cid, out_of_date)  \
            srv_um_release_list(list_cid, out_of_date)

/*****************************************************************************
 * FUNCTION
 *  srv_um_check_thread_info
 * DESCRIPTION
 *  To get the thread information but the UM service return the pointers in cache
 *  directly.
 * PARAMETERS
 *  thread_list:        [IN]    The thread list
 *  list_info_size:     [IN]    Size of thread list
 *  start_entry:        [IN]    The start entry in thread list to get information
 *  thread_number:      [IN]    How many thread information to get
 *  thread_info:        [OUT]   A pointer array contains thread information pointers
 *  msg_info:           [OUT]   If you want to get the message info of the first message
 *                              in each message thread. This is the pointer array contains
 *                              message information pointers.
 *                              You also can set it as NULL to get the simple thread information
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_check_thread_info(
        srv_um_box_identity_struct msg_box,
        srv_um_thread_id_struct thread_list[],
        U16 list_info_size,
        U16 start_entry,
        U16 thread_number,
        srv_um_thread_info_struct *thread_info[],
        srv_um_msg_info_struct *msg_info[]);

/***********************************************************************************
  * FUNCTION
  *   srv_um_get_thread_info
  * Description
  *   This function gets the thread information. Due to this is a non-blocking
  *   process, application needs to register a callback function. After UMS finishes
  *   this process, UMS would invoke the callback function and return the result.
  * Parameters
  *   thread_list :   [IN] The message list need to get message information
  *   thread_number : [IN] How much message to get message information
  *   cb_func :       [IN] The callback function when the response message back
  *   user_data :     [IN] A callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_get_msg_info_cb
  *   Callback Function Argument: srv_um_get_msg_info_result
  ***********************************************************************************/
extern S32 srv_um_get_thread_info (
    srv_um_box_identity_struct msg_box,
    srv_um_thread_id_struct thread_list[],
    U16 thread_number,
    srv_um_get_thread_info_cb cb_func,
    S32 user_data);

/************************************************************************************
  * FUNCTION
  *   srv_um_mark_several_thread_op
  * Description
  *   This function is for application to do some operation on multiple thread.
  * Parameters
  *   thread_list :       [IN] The message list to do mark several operation
  *   thread_list_size :  [IN] The size of message list
  *   mark_status :    [IN] The mark status of each message node in list. Each bit is
  *                    corresponed to one message node. The left-most bit (MSB) in
  *                    mark_status[0] is corresponded to the first message node. The
  *                    right-most bit (LSB) in mark_Status[0] is corresponed to 32th
  *                    message node.
  *   action_type :    [IN] The type of action
  *   cb_func :        [IN] The callback function when the response message back
  *   user_data :      [IN] a callback parameter in callback function
  * Returns
  *   srv_um_result_enum
  * Return Values
  *   Pos. Value :  A process identifier that use to control the whole process
  *   0 :           Impossible Value
  *   Neg. Value :  Error code
  * See Also
  *   Callback Function: srv_um_mark_several_op_cb
  *   Callback Function Argument: srv_um_mark_several_op_result
  ************************************************************************************/
extern S32 srv_um_mark_several_thread_op(
    srv_um_box_identity_struct msg_box,
    srv_um_thread_id_struct thread_list[],
    U16 thread_list_size,
    U32 mark_status[],
    srv_um_mark_several_op_action_enum action_type,
    srv_um_mark_several_thread_op_cb cb_func,
    S32 user_data);

/*****************************************************************************
 * FUNCTION
 *  srv_um_tsfr_address_to_thread_id
 * DESCRIPTION
 *  transfer address to thread id
 * PARAMETERS
 *  type:           [IN]    address type
 *  ucs2_str:       [IN]    address
 *  sim_id:         [IN]    sim id
 *  thread_id:      [OUT]   thread id
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_tsfr_address_to_thread_id(srv_um_addr_enum type, U16* ucs2_str, srv_um_sim_enum sim_id, srv_um_thread_id_struct *thread_id);

/*****************************************************************************
 * FUNCTION
 *  srv_um_update_thread_id
 * DESCRIPTION
 *  update the thread_id if the number saved into phonebook
 * PARAMETERS
 *  thread_id:       [IN]   the thread_id
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_update_thread_id(srv_um_thread_id_struct *thread_id);
/* DOM-NOT_FOR_SDK-BEGIN */
/*****************************************************************************
 * FUNCTION
 *  srv_um_tsfr_msg_id_to_thread_id
 * DESCRIPTION
 *  transfer msg id to thread id, only used for messages with multiple address
 * PARAMETERS
 *  msg_type:       [IN]    message type
 *  msg_id:         [IN]    message id
 *  thread_id:      [OUT]   thread id
 * RETURNS
 *  srv_um_result_enum
 * RETURN VALUES
 *  SRV_UM_RESULT_OK
 *****************************************************************************/
extern S32 srv_um_tsfr_msg_id_to_thread_id(srv_um_msg_enum msg_type, U32 msg_id, srv_um_thread_id_struct *thread_id);

#if (defined(__OP01__) && (MMI_MAX_SIM_NUM >= 2))
/*****************************************************************************
 * FUNCTION
 *  srv_um_get_prefer_sim
 * DESCRIPTION
 *
 * PARAMETERS
 *  void        
 * RETURNS
 *  srv_um_sim_enum   preferred SIM, SRV_UM_SIM_UNCLASSIFIED if no prefer sim is set
 *****************************************************************************/
extern srv_um_sim_enum srv_um_get_prefer_sim(void);
/*****************************************************************************
 * FUNCTION
 *  srv_um_get_prefer_sim
 * DESCRIPTION
 *
 * PARAMETERS
 *  srv_um_sim_enum   preferred SIM, SRV_UM_SIM_UNCLASSIFIED if no prefer sim is set
 * RETURNS
 *  MMI_TRUE if save successful
 *  MMI_FALSE if not save failed
 *****************************************************************************/
extern MMI_BOOL srv_um_set_prefer_sim(srv_um_sim_enum prefer_sim);
#endif /* (defined(__OP01__) && defined(__MMI_DUAL_SIM_MASTER__)) */

/* DOM-NOT_FOR_SDK-END */
#endif

/*****************************************************************************
 * FUNCTION
 *  srv_um_service_init
 * DESCRIPTION
 *  To initiate the unified message service
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 * RETURN VALUES
 *  void
 *****************************************************************************/
extern void srv_um_service_init(void);

/*****************************************************************************
 * FUNCTION
 *  srv_um_send_delete_all_res
 * DESCRIPTION
 *  To send delete all response message
 * PARAMETERS
 *  msg_type:   [IN]    message type
 *  result:     [IN]    result
 * RETURNS
 *  void
 * RETURN VALUES
 *  void
 *****************************************************************************/
extern void srv_um_send_delete_all_res(srv_um_msg_enum msg_type, MMI_BOOL result);

/***********************************************
 * Extra definition
 **************************************/



#include "UmSrvStruct.h"
#endif /* __UM_SUPPORT__ */
#endif /* __UMSGPROT_H__ */