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

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

Issue 2654403002: Implement WebBluetooth descriptor.writeValue() (Closed)
Patch Set: #4 Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BluetoothRemoteGATTDescriptor_h 5 #ifndef BluetoothRemoteGATTDescriptor_h
6 #define BluetoothRemoteGATTDescriptor_h 6 #define BluetoothRemoteGATTDescriptor_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMArrayPiece.h" 9 #include "core/dom/DOMArrayPiece.h"
10 #include "core/dom/DOMDataView.h" 10 #include "core/dom/DOMDataView.h"
11 #include "modules/EventTargetModules.h" 11 #include "modules/EventTargetModules.h"
12 #include "modules/bluetooth/Bluetooth.h"
12 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" 13 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
13 #include "modules/bluetooth/BluetoothRemoteGATTService.h" 14 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
14 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
15 #include "wtf/text/WTFString.h" 16 #include "wtf/text/WTFString.h"
16 #include <memory> 17 #include <memory>
17 18
18 namespace blink { 19 namespace blink {
19 20
20 class BluetoothRemoteGATTCharacteristic; 21 class BluetoothRemoteGATTCharacteristic;
21 class ScriptPromise; 22 class ScriptPromise;
(...skipping 25 matching lines...) Expand all
47 ScriptPromise readValue(ScriptState*); 48 ScriptPromise readValue(ScriptState*);
48 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); 49 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
49 50
50 // Interface required by garbage collection. 51 // Interface required by garbage collection.
51 DECLARE_VIRTUAL_TRACE(); 52 DECLARE_VIRTUAL_TRACE();
52 53
53 private: 54 private:
54 friend class DescriptorReadValueCallback; 55 friend class DescriptorReadValueCallback;
55 56
56 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->getGatt(); } 57 BluetoothRemoteGATTServer* getGatt() { return m_characteristic->getGatt(); }
58 mojom::blink::WebBluetoothService* getService() {
59 return m_characteristic->m_device->bluetooth()->service();
60 }
57 61
58 void ReadValueCallback(ScriptPromiseResolver*, 62 void ReadValueCallback(ScriptPromiseResolver*,
59 mojom::blink::WebBluetoothResult, 63 mojom::blink::WebBluetoothResult,
60 const Optional<Vector<uint8_t>>&); 64 const Optional<Vector<uint8_t>>&);
61 65
66 void WriteValueCallback(ScriptPromiseResolver*,
67 const Vector<uint8_t>&,
68 mojom::blink::WebBluetoothResult);
69
62 mojom::blink::WebBluetoothRemoteGATTDescriptorPtr m_descriptor; 70 mojom::blink::WebBluetoothRemoteGATTDescriptorPtr m_descriptor;
63 Member<BluetoothRemoteGATTCharacteristic> m_characteristic; 71 Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
64 Member<DOMDataView> m_value; 72 Member<DOMDataView> m_value;
65 }; 73 };
66 74
67 } // namespace blink 75 } // namespace blink
68 76
69 #endif // BluetoothRemoteGATTDescriptor_h 77 #endif // BluetoothRemoteGATTDescriptor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698