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

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

Issue 2637343002: Implement WebBluetooth descriptor.readValue() (Closed)
Patch Set: #3 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 #include "modules/bluetooth/BluetoothRemoteGATTService.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ScriptState* scriptState, 122 ScriptState* scriptState,
123 ExceptionState&) { 123 ExceptionState&) {
124 return getCharacteristicsImpl( 124 return getCharacteristicsImpl(
125 scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE); 125 scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE);
126 } 126 }
127 127
128 ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl( 128 ScriptPromise BluetoothRemoteGATTService::getCharacteristicsImpl(
129 ScriptState* scriptState, 129 ScriptState* scriptState,
130 mojom::blink::WebBluetoothGATTQueryQuantity quantity, 130 mojom::blink::WebBluetoothGATTQueryQuantity quantity,
131 const String& characteristicsUUID) { 131 const String& characteristicsUUID) {
132 // We always check that the device is connected.
133 if (!device()->gatt()->connected()) { 132 if (!device()->gatt()->connected()) {
134 return ScriptPromise::rejectWithDOMException( 133 return ScriptPromise::rejectWithDOMException(
135 scriptState, 134 scriptState,
136 DOMException::create(NetworkError, kGATTServerNotConnected)); 135 DOMException::create(NetworkError, kGATTServerNotConnected));
137 } 136 }
138 137
139 if (!device()->isValidService(m_service->instance_id)) { 138 if (!device()->isValidService(m_service->instance_id)) {
140 return ScriptPromise::rejectWithDOMException( 139 return ScriptPromise::rejectWithDOMException(
141 scriptState, DOMException::create(InvalidStateError, kInvalidService)); 140 scriptState, DOMException::create(InvalidStateError, kInvalidService));
142 } 141 }
(...skipping 11 matching lines...) Expand all
154 m_service->instance_id, quantity, uuid, 153 m_service->instance_id, quantity, uuid,
155 convertToBaseCallback( 154 convertToBaseCallback(
156 WTF::bind(&BluetoothRemoteGATTService::GetCharacteristicsCallback, 155 WTF::bind(&BluetoothRemoteGATTService::GetCharacteristicsCallback,
157 wrapPersistent(this), m_service->instance_id, quantity, 156 wrapPersistent(this), m_service->instance_id, quantity,
158 wrapPersistent(resolver)))); 157 wrapPersistent(resolver))));
159 158
160 return promise; 159 return promise;
161 } 160 }
162 161
163 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698