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.
20 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
25 #ifndef CALLBACKMGR_H_
26 #define CALLBACKMGR_H_
29 #include <dpl/singleton.h>
30 #include <dpl/mutex.h>
34 #include <MsgTransportTypes.h>
37 namespace WrtDeviceApis {
39 class ISendingObserver;
49 static void sendCallback(MSG_HANDLE_T handle,
50 MSG_SENT_STATUS_S *sent_status,
53 void call(MSG_SENT_STATUS_S *sent_status);
58 typedef int (*SendingFunction)(MSG_HANDLE_T, MSG_REQUEST_S*);
60 // register for sending callback
61 MSG_ERROR_T registerAndSend(SendingFunction sendingFn,
62 const msg_message_t& message,
63 ISendingObserver* observer);
65 // unregister callback
66 void unregister(int reqId);
71 typedef std::map<MSG_REQUEST_ID_T, ISendingObserver*> SendReqMap;
72 SendReqMap m_sendRequests;
75 typedef DPL::Singleton<CallbackMgr> CallbackMgrSingleton;
79 #endif /* CALLBACKMGR_H_ */