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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm

Issue 2287273002: Remove TODOs that are out of date. (Closed)
Patch Set: Fix a compile error on mac Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return; 191 return;
192 } 192 }
193 characteristic_value_read_or_write_in_progress_ = true; 193 characteristic_value_read_or_write_in_progress_ = true;
194 read_characteristic_value_callbacks_ = 194 read_characteristic_value_callbacks_ =
195 std::make_pair(callback, error_callback); 195 std::make_pair(callback, error_callback);
196 [gatt_service_->GetCBPeripheral() 196 [gatt_service_->GetCBPeripheral()
197 readValueForCharacteristic:cb_characteristic_]; 197 readValueForCharacteristic:cb_characteristic_];
198 } 198 }
199 199
200 void BluetoothRemoteGattCharacteristicMac::WriteRemoteCharacteristic( 200 void BluetoothRemoteGattCharacteristicMac::WriteRemoteCharacteristic(
201 const std::vector<uint8_t>& new_value, 201 const std::vector<uint8_t>& value,
202 const base::Closure& callback, 202 const base::Closure& callback,
203 const ErrorCallback& error_callback) { 203 const ErrorCallback& error_callback) {
204 if (!IsWritable()) { 204 if (!IsWritable()) {
205 base::ThreadTaskRunnerHandle::Get()->PostTask( 205 base::ThreadTaskRunnerHandle::Get()->PostTask(
206 FROM_HERE, 206 FROM_HERE,
207 base::Bind(error_callback, 207 base::Bind(error_callback,
208 BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED)); 208 BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED));
209 return; 209 return;
210 } 210 }
211 if (characteristic_value_read_or_write_in_progress_) { 211 if (characteristic_value_read_or_write_in_progress_) {
212 base::ThreadTaskRunnerHandle::Get()->PostTask( 212 base::ThreadTaskRunnerHandle::Get()->PostTask(
213 FROM_HERE, 213 FROM_HERE,
214 base::Bind(error_callback, 214 base::Bind(error_callback,
215 BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS)); 215 BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS));
216 return; 216 return;
217 } 217 }
218 characteristic_value_read_or_write_in_progress_ = true; 218 characteristic_value_read_or_write_in_progress_ = true;
219 write_characteristic_value_callbacks_ = 219 write_characteristic_value_callbacks_ =
220 std::make_pair(callback, error_callback); 220 std::make_pair(callback, error_callback);
221 base::scoped_nsobject<NSData> nsdata_value( 221 base::scoped_nsobject<NSData> nsdata_value(
222 [[NSData alloc] initWithBytes:new_value.data() length:new_value.size()]); 222 [[NSData alloc] initWithBytes:value.data() length:value.size()]);
223 CBCharacteristicWriteType write_type = GetCBWriteType(); 223 CBCharacteristicWriteType write_type = GetCBWriteType();
224 [gatt_service_->GetCBPeripheral() writeValue:nsdata_value 224 [gatt_service_->GetCBPeripheral() writeValue:nsdata_value
225 forCharacteristic:cb_characteristic_ 225 forCharacteristic:cb_characteristic_
226 type:write_type]; 226 type:write_type];
227 if (write_type == CBCharacteristicWriteWithoutResponse) { 227 if (write_type == CBCharacteristicWriteWithoutResponse) {
228 base::ThreadTaskRunnerHandle::Get()->PostTask( 228 base::ThreadTaskRunnerHandle::Get()->PostTask(
229 FROM_HERE, 229 FROM_HERE,
230 base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue, 230 base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue,
231 base::Unretained(this), nil)); 231 base::Unretained(this), nil));
232 } 232 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return (GetProperties() & BluetoothGattCharacteristic::PROPERTY_WRITE) 357 return (GetProperties() & BluetoothGattCharacteristic::PROPERTY_WRITE)
358 ? CBCharacteristicWriteWithResponse 358 ? CBCharacteristicWriteWithResponse
359 : CBCharacteristicWriteWithoutResponse; 359 : CBCharacteristicWriteWithoutResponse;
360 } 360 }
361 361
362 CBCharacteristic* BluetoothRemoteGattCharacteristicMac::GetCBCharacteristic() 362 CBCharacteristic* BluetoothRemoteGattCharacteristicMac::GetCBCharacteristic()
363 const { 363 const {
364 return cb_characteristic_.get(); 364 return cb_characteristic_.get();
365 } 365 }
366 } // namespace device. 366 } // namespace device.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698