// // Tizen Web Device API // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef CALLBACKMGR_H_ #define CALLBACKMGR_H_ #include #include #include extern "C" { #include #include } namespace DeviceAPI { namespace Messaging { class ISendingObserver; /* * */ class CallbackMgr { protected: CallbackMgr(); // static void sendCallback(MSG_HANDLE_T handle, // MSG_SENT_STATUS_S *sent_status, static void sendCallback(msg_handle_t handle, msg_struct_t sent_status, void *user_param); // void call(MSG_SENT_STATUS_S *sent_status); void call(msg_struct_t sent_status); public: ~CallbackMgr(); // typedef int (*SendingFunction)(MSG_HANDLE_T, MSG_REQUEST_S*); typedef int (*SendingFunction)(msg_handle_t, msg_struct_t); // register for sending callback msg_error_t registerAndSend(SendingFunction sendingFn, // const msg_message_t& message, const msg_struct_t& message, ISendingObserver* observer); // unregister callback void unregister(int reqId); private: DPL::Mutex m_mutex; typedef std::map SendReqMap; SendReqMap m_sendRequests; }; typedef DPL::Singleton CallbackMgrSingleton; } } #endif /* CALLBACKMGR_H_ */