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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ExecutionContext* getExecutionContext() const; | 74 ExecutionContext* getExecutionContext() const; |
75 | 75 |
76 // Interface required by garbage collection. | 76 // Interface required by garbage collection. |
77 DECLARE_VIRTUAL_TRACE(); | 77 DECLARE_VIRTUAL_TRACE(); |
78 | 78 |
79 // IDL exposed interface: | 79 // IDL exposed interface: |
80 BluetoothRemoteGATTService* service() { return m_service; } | 80 BluetoothRemoteGATTService* service() { return m_service; } |
81 String uuid() { return m_webCharacteristic->uuid; } | 81 String uuid() { return m_webCharacteristic->uuid; } |
82 BluetoothCharacteristicProperties* properties() { return m_properties; } | 82 BluetoothCharacteristicProperties* properties() { return m_properties; } |
83 DOMDataView* value() const { return m_value; } | 83 DOMDataView* value() const { return m_value; } |
| 84 ScriptPromise getDescriptor(ScriptState*, |
| 85 const StringOrUnsignedLong& descriptor, |
| 86 ExceptionState&); |
| 87 ScriptPromise getDescriptors(ScriptState*, ExceptionState&); |
| 88 ScriptPromise getDescriptors(ScriptState*, |
| 89 const StringOrUnsignedLong& descriptor, |
| 90 ExceptionState&); |
84 ScriptPromise readValue(ScriptState*); | 91 ScriptPromise readValue(ScriptState*); |
85 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); | 92 ScriptPromise writeValue(ScriptState*, const DOMArrayPiece&); |
86 ScriptPromise startNotifications(ScriptState*); | 93 ScriptPromise startNotifications(ScriptState*); |
87 ScriptPromise stopNotifications(ScriptState*); | 94 ScriptPromise stopNotifications(ScriptState*); |
88 | 95 |
89 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(characteristicvaluechanged); |
90 | 97 |
91 protected: | 98 protected: |
92 // EventTarget overrides. | 99 // EventTarget overrides. |
93 void addedEventListener(const AtomicString& eventType, | 100 void addedEventListener(const AtomicString& eventType, |
94 RegisteredEventListener&) override; | 101 RegisteredEventListener&) override; |
95 | 102 |
96 private: | 103 private: |
97 friend class ReadValueCallback; | 104 friend class CharacteristicReadValueCallback; |
98 friend class WriteValueCallback; | 105 friend class CharacteristicWriteValueCallback; |
99 friend class NotificationsCallback; | 106 friend class NotificationsCallback; |
| 107 friend class GetDescriptorsCallback; |
| 108 friend class BluetoothRemoteGATTDescriptor; |
100 | 109 |
101 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); } | 110 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); } |
102 | 111 |
| 112 ScriptPromise getDescriptorsImpl(ScriptState*, |
| 113 mojom::blink::WebBluetoothGATTQueryQuantity, |
| 114 const String& descriptorUUID = String()); |
| 115 |
103 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; | 116 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> m_webCharacteristic; |
104 Member<BluetoothRemoteGATTService> m_service; | 117 Member<BluetoothRemoteGATTService> m_service; |
105 bool m_stopped; | 118 bool m_stopped; |
106 Member<BluetoothCharacteristicProperties> m_properties; | 119 Member<BluetoothCharacteristicProperties> m_properties; |
107 Member<DOMDataView> m_value; | 120 Member<DOMDataView> m_value; |
108 }; | 121 }; |
109 | 122 |
110 } // namespace blink | 123 } // namespace blink |
111 | 124 |
112 #endif // BluetoothRemoteGATTCharacteristic_h | 125 #endif // BluetoothRemoteGATTCharacteristic_h |
OLD | NEW |