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

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: Addressing msarda's comment 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
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::DidUpdateValue(
316 CBCharacteristic* characteristic,
317 NSError* error) {
318 BluetoothRemoteGattServiceMac* gatt_service =
319 GetBluetoothRemoteGattService(characteristic.service);
320 DCHECK(gatt_service);
321 gatt_service->DidUpdateValue(characteristic, error);
322 }
323
315 // static 324 // static
316 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier( 325 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(
317 CBPeripheral* peripheral) { 326 CBPeripheral* peripheral) {
318 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); 327 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable());
319 NSUUID* uuid = [peripheral identifier]; 328 NSUUID* uuid = [peripheral identifier];
320 NSString* uuidString = [uuid UUIDString]; 329 NSString* uuidString = [uuid UUIDString];
321 return base::SysNSStringToUTF8(uuidString); 330 return base::SysNSStringToUTF8(uuidString);
322 } 331 }
323 332
324 // static 333 // static
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GattServiceMap gatt_services_swapped; 371 GattServiceMap gatt_services_swapped;
363 gatt_services_swapped.swap(gatt_services_); 372 gatt_services_swapped.swap(gatt_services_);
364 gatt_services_swapped.clear(); 373 gatt_services_swapped.clear();
365 if (create_gatt_connection_error_callbacks_.empty()) { 374 if (create_gatt_connection_error_callbacks_.empty()) {
366 // TODO(http://crbug.com/585897): Need to pass the error. 375 // TODO(http://crbug.com/585897): Need to pass the error.
367 DidDisconnectGatt(); 376 DidDisconnectGatt();
368 } else { 377 } else {
369 DidFailToConnectGatt(error_code); 378 DidFailToConnectGatt(error_code);
370 } 379 }
371 } 380 }
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.h ('k') | device/bluetooth/bluetooth_low_energy_peripheral_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698