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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 characteristic_to_remove; | 112 characteristic_to_remove; |
113 pair_to_remove->second.swap(characteristic_to_remove); | 113 pair_to_remove->second.swap(characteristic_to_remove); |
114 gatt_characteristic_macs_.erase(pair_to_remove); | 114 gatt_characteristic_macs_.erase(pair_to_remove); |
115 GetMacAdapter()->NotifyGattCharacteristicRemoved( | 115 GetMacAdapter()->NotifyGattCharacteristicRemoved( |
116 characteristic_to_remove.get()); | 116 characteristic_to_remove.get()); |
117 } | 117 } |
118 is_discovery_complete_ = true; | 118 is_discovery_complete_ = true; |
119 GetMacAdapter()->NotifyGattServiceChanged(this); | 119 GetMacAdapter()->NotifyGattServiceChanged(this); |
120 } | 120 } |
121 | 121 |
| 122 void BluetoothRemoteGattServiceMac::DidUpdateValue( |
| 123 CBCharacteristic* characteristic, |
| 124 NSError* error) { |
| 125 BluetoothRemoteGattCharacteristicMac* gatt_characteristic = |
| 126 GetBluetoothRemoteGattCharacteristicMac(characteristic); |
| 127 DCHECK(gatt_characteristic); |
| 128 gatt_characteristic->DidUpdateValue(error); |
| 129 } |
| 130 |
122 bool BluetoothRemoteGattServiceMac::IsDiscoveryComplete() { | 131 bool BluetoothRemoteGattServiceMac::IsDiscoveryComplete() { |
123 return is_discovery_complete_; | 132 return is_discovery_complete_; |
124 } | 133 } |
125 | 134 |
126 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { | 135 BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const { |
127 return bluetooth_device_mac_->GetMacAdapter(); | 136 return bluetooth_device_mac_->GetMacAdapter(); |
128 } | 137 } |
129 | 138 |
130 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { | 139 CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const { |
131 return bluetooth_device_mac_->GetPeripheral(); | 140 return bluetooth_device_mac_->GetPeripheral(); |
(...skipping 15 matching lines...) Expand all Loading... |
147 return pair.second->GetCBCharacteristic() == characteristic; | 156 return pair.second->GetCBCharacteristic() == characteristic; |
148 }); | 157 }); |
149 if (found == gatt_characteristic_macs_.end()) { | 158 if (found == gatt_characteristic_macs_.end()) { |
150 return nullptr; | 159 return nullptr; |
151 } else { | 160 } else { |
152 return found->second.get(); | 161 return found->second.get(); |
153 } | 162 } |
154 } | 163 } |
155 | 164 |
156 } // namespace device | 165 } // namespace device |
OLD | NEW |