Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Bluetooth / BluetoothMultiCallback.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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. 
15  */
16
17 #ifndef TIZENAPIS_TIZEN_BLUETOOTH_MULTI_CALLBACK_H_
18 #define TIZENAPIS_TIZEN_BLUETOOTH_MULTI_CALLBACK_H_
19
20 #include <dpl/shared_ptr.h>
21 #include <Commons/IEvent.h>
22 #include <CommonsJavaScript/JSCallbackManager.h>
23 #include <JavaScriptCore/JavaScript.h>
24
25 using namespace WrtDeviceApis::CommonsJavaScript;
26
27 namespace TizenApis {
28 namespace Tizen1_0 {
29
30 struct BluetoothDiscoveryDevicesSuccessCallback 
31 {
32         JSValueRef onSuccess;
33         JSValueRef onFound;
34         JSValueRef onFinished;
35
36         BluetoothDiscoveryDevicesSuccessCallback()
37                 : onSuccess(NULL),
38                 onFound(NULL),
39                 onFinished(NULL)
40         { }
41 };
42
43 struct BluetoothSocketNotifier 
44 {
45         JSValueRef onMessage;
46         JSValueRef onError;
47         JSValueRef onClose;
48
49         BluetoothSocketNotifier()
50                 : onMessage(NULL),
51                 onError(NULL),
52                 onClose(NULL)
53         { }
54
55 };
56
57 struct BluetoothRegisterServiceSuccessCallback 
58 {
59         JSValueRef onSuccess;
60         JSValueRef onConnected;
61
62         BluetoothRegisterServiceSuccessCallback()
63                 : onSuccess(NULL),
64                 onConnected(NULL)
65         { }
66 };
67
68
69 class EventBTOnDiscoveryDevicesPrivateData : public WrtDeviceApis::Commons::IEventPrivateData 
70 {
71 public:
72         EventBTOnDiscoveryDevicesPrivateData(const JSCallbackManagerPtr& onSuccess,
73                         const JSCallbackManagerPtr& onFound,
74                         const JSCallbackManagerPtr& onFinished);
75
76         JSCallbackManagerPtr getOnSuccess() const;
77         JSCallbackManagerPtr getOnFound() const;
78         JSCallbackManagerPtr getOnFinished() const;
79
80 private:
81         JSCallbackManagerPtr m_onSuccess;
82         JSCallbackManagerPtr m_onFound;
83         JSCallbackManagerPtr m_onFinished;      
84 };
85
86 typedef DPL::SharedPtr<EventBTOnDiscoveryDevicesPrivateData> EventBTOnDiscoveryDevicesPrivateDataPtr;
87
88
89 class BluetoothSocketNotifierPrivateData : public WrtDeviceApis::Commons::IEventPrivateData 
90 {
91 public:
92         BluetoothSocketNotifierPrivateData
93                         (const JSCallbackManagerPtr& onMessage,
94                         const JSCallbackManagerPtr& onError,
95                         const JSCallbackManagerPtr& onClose);
96
97         JSCallbackManagerPtr getOnMessage() const;
98         JSCallbackManagerPtr getOnError() const;
99         JSCallbackManagerPtr getOnClose() const;
100         JSObjectRef getObject() const;
101         void setObject(const JSObjectRef object);
102
103 private:
104         JSCallbackManagerPtr m_onMessage;
105         JSCallbackManagerPtr m_onError;
106         JSCallbackManagerPtr m_onClose; 
107         JSObjectRef m_object;
108 };
109
110 typedef DPL::SharedPtr<BluetoothSocketNotifierPrivateData> BluetoothSocketNotifierPrivateDataPtr;
111
112
113 class BluetoothRegisterServiceSuccessCallbackPrivateData : public WrtDeviceApis::Commons::IEventPrivateData 
114 {
115 public:
116         BluetoothRegisterServiceSuccessCallbackPrivateData
117                         (const JSCallbackManagerPtr& onSuccess, const JSCallbackManagerPtr& onConnected);
118
119         JSCallbackManagerPtr getOnSuccess() const;
120         JSCallbackManagerPtr getOnConnected() const;
121
122 private:
123         JSCallbackManagerPtr m_onSuccess;
124         JSCallbackManagerPtr m_onConnected;
125 };
126
127 typedef DPL::SharedPtr<BluetoothRegisterServiceSuccessCallbackPrivateData> BluetoothRegisterServiceSuccessCallbackPrivateDataPtr;
128 }
129 }
130
131 #endif