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

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

Issue 2052513002: Read characteristic implementation on macOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@characteristicscan_servicescan_cleanup
Patch Set: Test not meant to be commited Created 4 years, 5 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 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMDataView.h" 10 #include "core/dom/DOMDataView.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 m_resolver->reject(BluetoothError::take(m_resolver, e)); 127 m_resolver->reject(BluetoothError::take(m_resolver, e));
128 } 128 }
129 129
130 private: 130 private:
131 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; 131 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic;
132 Persistent<ScriptPromiseResolver> m_resolver; 132 Persistent<ScriptPromiseResolver> m_resolver;
133 }; 133 };
134 134
135 ScriptPromise BluetoothRemoteGATTCharacteristic::readValue(ScriptState* scriptSt ate) 135 ScriptPromise BluetoothRemoteGATTCharacteristic::readValue(ScriptState* scriptSt ate)
136 { 136 {
137 #if OS(MACOSX)
138 // TODO(jlebel): Remove when readValue is implemented.
139 return ScriptPromise::rejectWithDOMException(scriptState,
140 DOMException::create(NotSupportedError,
141 "readValue is not implemented yet. See https://goo.gl/J6ASzs"));
142 #endif // OS(MACOSX)
143
144 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 137 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
145 138
146 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 139 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
147 ScriptPromise promise = resolver->promise(); 140 ScriptPromise promise = resolver->promise();
148 webbluetooth->readValue(m_webCharacteristic->characteristicInstanceID, new R eadValueCallback(this, resolver)); 141 webbluetooth->readValue(m_webCharacteristic->characteristicInstanceID, new R eadValueCallback(this, resolver));
149 142
150 return promise; 143 return promise;
151 } 144 }
152 145
153 class WriteValueCallback : public WebBluetoothWriteValueCallbacks { 146 class WriteValueCallback : public WebBluetoothWriteValueCallbacks {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 235
243 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) 236 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic)
244 { 237 {
245 visitor->trace(m_properties); 238 visitor->trace(m_properties);
246 visitor->trace(m_value); 239 visitor->trace(m_value);
247 EventTargetWithInlineData::trace(visitor); 240 EventTargetWithInlineData::trace(visitor);
248 ActiveDOMObject::trace(visitor); 241 ActiveDOMObject::trace(visitor);
249 } 242 }
250 243
251 } // namespace blink 244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698