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

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

Issue 2052513002: Read characteristic implementation on macOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@characteristicscan_servicescan_cleanup
Patch Set: Removing ReadRemoteCharacteristic_AfterDeleted test Created 4 years, 6 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 "device/bluetooth/bluetooth_low_energy_device_mac.h" 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
6 6
7 #import <CoreFoundation/CoreFoundation.h> 7 #import <CoreFoundation/CoreFoundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 GetBluetoothRemoteGattService(cb_service); 305 GetBluetoothRemoteGattService(cb_service);
306 DCHECK(gatt_service); 306 DCHECK(gatt_service);
307 std::unique_ptr<BluetoothRemoteGattService> scoped_service = 307 std::unique_ptr<BluetoothRemoteGattService> scoped_service =
308 gatt_services_.take_and_erase(gatt_service->GetIdentifier()); 308 gatt_services_.take_and_erase(gatt_service->GetIdentifier());
309 adapter_->NotifyGattServiceRemoved(scoped_service.get()); 309 adapter_->NotifyGattServiceRemoved(scoped_service.get());
310 } 310 }
311 SetGattServicesDiscoveryComplete(false); 311 SetGattServicesDiscoveryComplete(false);
312 [GetPeripheral() discoverServices:nil]; 312 [GetPeripheral() discoverServices:nil];
313 } 313 }
314 314
315 void BluetoothLowEnergyDeviceMac::DidReadValue(CBCharacteristic* characteristic,
316 NSError* error) {
317 BluetoothRemoteGattServiceMac* gatt_service =
318 GetBluetoothRemoteGattService(characteristic.service);
319 if (!gatt_service) {
320 return;
321 }
322 gatt_service->DidReadValue(characteristic, error);
323 }
324
315 // static 325 // static
316 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier( 326 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(
317 CBPeripheral* peripheral) { 327 CBPeripheral* peripheral) {
318 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); 328 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable());
319 NSUUID* uuid = [peripheral identifier]; 329 NSUUID* uuid = [peripheral identifier];
320 NSString* uuidString = [uuid UUIDString]; 330 NSString* uuidString = [uuid UUIDString];
321 return base::SysNSStringToUTF8(uuidString); 331 return base::SysNSStringToUTF8(uuidString);
322 } 332 }
323 333
324 // static 334 // static
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GattServiceMap gatt_services_swapped; 372 GattServiceMap gatt_services_swapped;
363 gatt_services_swapped.swap(gatt_services_); 373 gatt_services_swapped.swap(gatt_services_);
364 gatt_services_swapped.clear(); 374 gatt_services_swapped.clear();
365 if (create_gatt_connection_error_callbacks_.empty()) { 375 if (create_gatt_connection_error_callbacks_.empty()) {
366 // TODO(http://crbug.com/585897): Need to pass the error. 376 // TODO(http://crbug.com/585897): Need to pass the error.
367 DidDisconnectGatt(); 377 DidDisconnectGatt();
368 } else { 378 } else {
369 DidFailToConnectGatt(error_code); 379 DidFailToConnectGatt(error_code);
370 } 380 }
371 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698