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

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

Issue 2074563002: bluetooth: mac: write characteristic implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@read_characteristicscan_servicescan_cleanup
Patch Set: Merge from top of tree 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_resolver->reject(BluetoothError::take(m_resolver, e)); 167 m_resolver->reject(BluetoothError::take(m_resolver, e));
168 } 168 }
169 169
170 private: 170 private:
171 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; 171 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic;
172 Persistent<ScriptPromiseResolver> m_resolver; 172 Persistent<ScriptPromiseResolver> m_resolver;
173 }; 173 };
174 174
175 ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue(ScriptState* scriptS tate, const DOMArrayPiece& value) 175 ScriptPromise BluetoothRemoteGATTCharacteristic::writeValue(ScriptState* scriptS tate, const DOMArrayPiece& value)
176 { 176 {
177 #if OS(MACOSX)
178 // TODO(jlebel): Remove when writeValue is implemented.
179 return ScriptPromise::rejectWithDOMException(scriptState,
180 DOMException::create(NotSupportedError,
181 "writeValue is not implemented yet. See https://goo.gl/J6ASzs"));
182 #endif // OS(MACOSX)
183
184 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 177 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
185 // Partial implementation of writeValue algorithm: 178 // Partial implementation of writeValue algorithm:
186 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothgattchar acteristic-writevalue 179 // https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothgattchar acteristic-writevalue
187 180
188 // If bytes is more than 512 bytes long (the maximum length of an attribute 181 // If bytes is more than 512 bytes long (the maximum length of an attribute
189 // value, per Long Attribute Values) return a promise rejected with an 182 // value, per Long Attribute Values) return a promise rejected with an
190 // InvalidModificationError and abort. 183 // InvalidModificationError and abort.
191 if (value.byteLength() > 512) 184 if (value.byteLength() > 512)
192 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidModificationError, "Value can't exceed 512 bytes.")); 185 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidModificationError, "Value can't exceed 512 bytes."));
193 186
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) 231 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic)
239 { 232 {
240 visitor->trace(m_service); 233 visitor->trace(m_service);
241 visitor->trace(m_properties); 234 visitor->trace(m_properties);
242 visitor->trace(m_value); 235 visitor->trace(m_value);
243 EventTargetWithInlineData::trace(visitor); 236 EventTargetWithInlineData::trace(visitor);
244 ActiveDOMObject::trace(visitor); 237 ActiveDOMObject::trace(visitor);
245 } 238 }
246 239
247 } // namespace blink 240 } // 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