Index: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
similarity index 60% |
copy from third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h |
copy to third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
index 1dcdad97f09bfbb68f4c50428628475b6cc37f71..9a26bd49c62884b45c0f783bb42330319f451b85 100644 |
--- a/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h |
+++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTDescriptor.h |
@@ -2,61 +2,66 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef BluetoothRemoteGATTCharacteristic_h |
-#define BluetoothRemoteGATTCharacteristic_h |
+#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/WebBluetoothRemoteGATTCharacteristicInit.h" |
+#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptor.h" |
+#include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTDescriptorInit.h" |
#include "wtf/text/WTFString.h" |
#include <memory> |
namespace blink { |
class BluetoothCharacteristicProperties; |
+class BluetoothRemoteGATTCharacteristic; |
class ExecutionContext; |
class ScriptPromise; |
class ScriptPromiseResolver; |
class ScriptState; |
-// BluetoothRemoteGATTCharacteristic represents a GATT Characteristic, which is |
+// BluetoothRemoteGATTDescriptor represents a GATT Descriptor, which is |
// a basic data element that provides further information about a peripheral's |
-// service. |
+// descriptor. |
ortuno
2016/11/21 03:34:09
s/descriptor/characteristic/
dougt
2016/11/22 01:47:16
Acknowledged.
|
// |
-// Callbacks providing WebBluetoothRemoteGATTCharacteristicInit objects are |
+// Callbacks providing WebBluetoothRemoteGATTDescriptorInit objects are |
// handled by CallbackPromiseAdapter templatized with this class. See this |
// class's "Interface required by CallbackPromiseAdapter" section and the |
// CallbackPromiseAdapter class comments. |
-class BluetoothRemoteGATTCharacteristic final |
+class BluetoothRemoteGATTDescriptor final |
: public EventTargetWithInlineData, |
public ActiveDOMObject, |
- public WebBluetoothRemoteGATTCharacteristic { |
- USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose); |
+ public WebBluetoothRemoteGATTDescriptor { |
+ USING_PRE_FINALIZER(BluetoothRemoteGATTDescriptor, dispose); |
DEFINE_WRAPPERTYPEINFO(); |
- USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); |
+ USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTDescriptor); |
public: |
- explicit BluetoothRemoteGATTCharacteristic( |
+ explicit BluetoothRemoteGATTDescriptor( |
ExecutionContext*, |
- std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, |
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, |
BluetoothRemoteGATTService*); |
- static BluetoothRemoteGATTCharacteristic* create( |
- ExecutionContext*, |
- std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, |
+ // Interface required by CallbackPromiseAdapter. |
+ using WebType = std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>; |
+ static BluetoothRemoteGATTDescriptor* take( |
+ ScriptPromiseResolver*, |
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>, |
BluetoothRemoteGATTService*); |
// Save value. |
void setValue(DOMDataView*); |
- // WebBluetoothRemoteGATTCharacteristic interface: |
- void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; |
+ // WebBluetoothRemoteGATTDescriptor interface: |
+ void dispatchDescriptorValueChanged(const WebVector<uint8_t>&) override; |
// ActiveDOMObject interface. |
void contextDestroyed() override; |
@@ -67,7 +72,7 @@ class BluetoothRemoteGATTCharacteristic final |
// Notify our embedder that we should stop any notifications. |
// The function only notifies the embedder once. |
- void notifyCharacteristicObjectRemoved(); |
+ void notifyDescriptorObjectRemoved(); |
// EventTarget methods: |
const AtomicString& interfaceName() const override; |
@@ -77,16 +82,15 @@ class BluetoothRemoteGATTCharacteristic final |
DECLARE_VIRTUAL_TRACE(); |
// IDL exposed interface: |
- BluetoothRemoteGATTService* service() { return m_service; } |
- String uuid() { return m_webCharacteristic->uuid; } |
- BluetoothCharacteristicProperties* properties() { return m_properties; } |
+ 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&); |
- ScriptPromise startNotifications(ScriptState*); |
- ScriptPromise stopNotifications(ScriptState*); |
- DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(descriptorvaluechanged); |
protected: |
// EventTarget overrides. |
@@ -95,18 +99,17 @@ class BluetoothRemoteGATTCharacteristic final |
private: |
friend class ReadValueCallback; |
- friend class WriteValueCallback; |
- friend class NotificationsCallback; |
BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); } |
ortuno
2016/11/21 03:34:09
s/m_service/m_characteristic/ Also could you renam
dougt
2016/11/22 01:47:16
Acknowledged.
|
- std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; |
+ std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> m_webDescriptor; |
Member<BluetoothRemoteGATTService> m_service; |
+ Member<BluetoothRemoteGATTCharacteristic> m_characteristic; |
+ |
bool m_stopped; |
- Member<BluetoothCharacteristicProperties> m_properties; |
Member<DOMDataView> m_value; |
}; |
} // namespace blink |
-#endif // BluetoothRemoteGATTCharacteristic_h |
+#endif // BluetoothRemoteGATTDescriptor_h |