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/WebBluetoothRemoteGATTDescriptorInit .h" | |
18 #include "wtf/text/WTFString.h" | |
19 #include <memory> | |
20 | |
21 namespace blink { | |
22 | |
23 class BluetoothRemoteGATTCharacteristic; | |
24 class ScriptPromise; | |
25 class ScriptState; | |
26 | |
27 // BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is | |
28 // a basic data element that provides further information about a peripheral's | |
29 // characteristic. | |
30 | |
ortuno
2016/12/02 06:14:51
nit: Remove blank line.
dougt
2016/12/02 18:31:29
Done.
| |
31 class BluetoothRemoteGATTDescriptor final | |
32 : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>, | |
33 public ScriptWrappable { | |
34 DEFINE_WRAPPERTYPEINFO(); | |
35 | |
36 public: | |
37 explicit BluetoothRemoteGATTDescriptor( | |
ortuno
2016/12/02 06:14:51
No need for explicit since the function doesn't ta
dougt
2016/12/02 18:31:29
Done.
| |
38 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, | |
39 BluetoothRemoteGATTCharacteristic*); | |
40 | |
41 static BluetoothRemoteGATTDescriptor* create( | |
ortuno
2016/12/02 06:14:51
We don't do anything special in create so just use
dougt
2016/12/02 18:31:29
Acknowledged.
We test for a null input and this s
ortuno
2016/12/07 08:05:12
Characteristic needs it because it's an ActiveDOMO
| |
42 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, | |
43 BluetoothRemoteGATTCharacteristic*); | |
44 | |
45 // Save value. | |
ortuno
2016/12/02 06:14:51
No need for this yet.
dougt
2016/12/02 18:31:29
Done.
| |
46 void setValue(DOMDataView*); | |
47 | |
48 // IDL exposed interface: | |
49 BluetoothRemoteGATTCharacteristic* characteristic() { | |
50 return m_characteristic; | |
51 } | |
52 String uuid() { return m_webDescriptor->uuid; } | |
53 DOMDataView* value() const { return m_value; } | |
54 ScriptPromise readValue(ScriptState*); | |
55 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | |
56 | |
57 // Interface required by garbage collection. | |
58 DECLARE_VIRTUAL_TRACE(); | |
59 | |
60 private: | |
61 friend class DescriptorReadValueCallback; | |
62 | |
63 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); } | |
64 | |
65 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor; | |
66 Member<BluetoothRemoteGATTCharacteristic> m_characteristic; | |
67 Member<DOMDataView> m_value; | |
ortuno
2016/12/02 06:14:51
No need for value yet.
dougt
2016/12/02 18:31:29
Done.
| |
68 }; | |
69 | |
70 } // namespace blink | |
71 | |
72 #endif // BluetoothRemoteGATTDescriptor_h | |
OLD | NEW |