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" | 9 #include "core/dom/ActiveDOMObject.h" |
10 #include "core/dom/DOMArrayPiece.h" | 10 #include "core/dom/DOMArrayPiece.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(BluetoothRemoteGATTCharacteristic)
; | 42 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(BluetoothRemoteGATTCharacteristic)
; |
43 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); | 43 USING_GARBAGE_COLLECTED_MIXIN(BluetoothRemoteGATTCharacteristic); |
44 public: | 44 public: |
45 explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, PassOwnPtr<Web
BluetoothRemoteGATTCharacteristicInit>); | 45 explicit BluetoothRemoteGATTCharacteristic(ExecutionContext*, PassOwnPtr<Web
BluetoothRemoteGATTCharacteristicInit>); |
46 | 46 |
47 // Interface required by CallbackPromiseAdapter. | 47 // Interface required by CallbackPromiseAdapter. |
48 using WebType = OwnPtr<WebBluetoothRemoteGATTCharacteristicInit>; | 48 using WebType = OwnPtr<WebBluetoothRemoteGATTCharacteristicInit>; |
49 static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, PassO
wnPtr<WebBluetoothRemoteGATTCharacteristicInit>); | 49 static BluetoothRemoteGATTCharacteristic* take(ScriptPromiseResolver*, PassO
wnPtr<WebBluetoothRemoteGATTCharacteristicInit>); |
50 | 50 |
51 // Save value. | 51 // Save value. |
52 void setValue(const PassRefPtr<DOMDataView>&); | 52 void setValue(DOMDataView*); |
53 | 53 |
54 // WebBluetoothRemoteGATTCharacteristic interface: | 54 // WebBluetoothRemoteGATTCharacteristic interface: |
55 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; | 55 void dispatchCharacteristicValueChanged(const WebVector<uint8_t>&) override; |
56 | 56 |
57 // ActiveDOMObject interface. | 57 // ActiveDOMObject interface. |
58 void stop() override; | 58 void stop() override; |
59 | 59 |
60 // USING_PRE_FINALIZER interface. | 60 // USING_PRE_FINALIZER interface. |
61 // Called before the object gets garbage collected. | 61 // Called before the object gets garbage collected. |
62 void dispose(); | 62 void dispose(); |
63 | 63 |
64 // Notify our embedder that we should stop any notifications. | 64 // Notify our embedder that we should stop any notifications. |
65 // The function only notifies the embedder once. | 65 // The function only notifies the embedder once. |
66 void notifyCharacteristicObjectRemoved(); | 66 void notifyCharacteristicObjectRemoved(); |
67 | 67 |
68 // EventTarget methods: | 68 // EventTarget methods: |
69 const AtomicString& interfaceName() const override; | 69 const AtomicString& interfaceName() const override; |
70 ExecutionContext* getExecutionContext() const; | 70 ExecutionContext* getExecutionContext() const; |
71 | 71 |
72 // Interface required by garbage collection. | 72 // Interface required by garbage collection. |
73 DECLARE_VIRTUAL_TRACE(); | 73 DECLARE_VIRTUAL_TRACE(); |
74 | 74 |
75 // IDL exposed interface: | 75 // IDL exposed interface: |
76 String uuid() { return m_webCharacteristic->uuid; } | 76 String uuid() { return m_webCharacteristic->uuid; } |
77 | 77 |
78 BluetoothCharacteristicProperties* properties() { return m_properties; } | 78 BluetoothCharacteristicProperties* properties() { return m_properties; } |
79 PassRefPtr<DOMDataView> value() const { return m_value; } | 79 DOMDataView* value() const { return m_value; } |
80 ScriptPromise readValue(ScriptState*); | 80 ScriptPromise readValue(ScriptState*); |
81 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | 81 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); |
82 ScriptPromise startNotifications(ScriptState*); | 82 ScriptPromise startNotifications(ScriptState*); |
83 ScriptPromise stopNotifications(ScriptState*); | 83 ScriptPromise stopNotifications(ScriptState*); |
84 | 84 |
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); |
86 | 86 |
87 protected: | 87 protected: |
88 // EventTarget overrides. | 88 // EventTarget overrides. |
89 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const EventListenerOptions&) override; | 89 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const EventListenerOptions&) override; |
90 | 90 |
91 private: | 91 private: |
92 OwnPtr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; | 92 OwnPtr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; |
93 bool m_stopped; | 93 bool m_stopped; |
94 Member<BluetoothCharacteristicProperties> m_properties; | 94 Member<BluetoothCharacteristicProperties> m_properties; |
95 RefPtr<DOMDataView> m_value; | 95 Member<DOMDataView> m_value; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
99 | 99 |
100 #endif // BluetoothRemoteGATTCharacteristic_h | 100 #endif // BluetoothRemoteGATTCharacteristic_h |
OLD | NEW |