Sync with tizen 2.4
[platform/core/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginEventHandler.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_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(struct tapi_handle *handle, SMS_TPDU_S *pTpdu);
41         void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, int simIndex);
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         void handleResendMessage(void);
45
46         msg_error_t callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
47         msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
48         msg_error_t callbackInitSimBySat();
49         msg_error_t callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
50         msg_error_t handleSimMsg(MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList, msg_message_id_t *retMsgId, int listSize);
51         msg_error_t updateIMSI(int sim_idx);
52         void handleSimMemoryFull(int simIndex);
53
54         void SetSentInfo(SMS_SENT_INFO_S *pSentInfo);
55
56         void setDeviceStatus(struct tapi_handle *handle);
57         bool getDeviceStatus(struct tapi_handle *handle);
58
59         void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
60
61         MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
62
63 private:
64         SmsPluginEventHandler();
65         virtual ~SmsPluginEventHandler();
66
67         void convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
68         void convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
69         void convertStatusRepTpduToMsginfo(const SMS_STATUS_REPORT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
70
71         static SmsPluginEventHandler* pInstance;
72
73         MSG_PLUGIN_LISTENER_S listener;
74         MSG_SIM_COUNT_S* pSimCnt;
75         SMS_SENT_INFO_S sentInfo;
76
77         bool devStatus;
78         bool bUdhMwiMethod;
79         int udhMwiCnt;
80
81         Mutex mx;
82         CndVar cv;
83         struct tapi_handle *devHandle;
84 };
85
86 #endif //SMS_PLUGIN_EVENT_HANDLER_H
87