4d9973a479dd1b0ef5a4b6cd43e88b2bfa3ccda4
[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(TapiHandle *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(TapiHandle *handle);
57         bool getDeviceStatus(TapiHandle *handle);
58
59         /* temp */
60         void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
61
62         MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
63
64 private:
65         SmsPluginEventHandler();
66         virtual ~SmsPluginEventHandler();
67
68         void convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
69         void convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
70         void convertStatusRepTpduToMsginfo(const SMS_STATUS_REPORT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
71
72         static SmsPluginEventHandler* pInstance;
73
74         MSG_PLUGIN_LISTENER_S listener;
75         MSG_SIM_COUNT_S* pSimCnt;
76         SMS_SENT_INFO_S sentInfo;
77
78         bool devStatus;
79         bool bUdhMwiMethod;
80         int udhMwiCnt;
81
82         Mutex mx;
83         CndVar cv;
84         TapiHandle *devHandle;
85 };
86
87 #endif /* SMS_PLUGIN_EVENT_HANDLER_H */
88