OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_cbcharacteristic_mac.h" | 5 #include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_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/bluetooth_gatt_characteristic.h" | 9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 - (void)simulateReadWithValue:(NSData*)value error:(NSError*)error { | 132 - (void)simulateReadWithValue:(NSData*)value error:(NSError*)error { |
133 _value.reset([value copy]); | 133 _value.reset([value copy]); |
134 CBPeripheral* peripheral = _service.peripheral; | 134 CBPeripheral* peripheral = _service.peripheral; |
135 [peripheral.delegate peripheral:peripheral | 135 [peripheral.delegate peripheral:peripheral |
136 didUpdateValueForCharacteristic:self.characteristic | 136 didUpdateValueForCharacteristic:self.characteristic |
137 error:error]; | 137 error:error]; |
138 } | 138 } |
139 | 139 |
| 140 - (void)simulateWriteWithError:(NSError*)error { |
| 141 CBPeripheral* peripheral = _service.peripheral; |
| 142 [peripheral.delegate peripheral:peripheral |
| 143 didWriteValueForCharacteristic:self.characteristic |
| 144 error:error]; |
| 145 } |
| 146 |
140 - (CBUUID*)UUID { | 147 - (CBUUID*)UUID { |
141 return _UUID.get(); | 148 return _UUID.get(); |
142 } | 149 } |
143 | 150 |
144 - (CBCharacteristic*)characteristic { | 151 - (CBCharacteristic*)characteristic { |
145 return ObjCCast<CBCharacteristic>(self); | 152 return ObjCCast<CBCharacteristic>(self); |
146 } | 153 } |
147 | 154 |
148 - (CBService*)service { | 155 - (CBService*)service { |
149 return _service; | 156 return _service; |
150 } | 157 } |
151 | 158 |
152 - (CBCharacteristicProperties)properties { | 159 - (CBCharacteristicProperties)properties { |
153 return _cb_properties; | 160 return _cb_properties; |
154 } | 161 } |
155 | 162 |
156 - (NSData*)value { | 163 - (NSData*)value { |
157 return _value.get(); | 164 return _value.get(); |
158 } | 165 } |
159 | 166 |
160 @end | 167 @end |
OLD | NEW |