OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BluetoothRemoteGATTServer_h | 5 #ifndef BluetoothRemoteGATTServer_h |
6 #define BluetoothRemoteGATTServer_h | 6 #define BluetoothRemoteGATTServer_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "bindings/modules/v8/UnionTypesModules.h" | 9 #include "bindings/modules/v8/UnionTypesModules.h" |
10 #include "modules/bluetooth/BluetoothDevice.h" | 10 #include "modules/bluetooth/BluetoothDevice.h" |
11 #include "platform/heap/Heap.h" | 11 #include "platform/heap/Heap.h" |
12 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
13 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
14 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class BluetoothDevice; | 18 class BluetoothDevice; |
19 class ScriptPromise; | 19 class ScriptPromise; |
20 class ScriptPromiseResolver; | 20 class ScriptPromiseResolver; |
21 class ScriptState; | 21 class ScriptState; |
22 | 22 |
23 // BluetoothRemoteGATTServer provides a way to interact with a connected bluetoo
th peripheral. | 23 // BluetoothRemoteGATTServer provides a way to interact with a connected bluetoo
th peripheral. |
24 class BluetoothRemoteGATTServer final | 24 class BluetoothRemoteGATTServer final |
25 : public GarbageCollectedFinalized<BluetoothRemoteGATTServer> | 25 : public GarbageCollected<BluetoothRemoteGATTServer> |
26 , public ScriptWrappable { | 26 , public ScriptWrappable { |
27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
28 public: | 28 public: |
29 BluetoothRemoteGATTServer(BluetoothDevice*); | 29 BluetoothRemoteGATTServer(BluetoothDevice*); |
30 | 30 |
31 static BluetoothRemoteGATTServer* create(BluetoothDevice*); | 31 static BluetoothRemoteGATTServer* create(BluetoothDevice*); |
32 | 32 |
33 void setConnected(bool connected) { m_connected = connected; } | 33 void setConnected(bool connected) { m_connected = connected; } |
34 | 34 |
35 // Interface required by Garbage Collectoin: | 35 // Interface required by Garbage Collectoin: |
36 DECLARE_VIRTUAL_TRACE(); | 36 DECLARE_VIRTUAL_TRACE(); |
37 | 37 |
38 // IDL exposed interface: | 38 // IDL exposed interface: |
39 BluetoothDevice* device() { return m_device; } | 39 BluetoothDevice* device() { return m_device; } |
40 bool connected() { return m_connected; } | 40 bool connected() { return m_connected; } |
41 ScriptPromise connect(ScriptState*); | 41 ScriptPromise connect(ScriptState*); |
42 void disconnect(ScriptState*); | 42 void disconnect(ScriptState*); |
43 ScriptPromise getPrimaryService(ScriptState*, const StringOrUnsignedLong& se
rvice, ExceptionState&); | 43 ScriptPromise getPrimaryService(ScriptState*, const StringOrUnsignedLong& se
rvice, ExceptionState&); |
44 | 44 |
45 private: | 45 private: |
46 Member<BluetoothDevice> m_device; | 46 Member<BluetoothDevice> m_device; |
47 bool m_connected; | 47 bool m_connected; |
48 }; | 48 }; |
49 | 49 |
50 } // namespace blink | 50 } // namespace blink |
51 | 51 |
52 #endif // BluetoothDevice_h | 52 #endif // BluetoothDevice_h |
OLD | NEW |