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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_mac.mm

Issue 2071853002: Revert of bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_remote_gatt_service_mac.mm
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_mac.mm b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
index f2b17d755817bba373126509a1639043655c2d41..2e840703e40d32391166aa9f42ca0fcaa277b2ab 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
@@ -8,10 +8,8 @@
#include <vector>
#include "base/logging.h"
-#include "base/memory/ptr_util.h"
#include "device/bluetooth/bluetooth_adapter_mac.h"
#include "device/bluetooth/bluetooth_low_energy_device_mac.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
#include "device/bluetooth/bluetooth_uuid.h"
namespace device {
@@ -22,8 +20,7 @@
bool is_primary)
: bluetooth_device_mac_(bluetooth_device_mac),
service_(service, base::scoped_policy::RETAIN),
- is_primary_(is_primary),
- is_discovery_complete_(false) {
+ is_primary_(is_primary) {
uuid_ = BluetoothAdapterMac::BluetoothUUIDWithCBUUID([service_.get() UUID]);
identifier_ =
[NSString stringWithFormat:@"%s-%p", uuid_.canonical_value().c_str(),
@@ -51,13 +48,8 @@
std::vector<BluetoothRemoteGattCharacteristic*>
BluetoothRemoteGattServiceMac::GetCharacteristics() const {
- std::vector<BluetoothRemoteGattCharacteristic*> gatt_characteristics;
- for (const auto& iter : gatt_characteristic_macs_) {
- BluetoothRemoteGattCharacteristic* gatt_characteristic =
- static_cast<BluetoothRemoteGattCharacteristic*>(iter.second.get());
- gatt_characteristics.push_back(gatt_characteristic);
- }
- return gatt_characteristics;
+ NOTIMPLEMENTED();
+ return std::vector<BluetoothRemoteGattCharacteristic*>();
}
std::vector<BluetoothRemoteGattService*>
@@ -69,88 +61,12 @@
BluetoothRemoteGattCharacteristic*
BluetoothRemoteGattServiceMac::GetCharacteristic(
const std::string& identifier) const {
- auto searched_pair = gatt_characteristic_macs_.find(identifier);
- if (searched_pair == gatt_characteristic_macs_.end()) {
- return nullptr;
- }
- return static_cast<BluetoothRemoteGattCharacteristic*>(
- searched_pair->second.get());
-}
-
-void BluetoothRemoteGattServiceMac::DiscoverCharacteristics() {
- is_discovery_complete_ = false;
- [GetCBPeripheral() discoverCharacteristics:nil forService:GetService()];
-}
-
-void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
- DCHECK(!is_discovery_complete_);
- std::unordered_set<std::string> characteristic_identifier_to_remove;
- for (const auto& iter : gatt_characteristic_macs_) {
- characteristic_identifier_to_remove.insert(iter.first);
- }
-
- for (CBCharacteristic* cb_characteristic in GetService().characteristics) {
- BluetoothRemoteGattCharacteristicMac* gatt_characteristic_mac =
- GetBluetoothRemoteGattCharacteristicMac(cb_characteristic);
- if (gatt_characteristic_mac) {
- const std::string& identifier = gatt_characteristic_mac->GetIdentifier();
- characteristic_identifier_to_remove.erase(identifier);
- continue;
- }
- gatt_characteristic_mac =
- new BluetoothRemoteGattCharacteristicMac(this, cb_characteristic);
- const std::string& identifier = gatt_characteristic_mac->GetIdentifier();
- auto result_iter = gatt_characteristic_macs_.insert(
- {identifier, base::WrapUnique(gatt_characteristic_mac)});
- DCHECK(result_iter.second);
- GetMacAdapter()->NotifyGattCharacteristicAdded(gatt_characteristic_mac);
- }
-
- for (const std::string& identifier : characteristic_identifier_to_remove) {
- auto pair_to_remove = gatt_characteristic_macs_.find(identifier);
- std::unique_ptr<BluetoothRemoteGattCharacteristicMac>
- characteristic_to_remove;
- pair_to_remove->second.swap(characteristic_to_remove);
- gatt_characteristic_macs_.erase(pair_to_remove);
- GetMacAdapter()->NotifyGattCharacteristicRemoved(
- characteristic_to_remove.get());
- }
- is_discovery_complete_ = true;
- GetMacAdapter()->NotifyGattServiceChanged(this);
-}
-
-bool BluetoothRemoteGattServiceMac::IsDiscoveryComplete() {
- return is_discovery_complete_;
-}
-
-BluetoothAdapterMac* BluetoothRemoteGattServiceMac::GetMacAdapter() const {
- return bluetooth_device_mac_->GetMacAdapter();
-}
-
-CBPeripheral* BluetoothRemoteGattServiceMac::GetCBPeripheral() const {
- return bluetooth_device_mac_->GetPeripheral();
+ NOTIMPLEMENTED();
+ return nullptr;
}
CBService* BluetoothRemoteGattServiceMac::GetService() const {
return service_.get();
}
-BluetoothRemoteGattCharacteristicMac*
-BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac(
- CBCharacteristic* characteristic) const {
- auto found = std::find_if(
- gatt_characteristic_macs_.begin(), gatt_characteristic_macs_.end(),
- [characteristic](
- const std::pair<
- const std::string,
- std::unique_ptr<BluetoothRemoteGattCharacteristicMac>>& pair) {
- return pair.second->GetCBCharacteristic() == characteristic;
- });
- if (found == gatt_characteristic_macs_.end()) {
- return nullptr;
- } else {
- return found->second.get();
- }
-}
-
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.h ('k') | device/bluetooth/bluetooth_remote_gatt_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698