RSA sync with private
[platform/core/messaging/msg-service.git] / include / framework / MsgPluginManager.h
1 /*
2 * Copyright 2012  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://www.tizenopensource.org/license
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 MSG_PLUGIN_MANAGER_H
18 #define MSG_PLUGIN_MANAGER_H
19
20 /*==================================================================================================
21                                          INCLUDE FILES
22 ==================================================================================================*/
23 #include <map>
24
25 #include "MsgTypes.h"
26 #include "MsgPluginInterface.h"
27 #include "MsgPluginConfig.h"
28
29
30 /*==================================================================================================
31                                     DEFINES
32 ==================================================================================================*/
33 #define MSG_PLUGIN_CFG_PATH     "/usr/share/msg-service/"
34 #define MSG_PLUGIN_CFG_NAME     "plugin.cfg"
35
36
37 /*==================================================================================================
38                                      CLASS DEFINITIONS
39 ==================================================================================================*/
40 class MsgPlugin
41 {
42 public:
43         MsgPlugin(MSG_MAIN_TYPE_T plgType = MSG_UNKNOWN_TYPE, const char* libPath = NULL);
44         ~MsgPlugin();
45
46         msg_error_t initialize();
47         void finalize();
48
49         msg_error_t submitReq(MSG_REQUEST_INFO_S *pReqInfo);
50         msg_error_t registerListener(MSG_PLUGIN_LISTENER_S *pListener);
51         msg_error_t checkSimStatus(MSG_SIM_STATUS_T *pStatus);
52         msg_error_t checkDeviceStatus();
53
54         msg_error_t initSimMessage();
55         msg_error_t saveSimMessage(MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList);
56         msg_error_t deleteSimMessage(msg_sim_id_t SimMsgId);
57         msg_error_t setReadStatus(msg_sim_id_t SimMsgId);
58         msg_error_t setMemoryStatus(msg_error_t Error);
59
60         msg_error_t initConfigData(MSG_SIM_STATUS_T SimStatus);
61         msg_error_t setConfigData(const MSG_SETTING_S *pSetting);
62         msg_error_t getConfigData(MSG_SETTING_S *pSetting);
63
64         // MMS handlers
65         msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
66         msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
67         msg_error_t processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject);
68         msg_error_t getMmsMessage(MSG_MESSAGE_INFO_S *pMsg,  MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
69         msg_error_t updateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo);
70         msg_error_t composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
71
72         msg_error_t restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, int rcvdBodyLen, char* filePath);
73
74         operator void*() const {
75                 return (mSupportedMsg==MSG_UNKNOWN_TYPE)? NULL:(void*) this;
76         }
77
78 private:
79         MSG_MAIN_TYPE_T                         mSupportedMsg;
80         MSG_PLUGIN_HANDLER_S    mPlgHandler;
81
82         void    *mLibHandler;    // plugin library pointer
83 };
84
85
86 /*==================================================================================================
87                                      GLOBAL VARIABLES
88 ==================================================================================================*/
89 typedef std::map<MSG_MAIN_TYPE_T, MsgPlugin*> MsgPluginMap;
90
91
92 /*==================================================================================================
93                                      CLASS DEFINITIONS
94 ==================================================================================================*/
95 class MsgPluginManager
96 {
97 public:
98         static MsgPluginManager* instance();
99
100         void initialize();
101         void finalize();
102         MsgPlugin* getPlugin(MSG_MAIN_TYPE_T mainType);
103         void loadPlugins(const char* path);
104
105 private:
106         MsgPluginManager();
107         ~MsgPluginManager();
108
109         static MsgPluginManager* pInstance;
110         MsgPluginMap plgMap;
111 };
112
113 #endif // MSG_PLUGIN_MANAGER_H
114