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_cbservice_mac.h" | 10 #include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (_bluetoothTestMac) { | 84 if (_bluetoothTestMac) { |
85 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); | 85 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); |
86 } | 86 } |
87 [_delegate peripheral:self.peripheral didDiscoverServices:nil]; | 87 [_delegate peripheral:self.peripheral didDiscoverServices:nil]; |
88 } | 88 } |
89 | 89 |
90 - (void)discoverCharacteristics:(NSArray*)characteristics | 90 - (void)discoverCharacteristics:(NSArray*)characteristics |
91 forService:(CBService*)service { | 91 forService:(CBService*)service { |
92 } | 92 } |
93 | 93 |
| 94 - (void)readValueForCharacteristic:(CBCharacteristic*)characteristic { |
| 95 DCHECK(_bluetoothTestMac); |
| 96 _bluetoothTestMac->OnFakeBluetoothCharacteristicReadValue(); |
| 97 } |
| 98 |
94 - (void)removeAllServices { | 99 - (void)removeAllServices { |
95 [_services.get() removeAllObjects]; | 100 [_services.get() removeAllObjects]; |
96 } | 101 } |
97 | 102 |
98 - (void)addServices:(NSArray*)services { | 103 - (void)addServices:(NSArray*)services { |
99 if (!_services.get()) { | 104 if (!_services.get()) { |
100 _services.reset([[NSMutableArray alloc] init]); | 105 _services.reset([[NSMutableArray alloc] init]); |
101 } | 106 } |
102 for (CBUUID* uuid in services) { | 107 for (CBUUID* uuid in services) { |
103 base::scoped_nsobject<MockCBService> service([[MockCBService alloc] | 108 base::scoped_nsobject<MockCBService> service([[MockCBService alloc] |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 155 |
151 - (NSArray*)services { | 156 - (NSArray*)services { |
152 return _services.get(); | 157 return _services.get(); |
153 } | 158 } |
154 | 159 |
155 - (CBPeripheral*)peripheral { | 160 - (CBPeripheral*)peripheral { |
156 return ObjCCast<CBPeripheral>(self); | 161 return ObjCCast<CBPeripheral>(self); |
157 } | 162 } |
158 | 163 |
159 @end | 164 @end |
OLD | NEW |