changed all instances of getObjectPath to getObject().getObjectPath(). migrated to ne ProxyInterfaces constructor

This commit is contained in:
lasan
2026-03-19 18:44:02 +05:30
parent 4cc3bec2aa
commit 45406089e1
42 changed files with 181 additions and 154 deletions
@@ -58,7 +58,7 @@ void ServiceBrowser::onItemNew(const int32_t &interface,
const std::string &type,
const std::string &domain,
const uint32_t &flags) {
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< ": Found new item through the ServiceBrowser: "
<< "interface: " << interface << ", protocol: "
<< protocol << ", name: '" << name << "', type: '"
@@ -123,18 +123,18 @@ void ServiceBrowser::onItemRemove(
}
void ServiceBrowser::onFailure(const std::string &error) {
LOG(ERROR) << __func__ << ": " << getObjectPath()
LOG(ERROR) << __func__ << ": " << getProxy().getObjectPath()
<< ": ServiceBrowser reported a failure: " << error;
}
void ServiceBrowser::onAllForNow() {
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< ": notified via ServiceBrowser that all records have "
"been added for now";
}
void ServiceBrowser::onCacheExhausted() {
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< ": notified via ServiceBrowser of cache exhaustion";
}
@@ -44,7 +44,8 @@ class Server final
public:
Server(sdbus::IConnection &system_bus,
api::WifiLanMedium::DiscoveredServiceCallback callback)
: ProxyInterfaces(system_bus, "org.freedesktop.Avahi", "/"),
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.freedesktop.Avahi"),
sdbus::ObjectPath("/")),
discovery_cb_(std::move(callback))
{
registerProxy();
@@ -74,13 +75,13 @@ class EntryGroup final
public:
EntryGroup(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &entry_group_object_path)
: ProxyInterfaces(system_bus, "org.freedesktop.Avahi",
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.freedesktop.Avahi"),
entry_group_object_path) {
registerProxy();
}
~EntryGroup() {
LOG(INFO) << __func__ << ": Freeing entry group "
<< getObjectPath();
<< getProxy().getObjectPath();
try {
Free();
@@ -103,14 +104,14 @@ class ServiceBrowser final
ServiceBrowser(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &service_browser_object_path,
std::shared_ptr<Server> avahi_server)
: ProxyInterfaces(system_bus, "org.freedesktop.Avahi",
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.freedesktop.Avahi"),
service_browser_object_path),
server_(avahi_server) {
registerProxy();
}
~ServiceBrowser() {
LOG(INFO) << __func__ << ": Freeing service browser "
<< getObjectPath();
<< getProxy().getObjectPath();
try {
Free();
@@ -399,7 +399,8 @@ try {
void BluezGattDiscovery::onInterfacesAdded(
const sdbus::ObjectPath &objectPath,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) {
if (interfacesAndProperties.count(
org::bluez::GattCharacteristic1_proxy::INTERFACE_NAME) == 0)
@@ -421,7 +422,7 @@ void BluezGattDiscovery::onInterfacesAdded(
void BluezGattDiscovery::onInterfacesRemoved(
const sdbus::ObjectPath &objectPath,
const std::vector<std::string> &interfaces) {
const std::vector<sdbus::InterfaceName> &interfaces) {
auto begin = interfaces.cbegin();
auto end = interfaces.cend();
@@ -67,11 +67,12 @@ class BluezGattDiscovery final : public bluez::BluezObjectManager {
protected:
void onInterfacesAdded(
const sdbus::ObjectPath &objectPath,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) override ABSL_LOCKS_EXCLUDED(mutex_);
void onInterfacesRemoved(const sdbus::ObjectPath &objectPath,
const std::vector<std::string> &interfaces) override
ABSL_LOCKS_EXCLUDED(mutex_);
const std::vector<sdbus::InterfaceName> &interfaces)
override ABSL_LOCKS_EXCLUDED(mutex_);
private:
std::optional<std::tuple<Uuid, Uuid, sdbus::ObjectPath>>
@@ -50,7 +50,7 @@ GattServer::CreateCharacteristic(
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesAdded signal for object path "
<< service->getObjectPath() << " with name '" << e.getName()
<< service->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
return std::nullopt;
}
@@ -64,12 +64,12 @@ GattServer::CreateCharacteristic(
LOG(INFO)<< __func__ << ": Registering service on gattmanager with characteristic_uuid: "
<< std::string(characteristic_uuid) << " and service_uuid: " << std::string(service_uuid);
gatt_manager_ -> RegisterApplication(gatt_service_root_object_manager -> getObjectPath(), {});
gatt_manager_ -> RegisterApplication(gatt_service_root_object_manager -> getObject().getObjectPath(), {});
} catch (const sdbus::Error& e) {
LOG(ERROR)
<< __func__
<< ": error calling RegisterAplication for GattManager with object path "
<< gatt_manager_->getObjectPath() << " with name '" << e.getName()
<< gatt_manager_->getProxy().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
return std::nullopt;
}
@@ -142,7 +142,7 @@ void GattServer::Stop() {
absl::MutexLock lock(&services_mutex_);
for (auto& [uuid, service] : services_) {
LOG(INFO) << __func__ << ": Unregistering service "
<< service->getObjectPath();
<< service->getObject().getObjectPath();
try {
manager.UnregisterApplication("/");
} catch (const sdbus::Error& e) {
@@ -88,9 +88,9 @@ BleV2Medium::BleV2Medium(BluetoothAdapter &adapter)
LOG(INFO)
<< __func__
<< ": Registering path /com/google/nearby/medium/ble/advertisement/monitor with AdvertisementMonitorManager at "
<< adv_monitor_manager_->getObjectPath();
<< adv_monitor_manager_->getProxy().getObjectPath();
try {
adv_monitor_manager_->RegisterMonitor(root_object_manager_->getObjectPath());
adv_monitor_manager_->RegisterMonitor(root_object_manager_->getObject().getObjectPath());
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(adv_monitor_manager_, "RegisterMonitor", e);
}
@@ -131,11 +131,11 @@ BleV2Medium::BleV2Medium(BluetoothAdapter &adapter)
LOG(INFO) << __func__ << ": Registering advertisement, is_extended: " << advertising_data.is_extended_advertisement
<< " " << (*it) -> getObjectPath() << " on bluetooth adapter "
<< " " << (*it) -> getObject().getObjectPath() << " on bluetooth adapter "
<< adapter_.GetObjectPath();
try {
adv_manager_->RegisterAdvertisement((*it)->getObjectPath(), {});
adv_manager_->RegisterAdvertisement((*it)->getObject().getObjectPath(), {});
} catch (const sdbus::Error &e) {
advs_.erase(it);
DBUS_LOG_METHOD_CALL_ERROR(adv_manager_, "RegisterAdvertisement", e);
@@ -175,7 +175,7 @@ BleV2Medium::StartAdvertising(
// Keep async API surface, but register using the same typed DBus path as the
// working sync implementation to avoid signature mismatch (oa{sv} vs sa{sv}).
try {
adv_manager_->RegisterAdvertisement((*adv_it)->getObjectPath(), {});
adv_manager_->RegisterAdvertisement((*adv_it)->getObject().getObjectPath(), {});
shared_cb->start_advertising_result(absl::OkStatus());
} catch (const sdbus::Error &e) {
advs_.erase(adv_it);
@@ -199,10 +199,10 @@ BleV2Medium::StartAdvertising(
absl::AnyInvocable<absl::Status()> stop_adv = [&, adv_it]() {
LOG(INFO) << __func__ << ": Unregistering advertisement object "
<< (*adv_it)->getObjectPath();
<< (*adv_it)->getObject().getObjectPath();
absl::MutexLock lock(&advs_mutex_);
try {
adv_manager_->UnregisterAdvertisement((*adv_it)->getObjectPath());
adv_manager_->UnregisterAdvertisement((*adv_it)->getObject().getObjectPath());
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(adv_manager_, "UnregisterAdvertisement", e);
return absl::UnknownError(e.getMessage());
@@ -219,7 +219,7 @@ BleV2Medium::StartAdvertising(
try {
for (auto& adv: advs_)
{
adv_manager_->UnregisterAdvertisement(adv->getObjectPath());
adv_manager_->UnregisterAdvertisement(adv->getObject().getObjectPath());
}
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(adv_manager_, "UnregisterAdvertisement", e);
@@ -270,13 +270,13 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
monitor->emitInterfacesAddedSignal(
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
// adv_monitor_manager_ -> RegisterMonitor(monitor -> getObjectPath());
LOG(INFO)<< __func__ << ": Registered advertisement monitor with path " << monitor -> getObjectPath();
// adv_monitor_manager_ -> RegisterMonitor(monitor -> getObject().getObjectPath());
LOG(INFO)<< __func__ << ": Registered advertisement monitor with path " << monitor -> getObject().getObjectPath();
} catch (const sdbus::Error &e) {
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesAdded signal for object path "
<< monitor->getObjectPath() << " with name '" << e.getName()
<< monitor->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
return false;
}
@@ -294,7 +294,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesRemoved signal for object path "
<< monitor->getObjectPath() << " with name '" << e.getName()
<< monitor->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
}
return false;
@@ -321,7 +321,7 @@ bool BleV2Medium::StopScanning() {
auto &adapter = adapter_.GetBluezAdapterObject();
LOG(INFO) << __func__ << ": Stopping discovery for adapter "
<< adapter.getObjectPath();
<< adapter.getProxy().getObjectPath();
try {
adapter.StopDiscovery(); // this will stop bluetooth classic discovery as well. do we want this?
} catch (const sdbus::Error &e) {
@@ -336,7 +336,7 @@ bool BleV2Medium::StopScanning() {
auto &[adv_monitor, _watcher] = session;
LOG(INFO) << __func__ << ": Removing advertising monitor "
<< adv_monitor->getObjectPath();
<< adv_monitor->getObject().getObjectPath();
adv_monitor->emitInterfacesRemovedSignal(
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
}
@@ -371,7 +371,7 @@ bool BleV2Medium::StopScanning() {
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesAdded signal for object path "
<< monitor->getObjectPath() << " with name '" << e.getName()
<< monitor->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
return nullptr;
}
@@ -389,7 +389,7 @@ bool BleV2Medium::StopScanning() {
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesRemoved signal for object path "
<< monitor->getObjectPath() << " with name '" << e.getName()
<< monitor->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
}
return nullptr;
@@ -417,7 +417,7 @@ bool BleV2Medium::StopScanning() {
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesRemoved signal for object path "
<< monitor->getObjectPath() << " with name '" << e.getName()
<< monitor->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
}
@@ -510,7 +510,7 @@ bool BleV2Medium::StartLEDiscovery() {
try {
LOG(INFO) << __func__ << ": Starting LE discovery on "
<< adapter.getObjectPath();
<< adapter.getProxy().getObjectPath();
adapter.StartDiscovery();
} catch (const sdbus::Error &e) {
if (e.getName() != "org.bluez.Error.InProgress") {
@@ -29,7 +29,8 @@ class BluezAdapter : public sdbus::ProxyInterfaces<org::bluez::Adapter1_proxy> {
public:
BluezAdapter(sdbus::IConnection &system_bus,
const sdbus::ObjectPath &adapter_object_path)
: ProxyInterfaces(system_bus, bluez::SERVICE_DEST, adapter_object_path) {
: ProxyInterfaces(system_bus, sdbus::ServiceName(bluez::SERVICE_DEST),
adapter_object_path) {
registerProxy();
}
~BluezAdapter() { unregisterProxy(); }
@@ -68,7 +69,7 @@ class BluetoothAdapter : public api::BluetoothAdapter {
}
sdbus::ObjectPath GetObjectPath() const {
return bluez_adapter_->getObjectPath();
return bluez_adapter_->getProxy().getObjectPath();
}
BluezAdapter &GetBluezAdapterObject() { return *bluez_adapter_; }
@@ -47,7 +47,7 @@ bool ProfileManager::ProfileRegistered(absl::string_view service_uuid) {
void Profile::Release() {
released_ = true;
LOG(INFO) << __func__ << ": Profile object " << getObjectPath()
LOG(INFO) << __func__ << ": Profile object " << getObject().getObjectPath()
<< " has been released";
}
@@ -57,7 +57,7 @@ void Profile::NewConnection(
if (released_) {
LOG(ERROR) << __func__
<< ": NewConnection called on released object "
<< getObjectPath();
<< getObject().getObjectPath();
throw sdbus::Error("org.bluez.Error.Rejected",
"NewConnection called on released object");
}
@@ -70,7 +70,7 @@ void Profile::NewConnection(
auto alias = device->GetName();
auto mac_addr = device->GetAddress();
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getObject().getObjectPath()
<< ": Connected to " << mac_addr.ToString();
FDProperties props(fd_props);
@@ -79,7 +79,7 @@ void Profile::NewConnection(
<< " alias=" << alias;
LOG(INFO) << "PUSH_ENTER profile=" << this
<< " mutex=" << &connections_lock_
<< " obj=" << getObjectPath()
<< " obj=" << getObject().getObjectPath()
<< " path=" << device_object_path;
{
absl::MutexLock l(&connections_lock_);
@@ -91,7 +91,7 @@ void Profile::RequestDisconnection(
const sdbus::ObjectPath &device_object_path) {
auto device = devices_.get_device_by_path(device_object_path);
if (device == nullptr) {
LOG(ERROR) << __func__ << ": " << getObjectPath()
LOG(ERROR) << __func__ << ": " << getObject().getObjectPath()
<< ": RequestDisconnection called with a device object "
"we don't know about: "
<< device_object_path;
@@ -135,8 +135,8 @@ bool ProfileManager::Register(std::optional<absl::string_view> name,
options["Channel"] = static_cast<uint16_t>(0);
options["PSM"] = static_cast<uint16_t>(0);
RegisterProfile(profile->getObjectPath(), std::string(service_uuid),
options);
RegisterProfile(profile->getObject().getObjectPath(),
std::string(service_uuid), options);
} catch (const sdbus::Error &e) {
BLUEZ_LOG_METHOD_CALL_ERROR(&getProxy(), "RegisterProfile", e);
return false;
@@ -200,13 +200,13 @@ std::optional<sdbus::UnixFd> ProfileManager::GetServiceRecordFD(
}
);
LOG(INFO) << __func__ << ": " << profile->getObjectPath()
LOG(INFO) << __func__ << ": " << profile->getObject().getObjectPath()
<< ": Attempting to get a FD for service "
<< service_uuid << " on device " << mac_addr.ToString();
LOG(INFO) << "WAIT profile=" << profile.get()
<< " mutex=" << &profile->connections_lock_
<< " obj=" << profile->getObjectPath()
<< " obj=" << profile->getObject().getObjectPath()
<< " key=" << mac_addr.ToString();
auto cond = [mac_addr, profile, cancellation_flag]() {
profile->connections_lock_.AssertHeld();
@@ -228,7 +228,7 @@ std::optional<sdbus::UnixFd> ProfileManager::GetServiceRecordFD(
if (cancellation_flag != nullptr && cancellation_flag->Cancelled()) {
LOG(INFO)
<< __func__ << ": " << profile->getObjectPath() << ": "
<< __func__ << ": " << profile->getObject().getObjectPath() << ": "
<< remote_device.GetMacAddress().ToString()
<< ": Cancelled waiting for a new connection on profile "
<< service_uuid;
@@ -261,7 +261,7 @@ ProfileManager::GetServiceRecordFD(absl::string_view service_uuid,
profile = registered_services_[std::string(service_uuid)];
}
LOG(INFO) << __func__ << ": " << profile->getObjectPath()
LOG(INFO) << __func__ << ": " << profile->getObject().getObjectPath()
<< ": Attempting to get a FD for service "
<< service_uuid;
@@ -291,7 +291,7 @@ ProfileManager::GetServiceRecordFD(absl::string_view service_uuid,
if (cancellation_flag != nullptr && cancellation_flag->Cancelled()) {
LOG(INFO)
<< __func__ << ": Cancelled waiting for new connections on profile "
<< profile->getObjectPath();
<< profile->getObject().getObjectPath();
profile->connections_lock_.Unlock();
return std::nullopt;
}
@@ -61,7 +61,7 @@ class Profile final
devices_(devices) {
registerAdaptor();
LOG(INFO) << __func__ << ": Created a new BlueZ profile at :"
<< getObjectPath();
<< getObject().getObjectPath();
}
~Profile() { unregisterAdaptor(); }
@@ -110,7 +110,8 @@ class ProfileManager final
ProfileManager &operator=(const ProfileManager &) = delete;
ProfileManager &operator=(ProfileManager &&) = delete;
ProfileManager(sdbus::IConnection &system_bus, BluetoothDevices &devices)
: ProxyInterfaces(system_bus, bluez::SERVICE_DEST, "/org/bluez"),
: ProxyInterfaces(system_bus, sdbus::ServiceName(bluez::SERVICE_DEST),
sdbus::ObjectPath("/org/bluez")),
devices_(devices) {
registerProxy();
}
@@ -152,7 +152,7 @@ bool BluetoothDevice::ConnectToProfile(absl::string_view service_uuid) {
ObserverList<api::BluetoothClassicMedium::Observer> &observers)
: BluetoothDevice(device),
ProxyInterfaces<sdbus::Properties_proxy>(*system_bus, bluez::SERVICE_DEST,
device->getObjectPath()),
device->getProxy().getObjectPath()),
system_bus_(std::move(system_bus)),
observers_(observers) {
registerProxy();
@@ -170,7 +170,7 @@ void MonitoredBluetoothDevice::onPropertiesChanged(
it++)
{
if (it->first == bluez::DEVICE_PROP_ADDRESS) {
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< ": Notifying observers about address change";
std::string address = it->second;
for (const auto &observer : observers_.GetObservers()) {
@@ -178,14 +178,14 @@ void MonitoredBluetoothDevice::onPropertiesChanged(
}
} else if (it->first == bluez::DEVICE_PROP_PAIRED) {
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< "Notifying observers about paired status change.";
for (const auto &observer : observers_.GetObservers()) {
observer->DevicePairedChanged(*this, it->second);
}
} else if (it->first == bluez::DEVICE_PROP_CONNECTED) {
LOG(INFO)
<< __func__ << ": " << getObjectPath()
<< __func__ << ": " << getProxy().getObjectPath()
<< "Notifying observers about connected status change";
for (const auto &observer : observers_.GetObservers()) {
observer->DeviceConnectedStateChanged(*this, it->second);
@@ -118,7 +118,7 @@ class BluetoothDevice : public api::BluetoothDevice {
void MarkLost() { lost_ = true; }
void UnmarkLost() { lost_ = false; }
bool Lost() const { return lost_; }
sdbus::ObjectPath GetObjectPath() {return device_->getObjectPath();}
sdbus::ObjectPath GetObjectPath() {return device_->getProxy().getObjectPath();}
private:
UniqueId unique_id_;
@@ -87,7 +87,7 @@ bool BluetoothClassicMedium::StartDiscovery(
bool BluetoothClassicMedium::StopDiscovery() {
auto &adapter = adapter_.GetBluezAdapterObject();
LOG(INFO) << __func__ << "Stopping discovery on "
<< adapter.getObjectPath();
<< adapter.getProxy().getObjectPath();
auto ret = true;
try {
adapter.StopDiscovery();
@@ -143,17 +143,20 @@ std::shared_ptr<MonitoredBluetoothDevice> BluetoothDevices::add_new_device(
}
void DeviceWatcher::onInterfacesAdded(
const sdbus::ObjectPath &object,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
&interfaces) {
const sdbus::ObjectPath &objectPath,
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) {
auto path_prefix = absl::Substitute("$0/dev_", adapter_object_path_);
if (object.find(path_prefix) != 0) {
if (objectPath.find(path_prefix) != 0) {
return;
}
if (interfaces.count(org::bluez::Device1_proxy::INTERFACE_NAME) == 0) return;
if (interfacesAndProperties.count(org::bluez::Device1_proxy::INTERFACE_NAME) ==
0)
return;
auto device = devices_->add_new_device(object);
auto device = devices_->add_new_device(objectPath);
device->SetDiscoveryCallback(discovery_cb_);
if (discovery_cb_ != nullptr &&
discovery_cb_->device_discovered_cb != nullptr) {
@@ -168,10 +171,10 @@ void DeviceWatcher::onInterfacesAdded(
}
void DeviceWatcher::onInterfacesRemoved(
const sdbus::ObjectPath &object,
const std::vector<std::string> &interfaces) {
const sdbus::ObjectPath &objectPath,
const std::vector<sdbus::InterfaceName> &interfaces) {
auto path_prefix = absl::Substitute("$0/dev_", adapter_object_path_);
if (object.find(path_prefix) != 0) {
if (objectPath.find(path_prefix) != 0) {
return;
}
@@ -109,7 +109,8 @@ class DeviceWatcher final : sdbus::ProxyInterfaces<sdbus::ObjectManager_proxy> {
discovery_callback,
std::shared_ptr<ObserverList<api::BluetoothClassicMedium::Observer>>
observers)
: ProxyInterfaces(system_bus, "org.bluez", "/"),
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.bluez"),
sdbus::ObjectPath("/")),
adapter_object_path_(adapter_object_path),
adapter_(adapter),
devices_(std::move(devices)),
@@ -127,11 +128,13 @@ class DeviceWatcher final : sdbus::ProxyInterfaces<sdbus::ObjectManager_proxy> {
~DeviceWatcher() { unregisterProxy(); }
void onInterfacesAdded(
const sdbus::ObjectPath &object,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
&interfaces) override;
void onInterfacesRemoved(const sdbus::ObjectPath &object,
const std::vector<std::string> &interfaces) override;
const sdbus::ObjectPath &objectPath,
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) override;
void onInterfacesRemoved(const sdbus::ObjectPath &objectPath,
const std::vector<sdbus::InterfaceName> &interfaces)
override;
private:
void notifyExistingDevices();
@@ -29,7 +29,7 @@
LOG(ERROR) << __func__ << ": Got error '" << (err).getName() \
<< "' with message '" << (err).getMessage() \
<< "' while calling " << method << " on object " \
<< (proxy)->getObjectPath(); \
<< (proxy)->getProxy().getObjectPath(); \
} while (false)
namespace nearby {
@@ -67,7 +67,7 @@ class BluezObjectManager
: public sdbus::ProxyInterfaces<sdbus::ObjectManager_proxy> {
public:
explicit BluezObjectManager(sdbus::IConnection &system_bus)
: ProxyInterfaces(system_bus, "org.bluez", "/") {
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.bluez"), sdbus::ObjectPath("/")) {
registerProxy();
}
virtual ~BluezObjectManager() { unregisterProxy(); }
@@ -75,11 +75,12 @@ class BluezObjectManager
protected:
void onInterfacesAdded(
const sdbus::ObjectPath &objectPath,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) override {}
void onInterfacesRemoved(
const sdbus::ObjectPath &objectPath,
const std::vector<std::string> &interfaces) override {}
const std::vector<sdbus::InterfaceName> &interfaces) override {}
};
} // namespace bluez
@@ -52,7 +52,7 @@ void AdvertisementMonitor::DeviceFound(const sdbus::ObjectPath &device) {
LOG(ERROR)
<< __func__
<< ": Could not parse UUID string in ServiceData for peripheral "
<< peripheral->getObjectPath();
<< peripheral->getProxy().getObjectPath();
continue;
}
@@ -53,7 +53,8 @@ class AdvertisementMonitor final
// Methods
void Release() override {}
void Activate() override {
LOG(INFO) <<__func__ << ": bluez advertisement monitor activated at path: " << getObjectPath();
LOG(INFO) <<__func__ << ": bluez advertisement monitor activated at path: "
<< getObject().getObjectPath();
if (start_scanning_result_callback_ != nullptr) {
start_scanning_result_callback_(absl::OkStatus());
}
@@ -36,7 +36,8 @@ class AdvertisementMonitorManager final
AdvertisementMonitorManager(
sdbus::IConnection &system_bus,
const ::nearby::linux::BluetoothAdapter &adapter)
: ProxyInterfaces(system_bus, "org.bluez", adapter.GetObjectPath()) {
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.bluez"),
adapter.GetObjectPath()) {
registerProxy();
}
@@ -29,7 +29,7 @@ class Device : public sdbus::ProxyInterfaces<org::bluez::Device1_proxy> {
public:
Device(std::shared_ptr<sdbus::IConnection> system_bus,
const sdbus::ObjectPath &device_path)
: ProxyInterfaces(*system_bus, "org.bluez", device_path),
: ProxyInterfaces(*system_bus, sdbus::ServiceName("org.bluez"), device_path),
system_bus(std::move(system_bus)) {
registerProxy();
}
@@ -32,7 +32,8 @@ class GattCharacteristicClient
public:
GattCharacteristicClient(std::shared_ptr<sdbus::IConnection> system_bus,
sdbus::ObjectPath path)
: ProxyInterfaces(*system_bus, "org.bluez", std::move(path)),
: ProxyInterfaces(*system_bus, sdbus::ServiceName("org.bluez"),
std::move(path)),
system_bus_(std::move(system_bus)) {
registerProxy();
}
@@ -63,8 +63,9 @@ absl::Status GattCharacteristicServer::NotifyChanged(
} catch (const sdbus::Error &e) {
LOG(ERROR) << __func__
<< ": Error emitting PropertiesChanged signal on "
<< getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
<< getObject().getObjectPath() << " with name '"
<< e.getName() << "' and message '" << e.getMessage()
<< "'";
return absl::UnknownError(e.getMessage());
}
}
@@ -68,7 +68,7 @@ class GattCharacteristicServer final
LOG(INFO)
<< __func__ << "Creating a "
<< org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME
<< " object at " << getObjectPath();
<< " object at " << getObject().getObjectPath();
}
~GattCharacteristicServer() { unregisterAdaptor(); }
@@ -32,7 +32,7 @@ class GattManager
GattManager(sdbus::IConnection &system_bus,
sdbus::ObjectPath adapter_object_path)
: ProxyInterfaces(system_bus, "org.bluez",
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.bluez"),
std::move(adapter_object_path)) {
registerProxy();
}
@@ -28,7 +28,7 @@ class GattServiceClient final
public:
GattServiceClient(std::shared_ptr<sdbus::IConnection> system_bus,
sdbus::ObjectPath service_object_path)
: ProxyInterfaces(*system_bus, "org.bluez",
: ProxyInterfaces(*system_bus, sdbus::ServiceName("org.bluez"),
std::move(service_object_path)) {
registerProxy();
}
@@ -32,7 +32,7 @@ bool GattServiceServer::AddCharacteristic(
auto count = characteristics_.size();
std::shared_ptr<GattCharacteristicServer> chr =
std::make_shared<GattCharacteristicServer>(
getObject().getConnection(), getObjectPath(), count, characteristic,
getObject().getConnection(), getObject().getObjectPath(), count, characteristic,
server_cb_, devices_);
try {
chr->emitInterfacesAddedSignal(
@@ -41,7 +41,7 @@ bool GattServiceServer::AddCharacteristic(
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesAdded signal for object path "
<< chr->getObjectPath() << " with name '" << e.getName()
<< chr->getObject().getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
return false;
}
@@ -56,14 +56,14 @@ class GattServiceServer final
registerAdaptor();
LOG(INFO) << __func__ << ": Created a "
<< org::bluez::GattService1_adaptor::INTERFACE_NAME
<< " object at " << getObjectPath();
<< " object at " << getObject().getObjectPath();
}
~GattServiceServer() {
absl::MutexLock lock(&characterstics_mutex_);
for (auto &[_uuid, characteristic] : characteristics_) {
LOG(INFO) << __func__ << ": Removing characteristic "
<< characteristic->getObjectPath();
<< characteristic->getObject().getObjectPath();
try {
characteristic->emitInterfacesRemovedSignal(
{org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME});
@@ -71,8 +71,8 @@ class GattServiceServer final
LOG(ERROR)
<< __func__
<< ": error emitting InterfacesRemoved signal for object path "
<< characteristic->getObjectPath() << " with name '" << e.getName()
<< "' and message '" << e.getMessage() << "'";
<< characteristic->getObject().getObjectPath() << " with name '"
<< e.getName() << "' and message '" << e.getMessage() << "'";
}
}
unregisterAdaptor();
@@ -59,7 +59,7 @@ LEAdvertisement::LEAdvertisement(
LOG(INFO) << __func__
<< ": Created a org.bluez.LEAdvertisement1 instance at "
<< getObjectPath();
<< getObject().getObjectPath();
}
} // namespace bluez
} // namespace linux
@@ -59,7 +59,8 @@ class LEAdvertisement final
// Methods
void Release() override {
LOG(INFO) << __func__
<< ": LE Advertisement released: " << getObjectPath();
<< ": LE Advertisement released: "
<< getObject().getObjectPath();
}
// Properties
@@ -100,7 +101,8 @@ class LEAdvertisementManager final
public:
LEAdvertisementManager(sdbus::IConnection& system_bus,
BluetoothAdapter& adapter)
: ProxyInterfaces(system_bus, "org.bluez", adapter.GetObjectPath()) {
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.bluez"),
adapter.GetObjectPath()) {
registerProxy();
}
~LEAdvertisementManager() { unregisterProxy(); }
@@ -35,7 +35,8 @@ class LEBearerClient
public:
LEBearerClient(std::shared_ptr<sdbus::IConnection> system_bus,
sdbus::ObjectPath bearer_path)
: ProxyInterfaces(*system_bus, "org.bluez", std::move(bearer_path)),
: ProxyInterfaces(*system_bus, sdbus::ServiceName("org.bluez"),
std::move(bearer_path)),
system_bus_(std::move(system_bus)) {
registerProxy();
}
@@ -25,7 +25,7 @@
LOG(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while calling " << (m) << " on object " \
<< (p)->getObjectPath(); \
<< (p)->getProxy().getObjectPath(); \
} while (false)
#define DBUS_LOG_PROPERTY_GET_ERROR(p, prop, e) \
@@ -33,7 +33,7 @@
LOG(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while getting property " << (prop) \
<< " on object " << (p)->getObjectPath(); \
<< " on object " << (p)->getProxy().getObjectPath(); \
} while (false)
#define DBUS_LOG_PROPERTY_SET_ERROR(p, prop, e) \
@@ -41,7 +41,7 @@
LOG(ERROR) << __func__ << ": Got error '" << (e).getName() \
<< "' with message '" << (e).getMessage() \
<< "' while setting property " << (prop) \
<< " on object " << (p)->getObjectPath(); \
<< " on object " << (p)->getProxy().getObjectPath(); \
} while (false)
namespace nearby {
@@ -43,8 +43,8 @@ class CurrentUserSession final
CurrentUserSession &operator=(CurrentUserSession &&) = delete;
~CurrentUserSession() { unregisterProxy(); }
explicit CurrentUserSession(sdbus::IConnection &system_bus)
: ProxyInterfaces(system_bus, "org.freedesktop.login1",
"/org/freedesktop/login1/session/auto") {
: ProxyInterfaces(system_bus, sdbus::ServiceName("org.freedesktop.login1"),
sdbus::ObjectPath("/org/freedesktop/login1/session/auto")) {
registerProxy();
}
@@ -79,8 +79,9 @@ class Hostnamed
Hostnamed &operator=(const Hostnamed &) = delete;
Hostnamed &operator=(Hostnamed &&) = delete;
explicit Hostnamed(sdbus::IConnection &system_bus)
: ProxyInterfaces(system_bus, "org.freedesktop.hostname1",
"/org/freedesktop/hostname1") {
: ProxyInterfaces(system_bus,
sdbus::ServiceName("org.freedesktop.hostname1"),
sdbus::ObjectPath("/org/freedesktop/hostname1")) {
registerProxy();
}
~Hostnamed() { unregisterProxy(); }
@@ -94,8 +95,9 @@ class LoginManager final
LoginManager &operator=(const LoginManager &) = delete;
LoginManager &operator=(LoginManager &&) = delete;
explicit LoginManager(sdbus::IConnection &system_bus)
: ProxyInterfaces(system_bus, "org.freedesktop.login1",
"/org/freedesktop/login1") {
: ProxyInterfaces(system_bus,
sdbus::ServiceName("org.freedesktop.login1"),
sdbus::ObjectPath("/org/freedesktop/login1")) {
registerProxy();
}
~LoginManager() { unregisterProxy(); }
@@ -36,8 +36,9 @@ class NetworkManager final
NetworkManager &operator=(const NetworkManager &) = delete;
NetworkManager &operator=(NetworkManager &&) = delete;
explicit NetworkManager(std::shared_ptr<sdbus::IConnection> system_bus)
: ProxyInterfaces(*system_bus, "org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager"),
: ProxyInterfaces(*system_bus,
sdbus::ServiceName("org.freedesktop.NetworkManager"),
sdbus::ObjectPath("/org/freedesktop/NetworkManager")),
system_bus_(std::move(system_bus)),
state_(kNMStateUnknown) {
registerProxy();
@@ -106,7 +107,8 @@ class IP4Config : public sdbus::ProxyInterfaces<
IP4Config &operator=(IP4Config &&) = delete;
IP4Config(std::shared_ptr<sdbus::IConnection> system_bus,
const sdbus::ObjectPath &config_object_path)
: ProxyInterfaces(*system_bus, "org.freedesktop.NetworkManager",
: ProxyInterfaces(*system_bus,
sdbus::ServiceName("org.freedesktop.NetworkManager"),
config_object_path),
system_bus_(std::move(system_bus)) {
registerProxy();
@@ -125,8 +127,9 @@ class ObjectManager final
ObjectManager &operator=(const ObjectManager &) = delete;
ObjectManager &operator=(ObjectManager &&) = delete;
explicit ObjectManager(std::shared_ptr<sdbus::IConnection> system_bus)
: ProxyInterfaces(*system_bus, "org.freedesktop.NetworkManager",
"/org/freedesktop"),
: ProxyInterfaces(*system_bus,
sdbus::ServiceName("org.freedesktop.NetworkManager"),
sdbus::ObjectPath("/org/freedesktop")),
system_bus_(std::move(system_bus)) {
registerProxy();
}
@@ -141,11 +144,12 @@ class ObjectManager final
protected:
void onInterfacesAdded(
const sdbus::ObjectPath &objectPath,
const std::map<std::string, std::map<std::string, sdbus::Variant>>
const std::map<sdbus::InterfaceName,
std::map<sdbus::PropertyName, sdbus::Variant>>
&interfacesAndProperties) override {}
void onInterfacesRemoved(
const sdbus::ObjectPath &objectPath,
const std::vector<std::string> &interfaces) override {}
const std::vector<sdbus::InterfaceName> &interfaces) override {}
private:
std::shared_ptr<sdbus::IConnection> system_bus_;
@@ -31,7 +31,8 @@ class NetworkManagerAccessPoint
NetworkManagerAccessPoint &operator=(NetworkManagerAccessPoint &&) = delete;
NetworkManagerAccessPoint(sdbus::IConnection &system_bus,
sdbus::ObjectPath access_point_object_path)
: ProxyInterfaces(system_bus, "org.freedesktop.NetworkManager",
: ProxyInterfaces(system_bus,
sdbus::ServiceName("org.freedesktop.NetworkManager"),
std::move(access_point_object_path)) {
registerProxy();
}
@@ -105,7 +105,7 @@ std::vector<std::string> ActiveConnection::GetIP4Addresses() {
std::pair<std::optional<ActiveConnection::ActiveConnectionStateReason>, bool>
ActiveConnection::WaitForConnection(absl::Duration timeout) {
LOG(INFO) << __func__ << ": Waiting for an update to "
<< getObjectPath() << "'s state";
<< getProxy().getObjectPath() << "'s state";
auto state_changed = [this]() {
this->state_mutex_.AssertReaderHeld();
@@ -67,7 +67,8 @@ class ActiveConnection
ActiveConnection &operator=(ActiveConnection &&) = delete;
explicit ActiveConnection(std::shared_ptr<sdbus::IConnection> system_bus,
sdbus::ObjectPath active_connection_path)
: ProxyInterfaces(*system_bus, "org.freedesktop.NetworkManager",
: ProxyInterfaces(*system_bus,
sdbus::ServiceName("org.freedesktop.NetworkManager"),
std::move(active_connection_path)),
system_bus_(std::move(system_bus)),
state_(kStateUnknown),
@@ -50,7 +50,7 @@ NetworkManagerWifiDirectMedium::ListenForService(int port) {
LOG(ERROR)
<< __func__
<< "Could not find any IPv4 addresses for active connection "
<< active_connection->getObjectPath();
<< active_connection->getProxy().getObjectPath();
return nullptr;
}
@@ -88,7 +88,7 @@ bool NetworkManagerWifiDirectMedium::DisconnectWifiDirect() {
}
try {
network_manager_->DeactivateConnection(active_connection->getObjectPath());
network_manager_->DeactivateConnection(active_connection->getProxy().getObjectPath());
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(network_manager_, "DeactivateConnection", e);
return false;
@@ -112,7 +112,7 @@ bool NetworkManagerWifiDirectMedium::StartWifiDirect(
// According to the comments in the windows implementation, the wifi direct
// medium is currently just a regular wifi hotspot.
auto wireless_device = std::make_unique<NetworkManagerWifiMedium>(
network_manager_, wireless_device_->getObjectPath());
network_manager_, wireless_device_->getProxy().getObjectPath());
auto hotspot = NetworkManagerWifiHotspotMedium(network_manager_,
std::move(wireless_device));
@@ -127,7 +127,7 @@ bool NetworkManagerWifiDirectMedium::StartWifiDirect(
bool NetworkManagerWifiDirectMedium::StopWifiDirect() {
auto wireless_device = std::make_unique<NetworkManagerWifiMedium>(
network_manager_, wireless_device_->getObjectPath());
network_manager_, wireless_device_->getProxy().getObjectPath());
auto hotspot = NetworkManagerWifiHotspotMedium(network_manager_,
std::move(wireless_device));
@@ -27,7 +27,7 @@ std::string NetworkManagerWifiDirectServerSocket::GetIPAddress() const {
LOG(ERROR)
<< __func__
<< ": Could not find any IPv4 addresses for active connection "
<< active_conn_->getObjectPath();
<< active_conn_->getProxy().getObjectPath();
return std::string();
}
return ip4addresses[0];
@@ -100,7 +100,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
LOG(ERROR)
<< __func__
<< "Could not find any IPv4 addresses for active connection "
<< active_connection->getObjectPath();
<< active_connection->getProxy().getObjectPath();
return nullptr;
}
@@ -126,7 +126,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
LOG(INFO) << __func__ << ": Listening for services on "
<< ip4addresses[0] << ":" << port << " on device "
<< wireless_device_->getObjectPath();
<< wireless_device_->getProxy().getObjectPath();
ret = listen(sock, 0);
if (ret < 0) {
@@ -142,7 +142,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
HotspotCredentials *hotspot_credentials) {
if (WifiHotspotActive()) {
LOG(ERROR) << __func__ << ": " << wireless_device_->getObjectPath()
LOG(ERROR) << __func__ << ": " << wireless_device_->getProxy().getObjectPath()
<< ": cannot start WiFi hotspot, a hotspot is already "
"active on this device";
return false;
@@ -224,7 +224,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
try {
auto [path, active_path, result] =
network_manager_->AddAndActivateConnection2(
connection_settings, wireless_device_->getObjectPath(), "/",
connection_settings, wireless_device_->getProxy().getObjectPath(), "/",
{{"persist", "volatile"}, {"bind-activation", "dbus-client"}});
active_conn = std::make_unique<networkmanager::ActiveConnection>(
system_bus_, active_path);
@@ -253,7 +253,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
LOG(ERROR)
<< __func__ << ": "
<< ": timed out while waiting for connection "
<< active_conn->getObjectPath()
<< active_conn->getProxy().getObjectPath()
<< " to be activated, last NMActiveConnectionStateReason: "
<< reason->ToString();
DisconnectWifiHotspot();
@@ -279,15 +279,15 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
}
LOG(INFO) << __func__ << ": Started a WiFi hotspot on device "
<< wireless_device_->getObjectPath() << " at "
<< active_conn->getObjectPath();
<< wireless_device_->getProxy().getObjectPath() << " at "
<< active_conn->getProxy().getObjectPath();
return true;
}
bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
if (!WifiHotspotActive()) {
LOG(ERROR)
<< __func__ << ": " << wireless_device_->getObjectPath()
<< __func__ << ": " << wireless_device_->getProxy().getObjectPath()
<< ": Cannot stop WiFi hotspot as a WiFi hotspot is not active";
}
@@ -298,7 +298,7 @@ bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
active_ap_path = wireless_device_->ActiveAccessPoint();
if (active_ap_path.empty()) {
LOG(ERROR) << __func__ << ": No active access points on "
<< wireless_device_->getObjectPath();
<< wireless_device_->getProxy().getObjectPath();
return false;
}
} catch (const sdbus::Error &e) {
@@ -315,12 +315,12 @@ bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
return false;
}
LOG(INFO) << __func__ << ": " << wireless_device_->getObjectPath()
LOG(INFO) << __func__ << ": " << wireless_device_->getProxy().getObjectPath()
<< ": Deactivating active connection "
<< active_connection->getObjectPath();
<< active_connection->getProxy().getObjectPath();
try {
network_manager_->DeactivateConnection(active_connection->getObjectPath());
network_manager_->DeactivateConnection(active_connection->getProxy().getObjectPath());
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(network_manager_, "DeactivateConnection", e);
return false;
@@ -352,7 +352,7 @@ bool NetworkManagerWifiHotspotMedium::DisconnectWifiHotspot() {
}
try {
network_manager_->DeactivateConnection(active_connection->getObjectPath());
network_manager_->DeactivateConnection(active_connection->getProxy().getObjectPath());
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(network_manager_, "DeactivateConnection", e);
return false;
@@ -32,7 +32,7 @@ std::string NetworkManagerWifiHotspotServerSocket::GetIPAddress() const {
LOG(ERROR)
<< __func__
<< ": Could not find any IPv4 addresses for active connection "
<< active_conn_->getObjectPath();
<< active_conn_->getProxy().getObjectPath();
return {};
}
return ip4addresses[0];
@@ -122,7 +122,7 @@ void NetworkManagerWifiHotspotServerSocket::PopulateHotspotCredentials(
if (ip4addresses.empty()) {
LOG(ERROR) << __func__
<< ": Could not find any IPv4 addresses for active connection "
<< active_conn_->getObjectPath();
<< active_conn_->getProxy().getObjectPath();
return;
}
@@ -192,7 +192,7 @@ bool WifiLanMedium::StartDiscovery(
auto &object = service_browsers_[service_type];
LOG(ERROR) << __func__ << ": A service browser for service type "
<< service_type << " already exists at "
<< object->getObjectPath();
<< object->getProxy().getObjectPath();
return false;
}
}
@@ -225,7 +225,7 @@ bool WifiLanMedium::StartDiscovery(
try {
LOG(INFO) << __func__ << ": Starting service discovery for "
<< browser->getObjectPath();
<< browser->getProxy().getObjectPath();
browser->Start();
} catch (const sdbus::Error &e) {
DBUS_LOG_METHOD_CALL_ERROR(browser, "Start", e);
@@ -79,14 +79,14 @@ api::WifiInformation &NetworkManagerWifiMedium::GetInformation() {
api::WifiInformation{true, ssid, active_access_point->HwAddress(),
to_signed(active_access_point->Frequency())};
networkmanager::ObjectManager manager(system_bus_);
auto ip4config = manager.GetIp4Config(active_access_point->getObjectPath());
auto ip4config = manager.GetIp4Config(active_access_point->getProxy().getObjectPath());
} catch (const sdbus::Error &e) {
LOG(ERROR)
<< __func__ << ": " << getObjectPath() << ": Got error '" << e.getName()
<< __func__ << ": " << getProxy().getObjectPath() << ": Got error '" << e.getName()
<< "' with message '" << e.getMessage()
<< "' while populating network information for access point "
<< active_access_point->getObjectPath();
<< active_access_point->getProxy().getObjectPath();
}
return information_;
@@ -135,8 +135,8 @@ NetworkManagerWifiMedium::SearchBySSID(absl::string_view ssid,
return ap;
}
LOG(INFO) << __func__ << ": " << getObjectPath() << ": SSID " << ssid
<< " not currently known by device " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath() << ": SSID " << ssid
<< " not currently known by device " << getProxy().getObjectPath()
<< ", requesting a scan";
std::int64_t cur_last_scan;
@@ -163,13 +163,13 @@ NetworkManagerWifiMedium::SearchBySSID(absl::string_view ssid,
last_scan_lock_.ReaderUnlock();
if (!success) {
LOG(WARNING) << __func__ << ": " << getObjectPath()
LOG(WARNING) << __func__ << ": " << getProxy().getObjectPath()
<< ": timed out waiting for scan to finish";
}
ap = SearchBySSIDNoScan(ssid_bytes);
if (ap == nullptr) {
LOG(WARNING) << __func__ << ": " << getObjectPath()
LOG(WARNING) << __func__ << ": " << getProxy().getObjectPath()
<< ": Couldn't find SSID " << ssid;
}
@@ -194,7 +194,7 @@ NetworkManagerWifiMedium::WifiConnectionStatus NetworkManagerWifiMedium::Connect
NetworkManagerWifiMedium::WifiAuthType auth_type) {
auto ap = SearchBySSID(ssid);
if (ap == nullptr) {
LOG(ERROR) << __func__ << ": " << getObjectPath()
LOG(ERROR) << __func__ << ": " << getProxy().getObjectPath()
<< ": Couldn't find SSID " << ssid;
return NetworkManagerWifiMedium::WifiConnectionStatus::kConnectionFailure;
}
@@ -236,7 +236,7 @@ NetworkManagerWifiMedium::WifiConnectionStatus NetworkManagerWifiMedium::Connect
sdbus::ObjectPath connection_path, active_conn_path;
try {
auto [cp, acp, _r] = network_manager_->AddAndActivateConnection2(
connection_settings, getObjectPath(), ap->getObjectPath(),
connection_settings, getProxy().getObjectPath(), ap->getProxy().getObjectPath(),
{{"persist", "volatile"}, {"bind-activation", "dbus-client"}});
connection_path = std::move(cp);
active_conn_path = std::move(acp);
@@ -245,14 +245,14 @@ NetworkManagerWifiMedium::WifiConnectionStatus NetworkManagerWifiMedium::Connect
return NetworkManagerWifiMedium::WifiConnectionStatus::kUnknown;
}
LOG(INFO) << __func__ << ": " << getObjectPath()
LOG(INFO) << __func__ << ": " << getProxy().getObjectPath()
<< ": Added a new connection at " << connection_path;
auto active_connection =
networkmanager::ActiveConnection(system_bus_, active_conn_path);
auto [reason, timeout] = active_connection.WaitForConnection();
if (timeout) {
LOG(ERROR)
<< __func__ << ": " << getObjectPath()
<< __func__ << ": " << getProxy().getObjectPath()
<< ": timed out while waiting for connection " << active_conn_path
<< " to be activated, last NMActiveConnectionStateReason: "
<< reason->ToString();
@@ -260,7 +260,7 @@ NetworkManagerWifiMedium::WifiConnectionStatus NetworkManagerWifiMedium::Connect
}
if (reason.has_value()) {
LOG(ERROR) << __func__ << ": " << getObjectPath() << ": connection "
LOG(ERROR) << __func__ << ": " << getProxy().getObjectPath() << ": connection "
<< active_conn_path
<< " failed to activate, NMActiveConnectionStateReason:"
<< reason->ToString();
@@ -286,7 +286,7 @@ NetworkManagerWifiMedium::GetActiveConnection() {
active_ap_path = ActiveAccessPoint();
if (active_ap_path.empty()) {
LOG(ERROR) << __func__ << ": No active access points on "
<< getObjectPath();
<< getProxy().getObjectPath();
return nullptr;
}
} catch (const sdbus::Error &e) {
@@ -296,13 +296,13 @@ NetworkManagerWifiMedium::GetActiveConnection() {
auto object_manager = networkmanager::ObjectManager(system_bus_);
auto conn = object_manager.GetActiveConnectionForAccessPoint(active_ap_path,
getObjectPath());
getProxy().getObjectPath());
if (conn == nullptr) {
LOG(ERROR)
<< __func__
<< ": Could not find an active connection using the access point "
<< active_ap_path << " and device " << getObjectPath();
<< active_ap_path << " and device " << getProxy().getObjectPath();
}
return conn;
}
@@ -74,7 +74,7 @@ class NetworkManagerWifiMedium
std::shared_ptr<networkmanager::NetworkManager> network_manager,
const sdbus::ObjectPath &wireless_device_object_path)
: ProxyInterfaces(*network_manager->GetConnection(),
"org.freedesktop.NetworkManager",
sdbus::ServiceName("org.freedesktop.NetworkManager"),
wireless_device_object_path),
system_bus_(network_manager->GetConnection()),
network_manager_(std::move(network_manager)),