| 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/test/mock_bluetooth_cbperipheral_mac.h" | 5 #include "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "device/bluetooth/test/bluetooth_test_mac.h" | 9 #include "device/bluetooth/test/bluetooth_test_mac.h" |
| 10 #include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h" | 10 #include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 _state = state; | 76 _state = state; |
| 77 if (_state == CBPeripheralStateDisconnected) { | 77 if (_state == CBPeripheralStateDisconnected) { |
| 78 _services.reset(); | 78 _services.reset(); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 - (void)discoverServices:(NSArray*)serviceUUIDs { | 82 - (void)discoverServices:(NSArray*)serviceUUIDs { |
| 83 if (_bluetoothTestMac) { | 83 if (_bluetoothTestMac) { |
| 84 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); | 84 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); |
| 85 } | 85 } |
| 86 [_delegate peripheral:self.peripheral didDiscoverServices:nil]; | |
| 87 } | 86 } |
| 88 | 87 |
| 89 - (void)discoverCharacteristics:(NSArray*)characteristics | 88 - (void)discoverCharacteristics:(NSArray*)characteristics |
| 90 forService:(CBService*)service { | 89 forService:(CBService*)service { |
| 90 if (_bluetoothTestMac) { |
| 91 _bluetoothTestMac->OnFakeBluetoothCharacteristicDiscovery(); |
| 92 } |
| 91 } | 93 } |
| 92 | 94 |
| 93 - (void)discoverDescriptorsForCharacteristic:(CBCharacteristic*)characteristic { | 95 - (void)discoverDescriptorsForCharacteristic:(CBCharacteristic*)characteristic { |
| 94 MockCBCharacteristic* mock_characteristic = | 96 MockCBCharacteristic* mock_characteristic = |
| 95 ObjCCast<MockCBCharacteristic>(characteristic); | 97 ObjCCast<MockCBCharacteristic>(characteristic); |
| 96 [mock_characteristic discoverDescriptors]; | 98 [mock_characteristic discoverDescriptors]; |
| 97 } | 99 } |
| 98 | 100 |
| 99 - (void)readValueForCharacteristic:(CBCharacteristic*)characteristic { | 101 - (void)readValueForCharacteristic:(CBCharacteristic*)characteristic { |
| 100 DCHECK(_bluetoothTestMac); | 102 DCHECK(_bluetoothTestMac); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return ObjCCast<CBPeripheral>(self); | 190 return ObjCCast<CBPeripheral>(self); |
| 189 } | 191 } |
| 190 | 192 |
| 191 - (void)setNotifyValue:(BOOL)notification | 193 - (void)setNotifyValue:(BOOL)notification |
| 192 forCharacteristic:(CBCharacteristic*)characteristic { | 194 forCharacteristic:(CBCharacteristic*)characteristic { |
| 193 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification( | 195 _bluetoothTestMac->OnFakeBluetoothGattSetCharacteristicNotification( |
| 194 notification == YES); | 196 notification == YES); |
| 195 } | 197 } |
| 196 | 198 |
| 197 @end | 199 @end |
| OLD | NEW |