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