| 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 BluetoothGATTCharacteristic_h | 5 #ifndef BluetoothGATTCharacteristic_h |
| 6 #define BluetoothGATTCharacteristic_h | 6 #define BluetoothGATTCharacteristic_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/dom/ActiveDOMObject.h" | 9 #include "core/dom/ActiveDOMObject.h" |
| 10 #include "core/dom/DOMArrayPiece.h" | 10 #include "core/dom/DOMArrayPiece.h" |
| 11 #include "modules/EventTargetModules.h" | 11 #include "modules/EventTargetModules.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.h" | 13 #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristic.h" |
| 14 #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristicInit.h
" | 14 #include "public/platform/modules/bluetooth/WebBluetoothGATTCharacteristicInit.h
" |
| 15 #include "wtf/OwnPtr.h" | 15 #include "wtf/OwnPtr.h" |
| 16 #include "wtf/PassOwnPtr.h" | 16 #include "wtf/PassOwnPtr.h" |
| 17 #include "wtf/text/WTFString.h" | 17 #include "wtf/text/WTFString.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 class BluetoothCharacteristicProperties; |
| 21 class ExecutionContext; | 22 class ExecutionContext; |
| 22 class ScriptPromise; | 23 class ScriptPromise; |
| 23 class ScriptPromiseResolver; | 24 class ScriptPromiseResolver; |
| 24 class ScriptState; | 25 class ScriptState; |
| 25 | 26 |
| 26 // BluetoothGATTCharacteristic represents a GATT Characteristic, which is a | 27 // BluetoothGATTCharacteristic represents a GATT Characteristic, which is a |
| 27 // basic data element that provides further information about a peripheral's | 28 // basic data element that provides further information about a peripheral's |
| 28 // service. | 29 // service. |
| 29 // | 30 // |
| 30 // Callbacks providing WebBluetoothGATTCharacteristicInit objects are handled by | 31 // Callbacks providing WebBluetoothGATTCharacteristicInit objects are handled by |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // EventTarget methods: | 64 // EventTarget methods: |
| 64 const AtomicString& interfaceName() const override; | 65 const AtomicString& interfaceName() const override; |
| 65 ExecutionContext* executionContext() const; | 66 ExecutionContext* executionContext() const; |
| 66 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool useCapture) override; | 67 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool useCapture) override; |
| 67 | 68 |
| 68 // Interface required by garbage collection. | 69 // Interface required by garbage collection. |
| 69 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 70 | 71 |
| 71 // IDL exposed interface: | 72 // IDL exposed interface: |
| 72 String uuid() { return m_webCharacteristic->uuid; } | 73 String uuid() { return m_webCharacteristic->uuid; } |
| 74 |
| 75 BluetoothCharacteristicProperties* properties() { return m_properties; } |
| 73 PassRefPtr<DOMArrayBuffer> value() const { return m_value; } | 76 PassRefPtr<DOMArrayBuffer> value() const { return m_value; } |
| 74 ScriptPromise readValue(ScriptState*); | 77 ScriptPromise readValue(ScriptState*); |
| 75 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | 78 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); |
| 76 ScriptPromise startNotifications(ScriptState*); | 79 ScriptPromise startNotifications(ScriptState*); |
| 77 ScriptPromise stopNotifications(ScriptState*); | 80 ScriptPromise stopNotifications(ScriptState*); |
| 78 | 81 |
| 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 OwnPtr<WebBluetoothGATTCharacteristicInit> m_webCharacteristic; | 85 OwnPtr<WebBluetoothGATTCharacteristicInit> m_webCharacteristic; |
| 83 bool m_stopped; | 86 bool m_stopped; |
| 87 Member<BluetoothCharacteristicProperties> m_properties; |
| 84 RefPtr<DOMArrayBuffer> m_value; | 88 RefPtr<DOMArrayBuffer> m_value; |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 } // namespace blink | 91 } // namespace blink |
| 88 | 92 |
| 89 #endif // BluetoothGATTCharacteristic_h | 93 #endif // BluetoothGATTCharacteristic_h |
| OLD | NEW |