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