| 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/bluetooth_remote_gatt_service_mac.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_mac.h" |
| 6 | 6 |
| 7 #import <CoreBluetooth/CoreBluetooth.h> | 7 #import <CoreBluetooth/CoreBluetooth.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const std::string, | 167 const std::string, |
| 168 std::unique_ptr<BluetoothRemoteGattCharacteristicMac>>& pair) { | 168 std::unique_ptr<BluetoothRemoteGattCharacteristicMac>>& pair) { |
| 169 return pair.second->IsDiscoveryComplete(); | 169 return pair.second->IsDiscoveryComplete(); |
| 170 }) == gatt_characteristic_macs_.end(); | 170 }) == gatt_characteristic_macs_.end(); |
| 171 if (is_discovery_complete_) { | 171 if (is_discovery_complete_) { |
| 172 VLOG(1) << *this << ": Discovery complete."; | 172 VLOG(1) << *this << ": Discovery complete."; |
| 173 GetMacAdapter()->NotifyGattServiceChanged(this); | 173 GetMacAdapter()->NotifyGattServiceChanged(this); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void BluetoothRemoteGattServiceMac::DidUpdateValue( | |
| 178 CBCharacteristic* characteristic, | |
| 179 NSError* error) { | |
| 180 BluetoothRemoteGattCharacteristicMac* gatt_characteristic = | |
| 181 GetBluetoothRemoteGattCharacteristicMac(characteristic); | |
| 182 DCHECK(gatt_characteristic); | |
| 183 gatt_characteristic->DidUpdateValue(error); | |
| 184 } | |
| 185 | |
| 186 void BluetoothRemoteGattServiceMac::DidWriteValue( | |
| 187 CBCharacteristic* characteristic, | |
| 188 NSError* error) { | |
| 189 BluetoothRemoteGattCharacteristicMac* gatt_characteristic = | |
| 190 GetBluetoothRemoteGattCharacteristicMac(characteristic); | |
| 191 DCHECK(gatt_characteristic); | |
| 192 gatt_characteristic->DidWriteValue(error); | |
| 193 } | |
| 194 | |
| 195 void BluetoothRemoteGattServiceMac::DidUpdateNotificationState( | |
| 196 CBCharacteristic* characteristic, | |
| 197 NSError* error) { | |
| 198 BluetoothRemoteGattCharacteristicMac* gatt_characteristic = | |
| 199 GetBluetoothRemoteGattCharacteristicMac(characteristic); | |
| 200 DCHECK(gatt_characteristic); | |
| 201 gatt_characteristic->DidUpdateNotificationState(error); | |
| 202 } | |
| 203 | |
| 204 bool BluetoothRemoteGattServiceMac::IsDiscoveryComplete() const { | 177 bool BluetoothRemoteGattServiceMac::IsDiscoveryComplete() const { |
| 205 return is_discovery_complete_; | 178 return is_discovery_complete_; |
| 206 } | 179 } |
| 207 | 180 |
| 208 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { | 181 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { |
| 209 return bluetooth_device_mac_->GetMacAdapter(); | 182 return bluetooth_device_mac_->GetMacAdapter(); |
| 210 } | 183 } |
| 211 | 184 |
| 212 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { | 185 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { |
| 213 return bluetooth_device_mac_->GetPeripheral(); | 186 return bluetooth_device_mac_->GetPeripheral(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 240 const BluetoothRemoteGattServiceMac& service) { | 213 const BluetoothRemoteGattServiceMac& service) { |
| 241 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ = | 214 const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ = |
| 242 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice()); | 215 static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice()); |
| 243 return out << "<BluetoothRemoteGattServiceMac " | 216 return out << "<BluetoothRemoteGattServiceMac " |
| 244 << service.GetUUID().canonical_value() << "/" << &service | 217 << service.GetUUID().canonical_value() << "/" << &service |
| 245 << ", device: " << bluetooth_device_mac_->GetAddress() << "/" | 218 << ", device: " << bluetooth_device_mac_->GetAddress() << "/" |
| 246 << bluetooth_device_mac_ << ">"; | 219 << bluetooth_device_mac_ << ">"; |
| 247 } | 220 } |
| 248 | 221 |
| 249 } // namespace device | 222 } // namespace device |
| OLD | NEW |