OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BluetoothRemoteGATTDescriptor_h | |
6 #define BluetoothRemoteGATTDescriptor_h | |
7 | |
8 #include "bindings/core/v8/ScriptWrappable.h" | |
9 #include "core/dom/ActiveDOMObject.h" | |
10 #include "core/dom/DOMArrayPiece.h" | |
11 #include "core/dom/DOMDataView.h" | |
12 #include "modules/EventTargetModules.h" | |
13 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" | |
14 #include "modules/bluetooth/BluetoothRemoteGATTService.h" | |
15 #include "platform/heap/Handle.h" | |
16 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic .h" | |
17 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptor.h" | |
18 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit .h" | |
19 #include "wtf/text/WTFString.h" | |
20 #include <memory> | |
21 | |
22 namespace blink { | |
23 | |
24 class BluetoothCharacteristicProperties; | |
25 class BluetoothRemoteGATTCharacteristic; | |
26 class ScriptPromise; | |
27 class ScriptPromiseResolver; | |
28 class ScriptState; | |
29 | |
30 // BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is | |
31 // a basic data element that provides further information about a peripheral's | |
32 // characteristic. | |
33 | |
34 class BluetoothRemoteGATTDescriptor final | |
35 : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>, | |
ortuno
2016/11/22 03:02:02
Does this need to be Finalized? Could it be just G
dougt
2016/11/29 22:50:48
It needs to be finalized.
../../third_party/WebKi
| |
36 public ScriptWrappable { | |
37 DEFINE_WRAPPERTYPEINFO(); | |
38 | |
39 public: | |
40 explicit BluetoothRemoteGATTDescriptor( | |
41 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, | |
42 BluetoothRemoteGATTCharacteristic*); | |
43 | |
44 // Interface required by CallbackPromiseAdapter. | |
45 static BluetoothRemoteGATTDescriptor* take( | |
46 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, | |
47 BluetoothRemoteGATTCharacteristic*); | |
48 | |
49 // Save value. | |
50 void setValue(DOMDataView*); | |
51 | |
52 // IDL exposed interface: | |
53 BluetoothRemoteGATTCharacteristic* characteristic() { | |
54 return m_characteristic; | |
55 } | |
56 String uuid() { return m_webDescriptor->uuid; } | |
57 DOMDataView* value() const { return m_value; } | |
58 ScriptPromise readValue(ScriptState*); | |
59 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | |
60 | |
61 // Interface required by garbage collection. | |
62 DECLARE_VIRTUAL_TRACE(); | |
63 | |
64 private: | |
65 friend class DescriptorReadValueCallback; | |
66 | |
67 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); } | |
68 | |
69 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor; | |
70 Member<BluetoothRemoteGATTCharacteristic> m_characteristic; | |
71 Member<DOMDataView> m_value; | |
72 }; | |
73 | |
74 } // namespace blink | |
75 | |
76 #endif // BluetoothRemoteGATTDescriptor_h | |
OLD | NEW |