Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Bluetooth / JSBluetoothSocket.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_JS_BLUETOOTH_SOCKET_H_
18 #define TIZENAPIS_TIZEN_JS_BLUETOOTH_SOCKET_H_
19
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Bluetooth/BTDevice.h>
23 #include <API/Bluetooth/IBluetoothSocketManager.h>
24
25 using namespace WrtDeviceApis::CommonsJavaScript;
26   
27 namespace TizenApis {
28 namespace Tizen1_0 {
29
30 typedef  PrivateObjectT<Api::Bluetooth::IBluetoothSocketManagerPtr>::Type JSBluetoothSocketPriv;
31 class JSBluetoothSocket 
32 {
33 public:
34         static const JSClassDefinition* getClassInfo();
35         static const JSClassRef getClassRef();
36         static JSObjectRef createJSObject(JSContextRef context, BluetoothSocketData socketData);
37         static JSObjectRef createJSObject(JSContextRef context, BluetoothSocketData socketData, 
38                 EventBTReadDataType readData);
39
40 private:
41         static void initialize(JSContextRef context, JSObjectRef object);
42         static void finalize(JSObjectRef object);
43         static bool hasInstance(JSContextRef context, JSObjectRef constructor,
44                 JSValueRef possibleInstance, JSValueRef* exception);
45
46         static bool setProperty(JSContextRef context, 
47                                                 JSObjectRef object,
48                                                 JSStringRef propertyName,
49                                                 JSValueRef value,
50                                                 JSValueRef* exception);
51
52         static bool setOnConnect(JSContextRef context, JSObjectRef object,
53                                                 JSStringRef propertyName, JSValueRef value,
54                                                 JSValueRef* exception);
55
56
57         static JSValueRef setSocketNotifier(JSContextRef context, JSObjectRef object,
58                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
59                 JSValueRef* exception);
60
61         static JSValueRef writeData(JSContextRef context, JSObjectRef object,
62                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
63                 JSValueRef* exception);
64
65                 
66         static JSValueRef readData(JSContextRef context, JSObjectRef object,
67                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
68                 JSValueRef* exception);
69
70                 
71         static JSValueRef close(JSContextRef context, JSObjectRef object,
72                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
73                 JSValueRef* exception);
74
75
76         static JSValueRef getProperty(JSContextRef context,
77                                JSObjectRef object,
78                                JSStringRef propertyName,
79                                JSValueRef* exception);
80
81         static JSClassDefinition m_classInfo;
82         static JSStaticFunction m_function[];
83         static JSStaticValue m_properties[];
84
85         static JSClassRef m_jsClassRef;
86         
87 };
88
89
90 }
91
92 #endif
93