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