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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Updating cross-origin-objects-exceptions.html 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 static BluetoothRemoteGATTDescriptor* create(
41 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
42 BluetoothRemoteGATTCharacteristic*);
43
44 // IDL exposed interface:
45 BluetoothRemoteGATTCharacteristic* characteristic() {
46 return m_characteristic;
47 }
48 String uuid() { return m_webDescriptor->uuid; }
49 DOMDataView* value() const { return m_value; }
50 ScriptPromise readValue(ScriptState*);
51 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
52
53 // Interface required by garbage collection.
54 DECLARE_VIRTUAL_TRACE();
55
56 private:
57 friend class DescriptorReadValueCallback;
58
59 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); }
60
61 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor;
62 Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
63 Member<DOMDataView> m_value;
64 };
65
66 } // namespace blink
67
68 #endif // BluetoothRemoteGATTDescriptor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698