update tizen source
[framework/messaging/msg-service.git] / plugin / sms_plugin / include / SmsPluginEventHandler.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 SMS_PLUGIN_EVENT_HANDLER_H
32 #define SMS_PLUGIN_EVENT_HANDLER_H
33
34
35 /*==================================================================================================
36                                          INCLUDE FILES
37 ==================================================================================================*/
38 #include "MsgMutex.h"
39 #include "MsgPluginInterface.h"
40 #include "SmsPluginTypes.h"
41
42
43 /*==================================================================================================
44                                      CLASS DEFINITIONS
45 ==================================================================================================*/
46 class SmsPluginEventHandler
47 {
48 public:
49         static SmsPluginEventHandler* instance();
50
51         void registerListener(MSG_PLUGIN_LISTENER_S *pListener);
52         void handleSentStatus(int TapiReqId, MSG_NETWORK_STATUS_T NetStatus);
53         void handleMsgIncoming(SMS_TPDU_S *pTpdu);
54         void handleSyncMLMsgIncoming(MSG_SYNCML_MESSAGE_TYPE_T msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen);
55         void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
56         void handleDftSms(MSG_FOLDER_ID_T FolderId, char* pNumber, char* pData);
57
58         MSG_ERROR_T callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
59         MSG_ERROR_T callbackInitSimBySat();
60         MSG_ERROR_T callbackStorageChange(MSG_STORAGE_CHANGE_TYPE_T storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
61
62         void SetSentInfo(SMS_SENT_INFO_S *pSentInfo);
63
64         void setDeviceStatus();
65         bool getDeviceStatus();
66
67         void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
68
69 private:
70         SmsPluginEventHandler();
71         virtual ~SmsPluginEventHandler();
72
73         void convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
74         void convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
75         void convertStatusRepTpduToMsginfo(const SMS_STATUS_REPORT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
76         MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
77
78         static SmsPluginEventHandler* pInstance;
79
80         MSG_PLUGIN_LISTENER_S listener;
81         MSG_SIM_COUNT_S* pSimCnt;
82         SMS_SENT_INFO_S sentInfo;
83
84         bool devStatus;
85
86         Mutex mx;
87         CndVar cv;
88 };
89
90 #endif //SMS_PLUGIN_EVENT_HANDLER_H
91