2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
27 #ifndef CALLBACKMGR_H_
28 #define CALLBACKMGR_H_
31 #include <dpl/singleton.h>
32 #include <dpl/mutex.h>
35 #include <msg_types.h>
36 #include <msg_transport_types.h>
43 class ISendingObserver;
53 // static void sendCallback(MSG_HANDLE_T handle,
54 // MSG_SENT_STATUS_S *sent_status,
55 static void sendCallback(msg_handle_t handle,
56 msg_struct_t sent_status,
59 // void call(MSG_SENT_STATUS_S *sent_status);
60 void call(msg_struct_t sent_status);
65 // typedef int (*SendingFunction)(MSG_HANDLE_T, MSG_REQUEST_S*);
66 typedef int (*SendingFunction)(msg_handle_t, msg_struct_t);
68 // register for sending callback
69 msg_error_t registerAndSend(SendingFunction sendingFn,
70 // const msg_message_t& message,
71 const msg_struct_t& message,
72 ISendingObserver* observer);
74 // unregister callback
75 void unregister(int reqId);
80 typedef std::map<msg_request_id_t, ISendingObserver*> SendReqMap;
81 SendReqMap m_sendRequests;
84 typedef DPL::Singleton<CallbackMgr> CallbackMgrSingleton;
88 #endif /* CALLBACKMGR_H_ */