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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (aClass == [CBPeripheral class] || | 69 if (aClass == [CBPeripheral class] || |
70 [aClass isSubclassOfClass:[CBPeripheral class]]) { | 70 [aClass isSubclassOfClass:[CBPeripheral class]]) { |
71 return YES; | 71 return YES; |
72 } | 72 } |
73 return [super isKindOfClass:aClass]; | 73 return [super isKindOfClass:aClass]; |
74 } | 74 } |
75 | 75 |
76 - (void)setState:(CBPeripheralState)state { | 76 - (void)setState:(CBPeripheralState)state { |
77 _state = state; | 77 _state = state; |
78 if (_state == CBPeripheralStateDisconnected) { | 78 if (_state == CBPeripheralStateDisconnected) { |
79 _services = nil; | 79 _services.reset(); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 - (void)discoverServices:(NSArray*)serviceUUIDs { | 83 - (void)discoverServices:(NSArray*)serviceUUIDs { |
84 if (_bluetoothTestMac) { | 84 if (_bluetoothTestMac) { |
85 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); | 85 _bluetoothTestMac->OnFakeBluetoothServiceDiscovery(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 - (void)removeAllServices { | 89 - (void)removeAllServices { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 - (NSArray*)services { | 132 - (NSArray*)services { |
133 return _services.get(); | 133 return _services.get(); |
134 } | 134 } |
135 | 135 |
136 - (CBPeripheral*)peripheral { | 136 - (CBPeripheral*)peripheral { |
137 return ObjCCast<CBPeripheral>(self); | 137 return ObjCCast<CBPeripheral>(self); |
138 } | 138 } |
139 | 139 |
140 @end | 140 @end |
OLD | NEW |