2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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
8 * http://www.tizenopensource.org/license
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.
17 #ifndef __MSG_PROXY_LISTENER_H__
18 #define __MSG_PROXY_LISTENER_H__
21 /*==================================================================================================
23 ==================================================================================================*/
24 #include "MsgIpcSocket.h"
27 #include "MsgHandle.h"
34 /*==================================================================================================
36 ==================================================================================================*/
40 msg_sent_status_cb pfSentStatusCB;
42 } MSG_SENT_STATUS_CB_ITEM_S;
47 msg_sms_incoming_cb pfIncomingCB;
50 } MSG_INCOMING_CB_ITEM_S;
55 msg_mms_conf_msg_incoming_cb pfMMSConfIncomingCB;
56 char appId[MAX_MMS_JAVA_APPID_LEN+1];
58 } MSG_MMS_CONF_INCOMING_CB_ITEM_S;
63 msg_push_msg_incoming_cb pfPushIncomingCB;
64 char appId[MAX_WAPPUSH_ID_LEN+1];
66 } MSG_PUSH_INCOMING_CB_ITEM_S;
71 msg_cb_incoming_cb pfCBIncomingCB;
74 } MSG_CB_INCOMING_CB_ITEM_S;
79 msg_syncml_msg_incoming_cb pfSyncMLIncomingCB;
81 } MSG_SYNCML_INCOMING_CB_ITEM_S;
86 msg_lbs_msg_incoming_cb pfLBSMsgIncoming;
88 } MSG_LBS_INCOMING_CB_ITEM_S;
93 msg_syncml_msg_operation_cb pfSyncMLOperationCB;
95 } MSG_SYNCML_OPERATION_CB_ITEM_S;
100 msg_storage_change_cb pfStorageChangeCB;
102 } MSG_STORAGE_CHANGE_CB_ITEM_S;
105 typedef std::list<MSG_SENT_STATUS_CB_ITEM_S> MsgSentStatusCBList;
106 typedef std::list<MSG_INCOMING_CB_ITEM_S> MsgNewMessageCBList;
107 typedef std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S> MsgNewMMSConfMessageCBList;
108 typedef std::list<MSG_PUSH_INCOMING_CB_ITEM_S> MsgNewPushMessageCBList;
109 typedef std::list<MSG_CB_INCOMING_CB_ITEM_S> MsgNewCBMessageCBList;
110 typedef std::list<MSG_SYNCML_INCOMING_CB_ITEM_S> MsgNewSyncMLMessageCBList;
111 typedef std::list<MSG_LBS_INCOMING_CB_ITEM_S> MsgNewLBSMessageCBList;
112 typedef std::list<MSG_SYNCML_OPERATION_CB_ITEM_S> MsgOperationSyncMLMessageCBList;
113 typedef std::list<MSG_STORAGE_CHANGE_CB_ITEM_S> MsgStorageChangeCBList;
116 /*==================================================================================================
118 ==================================================================================================*/
119 class MsgProxyListener
122 static MsgProxyListener* instance();
127 bool regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam);
128 bool regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam);
129 bool regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam);
130 bool regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam);
131 bool regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam);
132 bool regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam);
133 bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam);
134 bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam);
135 bool regStorageChangeEventCB(MsgHandle* pMsgHandle, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam);
137 void clearListOfClosedHandle(MsgHandle* pMsgHandle);
139 void handleEvent(const MSG_EVENT_S* ptr);
142 int readFromSocket(char** buf, unsigned int* len);
143 #ifdef CHECK_SENT_STATUS_CALLBACK
144 int getSentStatusCbCnt();
151 static MsgProxyListener* pInstance;
153 unsigned int running;
155 MsgIpcClientSocket cliSock;
160 MsgSentStatusCBList sentStatusCBList;
161 MsgNewMessageCBList newMessageCBList;
162 MsgNewMMSConfMessageCBList newMMSConfMessageCBList;
163 MsgNewPushMessageCBList newPushMessageCBList;
164 MsgNewCBMessageCBList newCBMessageCBList;
165 MsgNewSyncMLMessageCBList newSyncMLMessageCBList;
166 MsgNewLBSMessageCBList newLBSMessageCBList;
167 MsgOperationSyncMLMessageCBList operationSyncMLMessageCBList;
168 MsgStorageChangeCBList storageChangeCBList;
174 #endif // __MSG_PROXY_LISTENER_H__