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