| 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/dbus/bluetooth_gatt_application_service_provider.h" | 5 #include "device/bluetooth/dbus/bluetooth_gatt_application_service_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 descriptor_providers) { | 40 descriptor_providers) { |
| 41 for (const auto& service : services) { | 41 for (const auto& service : services) { |
| 42 service_providers->push_back( | 42 service_providers->push_back( |
| 43 base::WrapUnique(BluetoothGattServiceServiceProvider::Create( | 43 base::WrapUnique(BluetoothGattServiceServiceProvider::Create( |
| 44 bus, service.second->object_path(), | 44 bus, service.second->object_path(), |
| 45 service.second->GetUUID().value(), service.second->IsPrimary(), | 45 service.second->GetUUID().value(), service.second->IsPrimary(), |
| 46 std::vector<dbus::ObjectPath>()))); | 46 std::vector<dbus::ObjectPath>()))); |
| 47 for (const auto& characteristic : service.second->GetCharacteristics()) { | 47 for (const auto& characteristic : service.second->GetCharacteristics()) { |
| 48 characteristic_providers->push_back( | 48 characteristic_providers->push_back( |
| 49 base::WrapUnique(BluetoothGattCharacteristicServiceProvider::Create( | 49 base::WrapUnique(BluetoothGattCharacteristicServiceProvider::Create( |
| 50 bus, characteristic->object_path(), | 50 bus, characteristic.second->object_path(), |
| 51 base::WrapUnique(new BluetoothGattCharacteristicDelegateWrapper( | 51 base::WrapUnique(new BluetoothGattCharacteristicDelegateWrapper( |
| 52 service.second, characteristic.get())), | 52 service.second, characteristic.second.get())), |
| 53 characteristic->GetUUID().value(), std::vector<std::string>(), | 53 characteristic.second->GetUUID().value(), |
| 54 std::vector<std::string>(), service.second->object_path()))); | 54 std::vector<std::string>(), std::vector<std::string>(), |
| 55 for (const auto& descriptor : characteristic->GetDescriptors()) { | 55 service.second->object_path()))); |
| 56 for (const auto& descriptor : characteristic.second->GetDescriptors()) { |
| 56 descriptor_providers->push_back( | 57 descriptor_providers->push_back( |
| 57 base::WrapUnique(BluetoothGattDescriptorServiceProvider::Create( | 58 base::WrapUnique(BluetoothGattDescriptorServiceProvider::Create( |
| 58 bus, descriptor->object_path(), | 59 bus, descriptor->object_path(), |
| 59 base::WrapUnique(new BluetoothGattDescriptorDelegateWrapper( | 60 base::WrapUnique(new BluetoothGattDescriptorDelegateWrapper( |
| 60 service.second, descriptor.get())), | 61 service.second, descriptor.get())), |
| 61 descriptor->GetUUID().value(), std::vector<std::string>(), | 62 descriptor->GetUUID().value(), std::vector<std::string>(), |
| 62 characteristic->object_path()))); | 63 characteristic.second->object_path()))); |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| 68 // static | 69 // static |
| 69 std::unique_ptr<BluetoothGattApplicationServiceProvider> | 70 std::unique_ptr<BluetoothGattApplicationServiceProvider> |
| 70 BluetoothGattApplicationServiceProvider::Create( | 71 BluetoothGattApplicationServiceProvider::Create( |
| 71 dbus::Bus* bus, | 72 dbus::Bus* bus, |
| 72 const dbus::ObjectPath& object_path, | 73 const dbus::ObjectPath& object_path, |
| 73 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& | 74 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 74 services) { | 75 services) { |
| 75 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { | 76 if (!bluez::BluezDBusManager::Get()->IsUsingFakes()) { |
| 76 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( | 77 return base::WrapUnique(new BluetoothGattApplicationServiceProviderImpl( |
| 77 bus, object_path, services)); | 78 bus, object_path, services)); |
| 78 } | 79 } |
| 79 return base::WrapUnique( | 80 return base::WrapUnique( |
| 80 new FakeBluetoothGattApplicationServiceProvider(object_path, services)); | 81 new FakeBluetoothGattApplicationServiceProvider(object_path, services)); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace bluez | 84 } // namespace bluez |
| OLD | NEW |