update tizen source
[framework/messaging/msg-service.git] / include / proxy / MsgHandle.h
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 *          Sangkoo Kim <sangkoo.kim@samsung.com>
9 *          Seunghwan Lee <sh.cat.lee@samsung.com>
10 *          SoonMin Jung <sm0415.jung@samsung.com>
11 *          Jae-Young Lee <jy4710.lee@samsung.com>
12 *          KeeBum Kim <keebum.kim@samsung.com>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
21 *
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
28 *
29 */
30
31 #ifndef MSG_HANDLE_H
32 #define MSG_HANDLE_H
33
34 #ifndef __cplusplus
35 #error "This is a C++ header file; it requires C++ to compile."
36 #endif
37
38 /*==================================================================================================
39                                          INCLUDE FILES
40 ==================================================================================================*/
41 #include "MsgStorageTypes.h"
42 #include "MsgTransportTypes.h"
43 #include "MsgSettingTypes.h"
44 #include "MsgCmdTypes.h"
45 #include "MsgInternalTypes.h"
46 #include "MsgIpcSocket.h"
47
48 /*==================================================================================================
49                                      CLASS DEFINITIONS
50 ==================================================================================================*/
51
52 class MsgHandle
53 {
54         public:
55                 MsgHandle();
56                 virtual ~MsgHandle();
57
58                 // Control
59                 void openHandle();
60                 void closeHandle(MsgHandle* pHandle);
61
62                 // Transport
63                 MSG_ERROR_T submitReq(MSG_REQUEST_S* pReq);
64                 MSG_ERROR_T cancelReq(MSG_REQUEST_ID_T reqId);
65
66                 MSG_ERROR_T regSentStatusCallback(msg_sent_status_cb onStatusChanged,  void *pUserParam);
67                 MSG_ERROR_T regSmsMessageCallback(msg_sms_incoming_cb onMsgIncoming, unsigned short port, void *pUserParam);
68                 MSG_ERROR_T regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb onMMSConfMsgIncoming, const char *pAppId, void *pUserParam);
69                 MSG_ERROR_T regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyncMLMsgIncoming, void *pUserParam);
70                 MSG_ERROR_T regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgIncoming, void *pUserParam);
71
72                 MSG_ERROR_T regSyncMLMessageOperationCallback(msg_syncml_msg_operation_cb onSyncMLMsgOperation, void *pUserParam);
73
74                 MSG_ERROR_T operateSyncMLMessage(MSG_MESSAGE_ID_T msgId);
75
76                 // Storage
77                 int addMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt);
78                 MSG_ERROR_T addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg);
79                 MSG_ERROR_T updateMessage(const MSG_MESSAGE_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt);
80                 MSG_ERROR_T updateReadStatus(MSG_MESSAGE_ID_T MsgId, bool bRead);
81                 MSG_ERROR_T updateProtectedStatus(MSG_MESSAGE_ID_T MsgId, bool bProtected);
82                 MSG_ERROR_T deleteMessage(MSG_MESSAGE_ID_T MsgId);
83                 MSG_ERROR_T deleteAllMessagesInFolder(MSG_FOLDER_ID_T FolderId, bool bOnlyDB);
84                 MSG_ERROR_T moveMessageToFolder(MSG_MESSAGE_ID_T MsgId, MSG_FOLDER_ID_T DestFolderId);
85                 MSG_ERROR_T moveMessageToStorage(MSG_MESSAGE_ID_T MsgId, MSG_STORAGE_ID_T DestStorageId);
86                 MSG_ERROR_T countMessage(MSG_FOLDER_ID_T FolderId, MSG_COUNT_INFO_S *pCountInfo);
87                 MSG_ERROR_T countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
88                 MSG_ERROR_T countMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList);
89                 MSG_ERROR_T getMessage(MSG_MESSAGE_ID_T MsgId, MSG_MESSAGE_S *pMsg, MSG_SENDINGOPT_S *pSendOpt);
90                 MSG_ERROR_T getFolderViewList(MSG_FOLDER_ID_T FolderId, const MSG_SORT_RULE_S *pSortRule, MSG_LIST_S *pMsgFolderViewList);
91                 MSG_ERROR_T addFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
92                 MSG_ERROR_T updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
93                 MSG_ERROR_T deleteFolder(MSG_FOLDER_ID_T FolderId);
94                 MSG_ERROR_T getFolderList(MSG_FOLDER_LIST_S *pFolderList);
95
96                 MSG_ERROR_T getThreadViewList(const MSG_SORT_RULE_S *pSortRule, MSG_THREAD_VIEW_LIST_S *pThreadViewList);
97                 MSG_ERROR_T getConversationViewList(MSG_THREAD_ID_T ThreadId, MSG_LIST_S *pConvViewList);
98                 MSG_ERROR_T deleteThreadMessageList(MSG_THREAD_ID_T thread_id);
99                 MSG_ERROR_T getQuickPanelData(MSG_QUICKPANEL_TYPE_T Type, MSG_MESSAGE_S *pMsg);
100                 MSG_ERROR_T resetDatabase();
101                 MSG_ERROR_T getMemSize(unsigned int* memsize);
102
103                 // Setting
104                 MSG_ERROR_T setConfig(const MSG_SETTING_S *pSetting);
105                 MSG_ERROR_T getConfig(MSG_SETTING_S *pSetting);
106
107                 // ETC
108                 MSG_ERROR_T searchMessage(const char *pSearchString, MSG_THREAD_VIEW_LIST_S *pThreadViewList);
109                 MSG_ERROR_T searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, MSG_LIST_S *pMsgList);
110                 MSG_ERROR_T getMsgIdList(MSG_REFERENCE_ID_T RefId, MSG_MSGID_LIST_S *pMsgIdList);
111                 MSG_ERROR_T getRejectMsgList(const char *pNumber, MSG_REJECT_MSG_LIST_S *pRejectMsgList);
112                 MSG_ERROR_T regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam);
113                 MSG_ERROR_T getReportStatus(MSG_MESSAGE_ID_T msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status);
114
115                 void convertMsgStruct(const MSG_MESSAGE_INFO_S *pSource, MSG_MESSAGE_S *pDest);
116                 void convertSendOptStruct(const MSG_SENDINGOPT_INFO_S* pSrc, MSG_SENDINGOPT_S* pDest, MSG_MESSAGE_TYPE_S msgType);
117
118         private:
119                 void connectSocket();
120                 void    disconnectSocket();
121                 void write(const char *pCmd, int CmdSize, char **ppEvent);
122                 void read(char **ppEvent);
123                 void generateConnectionId(char *ConnectionId);
124                 void convertMsgStruct(const MSG_MESSAGE_S *pSource, MSG_MESSAGE_INFO_S *pDest);
125                 void convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOPT_INFO_S* pDest, MSG_MESSAGE_TYPE_S msgType);
126                 int getSettingCmdSize(MSG_OPTION_TYPE_T optionType);
127
128                 char            mConnectionId[20];
129                 short   mCounter;
130
131                 char                            mCookie[MAX_COOKIE_LEN];
132
133                 MsgIpcClientSocket      mClientSock;
134 };
135
136 #endif // MSG_HANDLE_H
137