Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Removing BDH_INVALID_DESCRIPTOR_ID Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 class BluetoothRemoteGATTDescriptor final
31 : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>,
32 public ScriptWrappable {
33 DEFINE_WRAPPERTYPEINFO();
34
35 public:
36 BluetoothRemoteGATTDescriptor(
37 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
38 BluetoothRemoteGATTCharacteristic*);
39
40 // IDL exposed interface:
41 BluetoothRemoteGATTCharacteristic* characteristic() {
42 return m_characteristic;
43 }
44 String uuid() { return m_webDescriptor->uuid; }
45 DOMDataView* value() const { return m_value; }
46 ScriptPromise readValue(ScriptState*);
47 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
48
49 // Interface required by garbage collection.
50 DECLARE_VIRTUAL_TRACE();
51
52 private:
53 friend class DescriptorReadValueCallback;
54
55 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); }
56
57 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor;
58 Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
59 Member<DOMDataView> m_value;
60 };
61
62 } // namespace blink
63
64 #endif // BluetoothRemoteGATTDescriptor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698