OLD | NEW |
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 void BluetoothLowEnergyDeviceMac::DidUpdateValue( | 311 void BluetoothLowEnergyDeviceMac::DidUpdateValue( |
312 CBCharacteristic* characteristic, | 312 CBCharacteristic* characteristic, |
313 NSError* error) { | 313 NSError* error) { |
314 BluetoothRemoteGattServiceMac* gatt_service = | 314 BluetoothRemoteGattServiceMac* gatt_service = |
315 GetBluetoothRemoteGattService(characteristic.service); | 315 GetBluetoothRemoteGattService(characteristic.service); |
316 DCHECK(gatt_service); | 316 DCHECK(gatt_service); |
317 gatt_service->DidUpdateValue(characteristic, error); | 317 gatt_service->DidUpdateValue(characteristic, error); |
318 } | 318 } |
319 | 319 |
| 320 void BluetoothLowEnergyDeviceMac::DidWriteValue( |
| 321 CBCharacteristic* characteristic, |
| 322 NSError* error) { |
| 323 BluetoothRemoteGattServiceMac* gatt_service = |
| 324 GetBluetoothRemoteGattService(characteristic.service); |
| 325 DCHECK(gatt_service); |
| 326 gatt_service->DidWriteValue(characteristic, error); |
| 327 } |
| 328 |
320 // static | 329 // static |
321 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier( | 330 std::string BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier( |
322 CBPeripheral* peripheral) { | 331 CBPeripheral* peripheral) { |
323 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); | 332 DCHECK(BluetoothAdapterMac::IsLowEnergyAvailable()); |
324 NSUUID* uuid = [peripheral identifier]; | 333 NSUUID* uuid = [peripheral identifier]; |
325 NSString* uuidString = [uuid UUIDString]; | 334 NSString* uuidString = [uuid UUIDString]; |
326 return base::SysNSStringToUTF8(uuidString); | 335 return base::SysNSStringToUTF8(uuidString); |
327 } | 336 } |
328 | 337 |
329 // static | 338 // static |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 GattServiceMap gatt_services_swapped; | 376 GattServiceMap gatt_services_swapped; |
368 gatt_services_swapped.swap(gatt_services_); | 377 gatt_services_swapped.swap(gatt_services_); |
369 gatt_services_swapped.clear(); | 378 gatt_services_swapped.clear(); |
370 if (create_gatt_connection_error_callbacks_.empty()) { | 379 if (create_gatt_connection_error_callbacks_.empty()) { |
371 // TODO(http://crbug.com/585897): Need to pass the error. | 380 // TODO(http://crbug.com/585897): Need to pass the error. |
372 DidDisconnectGatt(); | 381 DidDisconnectGatt(); |
373 } else { | 382 } else { |
374 DidFailToConnectGatt(error_code); | 383 DidFailToConnectGatt(error_code); |
375 } | 384 } |
376 } | 385 } |
OLD | NEW |