tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Bluetooth / BluetoothServiceHandler.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef __TIZEN_BLUETOOTH_SERVICE_HANDLER_H__
19 #define __TIZEN_BLUETOOTH_SERVICE_HANDLER_H__
20
21 #include <string>
22 #include <JavaScriptCore/JavaScript.h>
23
24 //#include <boost/shared_ptr.hpp>
25 #include <MultiCallbackUserData.h>
26 #include <PropertyBag.h>
27 #include <Security.h>
28
29 namespace DeviceAPI {
30 namespace Bluetooth {
31
32 class BluetoothServiceHandler : public Common::SecurityAccessor
33 {
34 public:
35     BluetoothServiceHandler(std::string uuid, std::string name, int registeredSocket);
36     virtual ~BluetoothServiceHandler();
37
38     std::string getUUID() const;
39     std::string getName() const;
40     int getRegisteredSocket() const;
41     bool getConnectionState() const;
42     Common::MultiCallbackUserDataPtr getOnConnect() const;
43     JSValueRef getOnConnect(JSContextRef context);
44
45     void setConnectionState(bool isConnected);
46     bool setOnConnect(JSContextRef context, JSObjectRef onConnect);
47
48     void unregister(Common::MultiCallbackUserDataPtr userData);
49
50 private:
51     std::string mUUID;
52     std::string mName;
53     int mRegisteredSocket;
54     bool mIsConnected;
55     bool mIsRegistered;
56     Common::MultiCallbackUserDataPtr mOnConnect;
57     Common::PropertyBag mLocalProperty;
58 };
59
60 typedef BluetoothServiceHandler* BluetoothServiceHandlerPtr;
61
62 } // Bluetooth
63 } // DeviceAPI
64
65 #endif // __TIZEN_BLUETOOTH_SERVICE_HANDLER_H__