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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..59cab166f3301326b57bdfc1133ffabfc0cad3e9
--- /dev/null
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h
@@ -0,0 +1,65 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BluetoothRemoteGATTDescriptor_h
+#define BluetoothRemoteGATTDescriptor_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/dom/DOMArrayPiece.h"
+#include "core/dom/DOMDataView.h"
+#include "modules/EventTargetModules.h"
+#include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
+#include "modules/bluetooth/BluetoothRemoteGATTService.h"
+#include "platform/heap/Handle.h"
+#include "wtf/text/WTFString.h"
+#include <memory>
+
+namespace blink {
+
+class BluetoothRemoteGATTCharacteristic;
+class ScriptPromise;
+class ScriptState;
+
+// BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is
+// a basic data element that provides further information about a peripheral's
+// characteristic.
+class BluetoothRemoteGATTDescriptor final
+ : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ BluetoothRemoteGATTDescriptor(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr,
+ BluetoothRemoteGATTCharacteristic*);
+
+ static BluetoothRemoteGATTDescriptor* create(
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr,
+ BluetoothRemoteGATTCharacteristic*);
+
+ // IDL exposed interface:
+ BluetoothRemoteGATTCharacteristic* characteristic() {
+ return m_characteristic;
+ }
+ String uuid() { return m_descriptor->uuid; }
+ DOMDataView* value() const { return m_value; }
+ ScriptPromise readValue(ScriptState*);
+ ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&);
+
+ // Interface required by garbage collection.
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ friend class DescriptorReadValueCallback;
+
+ BluetoothRemoteGATTServer* getGatt() { return m_characteristic->gatt(); }
+
+ mojom::blink::WebBluetoothRemoteGATTDescriptorPtr m_descriptor;
+ Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
+ Member<DOMDataView> m_value;
+};
+
+} // namespace blink
+
+#endif // BluetoothRemoteGATTDescriptor_h

Powered by Google App Engine
This is Rietveld 408576698