Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Implement WebBluetooth getDescriptor[s] Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ContextLifecycleObserver.h" 9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "core/dom/DOMArrayPiece.h" 10 #include "core/dom/DOMArrayPiece.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_characteristic->uuid; } 80 String uuid() { return m_characteristic->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:
103 friend class BluetoothRemoteGATTDescriptor;
104
96 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); } 105 BluetoothRemoteGATTServer* gatt() { return m_service->device()->gatt(); }
97 106
98 void ReadValueCallback(ScriptPromiseResolver*, 107 void ReadValueCallback(ScriptPromiseResolver*,
99 mojom::blink::WebBluetoothResult, 108 mojom::blink::WebBluetoothResult,
100 const Optional<Vector<uint8_t>>& value); 109 const Optional<Vector<uint8_t>>& value);
101 void WriteValueCallback(ScriptPromiseResolver*, 110 void WriteValueCallback(ScriptPromiseResolver*,
102 const Vector<uint8_t>& value, 111 const Vector<uint8_t>& value,
103 mojom::blink::WebBluetoothResult); 112 mojom::blink::WebBluetoothResult);
104 void NotificationsCallback(ScriptPromiseResolver*, 113 void NotificationsCallback(ScriptPromiseResolver*,
105 mojom::blink::WebBluetoothResult); 114 mojom::blink::WebBluetoothResult);
106 115
116 ScriptPromise getDescriptorsImpl(ScriptState*,
117 mojom::blink::WebBluetoothGATTQueryQuantity,
118 const String& descriptorUUID = String());
119
120 void GetDescriptorsCallback(
121 const String& characteristicInstanceId,
122 mojom::blink::WebBluetoothGATTQueryQuantity,
123 ScriptPromiseResolver*,
124 mojom::blink::WebBluetoothResult,
125 Optional<Vector<mojom::blink::WebBluetoothRemoteGATTDescriptorPtr>>
126 descriptors);
127
107 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr m_characteristic; 128 mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr m_characteristic;
108 Member<BluetoothRemoteGATTService> m_service; 129 Member<BluetoothRemoteGATTService> m_service;
109 bool m_stopped; 130 bool m_stopped;
110 Member<BluetoothCharacteristicProperties> m_properties; 131 Member<BluetoothCharacteristicProperties> m_properties;
111 Member<DOMDataView> m_value; 132 Member<DOMDataView> m_value;
112 Member<BluetoothDevice> m_device; 133 Member<BluetoothDevice> m_device;
113 }; 134 };
114 135
115 } // namespace blink 136 } // namespace blink
116 137
117 #endif // BluetoothRemoteGATTCharacteristic_h 138 #endif // BluetoothRemoteGATTCharacteristic_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698