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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years, 1 month 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..e1b71d9d09ae0fb2ac56df0a1fb29c4c7eef2ed0
--- /dev/null
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h
@@ -0,0 +1,72 @@
+// 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/ActiveDOMObject.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 "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic.h"
+#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit.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.
+
ortuno 2016/12/02 06:14:51 nit: Remove blank line.
dougt 2016/12/02 18:31:29 Done.
+class BluetoothRemoteGATTDescriptor final
+ : public GarbageCollectedFinalized<BluetoothRemoteGATTDescriptor>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ explicit BluetoothRemoteGATTDescriptor(
ortuno 2016/12/02 06:14:51 No need for explicit since the function doesn't ta
dougt 2016/12/02 18:31:29 Done.
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
+ BluetoothRemoteGATTCharacteristic*);
+
+ static BluetoothRemoteGATTDescriptor* create(
ortuno 2016/12/02 06:14:51 We don't do anything special in create so just use
dougt 2016/12/02 18:31:29 Acknowledged. We test for a null input and this s
ortuno 2016/12/07 08:05:12 Characteristic needs it because it's an ActiveDOMO
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
+ BluetoothRemoteGATTCharacteristic*);
+
+ // Save value.
ortuno 2016/12/02 06:14:51 No need for this yet.
dougt 2016/12/02 18:31:29 Done.
+ void setValue(DOMDataView*);
+
+ // IDL exposed interface:
+ BluetoothRemoteGATTCharacteristic* characteristic() {
+ return m_characteristic;
+ }
+ String uuid() { return m_webDescriptor->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(); }
+
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor;
+ Member<BluetoothRemoteGATTCharacteristic> m_characteristic;
+ Member<DOMDataView> m_value;
ortuno 2016/12/02 06:14:51 No need for value yet.
dougt 2016/12/02 18:31:29 Done.
+};
+
+} // namespace blink
+
+#endif // BluetoothRemoteGATTDescriptor_h

Powered by Google App Engine
This is Rietveld 408576698