| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BluetoothRemoteGATTCharacteristic_h | 5 #ifndef BluetoothRemoteGATTCharacteristic_h |
| 6 #define BluetoothRemoteGATTCharacteristic_h | 6 #define BluetoothRemoteGATTCharacteristic_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/dom/ActiveDOMObject.h" | |
| 10 #include "core/dom/DOMArrayPiece.h" | 9 #include "core/dom/DOMArrayPiece.h" |
| 11 #include "core/dom/DOMDataView.h" | 10 #include "core/dom/DOMDataView.h" |
| 11 #include "core/dom/SuspendableObject.h" |
| 12 #include "modules/EventTargetModules.h" | 12 #include "modules/EventTargetModules.h" |
| 13 #include "modules/bluetooth/BluetoothRemoteGATTService.h" | 13 #include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic
.h" | 15 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic
.h" |
| 16 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic
Init.h" | 16 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic
Init.h" |
| 17 #include "wtf/text/WTFString.h" | 17 #include "wtf/text/WTFString.h" |
| 18 #include <memory> | 18 #include <memory> |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 class BluetoothCharacteristicProperties; | 22 class BluetoothCharacteristicProperties; |
| 23 class ExecutionContext; | 23 class ExecutionContext; |
| 24 class ScriptPromise; | 24 class ScriptPromise; |
| 25 class ScriptState; | 25 class ScriptState; |
| 26 | 26 |
| 27 // BluetoothRemoteGATTCharacteristic represents a GATT Characteristic, which is | 27 // BluetoothRemoteGATTCharacteristic represents a GATT Characteristic, which is |
| 28 // a basic data element that provides further information about a peripheral's | 28 // a basic data element that provides further information about a peripheral's |
| 29 // service. | 29 // service. |
| 30 // | 30 // |
| 31 // Callbacks providing WebBluetoothRemoteGATTCharacteristicInit objects are | 31 // Callbacks providing WebBluetoothRemoteGATTCharacteristicInit objects are |
| 32 // handled by CallbackPromiseAdapter templatized with this class. See this | 32 // handled by CallbackPromiseAdapter templatized with this class. See this |
| 33 // class's "Interface required by CallbackPromiseAdapter" section and the | 33 // class's "Interface required by CallbackPromiseAdapter" section and the |
| 34 // CallbackPromiseAdapter class comments. | 34 // CallbackPromiseAdapter class comments. |
| 35 class BluetoothRemoteGATTCharacteristic final | 35 class BluetoothRemoteGATTCharacteristic final |
| 36 : public EventTargetWithInlineData, | 36 : public EventTargetWithInlineData, |
| 37 public ActiveDOMObject, | 37 public SuspendableObject, |
| 38 public WebBluetoothRemoteGATTCharacteristic { | 38 public WebBluetoothRemoteGATTCharacteristic { |
| 39 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose); | 39 USING_PRE_FINALIZER(BluetoothRemoteGATTCharacteristic, dispose); |
| 40 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
| 41 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); | 41 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); |
| 42 | 42 |
| 43 public: | 43 public: |
| 44 explicit BluetoothRemoteGATTCharacteristic( | 44 explicit BluetoothRemoteGATTCharacteristic( |
| 45 ExecutionContext*, | 45 ExecutionContext*, |
| 46 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, | 46 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, |
| 47 BluetoothRemoteGATTService*); | 47 BluetoothRemoteGATTService*); |
| 48 | 48 |
| 49 static BluetoothRemoteGATTCharacteristic* create( | 49 static BluetoothRemoteGATTCharacteristic* create( |
| 50 ExecutionContext*, | 50 ExecutionContext*, |
| 51 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, | 51 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, |
| 52 BluetoothRemoteGATTService*); | 52 BluetoothRemoteGATTService*); |
| 53 | 53 |
| 54 // Save value. | 54 // Save value. |
| 55 void setValue(DOMDataView*); | 55 void setValue(DOMDataView*); |
| 56 | 56 |
| 57 // WebBluetoothRemoteGATTCharacteristic interface: | 57 // WebBluetoothRemoteGATTCharacteristic interface: |
| 58 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; | 58 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; |
| 59 | 59 |
| 60 // ActiveDOMObject interface. | 60 // SuspendableObject interface. |
| 61 void contextDestroyed() override; | 61 void contextDestroyed() override; |
| 62 | 62 |
| 63 // USING_PRE_FINALIZER interface. | 63 // USING_PRE_FINALIZER interface. |
| 64 // Called before the object gets garbage collected. | 64 // Called before the object gets garbage collected. |
| 65 void dispose(); | 65 void dispose(); |
| 66 | 66 |
| 67 // Notify our embedder that we should stop any notifications. | 67 // Notify our embedder that we should stop any notifications. |
| 68 // The function only notifies the embedder once. | 68 // The function only notifies the embedder once. |
| 69 void notifyCharacteristicObjectRemoved(); | 69 void notifyCharacteristicObjectRemoved(); |
| 70 | 70 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; | 102 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; |
| 103 Member<BluetoothRemoteGATTService> m_service; | 103 Member<BluetoothRemoteGATTService> m_service; |
| 104 bool m_stopped; | 104 bool m_stopped; |
| 105 Member<BluetoothCharacteristicProperties> m_properties; | 105 Member<BluetoothCharacteristicProperties> m_properties; |
| 106 Member<DOMDataView> m_value; | 106 Member<DOMDataView> m_value; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace blink | 109 } // namespace blink |
| 110 | 110 |
| 111 #endif // BluetoothRemoteGATTCharacteristic_h | 111 #endif // BluetoothRemoteGATTCharacteristic_h |
| OLD | NEW |