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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Remove macos restriction Created 3 years, 12 months 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/DOMArrayPiece.h"
10 #include "core/dom/DOMDataView.h"
11 #include "modules/EventTargetModules.h"
12 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
13 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
14 #include "platform/heap/Handle.h"
15 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic .h"
16 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit .h"
17 #include "wtf/text/WTFString.h"
18 #include <memory>
19
20 namespace blink {
21
22 class BluetoothRemoteGATTCharacteristic;
23 class ScriptPromise;
24 class ScriptState;
25
26 // BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is
27 // a basic data element that provides further information about a peripheral's
28 // characteristic.
29 class BluetoothRemoteGATTDescriptor final
30 : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>,
31 public ScriptWrappable {
32 DEFINE_WRAPPERTYPEINFO();
33
34 public:
35 BluetoothRemoteGATTDescriptor(
36 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
37 BluetoothRemoteGATTCharacteristic*);
38
39 // IDL exposed interface:
40 BluetoothRemoteGATTCharacteristic* characteristic() {
41 return m_characteristic;
42 }
43 String uuid() { return m_webDescriptor->uuid; }
44 DOMDataView* value() const { return m_value; }
45 ScriptPromise readValue(ScriptState*);
46 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
47
48 // Interface required by garbage collection.
49 DECLARE_VIRTUAL_TRACE();
50
51 private:
52 friend class DescriptorReadValueCallback;
53
54 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); }
55
56 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor;
57 Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
58 Member<DOMDataView> m_value;
59 };
60
61 } // namespace blink
62
63 #endif // BluetoothRemoteGATTDescriptor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698