Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_service_mac.mm

Issue 2052513002: Read characteristic implementation on macOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@characteristicscan_servicescan_cleanup
Patch Set: Addressing msarda's comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.h ('k') | device/bluetooth/test/bluetooth_test_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698