Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginEventHandler.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.1 (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/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 SMS_PLUGIN_EVENT_HANDLER_H
18 #define SMS_PLUGIN_EVENT_HANDLER_H
19
20
21 /*==================================================================================================
22                                          INCLUDE FILES
23 ==================================================================================================*/
24 #include "MsgMutex.h"
25 #include "MsgTextConvert.h"
26 #include "MsgPluginInterface.h"
27 #include "SmsPluginTypes.h"
28
29
30 /*==================================================================================================
31                                      CLASS DEFINITIONS
32 ==================================================================================================*/
33 class SmsPluginEventHandler
34 {
35 public:
36         static SmsPluginEventHandler* instance();
37
38         void registerListener(MSG_PLUGIN_LISTENER_S *pListener);
39         void handleSentStatus(msg_network_status_t NetStatus);
40         void handleMsgIncoming(SMS_TPDU_S *pTpdu);
41         void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen);
42         void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
43         void handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *app_id, char *content_type);
44
45         msg_error_t callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
46         msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg);
47         msg_error_t callbackInitSimBySat();
48         msg_error_t callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
49
50         void SetSentInfo(SMS_SENT_INFO_S *pSentInfo);
51
52         void setDeviceStatus();
53         bool getDeviceStatus();
54
55         void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
56
57 private:
58         SmsPluginEventHandler();
59         virtual ~SmsPluginEventHandler();
60
61         void convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
62         void convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
63         void convertStatusRepTpduToMsginfo(const SMS_STATUS_REPORT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
64         MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
65
66         static SmsPluginEventHandler* pInstance;
67
68         MSG_PLUGIN_LISTENER_S listener;
69         MSG_SIM_COUNT_S* pSimCnt;
70         SMS_SENT_INFO_S sentInfo;
71
72         bool devStatus;
73
74         Mutex mx;
75         CndVar cv;
76
77         MsgTextConvert textCvt;
78 };
79
80 #endif //SMS_PLUGIN_EVENT_HANDLER_H
81