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

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

Issue 2094633003: Bluetooth: Mac: implementation for start notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_read_characteristicscan_servicescan_cleanup
Patch Set: Addressing msarda's comments 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 190 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
191 191
192 ScriptPromise promise = resolver->promise(); 192 ScriptPromise promise = resolver->promise();
193 webbluetooth->writeValue(m_webCharacteristic->characteristicInstanceID, valu eVector, new WriteValueCallback(this, resolver)); 193 webbluetooth->writeValue(m_webCharacteristic->characteristicInstanceID, valu eVector, new WriteValueCallback(this, resolver));
194 194
195 return promise; 195 return promise;
196 } 196 }
197 197
198 ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(ScriptState* scriptState) 198 ScriptPromise BluetoothRemoteGATTCharacteristic::startNotifications(ScriptState* scriptState)
199 { 199 {
200 #if OS(MACOSX)
201 // TODO(jlebel): Remove when startNotifications is implemented.
202 return ScriptPromise::rejectWithDOMException(scriptState,
203 DOMException::create(NotSupportedError,
204 "startNotifications is not implemented yet. See https://goo.gl/J6ASz s"));
205 #endif // OS(MACOSX)
206
207 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 200 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
208 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 201 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
209 ScriptPromise promise = resolver->promise(); 202 ScriptPromise promise = resolver->promise();
210 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance ID, new CallbackPromiseAdapter<void, BluetoothError>(resolver)); 203 webbluetooth->startNotifications(m_webCharacteristic->characteristicInstance ID, new CallbackPromiseAdapter<void, BluetoothError>(resolver));
211 return promise; 204 return promise;
212 } 205 }
213 206
214 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState) 207 ScriptPromise BluetoothRemoteGATTCharacteristic::stopNotifications(ScriptState* scriptState)
215 { 208 {
216 #if OS(MACOSX) || OS(ANDROID) 209 #if OS(MACOSX) || OS(ANDROID)
(...skipping 14 matching lines...) Expand all
231 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) 224 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic)
232 { 225 {
233 visitor->trace(m_service); 226 visitor->trace(m_service);
234 visitor->trace(m_properties); 227 visitor->trace(m_properties);
235 visitor->trace(m_value); 228 visitor->trace(m_value);
236 EventTargetWithInlineData::trace(visitor); 229 EventTargetWithInlineData::trace(visitor);
237 ActiveDOMObject::trace(visitor); 230 ActiveDOMObject::trace(visitor);
238 } 231 }
239 232
240 } // namespace blink 233 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698