Merge from master.
[framework/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginStorage.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *    http://floralicense.org
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef MMS_PLUGIN_STORAGE_H
18 #define MMS_PLUGIN_STORAGE_H
19
20 #include "MsgSqliteWrapper.h"
21 #include "MmsPluginCodecTypes.h"
22
23 class MmsPluginStorage
24 {
25 public:
26         static MmsPluginStorage *instance();
27
28         MmsPluginStorage();
29         ~MmsPluginStorage();
30
31         void addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
32         void getMmsMessage(MmsMsg **pMmsMsg);
33         void getMmsAttrib(msg_message_id_t msgId, MmsMsg *pMmsMsg);
34         msg_error_t getMmsMessageId(msg_message_id_t selectedMsgId, MmsMsg *pMmsMsg);
35         void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
36
37         int searchMsgId(char *toNumber, char *szMsgID);
38         int getMmsVersion(msg_message_id_t selectedMsgId);
39
40         msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
41         msg_error_t updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
42         msg_error_t updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
43         msg_error_t updateMmsAttachCount(msg_message_id_t msgId, int count);
44         msg_error_t updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
45
46         msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
47         msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
48         msg_error_t insertPreviewInfo(int msgId, int type, char *value, int count = 0);
49
50         msg_error_t removePreviewInfo(int msgId);
51
52         msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
53         msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pDestMsg);
54         msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
55         msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
56
57         /* reject_msg_support */
58         msg_error_t getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen);
59         /* reject_msg_support */
60         msg_error_t getAddressInfo(msg_message_id_t msgId, MSG_ADDRESS_INFO_S *pAddrInfo);
61         msg_error_t updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
62
63         msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
64
65         msg_error_t deleteMmsMessage(int msgId);
66
67         void getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg);
68
69
70
71 private:
72         msg_error_t addMmsMsgToDB(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, int attachCnt = 0);
73         msg_error_t addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_filepath);
74         static MmsPluginStorage *pInstance;
75
76         MsgDbHandler dbHandle;
77
78         MmsMsg mmsMsg;
79 };
80
81 #endif //MMS_PLUGIN_STORAGE_H
82