[MPR-868] Add duplication logic for CB Messages
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginStorage.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 SMS_PLUGIN_STORAGE_H
18 #define SMS_PLUGIN_STORAGE_H
19
20
21 /*==================================================================================================
22                                                                                 INCLUDE FILES
23 ==================================================================================================*/
24 #include "MsgMutex.h"
25
26 #include "MsgStorageTypes.h"
27 #include "SmsPluginTypes.h"
28 #include "MsgInternalTypes.h"
29 #include "MsgSqliteWrapper.h"
30 #include <list>
31
32 extern "C"
33 {
34         #include <tapi_common.h>
35         #include <TelSms.h>
36         #include <TapiUtility.h>
37         #include <ITapiNetText.h>
38 }
39
40 /*==================================================================================================
41                                                                                 CLASS DEFINITIONS
42 ==================================================================================================*/
43 class SmsPluginStorage
44 {
45 public:
46         static SmsPluginStorage* instance();
47
48         msg_error_t insertMsgRef(MSG_MESSAGE_INFO_S *pMsg, unsigned char msgRef, int index);
49         msg_error_t updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInfo, unsigned char msgRef);
50
51         msg_error_t updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t Status);
52 /*      msg_error_t updateMsgRef(msg_message_id_t MsgId, unsigned char MsgRef); */
53 /*      msg_error_t updateStatusReport(unsigned char MsgRef, msg_delivery_report_status_t Status, time_t DeliveryTime); */
54
55         msg_error_t addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int *simIdList);
56         msg_error_t insertSimMessage(int simId, int msgId);
57         msg_error_t deleteSimMessage(int sim_idx, int simId);
58
59         msg_error_t checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
60         msg_error_t addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
61         msg_error_t deleteSmsMessage(msg_message_id_t msgId);
62 #if 0
63         msg_error_t isReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage);
64         msg_error_t insertReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage);
65 #endif
66         msg_error_t addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
67
68         msg_error_t getReplaceSimMsg(const MSG_MESSAGE_INFO_S *pMsg, int *pMsgId, int *pSimId);
69
70         msg_error_t checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo);
71         msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, int app_id_len, char *content_type, int content_type_len);
72         msg_error_t getnthPushEvent(int index, int *appcode);
73         msg_error_t releasePushEvent();
74         msg_error_t updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
75         bool isDuplicatedCBMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
76 private:
77         SmsPluginStorage();
78         ~SmsPluginStorage();
79
80         msg_error_t addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo);
81
82         static SmsPluginStorage* pInstance;
83         static void* class2_thread(void *data);
84
85         MSG_MESSAGE_INFO_S msgInfo;
86         MSG_ADDRESS_INFO_S addrInfo;
87
88         std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
89         /* unsigned char tmpMsgRef; */
90 };
91
92 #endif /* SMS_PLUGIN_STORAGE_H */
93