mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Doesn't build yet. But did more work to align the older fork with newer APIs.
This commit is contained in:
@@ -61,3 +61,4 @@ bazel-*
|
||||
# Devcontainers
|
||||
/.devcontainer/
|
||||
/connections/walkietalkie/
|
||||
/third_party/
|
||||
|
||||
@@ -32,12 +32,12 @@ cc_library(
|
||||
"submittable_executor.h",
|
||||
"timer.h",
|
||||
"thread_pool.h",
|
||||
"log_message.h",
|
||||
#"log_message.h",
|
||||
"utils.h",
|
||||
],
|
||||
srcs = [
|
||||
"device_info.cc",
|
||||
"log_message.cc",
|
||||
#"log_message.cc",
|
||||
"timer.cc",
|
||||
],
|
||||
copts = ["-lrt"],
|
||||
@@ -57,9 +57,9 @@ cc_library(
|
||||
"avahi.h",
|
||||
"ble_gatt_server.h",
|
||||
"ble_gatt_client.h",
|
||||
"ble_medium.h",
|
||||
"ble_v2_medium.h",
|
||||
"ble_v2_server_socket.h",
|
||||
# "ble_medium.h",
|
||||
# "ble_v2_medium.h",
|
||||
# "ble_v2_server_socket.h",
|
||||
"bluetooth_adapter.h",
|
||||
"bluetooth_bluez_profile.h",
|
||||
"bluetooth_classic_device.h",
|
||||
@@ -69,14 +69,15 @@ cc_library(
|
||||
"bluetooth_devices.h",
|
||||
"bluetooth_pairing.h",
|
||||
"bluez.h",
|
||||
"bluez_advertisement_monitor.h",
|
||||
"bluez_advertisement_monitor_manager.h",
|
||||
"bluez_gatt_characteristic_client.h",
|
||||
"bluez_gatt_characteristic_server.h",
|
||||
"bluez_gatt_manager.h",
|
||||
"bluez_gatt_service_client.h",
|
||||
"bluez_gatt_service_server.h",
|
||||
"bluez_le_advertisement.h",
|
||||
"bluez_device.h",
|
||||
# "bluez_advertisement_monitor.h",
|
||||
# "bluez_advertisement_monitor_manager.h",
|
||||
# "bluez_gatt_characteristic_client.h",
|
||||
# "bluez_gatt_characteristic_server.h",
|
||||
# "bluez_gatt_manager.h",
|
||||
# "bluez_gatt_service_client.h",
|
||||
# "bluez_gatt_service_server.h",
|
||||
# "bluez_le_advertisement.h",
|
||||
"dbus.h",
|
||||
"network_manager.h",
|
||||
"network_manager_active_connection.h",
|
||||
@@ -137,9 +138,9 @@ cc_library(
|
||||
name = "linux",
|
||||
srcs = [
|
||||
"avahi.cc",
|
||||
"ble_gatt_client.cc",
|
||||
"ble_gatt_server.cc",
|
||||
"ble_v2_medium.cc",
|
||||
# "ble_gatt_client.cc",
|
||||
# "ble_gatt_server.cc",
|
||||
# "ble_v2_medium.cc",
|
||||
"bluetooth_adapter.cc",
|
||||
"bluetooth_bluez_profile.cc",
|
||||
"bluetooth_classic_socket.cc",
|
||||
@@ -149,11 +150,11 @@ cc_library(
|
||||
"bluetooth_devices.cc",
|
||||
"bluetooth_pairing.cc",
|
||||
"bluez.cc",
|
||||
"bluez_advertisement_monitor.cc",
|
||||
"bluez_gatt_characteristic_client.cc",
|
||||
"bluez_gatt_characteristic_server.cc",
|
||||
"bluez_gatt_service_server.cc",
|
||||
"bluez_le_advertisement.cc",
|
||||
# "bluez_advertisement_monitor.cc",
|
||||
# "bluez_gatt_characteristic_client.cc",
|
||||
# "bluez_gatt_characteristic_server.cc",
|
||||
# "bluez_gatt_service_server.cc",
|
||||
# "bluez_le_advertisement.cc",
|
||||
"dbus.cc",
|
||||
"executor.cc",
|
||||
"network_manager.cc",
|
||||
@@ -214,7 +215,6 @@ cc_library(
|
||||
"@nlohmann_json//:json",
|
||||
"@sdbus_cpp//:libsystemd",
|
||||
"@sdbus_cpp//:sdbus_cpp",
|
||||
"@libcurl//:lib"
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ void ServiceBrowser::onItemNew(const int32_t &interface,
|
||||
const std::string &type,
|
||||
const std::string &domain,
|
||||
const uint32_t &flags) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": Found new item through the ServiceBrowser: "
|
||||
<< "interface: " << interface << ", protocol: "
|
||||
<< protocol << ", name: '" << name << "', type: '"
|
||||
<< type << "', domain: '" << domain
|
||||
<< "', flags: " << flags;
|
||||
if (flags & kAvahiLookupResultLocal) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Ignoring local service.";
|
||||
LOG(INFO) << __func__ << ": Ignoring local service.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void ServiceBrowser::onItemNew(const int32_t &interface,
|
||||
auto attr_str = std::string(attr.begin(), attr.end());
|
||||
size_t pos = attr_str.find('=');
|
||||
if (pos == 0 || pos == std::string::npos || pos == attr_str.size() - 1) {
|
||||
NEARBY_LOGS(WARNING) << " found invalid text attribute: " << attr_str;
|
||||
LOG(WARNING) << " found invalid text attribute: " << attr_str;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -68,14 +68,14 @@ void ServiceBrowser::onItemRemove(
|
||||
const int32_t &interface, const int32_t &protocol, const std::string &name,
|
||||
const std::string &type, const std::string &domain, const uint32_t &flags) {
|
||||
// TODO: Can we even resolve removed items?
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": Item removed through the ServiceBrowser: "
|
||||
<< "interface: " << interface << ", protocol: "
|
||||
<< protocol << ", name: '" << name << "', type: '"
|
||||
<< type << "', domain: '" << domain
|
||||
<< "', flags: " << flags;
|
||||
if (flags & kAvahiLookupResultLocal) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Ignoring local service.";
|
||||
LOG(INFO) << __func__ << ": Ignoring local service.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void ServiceBrowser::onItemRemove(
|
||||
auto attr_str = std::string(attr.begin(), attr.end());
|
||||
size_t pos = attr_str.find('=');
|
||||
if (pos == 0 || pos == std::string::npos || pos == attr_str.size() - 1) {
|
||||
NEARBY_LOGS(WARNING) << " found invalid text attribute: " << attr_str;
|
||||
LOG(WARNING) << " found invalid text attribute: " << attr_str;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -108,18 +108,18 @@ void ServiceBrowser::onItemRemove(
|
||||
}
|
||||
|
||||
void ServiceBrowser::onFailure(const std::string &error) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << getObjectPath()
|
||||
LOG(ERROR) << __func__ << ": " << getObjectPath()
|
||||
<< ": ServiceBrowser reported a failure: " << error;
|
||||
}
|
||||
|
||||
void ServiceBrowser::onAllForNow() {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": notified via ServiceBrowser that all records have "
|
||||
"been added for now";
|
||||
}
|
||||
|
||||
void ServiceBrowser::onCacheExhausted() {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": notified via ServiceBrowser of cache exhaustion";
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class EntryGroup final
|
||||
registerProxy();
|
||||
}
|
||||
~EntryGroup() {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Freeing entry group "
|
||||
LOG(INFO) << __func__ << ": Freeing entry group "
|
||||
<< getObjectPath();
|
||||
|
||||
try {
|
||||
@@ -85,7 +85,7 @@ class ServiceBrowser final
|
||||
registerProxy();
|
||||
}
|
||||
~ServiceBrowser() {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Freeing service browser "
|
||||
LOG(INFO) << __func__ << ": Freeing service browser "
|
||||
<< getObjectPath();
|
||||
|
||||
try {
|
||||
|
||||
@@ -85,7 +85,7 @@ absl::optional<std::string> GattClient::ReadCharacteristic(
|
||||
const api::ble_v2::GattCharacteristic &characteristic) {
|
||||
absl::ReaderMutexLock lock(&characteristics_mutex_);
|
||||
if (characteristics_.count(characteristic) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
LOG(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
<< absl::Substitute("$0", characteristic) << "'";
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ bool GattClient::WriteCharacteristic(
|
||||
absl::string_view value, WriteType type) {
|
||||
absl::ReaderMutexLock lock(&characteristics_mutex_);
|
||||
if (characteristics_.count(characteristic) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
LOG(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
<< absl::Substitute("$0", characteristic) << "'";
|
||||
return false;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ bool GattClient::SetCharacteristicSubscription(
|
||||
on_characteristic_changed_cb) {
|
||||
absl::MutexLock lock(&characteristics_mutex_);
|
||||
if (characteristics_.count(characteristic) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
LOG(ERROR) << __func__ << ": Unknown characteristic '"
|
||||
<< absl::Substitute("$0", characteristic) << "'";
|
||||
return false;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ BluezGattDiscovery::GetCharacteristic(
|
||||
absl::ReaderMutexLock lock(&mutex_);
|
||||
auto path_it = discovered_characteristics_.find(key);
|
||||
if (path_it == discovered_characteristics_.end()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No characteristic known for device "
|
||||
LOG(ERROR) << __func__ << ": No characteristic known for device "
|
||||
<< device_object_path << " with service "
|
||||
<< std::string{service_uuid} << " and UUID "
|
||||
<< std::string{characteristic_uuid};
|
||||
@@ -318,7 +318,7 @@ BluezGattDiscovery::GetSubscribedCharacteristic(
|
||||
absl::ReaderMutexLock lock(&mutex_);
|
||||
auto path_it = discovered_characteristics_.find(key);
|
||||
if (path_it == discovered_characteristics_.end()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No characteristic known for device "
|
||||
LOG(ERROR) << __func__ << ": No characteristic known for device "
|
||||
<< device_object_path << " with service "
|
||||
<< std::string{service_uuid} << " and UUID "
|
||||
<< std::string{characteristic_uuid};
|
||||
@@ -338,7 +338,7 @@ BluezGattDiscovery::characteristicProperties(
|
||||
const std::string &chr_uuid_str = properties.at("UUID");
|
||||
auto chr_uuid = UuidFromString(chr_uuid_str);
|
||||
if (!chr_uuid.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << ": Couldn't parse UUID '" << chr_uuid_str
|
||||
LOG(ERROR) << ": Couldn't parse UUID '" << chr_uuid_str
|
||||
<< "' in characteristic " << path;
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ BluezGattDiscovery::characteristicProperties(
|
||||
const std::string &service_uuid_str = service->UUID();
|
||||
auto service_uuid_maybe = UuidFromString(service_uuid_str);
|
||||
if (!service_uuid_maybe.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << ": Couldn't parse UUID '" << service_uuid_str
|
||||
LOG(ERROR) << ": Couldn't parse UUID '" << service_uuid_str
|
||||
<< "' in service " << service_path;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ GattServer::CreateCharacteristic(
|
||||
service->emitInterfacesAddedSignal(
|
||||
{org::bluez::GattService1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error& e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesAdded signal for object path "
|
||||
<< service->getObjectPath() << " with name '" << e.getName()
|
||||
@@ -59,7 +59,7 @@ GattServer::CreateCharacteristic(
|
||||
property)) {
|
||||
bluez::GattManager manager(system_bus_, adapter_.GetObjectPath());
|
||||
try {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": registering service "
|
||||
LOG(INFO) << __func__ << ": registering service "
|
||||
<< service->getObjectPath();
|
||||
manager.RegisterApplication("/", {});
|
||||
} catch (const sdbus::Error& e) {
|
||||
@@ -84,7 +84,7 @@ bool GattServer::UpdateCharacteristic(
|
||||
{
|
||||
absl::ReaderMutexLock lock(&services_mutex_);
|
||||
if (services_.count(characteristic.service_uuid) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": GATT Service "
|
||||
LOG(ERROR) << __func__ << ": GATT Service "
|
||||
<< std::string{characteristic.service_uuid}
|
||||
<< " doesn't exist";
|
||||
return false;
|
||||
@@ -93,7 +93,7 @@ bool GattServer::UpdateCharacteristic(
|
||||
characteristic.uuid);
|
||||
}
|
||||
if (chr == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Characteristic "
|
||||
LOG(ERROR) << __func__ << ": Characteristic "
|
||||
<< std::string{characteristic.uuid}
|
||||
<< " does not exist under service "
|
||||
<< std::string{characteristic.service_uuid};
|
||||
@@ -132,7 +132,7 @@ void GattServer::Stop() {
|
||||
bluez::GattManager manager(system_bus_, adapter_.GetObjectPath());
|
||||
absl::MutexLock lock(&services_mutex_);
|
||||
for (auto& [uuid, service] : services_) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Unregistering service "
|
||||
LOG(INFO) << __func__ << ": Unregistering service "
|
||||
<< service->getObjectPath();
|
||||
try {
|
||||
manager.UnregisterApplication("/");
|
||||
|
||||
@@ -49,7 +49,7 @@ BleV2Medium::BleV2Medium(BluetoothAdapter &adapter)
|
||||
adapter)),
|
||||
cur_adv_(nullptr) {
|
||||
if (adv_monitor_manager_) {
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__
|
||||
<< ": Registering path / with AdvertisementMonitorManager at "
|
||||
<< adv_monitor_manager_->getObjectPath();
|
||||
@@ -60,7 +60,7 @@ BleV2Medium::BleV2Medium(BluetoothAdapter &adapter)
|
||||
}
|
||||
}
|
||||
if (gatt_discovery_->InitializeKnownServices()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Could not initialize known GATT services";
|
||||
}
|
||||
}
|
||||
@@ -69,20 +69,20 @@ bool BleV2Medium::StartAdvertising(
|
||||
const api::ble_v2::BleAdvertisementData &advertising_data,
|
||||
api::ble_v2::AdvertiseParameters advertise_set_parameters) {
|
||||
if (!adapter_.IsEnabled()) {
|
||||
NEARBY_LOGS(WARNING) << "BLE cannot start advertising because the "
|
||||
LOG(WARNING) << "BLE cannot start advertising because the "
|
||||
"bluetooth adapter is not enabled.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (advertising_data.service_data.empty()) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
LOG(WARNING)
|
||||
<< "BLE cannot start to advertise due to invalid service data.";
|
||||
return false;
|
||||
}
|
||||
|
||||
absl::MutexLock lock(&cur_adv_mutex_);
|
||||
if (cur_adv_ != nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< "Advertising is already enabled for this medium.";
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ bool BleV2Medium::StartAdvertising(
|
||||
cur_adv_ = bluez::LEAdvertisement::CreateLEAdvertisement(
|
||||
*system_bus_, advertising_data, advertise_set_parameters);
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Registering advertisement "
|
||||
LOG(INFO) << __func__ << ": Registering advertisement "
|
||||
<< cur_adv_->getObjectPath() << " on bluetooth adapter "
|
||||
<< adapter_.GetObjectPath();
|
||||
|
||||
@@ -108,10 +108,10 @@ bool BleV2Medium::StartAdvertising(
|
||||
bool BleV2Medium::StopAdvertising() {
|
||||
absl::MutexLock lock(&cur_adv_mutex_);
|
||||
if (cur_adv_ == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Advertising is not enabled.";
|
||||
LOG(ERROR) << __func__ << ": Advertising is not enabled.";
|
||||
return false;
|
||||
}
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << "Unregistering advertisement object "
|
||||
LOG(INFO) << __func__ << "Unregistering advertisement object "
|
||||
<< cur_adv_->getObjectPath();
|
||||
|
||||
try {
|
||||
@@ -131,13 +131,13 @@ BleV2Medium::StartAdvertising(
|
||||
api::ble_v2::AdvertiseParameters advertise_set_parameters,
|
||||
AdvertisingCallback callback) {
|
||||
if (!adapter_.IsEnabled()) {
|
||||
NEARBY_LOGS(WARNING) << ": BLE cannot start advertising because the "
|
||||
LOG(WARNING) << ": BLE cannot start advertising because the "
|
||||
"bluetooth adapter is not enabled.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (advertising_data.service_data.empty()) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
LOG(WARNING)
|
||||
<< ": BLE cannot start to advertise due to invalid service data.";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ BleV2Medium::StartAdvertising(
|
||||
});
|
||||
|
||||
absl::AnyInvocable<absl::Status()> stop_adv = [&, adv_it]() {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Unregistering advertisement object "
|
||||
LOG(INFO) << __func__ << ": Unregistering advertisement object "
|
||||
<< (*adv_it)->getObjectPath();
|
||||
absl::MutexLock lock(&advs_mutex_);
|
||||
try {
|
||||
@@ -246,7 +246,7 @@ bool BleV2Medium::StartLEDiscovery() {
|
||||
}
|
||||
|
||||
try {
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Starting LE discovery on "
|
||||
LOG(INFO) << __func__ << ": Starting LE discovery on "
|
||||
<< adapter.getObjectPath();
|
||||
adapter.StartDiscovery();
|
||||
} catch (const sdbus::Error &e) {
|
||||
@@ -263,21 +263,21 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
api::ble_v2::TxPowerLevel tx_power_level,
|
||||
ScanCallback callback) {
|
||||
if (cur_monitored_service_uuid_.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": A sync scanning session is already active for "
|
||||
<< std::string{*cur_monitored_service_uuid_};
|
||||
return false;
|
||||
}
|
||||
|
||||
if (adv_monitor_manager_ == nullptr) {
|
||||
NEARBY_LOGS(WARNING) << __func__
|
||||
LOG(WARNING) << __func__
|
||||
<< ": Advertising monitor not supported by BlueZ";
|
||||
// TODO: Implement manual monitoring.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!MonitorManagerSupportsOr()) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
LOG(WARNING)
|
||||
<< __func__
|
||||
<< ": \"or_patterns\" not supported by AdvertisementMonitorManager";
|
||||
// TODO: Implement manual monitoring.
|
||||
@@ -286,7 +286,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
|
||||
absl::MutexLock lock(&active_adv_monitors_mutex_);
|
||||
if (active_adv_monitors_.count(service_uuid) == 1) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": an advertising session for service "
|
||||
LOG(ERROR) << __func__ << ": an advertising session for service "
|
||||
<< std::string{service_uuid} << " already exists";
|
||||
return false;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
monitor->emitInterfacesAddedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesAdded signal for object path "
|
||||
<< monitor->getObjectPath() << " with name '" << e.getName()
|
||||
@@ -309,7 +309,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
auto device_watcher = std::make_unique<DeviceWatcher>(
|
||||
*system_bus_, adapter_.GetObjectPath(), devices_);
|
||||
if (!StartLEDiscovery()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Could not start LE discovery on adapter "
|
||||
<< adapter_.GetObjectPath();
|
||||
device_watcher = nullptr;
|
||||
@@ -317,7 +317,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
monitor->emitInterfacesRemovedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesRemoved signal for object path "
|
||||
<< monitor->getObjectPath() << " with name '" << e.getName()
|
||||
@@ -334,7 +334,7 @@ bool BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
|
||||
bool BleV2Medium::StopScanning() {
|
||||
if (!cur_monitored_service_uuid_.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": No sync scanning session is currently active.";
|
||||
return false;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ bool BleV2Medium::StopScanning() {
|
||||
}
|
||||
|
||||
auto &adapter = adapter_.GetBluezAdapterObject();
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Stopping discovery for adapter "
|
||||
LOG(INFO) << __func__ << ": Stopping discovery for adapter "
|
||||
<< adapter.getObjectPath();
|
||||
try {
|
||||
adapter.StopDiscovery();
|
||||
@@ -360,7 +360,7 @@ bool BleV2Medium::StopScanning() {
|
||||
auto &[_uuid, session] = *monitor_it;
|
||||
auto &[adv_monitor, _watcher] = session;
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Removing advertising monitor "
|
||||
LOG(INFO) << __func__ << ": Removing advertising monitor "
|
||||
<< adv_monitor->getObjectPath();
|
||||
adv_monitor->emitInterfacesRemovedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
@@ -382,7 +382,7 @@ BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
|
||||
absl::MutexLock lock(&active_adv_monitors_mutex_);
|
||||
if (active_adv_monitors_.count(service_uuid) == 1) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Service " << std::string{service_uuid}
|
||||
LOG(ERROR) << __func__ << ": Service " << std::string{service_uuid}
|
||||
<< " is already being advertised";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -394,7 +394,7 @@ BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
monitor->emitInterfacesAddedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesAdded signal for object path "
|
||||
<< monitor->getObjectPath() << " with name '" << e.getName()
|
||||
@@ -405,14 +405,14 @@ BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
auto device_watcher = std::make_unique<DeviceWatcher>(
|
||||
*system_bus_, adapter_.GetObjectPath(), devices_);
|
||||
if (!StartLEDiscovery()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Could not start LE discovery on adapter "
|
||||
<< adapter_.GetObjectPath();
|
||||
try {
|
||||
monitor->emitInterfacesRemovedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesRemoved signal for object path "
|
||||
<< monitor->getObjectPath() << " with name '" << e.getName()
|
||||
@@ -428,7 +428,7 @@ BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
ScanningSession{.stop_scanning = [this, service_uuid]() {
|
||||
absl::MutexLock lock(&active_adv_monitors_mutex_);
|
||||
if (active_adv_monitors_.count(service_uuid) == 0) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": Advertising monitor for service "
|
||||
<< std::string{service_uuid} << " does not exist anymore";
|
||||
return absl::NotFoundError(
|
||||
@@ -440,7 +440,7 @@ BleV2Medium::StartScanning(const Uuid &service_uuid,
|
||||
monitor->emitInterfacesRemovedSignal(
|
||||
{org::bluez::AdvertisementMonitor1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesRemoved signal for object path "
|
||||
<< monitor->getObjectPath() << " with name '" << e.getName()
|
||||
|
||||
@@ -46,7 +46,7 @@ bool ProfileManager::ProfileRegistered(absl::string_view service_uuid) {
|
||||
|
||||
void Profile::Release() {
|
||||
released_ = true;
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Profile object " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": Profile object " << getObjectPath()
|
||||
<< " has been released";
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void Profile::NewConnection(
|
||||
const sdbus::ObjectPath &device_object_path, const sdbus::UnixFd &fd,
|
||||
const std::map<std::string, sdbus::Variant> &fd_props) {
|
||||
if (released_) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": NewConnection called on released object "
|
||||
<< getObjectPath();
|
||||
throw sdbus::Error("org.bluez.Error.Rejected",
|
||||
@@ -69,7 +69,7 @@ void Profile::NewConnection(
|
||||
|
||||
auto alias = device->GetName();
|
||||
auto mac_addr = device->GetAddress();
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": Connected to " << mac_addr;
|
||||
|
||||
FDProperties props(fd_props);
|
||||
@@ -82,7 +82,7 @@ void Profile::RequestDisconnection(
|
||||
const sdbus::ObjectPath &device_object_path) {
|
||||
auto device = devices_.get_device_by_path(device_object_path);
|
||||
if (device == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << getObjectPath()
|
||||
LOG(ERROR) << __func__ << ": " << getObjectPath()
|
||||
<< ": RequestDisconnection called with a device object "
|
||||
"we don't know about: "
|
||||
<< device_object_path;
|
||||
@@ -90,12 +90,12 @@ void Profile::RequestDisconnection(
|
||||
}
|
||||
|
||||
auto mac_addr = device->GetMacAddress();
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Disconnection requested for device "
|
||||
LOG(INFO) << __func__ << ": Disconnection requested for device "
|
||||
<< device_object_path;
|
||||
|
||||
absl::MutexLock l(&connections_lock_);
|
||||
if (connections_.count(mac_addr) == 0) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Disconnection requested, but we are not connected to this device";
|
||||
return;
|
||||
@@ -108,7 +108,7 @@ bool ProfileManager::Register(std::optional<absl::string_view> name,
|
||||
absl::string_view service_uuid) {
|
||||
absl::MutexLock l(®istered_service_uuids_mutex_);
|
||||
if (registered_services_.count(std::string(service_uuid)) == 1) {
|
||||
NEARBY_LOGS(WARNING) << __func__ << ": Trying to register profile "
|
||||
LOG(WARNING) << __func__ << ": Trying to register profile "
|
||||
<< service_uuid << " which was already registered.";
|
||||
return true;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ bool ProfileManager::Register(std::optional<absl::string_view> name,
|
||||
|
||||
registered_services_.emplace(service_uuid, profile);
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__
|
||||
LOG(INFO) << __func__
|
||||
<< ": Registered profile instance for service uuid "
|
||||
<< service_uuid;
|
||||
|
||||
@@ -146,14 +146,14 @@ bool ProfileManager::Register(std::optional<absl::string_view> name,
|
||||
void ProfileManager::Unregister(absl::string_view service_uuid) {
|
||||
absl::MutexLock l(®istered_service_uuids_mutex_);
|
||||
if (registered_services_.count(std::string(service_uuid)) == 0) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
LOG(WARNING)
|
||||
<< __func__
|
||||
<< ": attempted to unregister a profile that is not registered";
|
||||
return;
|
||||
}
|
||||
|
||||
auto profile_object_path = bluez::profile_object_path(service_uuid);
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Unregistering profile "
|
||||
LOG(INFO) << __func__ << ": Unregistering profile "
|
||||
<< profile_object_path;
|
||||
|
||||
try {
|
||||
@@ -174,7 +174,7 @@ std::optional<sdbus::UnixFd> ProfileManager::GetServiceRecordFD(
|
||||
{
|
||||
absl::ReaderMutexLock lock(®istered_service_uuids_mutex_);
|
||||
if (registered_services_.count(std::string(service_uuid)) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Service " << service_uuid
|
||||
LOG(ERROR) << __func__ << ": Service " << service_uuid
|
||||
<< " is not registered";
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ std::optional<sdbus::UnixFd> ProfileManager::GetServiceRecordFD(
|
||||
profile->connections_lock_.Unlock();
|
||||
});
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << profile->getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << profile->getObjectPath()
|
||||
<< ": Attempting to get a FD for service "
|
||||
<< service_uuid << " on device " << mac_addr;
|
||||
|
||||
@@ -204,7 +204,7 @@ std::optional<sdbus::UnixFd> ProfileManager::GetServiceRecordFD(
|
||||
absl::Condition(&cond));
|
||||
|
||||
if (cancellation_flag != nullptr && cancellation_flag->Cancelled()) {
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__ << ": " << profile->getObjectPath() << ": "
|
||||
<< remote_device.GetMacAddress()
|
||||
<< ": Cancelled waiting for a new connection on profile "
|
||||
@@ -236,7 +236,7 @@ ProfileManager::GetServiceRecordFD(absl::string_view service_uuid,
|
||||
profile = registered_services_[std::string(service_uuid)];
|
||||
}
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << profile->getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << profile->getObjectPath()
|
||||
<< ": Attempting to get a FD for service "
|
||||
<< service_uuid;
|
||||
|
||||
@@ -257,7 +257,7 @@ ProfileManager::GetServiceRecordFD(absl::string_view service_uuid,
|
||||
profile->connections_lock_.Await(absl::Condition(&cond));
|
||||
|
||||
if (cancellation_flag != nullptr && cancellation_flag->Cancelled()) {
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__ << ": Cancelled waiting for new connections on profile "
|
||||
<< profile->getObjectPath();
|
||||
profile->connections_lock_.Unlock();
|
||||
@@ -273,7 +273,7 @@ ProfileManager::GetServiceRecordFD(absl::string_view service_uuid,
|
||||
|
||||
auto device = devices_.get_device_by_address(mac_addr);
|
||||
if (device == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Device " << mac_addr
|
||||
LOG(ERROR) << __func__ << ": Device " << mac_addr
|
||||
<< " is no longer available";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Profile final
|
||||
released_(false),
|
||||
devices_(devices) {
|
||||
registerAdaptor();
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Created a new BlueZ profile at :"
|
||||
LOG(INFO) << __func__ << ": Created a new BlueZ profile at :"
|
||||
<< getObjectPath();
|
||||
}
|
||||
~Profile() { unregisterAdaptor(); }
|
||||
|
||||
@@ -35,8 +35,8 @@ BluetoothDevice::BluetoothDevice(std::shared_ptr<bluez::Device> device)
|
||||
DBUS_LOG_PROPERTY_GET_ERROR(device, "Alias", e);
|
||||
}
|
||||
try {
|
||||
last_known_address_ = device->Address();
|
||||
unique_id_ = BluetoothUtils::ToNumber(last_known_address_);
|
||||
MacAddress::FromString(device -> Address(), last_known_address_);
|
||||
unique_id_ = last_known_address_.address();
|
||||
} catch (const sdbus::Error &e) {
|
||||
DBUS_LOG_PROPERTY_GET_ERROR(device, "Address", e);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ std::string BluetoothDevice::GetMacAddress() const {
|
||||
std::string addr = device->Address();
|
||||
{
|
||||
absl::MutexLock l(&properties_mutex_);
|
||||
last_known_address_ = addr;
|
||||
MacAddress::FromString(addr, last_known_address_);
|
||||
}
|
||||
return addr;
|
||||
} catch (const sdbus::Error &e) {
|
||||
@@ -117,20 +117,20 @@ void MonitoredBluetoothDevice::onPropertiesChanged(
|
||||
for (auto it = changedProperties.begin(); it != changedProperties.end();
|
||||
it++) {
|
||||
if (it->first == bluez::DEVICE_PROP_ADDRESS) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath()
|
||||
<< ": Notifying observers about address change";
|
||||
std::string address = it->second;
|
||||
for (const auto &observer : observers_.GetObservers()) {
|
||||
observer->DeviceAddressChanged(*this, address);
|
||||
}
|
||||
} else if (it->first == bluez::DEVICE_PROP_PAIRED) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << 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) {
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__ << ": " << getObjectPath()
|
||||
<< "Notifying observers about connected status change";
|
||||
for (const auto &observer : observers_.GetObservers()) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "internal/base/observer_list.h"
|
||||
#include "internal/platform/implementation/ble_v2.h"
|
||||
// #include "internal/platform/implementation/ble_v2.h"
|
||||
#include "internal/platform/implementation/bluetooth_classic.h"
|
||||
#include "internal/platform/implementation/linux/bluez_device.h"
|
||||
#include "internal/platform/implementation/linux/dbus.h"
|
||||
@@ -38,8 +38,10 @@
|
||||
namespace nearby {
|
||||
namespace linux {
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html.
|
||||
class BluetoothDevice : public api::BluetoothDevice,
|
||||
public api::ble_v2::BlePeripheral {
|
||||
|
||||
// TODO: This used to inherit from ble_v2::BlePeripheral. Removed that since APIs have now changed
|
||||
class BluetoothDevice : public api::BluetoothDevice
|
||||
{
|
||||
public:
|
||||
using UniqueId = std::uint64_t;
|
||||
|
||||
@@ -55,9 +57,9 @@ class BluetoothDevice : public api::BluetoothDevice,
|
||||
// Returns BT MAC address assigned to this device.
|
||||
std::string GetMacAddress() const override;
|
||||
|
||||
MacAddress GetAddress() const override { return last_known_address_; }
|
||||
// BlePeripheral methods
|
||||
std::string GetAddress() const override { return GetMacAddress(); }
|
||||
UniqueId GetUniqueId() const override { return unique_id_; };
|
||||
//UniqueId GetUniqueId() const override { return unique_id_; };
|
||||
|
||||
std::optional<std::map<std::string, sdbus::Variant>> ServiceData() {
|
||||
auto device = device_.lock();
|
||||
@@ -123,7 +125,7 @@ class BluetoothDevice : public api::BluetoothDevice,
|
||||
|
||||
mutable absl::Mutex properties_mutex_;
|
||||
mutable std::string last_known_name_ ABSL_GUARDED_BY(properties_mutex_);
|
||||
mutable std::string last_known_address_ ABSL_GUARDED_BY(properties_mutex_);
|
||||
mutable MacAddress last_known_address_ ABSL_GUARDED_BY(properties_mutex_);
|
||||
mutable std::weak_ptr<bluez::Device> device_;
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ bool BluetoothClassicMedium::StartDiscovery(
|
||||
}
|
||||
|
||||
try {
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Starting BR/EDR discovery on "
|
||||
LOG(INFO) << __func__ << ": Starting BR/EDR discovery on "
|
||||
<< adapter_.GetObjectPath();
|
||||
adapter.StartDiscovery();
|
||||
} catch (const sdbus::Error &e) {
|
||||
@@ -78,7 +78,7 @@ bool BluetoothClassicMedium::StartDiscovery(
|
||||
|
||||
bool BluetoothClassicMedium::StopDiscovery() {
|
||||
auto &adapter = adapter_.GetBluezAdapterObject();
|
||||
NEARBY_LOGS(INFO) << __func__ << "Stopping discovery on "
|
||||
LOG(INFO) << __func__ << "Stopping discovery on "
|
||||
<< adapter.getObjectPath();
|
||||
auto ret = true;
|
||||
try {
|
||||
@@ -97,7 +97,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
|
||||
CancellationFlag *cancellation_flag) {
|
||||
if (!profile_manager_->ProfileRegistered(service_uuid)) {
|
||||
if (!profile_manager_->Register(std::nullopt, service_uuid)) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Could not register profile "
|
||||
LOG(ERROR) << __func__ << ": Could not register profile "
|
||||
<< service_uuid << " with Bluez";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
|
||||
auto address = remote_device.GetMacAddress();
|
||||
auto device = devices_->get_device_by_address(address);
|
||||
if (device == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Device " << address
|
||||
LOG(ERROR) << __func__ << ": Device " << address
|
||||
<< " is no longer known";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
|
||||
auto fd = profile_manager_->GetServiceRecordFD(remote_device, service_uuid,
|
||||
cancellation_flag);
|
||||
if (!fd.has_value()) {
|
||||
NEARBY_LOGS(WARNING) << __func__
|
||||
LOG(WARNING) << __func__
|
||||
<< ": Failed to get a new connection for profile "
|
||||
<< service_uuid << " for device " << address;
|
||||
return nullptr;
|
||||
@@ -133,7 +133,7 @@ BluetoothClassicMedium::ListenForService(const std::string &service_name,
|
||||
const std::string &service_uuid) {
|
||||
if (!profile_manager_->ProfileRegistered(service_uuid)) {
|
||||
if (!profile_manager_->Register(service_name, service_uuid)) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Could not register profile "
|
||||
LOG(ERROR) << __func__ << ": Could not register profile "
|
||||
<< service_name << " " << service_uuid
|
||||
<< " with Bluez";
|
||||
return nullptr;
|
||||
@@ -145,8 +145,8 @@ BluetoothClassicMedium::ListenForService(const std::string &service_name,
|
||||
}
|
||||
|
||||
api::BluetoothDevice *BluetoothClassicMedium::GetRemoteDevice(
|
||||
const std::string &mac_address) {
|
||||
auto device = devices_->get_device_by_address(mac_address);
|
||||
MacAddress mac_address) {
|
||||
auto device = devices_->get_device_by_address(mac_address.ToString());
|
||||
if (device == nullptr) return nullptr;
|
||||
|
||||
return device.get();
|
||||
|
||||
@@ -89,8 +89,7 @@ class BluetoothClassicMedium : public api::BluetoothClassicMedium {
|
||||
std::unique_ptr<api::BluetoothPairing> CreatePairing(
|
||||
api::BluetoothDevice &remote_device) override;
|
||||
|
||||
api::BluetoothDevice *GetRemoteDevice(
|
||||
const std::string &mac_address) override;
|
||||
api::BluetoothDevice *GetRemoteDevice(MacAddress mac_address) override;
|
||||
|
||||
void AddObserver(Observer *observer) override {
|
||||
observers_->AddObserver(observer);
|
||||
|
||||
@@ -23,18 +23,18 @@ namespace nearby {
|
||||
namespace linux {
|
||||
std::unique_ptr<api::BluetoothSocket> BluetoothServerSocket::Accept() {
|
||||
if (stopped_.Cancelled()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": server socket has been stopped";
|
||||
LOG(ERROR) << __func__ << ": server socket has been stopped";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__
|
||||
LOG(INFO) << __func__
|
||||
<< ": accepting new connections for service uuid "
|
||||
<< service_uuid_;
|
||||
|
||||
auto pair = profile_manager_.GetServiceRecordFD(service_uuid_, &stopped_);
|
||||
if (!pair.has_value()) {
|
||||
if (!stopped_.Cancelled())
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Failed to get a new connection for profile "
|
||||
<< service_uuid_;
|
||||
return nullptr;
|
||||
@@ -45,7 +45,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothServerSocket::Accept() {
|
||||
}
|
||||
|
||||
Exception BluetoothServerSocket::Close() {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": closing bluetooth server socket";
|
||||
LOG(ERROR) << __func__ << ": closing bluetooth server socket";
|
||||
stopped_.Cancel();
|
||||
profile_manager_.Unregister(service_uuid_);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Exception Poller::Ready() {
|
||||
auto ret = poll(fds_, 1, -1);
|
||||
if (ret < 0) {
|
||||
if (errno == EAGAIN) continue;
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": error polling socket for I/O: "
|
||||
LOG(ERROR) << __func__ << ": error polling socket for I/O: "
|
||||
<< std::strerror(errno);
|
||||
return {Exception::kIo};
|
||||
}
|
||||
@@ -40,11 +40,11 @@ Exception Poller::Ready() {
|
||||
return {Exception::kSuccess};
|
||||
}
|
||||
if ((fds_[0].revents & POLLHUP) != 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": socket disconnected";
|
||||
LOG(ERROR) << __func__ << ": socket disconnected";
|
||||
return {Exception::kIo};
|
||||
}
|
||||
if ((fds_[0].revents & (POLLERR | POLLNVAL)) != 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": an error occured on the socket";
|
||||
LOG(ERROR) << __func__ << ": an error occured on the socket";
|
||||
return {Exception::kIo};
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ ExceptionOr<ByteArray> BluetoothInputStream::Read(std::int64_t size) {
|
||||
auto bytes_read = read(fd_.get(), &data[total_read], (size - total_read));
|
||||
if (bytes_read < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) continue;
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": error reading data on bluetooth socket: "
|
||||
<< std::strerror(errno);
|
||||
return {Exception::kIo};
|
||||
@@ -101,7 +101,7 @@ Exception BluetoothOutputStream::Write(const ByteArray &data) {
|
||||
write(fd_.get(), &buf[total_wrote], (data.size() - total_wrote));
|
||||
if (wrote < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) continue;
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": error writing data on bluetooth socket: "
|
||||
<< std::strerror(errno);
|
||||
return {Exception::kIo};
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
#include <absl/time/clock.h>
|
||||
#include <sdbus-c++/Types.h>
|
||||
|
||||
#include "absl/strings/substitute.h"
|
||||
@@ -62,7 +61,7 @@ void BluetoothDevices::mark_peripheral_lost(
|
||||
const sdbus::ObjectPath &device_object_path) {
|
||||
absl::ReaderMutexLock lock(&devices_by_path_lock_);
|
||||
if (devices_by_path_.count(device_object_path) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Device " << device_object_path
|
||||
LOG(ERROR) << __func__ << ": Device " << device_object_path
|
||||
<< " doesn't exist";
|
||||
return;
|
||||
}
|
||||
@@ -135,14 +134,14 @@ void DeviceWatcher::onInterfacesRemoved(
|
||||
if (removed_device_it != interfaces.end()) {
|
||||
auto device = devices_->get_device_by_path(object);
|
||||
if (device == nullptr) {
|
||||
NEARBY_LOGS(WARNING) << __func__
|
||||
LOG(WARNING) << __func__
|
||||
<< ": received InterfacesRemoved for a device "
|
||||
"we don't know about: "
|
||||
<< object;
|
||||
return;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Device " << object
|
||||
LOG(INFO) << __func__ << ": Device " << object
|
||||
<< " has been removed";
|
||||
if (discovery_cb_ != nullptr && discovery_cb_->device_lost_cb != nullptr) {
|
||||
discovery_cb_->device_lost_cb(*device);
|
||||
@@ -179,7 +178,7 @@ void DeviceWatcher::notifyExistingDevices() {
|
||||
});
|
||||
|
||||
for (; device_it != objects.end(); device_it++) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Adding existing device "
|
||||
LOG(INFO) << __func__ << ": Adding existing device "
|
||||
<< device_it->first;
|
||||
auto device = devices_->add_new_device(device_it->first);
|
||||
if (discovery_cb_ != nullptr) {
|
||||
|
||||
@@ -49,8 +49,11 @@ class BluetoothDevices final {
|
||||
std::shared_ptr<BluetoothDevice> get_device_by_address(const std::string &);
|
||||
std::shared_ptr<BluetoothDevice> get_device_by_unique_id(
|
||||
api::ble_v2::BlePeripheral::UniqueId id) {
|
||||
auto addr = BluetoothUtils::FromNumber(id);
|
||||
return get_device_by_address(addr);
|
||||
// TODO: Should probably remove BlePeripheral stuff from here but we can keep it since we can convert to/from
|
||||
// uint64_t
|
||||
MacAddress tmp;
|
||||
MacAddress::FromUint64(id, tmp);
|
||||
return get_device_by_address(tmp.ToString());
|
||||
}
|
||||
|
||||
std::shared_ptr<MonitoredBluetoothDevice> add_new_device(sdbus::ObjectPath)
|
||||
|
||||
@@ -32,7 +32,7 @@ void BluetoothPairing::pairing_reply_handler(const sdbus::Error *error) {
|
||||
api::BluetoothPairingCallback::PairingError err =
|
||||
api::BluetoothPairingCallback::PairingError::kAuthFailed;
|
||||
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": "
|
||||
LOG(ERROR) << __func__ << ": "
|
||||
<< "Got error '" << error->getName()
|
||||
<< "' with message '" << error->getMessage()
|
||||
<< "' while pairing with device "
|
||||
@@ -63,7 +63,7 @@ BluetoothPairing::BluetoothPairing(
|
||||
BluetoothAdapter &adapter, std::shared_ptr<BluetoothDevice> remote_device)
|
||||
: device_(std::move(remote_device)),
|
||||
device_object_path_(bluez::device_object_path(adapter.GetObjectPath(),
|
||||
device_->GetAddress())),
|
||||
device_->GetAddress().ToString())),
|
||||
adapter_(adapter) {}
|
||||
|
||||
bool BluetoothPairing::InitiatePairing(
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#define BLUEZ_LOG_METHOD_CALL_ERROR(proxy, method, err) \
|
||||
do { \
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Got error '" << (err).getName() \
|
||||
LOG(ERROR) << __func__ << ": Got error '" << (err).getName() \
|
||||
<< "' with message '" << (err).getMessage() \
|
||||
<< "' while calling " << method << " on object " \
|
||||
<< (proxy)->getObjectPath(); \
|
||||
|
||||
@@ -46,7 +46,7 @@ void AdvertisementMonitor::DeviceFound(const sdbus::ObjectPath &device) {
|
||||
for (const auto &[uuid_str, data] : *service_data) {
|
||||
auto uuid = UuidFromString(uuid_str);
|
||||
if (!uuid.has_value()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Could not parse UUID string in ServiceData for peripheral "
|
||||
<< peripheral->getObjectPath();
|
||||
|
||||
@@ -62,7 +62,7 @@ class AdvertisementMonitorManager final
|
||||
return nullptr;
|
||||
}
|
||||
if (objects.count(adapter.GetObjectPath()) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Adapter object no longer exists "
|
||||
LOG(ERROR) << __func__ << ": Adapter object no longer exists "
|
||||
<< adapter.GetObjectPath();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class AdvertisementMonitorManager final
|
||||
if (objects[adapter.GetObjectPath()].count(
|
||||
org::bluez::AdvertisementMonitorManager1_proxy::INTERFACE_NAME) ==
|
||||
0) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": Adapter " << adapter.GetObjectPath()
|
||||
<< " doesn't provide "
|
||||
<< org::bluez::AdvertisementMonitorManager1_proxy::INTERFACE_NAME;
|
||||
|
||||
@@ -61,7 +61,7 @@ absl::Status GattCharacteristicServer::NotifyChanged(
|
||||
{"Value"});
|
||||
return absl::OkStatus();
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error emitting PropertiesChanged signal on "
|
||||
<< getObjectPath() << " with name '" << e.getName()
|
||||
<< "' and message '" << e.getMessage() << "'";
|
||||
|
||||
@@ -65,7 +65,7 @@ class GattCharacteristicServer final
|
||||
confirmed_(false),
|
||||
notify_sessions_(0) {
|
||||
registerAdaptor();
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__ << "Creating a "
|
||||
<< org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME
|
||||
<< " object at " << getObjectPath();
|
||||
|
||||
@@ -38,7 +38,7 @@ bool GattServiceServer::AddCharacteristic(
|
||||
chr->emitInterfacesAddedSignal(
|
||||
{org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesAdded signal for object path "
|
||||
<< chr->getObjectPath() << " with name '" << e.getName()
|
||||
|
||||
@@ -54,7 +54,7 @@ class GattServiceServer final
|
||||
uuid_(service_uuid),
|
||||
primary_(true) {
|
||||
registerAdaptor();
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Created a "
|
||||
LOG(INFO) << __func__ << ": Created a "
|
||||
<< org::bluez::GattService1_adaptor::INTERFACE_NAME
|
||||
<< " object at " << getObjectPath();
|
||||
}
|
||||
@@ -62,13 +62,13 @@ class GattServiceServer final
|
||||
~GattServiceServer() {
|
||||
absl::MutexLock lock(&characterstics_mutex_);
|
||||
for (auto &[_uuid, characteristic] : characteristics_) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Removing characteristic "
|
||||
LOG(INFO) << __func__ << ": Removing characteristic "
|
||||
<< characteristic->getObjectPath();
|
||||
try {
|
||||
characteristic->emitInterfacesRemovedSignal(
|
||||
{org::bluez::GattCharacteristic1_adaptor::INTERFACE_NAME});
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": error emitting InterfacesRemoved signal for object path "
|
||||
<< characteristic->getObjectPath() << " with name '" << e.getName()
|
||||
|
||||
@@ -45,7 +45,7 @@ LEAdvertisement::LEAdvertisement(
|
||||
|
||||
registerAdaptor();
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__
|
||||
LOG(INFO) << __func__
|
||||
<< ": Created a org.bluez.LEAdvertisement1 instance at "
|
||||
<< getObjectPath();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class LEAdvertisement final
|
||||
private:
|
||||
// Methods
|
||||
void Release() override {
|
||||
NEARBY_LOGS(INFO) << __func__
|
||||
LOG(INFO) << __func__
|
||||
<< ": LE Advertisement released: " << getObjectPath();
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ bool DeviceInfo::PreventSleep() {
|
||||
|
||||
bool DeviceInfo::AllowSleep() {
|
||||
if (!inhibit_fd_.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< "No inhibit lock is acquired at the moment";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ Executor::Executor(size_t max_concurrency)
|
||||
|
||||
void Executor::Execute(Runnable &&runnable) {
|
||||
if (shut_down_) {
|
||||
NEARBY_LOGS(VERBOSE) << "Warning: " << __func__
|
||||
LOG(INFO) << "Warning: " << __func__
|
||||
<< ": Attempt to execute on a shut down pool.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (runnable == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Runnable was null.";
|
||||
LOG(ERROR) << __func__ << ": Runnable was null.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ std::wstring FilePath::CreateOutputFileWithRename(std::wstring path) {
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
NEARBY_LOGS(INFO) << "Renamed " << wstring_to_string(path) << " to "
|
||||
LOG(INFO) << "Renamed " << wstring_to_string(path) << " to "
|
||||
<< wstring_to_string(target);
|
||||
}
|
||||
|
||||
@@ -189,14 +189,14 @@ void FilePath::ReplaceInvalidCharacters(std::wstring& path) {
|
||||
for (auto& character : path) {
|
||||
// If 0 < character < 32, it's illegal, replace it
|
||||
if (character > 0 && character < 32) {
|
||||
NEARBY_LOGS(INFO) << "In path " << wstring_to_string(path)
|
||||
LOG(INFO) << "In path " << wstring_to_string(path)
|
||||
<< " replaced \'" << std::string(1, character)
|
||||
<< "\' with \'" << std::string(1, kReplacementChar);
|
||||
character = kReplacementChar;
|
||||
}
|
||||
for (auto illegal_character : kIllegalFileCharacters) {
|
||||
if (character == illegal_character) {
|
||||
NEARBY_LOGS(INFO) << "In path " << wstring_to_string(path)
|
||||
LOG(INFO) << "In path " << wstring_to_string(path)
|
||||
<< " replaced \'" << std::string(1, character)
|
||||
<< "\' with \'" << std::string(1, kReplacementChar);
|
||||
character = kReplacementChar;
|
||||
|
||||
@@ -438,7 +438,7 @@ absl::Status HttpLoader::ConnectWebServer() {
|
||||
request_.body.size()));
|
||||
|
||||
} else {
|
||||
NEARBY_LOGS(ERROR) << "Failed to open internet with error "
|
||||
LOG(ERROR) << "Failed to open internet with error "
|
||||
<< "Invalid request method: " << request_.method << ".";
|
||||
return absl::FailedPreconditionError(
|
||||
"Failed to open internet: Invalid request method.");
|
||||
@@ -446,7 +446,7 @@ absl::Status HttpLoader::ConnectWebServer() {
|
||||
|
||||
for (const auto &ret : option_return_codes) {
|
||||
if (ret) {
|
||||
NEARBY_LOGS(ERROR) << "Failed to open internet with error "
|
||||
LOG(ERROR) << "Failed to open internet with error "
|
||||
<< curl_easy_strerror(ret) << ".";
|
||||
return absl::FailedPreconditionError(
|
||||
absl::StrCat(curl_easy_strerror(ret)));
|
||||
@@ -460,7 +460,7 @@ absl::Status HttpLoader::SendRequest() {
|
||||
CURLcode ret = curl_easy_perform(curl_);
|
||||
|
||||
if (ret != CURLE_OK) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< "Failed to send request to remote web server with error "
|
||||
<< curl_easy_strerror(ret) << ".";
|
||||
return absl::FailedPreconditionError(absl::StrCat(curl_easy_strerror(ret)));
|
||||
@@ -500,7 +500,7 @@ absl::StatusOr<WebResponse> HttpLoader::ProcessResponse() {
|
||||
// Append data to response
|
||||
web_response.body.assign(response_strings_, download_size);
|
||||
} else {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< "Failed to read response from remote web server with error "
|
||||
<< curl_easy_strerror(ret) << ".";
|
||||
return absl::FailedPreconditionError(
|
||||
|
||||
@@ -86,7 +86,7 @@ class NetworkManager final
|
||||
NM_STATE_CASE_SET(kNMStateConnectedSite);
|
||||
NM_STATE_CASE_SET(kNMStateConnectedGlobal);
|
||||
default:
|
||||
NEARBY_LOGS(ERROR) << __func__ << "invalid NMState value: " << val
|
||||
LOG(ERROR) << __func__ << "invalid NMState value: " << val
|
||||
<< ", setting state to unknown";
|
||||
NM_STATE_CASE_SET(kNMStateUnknown);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ std::vector<std::string> ActiveConnection::GetIP4Addresses() {
|
||||
|
||||
std::pair<std::optional<ActiveConnection::ActiveConnectionStateReason>, bool>
|
||||
ActiveConnection::WaitForConnection(absl::Duration timeout) {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Waiting for an update to "
|
||||
LOG(INFO) << __func__ << ": Waiting for an update to "
|
||||
<< getObjectPath() << "'s state";
|
||||
|
||||
auto state_changed = [this]() {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "internal/platform/implementation/input_file.h"
|
||||
#include "internal/platform/implementation/linux/atomic_boolean.h"
|
||||
#include "internal/platform/implementation/linux/atomic_uint32.h"
|
||||
#include "internal/platform/implementation/linux/ble_v2_medium.h"
|
||||
//#include "internal/platform/implementation/linux/ble_v2_medium.h"
|
||||
#include "internal/platform/implementation/linux/bluetooth_adapter.h"
|
||||
#include "internal/platform/implementation/linux/bluetooth_classic_medium.h"
|
||||
#include "internal/platform/implementation/linux/bluez.h"
|
||||
@@ -45,13 +45,15 @@
|
||||
#include "internal/platform/implementation/linux/wifi_lan.h"
|
||||
#include "internal/platform/implementation/linux/wifi_medium.h"
|
||||
#include "internal/platform/implementation/platform.h"
|
||||
|
||||
#include "absl/strings/str_cat.h"
|
||||
|
||||
#include "internal/platform/implementation/shared/count_down_latch.h"
|
||||
#include "internal/platform/implementation/shared/file.h"
|
||||
#include "internal/platform/implementation/submittable_executor.h"
|
||||
#include "internal/platform/implementation/wifi_hotspot.h"
|
||||
#include "internal/platform/implementation/wifi_lan.h"
|
||||
#include "internal/platform/payload_id.h"
|
||||
#include "log_message.h"
|
||||
#include "scheduled_executor.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -135,7 +137,7 @@ std::unique_ptr<OutputFile> ImplementationPlatform::CreateOutputFile(
|
||||
try {
|
||||
std::filesystem::create_directories(path.parent_path());
|
||||
} catch (std::filesystem::filesystem_error const &err) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": error creating directory tree "
|
||||
LOG(ERROR) << __func__ << ": error creating directory tree "
|
||||
<< path.parent_path() << ": " << err.what();
|
||||
}
|
||||
|
||||
@@ -144,7 +146,9 @@ std::unique_ptr<OutputFile> ImplementationPlatform::CreateOutputFile(
|
||||
|
||||
std::unique_ptr<api::LogMessage> ImplementationPlatform::CreateLogMessage(
|
||||
const char *file, int line, LogMessage::Severity severity) {
|
||||
return std::make_unique<linux::LogMessage>(file, line, severity);
|
||||
return nullptr;
|
||||
// Disabled LogMessage
|
||||
// return std::make_unique<linux::LogMessage>(file, line, severity);
|
||||
}
|
||||
|
||||
std::unique_ptr<api::SubmittableExecutor>
|
||||
@@ -171,7 +175,7 @@ ImplementationPlatform::CreateBluetoothAdapter() {
|
||||
auto interfaces = manager.GetManagedObjects();
|
||||
for (auto &[object, properties] : interfaces) {
|
||||
if (properties.count(org::bluez::Adapter1_proxy::INTERFACE_NAME) == 1) {
|
||||
NEARBY_LOGS(INFO) << __func__ << ": found bluetooth adapter " << object;
|
||||
LOG(INFO) << __func__ << ": found bluetooth adapter " << object;
|
||||
return std::make_unique<linux::BluetoothAdapter>(system_bus, object);
|
||||
}
|
||||
}
|
||||
@@ -180,7 +184,7 @@ ImplementationPlatform::CreateBluetoothAdapter() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": couldn't find a bluetooth adapter on this system";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -199,8 +203,10 @@ std::unique_ptr<BleMedium> ImplementationPlatform::CreateBleMedium(
|
||||
|
||||
std::unique_ptr<api::ble_v2::BleMedium>
|
||||
ImplementationPlatform::CreateBleV2Medium(api::BluetoothAdapter &adapter) {
|
||||
return std::make_unique<linux::BleV2Medium>(
|
||||
dynamic_cast<linux::BluetoothAdapter &>(adapter));
|
||||
return nullptr;
|
||||
// TODO: Enable BLEv2 once BlueZ support is added.
|
||||
// return std::make_unique<linux::BleV2Medium>(
|
||||
// dynamic_cast<linux::BluetoothAdapter &>(adapter));
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -232,7 +238,7 @@ static std::unique_ptr<linux::NetworkManagerWifiMedium> createWifiMedium(
|
||||
auto device = objects[device_path];
|
||||
if (device.count(org::freedesktop::NetworkManager::Device::
|
||||
Wireless_proxy::INTERFACE_NAME) == 1) {
|
||||
NEARBY_LOGS(INFO) << __func__
|
||||
LOG(INFO) << __func__
|
||||
<< ": Found a wireless device at :" << device_path;
|
||||
return std::make_unique<linux::NetworkManagerWifiMedium>(nm,
|
||||
device_path);
|
||||
@@ -240,7 +246,7 @@ static std::unique_ptr<linux::NetworkManagerWifiMedium> createWifiMedium(
|
||||
}
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": couldn't find a wireless device on this system";
|
||||
return nullptr;
|
||||
}
|
||||
@@ -266,7 +272,7 @@ ImplementationPlatform::CreateWifiHotspotMedium() {
|
||||
auto wifiMedium = createWifiMedium(nm);
|
||||
|
||||
if (wifiMedium == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Could not create a WiFi medium";
|
||||
LOG(ERROR) << __func__ << ": Could not create a WiFi medium";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -281,7 +287,7 @@ ImplementationPlatform::CreateWifiDirectMedium() {
|
||||
auto wifiMedium = createWifiMedium(nm);
|
||||
|
||||
if (wifiMedium == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Could not create a WiFi medium";
|
||||
LOG(ERROR) << __func__ << ": Could not create a WiFi medium";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -339,7 +345,7 @@ absl::StatusOr<api::WebResponse> ImplementationPlatform::SendRequest(
|
||||
api::WebResponse response;
|
||||
|
||||
if (curl_easy_perform(handle) != CURLE_OK) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error performing HTTP request: " << errbuf;
|
||||
return absl::Status(absl::StatusCode::kUnknown, errbuf);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void PreferencesManager::Remove(absl::string_view key) {
|
||||
// Writes data to storage.
|
||||
bool PreferencesManager::Commit() {
|
||||
if (!preferences_repository_->SavePreferences(value_)) {
|
||||
NEARBY_LOGS(ERROR) << "Failed to save preference." << std::endl;
|
||||
LOG(ERROR) << "Failed to save preference." << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -194,7 +194,7 @@ bool PreferencesManager::Commit() {
|
||||
|
||||
bool PreferencesManager::SetValue(absl::string_view key, const json& value) {
|
||||
if (!value_.is_object()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_="
|
||||
LOG(ERROR) << "Preferences is no longer an object! value_="
|
||||
<< value_.dump(4);
|
||||
value_ = json::object();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ template <typename T>
|
||||
T PreferencesManager::GetValue(absl::string_view key,
|
||||
const T& default_value) const {
|
||||
if (!value_.is_object()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_="
|
||||
LOG(ERROR) << "Preferences is no longer an object! value_="
|
||||
<< value_.dump(4);
|
||||
return default_value;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ template <typename T>
|
||||
bool PreferencesManager::SetArrayValue(absl::string_view key,
|
||||
absl::Span<const T> value) {
|
||||
if (!value_.is_object()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_="
|
||||
LOG(ERROR) << "Preferences is no longer an object! value_="
|
||||
<< value_.dump(4);
|
||||
value_ = json::object();
|
||||
}
|
||||
@@ -251,7 +251,7 @@ std::vector<T> PreferencesManager::GetArrayValue(
|
||||
std::vector<T> result;
|
||||
|
||||
if (!value_.is_object()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_="
|
||||
LOG(ERROR) << "Preferences is no longer an object! value_="
|
||||
<< value_.dump(4);
|
||||
|
||||
for (const T& value : default_value) {
|
||||
|
||||
@@ -45,7 +45,7 @@ TEST(PreferencesManager, CorruptedConfigFile) {
|
||||
std::ofstream output_stream{settingsPath / "preferences.json"};
|
||||
output_stream << "CORRUPTED" << std::endl;
|
||||
|
||||
NEARBY_LOGS(INFO) << "Loading preferences from: " << settingsPath.string();
|
||||
LOG(INFO) << "Loading preferences from: " << settingsPath.string();
|
||||
EXPECT_EQ(PreferencesManager(settingsPath.string()).GetInteger("data", 100),
|
||||
100);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ TEST(PreferencesManager, ValidConfigFile) {
|
||||
output_stream << "{\"data\":8, \"name\": \"Valid\"}" << std::endl;
|
||||
output_stream.close();
|
||||
|
||||
NEARBY_LOGS(INFO) << "Loading preferences from: " << settingsPath.string();
|
||||
LOG(INFO) << "Loading preferences from: " << settingsPath.string();
|
||||
EXPECT_EQ(PreferencesManager(settingsPath.string()).GetInteger("data", 100),
|
||||
8);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ json PreferencesRepository::LoadPreferences() {
|
||||
// The top level root should be an object, if it's not then something went
|
||||
// wrong or the file was corrupted.
|
||||
if (!preferences.value().is_object()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences loaded was not a valid object: "
|
||||
LOG(ERROR) << "Preferences loaded was not a valid object: "
|
||||
<< preferences.value().dump(4);
|
||||
|
||||
return json::object();
|
||||
@@ -47,17 +47,17 @@ json PreferencesRepository::LoadPreferences() {
|
||||
return preferences.value();
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << "Could not load preferences file, trying backup.";
|
||||
LOG(ERROR) << "Could not load preferences file, trying backup.";
|
||||
|
||||
// In the future we should switch to using a transaction log or another
|
||||
// stable method which doesn't pose a risk of losing settings
|
||||
preferences = RestoreFromBackup();
|
||||
if (preferences.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << "Successfully recovered from backup.";
|
||||
LOG(ERROR) << "Successfully recovered from backup.";
|
||||
return preferences.value();
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << "Failed to load preferences file from back up.";
|
||||
LOG(ERROR) << "Failed to load preferences file from back up.";
|
||||
|
||||
return json::object();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ bool PreferencesRepository::SavePreferences(json preferences) {
|
||||
std::filesystem::path path = path_;
|
||||
if (!std::filesystem::exists(path) &&
|
||||
!std::filesystem::create_directories(path)) {
|
||||
NEARBY_LOGS(ERROR) << "Failed to create preferences path.";
|
||||
LOG(ERROR) << "Failed to create preferences path.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ bool PreferencesRepository::SavePreferences(json preferences) {
|
||||
|
||||
// Create a backup without moving the bytes on disk
|
||||
if (std::filesystem::exists(full_name)) {
|
||||
NEARBY_LOGS(INFO) << "Making backup of preferences file.";
|
||||
LOG(INFO) << "Making backup of preferences file.";
|
||||
std::filesystem::rename(full_name, full_name_backup);
|
||||
}
|
||||
|
||||
@@ -87,16 +87,16 @@ bool PreferencesRepository::SavePreferences(json preferences) {
|
||||
|
||||
// Make sure the file wasn't saved in a corrupted state
|
||||
if (!AttemptLoad().has_value()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences saved to disk in corrupted state. "
|
||||
LOG(ERROR) << "Preferences saved to disk in corrupted state. "
|
||||
"Restoring from backup.";
|
||||
|
||||
if (!RestoreFromBackup().has_value()) {
|
||||
NEARBY_LOGS(ERROR) << "Failed to restore preferences file.";
|
||||
LOG(ERROR) << "Failed to restore preferences file.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
NEARBY_LOGS(ERROR) << "Failed to save preferences file: " << e.what();
|
||||
LOG(ERROR) << "Failed to save preferences file: " << e.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,13 @@ std::optional<json> PreferencesRepository::AttemptLoad() {
|
||||
preferences_file.close();
|
||||
|
||||
if (preferences.is_discarded()) {
|
||||
NEARBY_LOGS(ERROR) << "Preferences file corrupted.";
|
||||
LOG(ERROR) << "Preferences file corrupted.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return preferences;
|
||||
} catch (const std::exception& e) {
|
||||
NEARBY_LOGS(ERROR) << "Exception while loading preferences: " << e.what();
|
||||
LOG(ERROR) << "Exception while loading preferences: " << e.what();
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
@@ -137,14 +137,14 @@ std::optional<json> PreferencesRepository::RestoreFromBackup() {
|
||||
std::filesystem::path full_name_backup = path / kPreferencesBackupFileName;
|
||||
|
||||
if (!std::filesystem::exists(full_name_backup)) {
|
||||
NEARBY_LOGS(WARNING)
|
||||
LOG(WARNING)
|
||||
<< "Backup requested but no backup preferences file found.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::filesystem::rename(full_name_backup, full_name);
|
||||
|
||||
NEARBY_LOGS(INFO) << "Attempting load from backup preferences.";
|
||||
LOG(INFO) << "Attempting load from backup preferences.";
|
||||
return AttemptLoad();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ ScheduledExecutor::ScheduledExecutor()
|
||||
std::shared_ptr<api::Cancelable> ScheduledExecutor::Schedule(
|
||||
Runnable &&runnable, absl::Duration duration) {
|
||||
if (shut_down_) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Attempt to Schedule on a shut down executor.";
|
||||
|
||||
return nullptr;
|
||||
@@ -58,7 +58,7 @@ std::shared_ptr<api::Cancelable> ScheduledExecutor::Schedule(
|
||||
|
||||
void ScheduledExecutor::Execute(Runnable &&runnable) {
|
||||
if (shut_down_) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Attempt to Execute on a shut down executor.";
|
||||
return;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void ScheduledExecutor::Shutdown() {
|
||||
executor_->Shutdown();
|
||||
return;
|
||||
}
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Attempt to Shutdown on a shut down executor.";
|
||||
}
|
||||
} // namespace linux
|
||||
|
||||
@@ -36,7 +36,7 @@ ExceptionOr<ByteArray> InputStream::Read(std::int64_t size) {
|
||||
return ExceptionOr(ByteArray());
|
||||
}
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": error reading from fd: " << std::strerror(errno);
|
||||
return {Exception::kIo};
|
||||
}
|
||||
@@ -58,7 +58,7 @@ Exception OutputStream::Write(const ByteArray &data) {
|
||||
while (written < data.size()) {
|
||||
ssize_t ret = write(fd_.get(), data.data(), data.size());
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": error writing to fd: " << std::strerror(errno);
|
||||
return Exception{Exception::kIo};
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool SubmittableExecutor::DoSubmit(Runnable&& wrapped_callable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << "Error: " << __func__
|
||||
LOG(ERROR) << "Error: " << __func__
|
||||
<< ": Attempt to DoSubmit on a shutdown executor.";
|
||||
|
||||
return false;
|
||||
@@ -41,7 +41,7 @@ void SubmittableExecutor::Execute(Runnable&& runnable) {
|
||||
if (!shut_down_) {
|
||||
executor_->Execute(std::move(runnable));
|
||||
} else {
|
||||
NEARBY_LOGS(ERROR) << "Error: " << __func__
|
||||
LOG(ERROR) << "Error: " << __func__
|
||||
<< ": Attempt to Execute on a shutdown executor.";
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ void SubmittableExecutor::Shutdown() {
|
||||
return;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR) << "Error: " << __func__
|
||||
LOG(ERROR) << "Error: " << __func__
|
||||
<< ": Attempt to Shutdown on a shutdown executor.";
|
||||
}
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ class TCPSocket {
|
||||
int port) {
|
||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error opening socket: " << std::strerror(errno);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Connecting to " << ip_address << ":"
|
||||
LOG(INFO) << __func__ << ": Connecting to " << ip_address << ":"
|
||||
<< port;
|
||||
struct sockaddr_in addr;
|
||||
addr.sin_addr.s_addr = inet_addr(ip_address.c_str());
|
||||
@@ -52,7 +52,7 @@ class TCPSocket {
|
||||
auto ret =
|
||||
connect(sock, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr));
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error connecting to socket: "
|
||||
LOG(ERROR) << __func__ << ": Error connecting to socket: "
|
||||
<< std::strerror(errno);
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class TCPServerSocket {
|
||||
int port) {
|
||||
auto sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error opening socket: " << std::strerror(errno);
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -106,14 +106,14 @@ class TCPServerSocket {
|
||||
auto ret =
|
||||
bind(sock, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr));
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error binding to socket: "
|
||||
LOG(ERROR) << __func__ << ": Error binding to socket: "
|
||||
<< std::strerror(errno);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ret = listen(sock, 0);
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error listening on socket: "
|
||||
LOG(ERROR) << __func__ << ": Error listening on socket: "
|
||||
<< std::strerror(errno);
|
||||
return std::nullopt;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class TCPServerSocket {
|
||||
auto conn =
|
||||
accept(fd_.get(), reinterpret_cast<struct sockaddr*>(&addr), &len);
|
||||
if (conn < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error accepting incoming connections on socket "
|
||||
<< fd_.get() << ": " << std::strerror(errno);
|
||||
return std::nullopt;
|
||||
@@ -141,7 +141,7 @@ class TCPServerSocket {
|
||||
shutdown(fd, SHUT_RDWR);
|
||||
auto ret = close(fd);
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error closing socket " << fd << ": "
|
||||
LOG(ERROR) << __func__ << ": Error closing socket " << fd << ": "
|
||||
<< std::strerror(errno);
|
||||
return {Exception::kFailed};
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class TCPServerSocket {
|
||||
auto ret =
|
||||
getsockname(fd_.get(), reinterpret_cast<struct sockaddr*>(&sin), &len);
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error getting information for socket "
|
||||
<< fd_.get() << ": " << std::strerror(errno);
|
||||
return 0;
|
||||
|
||||
@@ -42,7 +42,7 @@ bool ThreadPool::Start() {
|
||||
if (shut_down_) {
|
||||
return;
|
||||
}
|
||||
NEARBY_LOGS(WARNING) << __func__ << ": Tried to run a null task.";
|
||||
LOG(WARNING) << __func__ << ": Tried to run a null task.";
|
||||
continue;
|
||||
}
|
||||
task();
|
||||
@@ -51,11 +51,11 @@ bool ThreadPool::Start() {
|
||||
|
||||
absl::MutexLock l(&threads_mutex_);
|
||||
if (!threads_.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << "thread pool is already active";
|
||||
LOG(ERROR) << __func__ << "thread pool is already active";
|
||||
return false;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Starting thread pool with "
|
||||
LOG(INFO) << __func__ << ": Starting thread pool with "
|
||||
<< max_pool_size_ << " threads";
|
||||
|
||||
for (size_t i = 0; i < max_pool_size_; i++) {
|
||||
@@ -67,14 +67,14 @@ bool ThreadPool::Start() {
|
||||
|
||||
bool ThreadPool::Run(Runnable &&task) {
|
||||
if (shut_down_) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << "thread pool has shut down";
|
||||
LOG(ERROR) << __func__ << "thread pool has shut down";
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
absl::ReaderMutexLock l(&threads_mutex_);
|
||||
if (threads_.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": thread pool is not active";
|
||||
LOG(ERROR) << __func__ << ": thread pool is not active";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ Timer::~Timer() {
|
||||
absl::MutexLock l(&mutex_);
|
||||
if (timerid_.has_value())
|
||||
if (timer_delete(*timerid_) < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error deleting POSIX timer: "
|
||||
LOG(ERROR) << __func__ << ": Error deleting POSIX timer: "
|
||||
<< std::strerror(errno);
|
||||
}
|
||||
}
|
||||
@@ -45,14 +45,14 @@ Timer::~Timer() {
|
||||
bool Timer::Create(int delay, int interval,
|
||||
absl::AnyInvocable<void()> callback) {
|
||||
if (delay < 0 || interval < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Delay and interval cannot be negative.";
|
||||
return false;
|
||||
}
|
||||
|
||||
absl::MutexLock l(&mutex_);
|
||||
if (timerid_.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< "Timer has already been created and armed.";
|
||||
return false;
|
||||
}
|
||||
@@ -74,16 +74,16 @@ bool Timer::Create(int delay, int interval,
|
||||
spec.it_interval.tv_sec = 0;
|
||||
|
||||
if (timer_create(CLOCK_MONOTONIC, &ev, &timerid) < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error creating POSIX timer: "
|
||||
LOG(ERROR) << __func__ << ": Error creating POSIX timer: "
|
||||
<< std::strerror(errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (timer_settime(&timerid, 0, &spec, nullptr) < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error arming POSIX timer: "
|
||||
LOG(ERROR) << __func__ << ": Error arming POSIX timer: "
|
||||
<< std::strerror(errno);
|
||||
if (!timer_delete(&timerid)) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": error deleting POSIX timer: "
|
||||
LOG(ERROR) << __func__ << ": error deleting POSIX timer: "
|
||||
<< std::strerror(errno);
|
||||
}
|
||||
return false;
|
||||
@@ -96,12 +96,12 @@ bool Timer::Create(int delay, int interval,
|
||||
bool Timer::Stop() {
|
||||
absl::MutexLock l(&mutex_);
|
||||
if (!timerid_.has_value()) {
|
||||
NEARBY_LOGS(WARNING) << __func__ << ": no timer created";
|
||||
LOG(WARNING) << __func__ << ": no timer created";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!timer_delete(&*timerid_)) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": error deleting POSIX timer: "
|
||||
LOG(ERROR) << __func__ << ": error deleting POSIX timer: "
|
||||
<< std::strerror(errno);
|
||||
return false;
|
||||
}
|
||||
@@ -111,24 +111,5 @@ bool Timer::Stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Timer::FireNow() {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (!timerid_.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No timer has been created";
|
||||
return false;
|
||||
}
|
||||
if (callback_ == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No callback has been set";
|
||||
return false;
|
||||
}
|
||||
if (task_executor_ == nullptr) {
|
||||
task_executor_ = std::make_unique<SubmittableExecutor>();
|
||||
}
|
||||
|
||||
task_executor_->Execute([&]() { callback_(); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace linux
|
||||
} // namespace nearby
|
||||
|
||||
@@ -37,7 +37,6 @@ class Timer : public api::Timer {
|
||||
absl::AnyInvocable<void()> callback) override
|
||||
ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
bool Stop() override ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
bool FireNow() override ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
private:
|
||||
absl::Mutex mutex_;
|
||||
|
||||
@@ -56,7 +56,7 @@ std::optional<std::string> NewUuidStr() {
|
||||
sd_id128_t id;
|
||||
char id_cstr[SD_ID128_UUID_STRING_MAX];
|
||||
if (auto ret = sd_id128_randomize(&id); ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": could not generate a random UUID: "
|
||||
LOG(ERROR) << __func__ << ": could not generate a random UUID: "
|
||||
<< std::strerror(ret);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ NetworkManagerWifiDirectMedium::ListenForService(int port) {
|
||||
|
||||
auto ip4addresses = active_connection->GetIP4Addresses();
|
||||
if (ip4addresses.empty()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< "Could not find any IPv4 addresses for active connection "
|
||||
<< active_connection->getObjectPath();
|
||||
@@ -64,7 +64,7 @@ NetworkManagerWifiDirectMedium::ListenForService(int port) {
|
||||
bool NetworkManagerWifiDirectMedium::ConnectWifiDirect(
|
||||
WifiDirectCredentials *wifi_direct_credentials) {
|
||||
if (wifi_direct_credentials == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": hotspot_credentials cannot be null";
|
||||
LOG(ERROR) << __func__ << ": hotspot_credentials cannot be null";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ bool NetworkManagerWifiDirectMedium::ConnectWifiDirect(
|
||||
|
||||
bool NetworkManagerWifiDirectMedium::DisconnectWifiDirect() {
|
||||
if (!ConnectedToWifi()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Not connected to a WiFi hotspot";
|
||||
LOG(ERROR) << __func__ << ": Not connected to a WiFi hotspot";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace linux {
|
||||
std::string NetworkManagerWifiDirectServerSocket::GetIPAddress() const {
|
||||
auto ip4addresses = active_conn_->GetIP4Addresses();
|
||||
if (ip4addresses.empty()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Could not find any IPv4 addresses for active connection "
|
||||
<< active_conn_->getObjectPath();
|
||||
|
||||
@@ -36,7 +36,7 @@ NetworkManagerWifiHotspotMedium::ConnectToService(
|
||||
absl::string_view ip_address, int port,
|
||||
CancellationFlag *cancellation_flag) {
|
||||
if (!ConnectedToWifi()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Cannot connect to service without an active WiFi hotspot";
|
||||
return nullptr;
|
||||
@@ -44,12 +44,12 @@ NetworkManagerWifiHotspotMedium::ConnectToService(
|
||||
|
||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error opening socket: " << std::strerror(errno);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Connecting to " << ip_address << ":"
|
||||
LOG(INFO) << __func__ << ": Connecting to " << ip_address << ":"
|
||||
<< port;
|
||||
struct sockaddr_in addr {};
|
||||
addr.sin_addr.s_addr = inet_addr(std::string(ip_address).c_str());
|
||||
@@ -59,7 +59,7 @@ NetworkManagerWifiHotspotMedium::ConnectToService(
|
||||
auto ret =
|
||||
connect(sock, reinterpret_cast<struct sockaddr *>(&addr), sizeof(addr));
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error connecting to socket: "
|
||||
LOG(ERROR) << __func__ << ": Error connecting to socket: "
|
||||
<< std::strerror(errno);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ NetworkManagerWifiHotspotMedium::ConnectToService(
|
||||
std::unique_ptr<api::WifiHotspotServerSocket>
|
||||
NetworkManagerWifiHotspotMedium::ListenForService(int port) {
|
||||
if (!WifiHotspotActive()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Cannot connect to service without an active WiFi hotspot";
|
||||
return nullptr;
|
||||
@@ -83,7 +83,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
|
||||
|
||||
auto ip4addresses = active_connection->GetIP4Addresses();
|
||||
if (ip4addresses.empty()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< "Could not find any IPv4 addresses for active connection "
|
||||
<< active_connection->getObjectPath();
|
||||
@@ -92,7 +92,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
|
||||
|
||||
auto sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error opening socket: " << std::strerror(errno);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -105,18 +105,18 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
|
||||
auto ret =
|
||||
bind(sock, reinterpret_cast<struct sockaddr *>(&addr), sizeof(addr));
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error binding to socket: " << std::strerror(errno);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Listening for services on "
|
||||
LOG(INFO) << __func__ << ": Listening for services on "
|
||||
<< ip4addresses[0] << ":" << port << " on device "
|
||||
<< wireless_device_->getObjectPath();
|
||||
|
||||
ret = listen(sock, 0);
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error listening on socket: "
|
||||
LOG(ERROR) << __func__ << ": Error listening on socket: "
|
||||
<< std::strerror(errno);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ NetworkManagerWifiHotspotMedium::ListenForService(int port) {
|
||||
bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
|
||||
HotspotCredentials *hotspot_credentials) {
|
||||
if (WifiHotspotActive()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << wireless_device_->getObjectPath()
|
||||
LOG(ERROR) << __func__ << ": " << wireless_device_->getObjectPath()
|
||||
<< ": cannot start WiFi hotspot, a hotspot is already "
|
||||
"active on this device";
|
||||
return false;
|
||||
@@ -142,7 +142,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
|
||||
|
||||
auto connection_id = NewUuidStr();
|
||||
if (!connection_id.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": could not generate a connection UUID";
|
||||
LOG(ERROR) << __func__ << ": could not generate a connection UUID";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
|
||||
|
||||
auto [reason, timeout] = active_conn->WaitForConnection();
|
||||
if (timeout) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": "
|
||||
<< ": timed out while waiting for connection "
|
||||
<< active_conn->getObjectPath()
|
||||
@@ -199,7 +199,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
|
||||
return false;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Started a WiFi hotspot on device "
|
||||
LOG(INFO) << __func__ << ": Started a WiFi hotspot on device "
|
||||
<< wireless_device_->getObjectPath() << " at "
|
||||
<< active_conn->getObjectPath();
|
||||
return true;
|
||||
@@ -207,7 +207,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot(
|
||||
|
||||
bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
|
||||
if (!WifiHotspotActive()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": " << wireless_device_->getObjectPath()
|
||||
<< ": Cannot stop WiFi hotspot as a WiFi hotspot is not active";
|
||||
}
|
||||
@@ -218,7 +218,7 @@ bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
|
||||
try {
|
||||
active_ap_path = wireless_device_->ActiveAccessPoint();
|
||||
if (active_ap_path.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No active access points on "
|
||||
LOG(ERROR) << __func__ << ": No active access points on "
|
||||
<< wireless_device_->getObjectPath();
|
||||
return false;
|
||||
}
|
||||
@@ -229,14 +229,14 @@ bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
|
||||
auto object_manager = networkmanager::ObjectManager(system_bus_);
|
||||
auto active_connection = wireless_device_->GetActiveConnection();
|
||||
if (active_connection == nullptr) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Could not find an active connection using the access point "
|
||||
<< active_ap_path;
|
||||
return false;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": " << wireless_device_->getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << wireless_device_->getObjectPath()
|
||||
<< ": Deactivating active connection "
|
||||
<< active_connection->getObjectPath();
|
||||
|
||||
@@ -253,7 +253,7 @@ bool NetworkManagerWifiHotspotMedium::StopWifiHotspot() {
|
||||
bool NetworkManagerWifiHotspotMedium::ConnectWifiHotspot(
|
||||
HotspotCredentials *hotspot_credentials) {
|
||||
if (hotspot_credentials == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": hotspot_credentials cannot be null";
|
||||
LOG(ERROR) << __func__ << ": hotspot_credentials cannot be null";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ bool NetworkManagerWifiHotspotMedium::ConnectWifiHotspot(
|
||||
|
||||
bool NetworkManagerWifiHotspotMedium::DisconnectWifiHotspot() {
|
||||
if (!ConnectedToWifi()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Not connected to a WiFi hotspot";
|
||||
LOG(ERROR) << __func__ << ": Not connected to a WiFi hotspot";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace linux {
|
||||
std::string NetworkManagerWifiHotspotServerSocket::GetIPAddress() const {
|
||||
auto ip4addresses = active_conn_->GetIP4Addresses();
|
||||
if (ip4addresses.empty()) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Could not find any IPv4 addresses for active connection "
|
||||
<< active_conn_->getObjectPath();
|
||||
@@ -39,7 +39,7 @@ int NetworkManagerWifiHotspotServerSocket::GetPort() const {
|
||||
auto ret =
|
||||
getsockname(fd_.get(), reinterpret_cast<struct sockaddr *>(&sin), &len);
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Error getting information for socket "
|
||||
LOG(ERROR) << __func__ << ": Error getting information for socket "
|
||||
<< fd_.get() << ": " << std::strerror(errno);
|
||||
return 0;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ NetworkManagerWifiHotspotServerSocket::Accept() {
|
||||
auto conn =
|
||||
accept(fd_.get(), reinterpret_cast<struct sockaddr *>(&addr), &len);
|
||||
if (conn < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error accepting incoming connections on socket "
|
||||
<< fd_.get() << ": " << std::strerror(errno);
|
||||
return nullptr;
|
||||
@@ -69,7 +69,7 @@ Exception NetworkManagerWifiHotspotServerSocket::Close() {
|
||||
shutdown(fd, SHUT_RDWR);
|
||||
auto ret = close(fd_.release());
|
||||
if (ret < 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error closing socket: " << std::strerror(errno);
|
||||
return {Exception::kFailed};
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ std::optional<std::pair<std::string, std::string>> entry_group_key(
|
||||
const NsdServiceInfo &nsd_service_info) {
|
||||
auto name = nsd_service_info.GetServiceName();
|
||||
if (name.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": service name cannot be empty";
|
||||
LOG(ERROR) << __func__ << ": service name cannot be empty";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto type = nsd_service_info.GetServiceType();
|
||||
if (type.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": service type cannot be empty";
|
||||
LOG(ERROR) << __func__ << ": service type cannot be empty";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo &nsd_service_info) {
|
||||
{
|
||||
absl::ReaderMutexLock l(&entry_groups_mutex_);
|
||||
if (entry_groups_.count(*key) == 1) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": advertising is already active for this service";
|
||||
return false;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo &nsd_service_info) {
|
||||
std::string(), std::string(), nsd_service_info.GetPort(), txt_records);
|
||||
entry_group->Commit();
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Got error '" << e.getName()
|
||||
LOG(ERROR) << __func__ << ": Got error '" << e.getName()
|
||||
<< "' with message '" << e.getMessage()
|
||||
<< "' while adding service";
|
||||
return false;
|
||||
@@ -130,7 +130,7 @@ bool WifiLanMedium::StopAdvertising(const NsdServiceInfo &nsd_service_info) {
|
||||
|
||||
absl::MutexLock l(&entry_groups_mutex_);
|
||||
if (entry_groups_.count(*key) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Advertising is already inactive for this service.";
|
||||
return false;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ bool WifiLanMedium::StartDiscovery(
|
||||
absl::ReaderMutexLock l(&service_browsers_mutex_);
|
||||
if (service_browsers_.count(service_type) != 0) {
|
||||
auto &object = service_browsers_[service_type];
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": A service browser for service type "
|
||||
LOG(ERROR) << __func__ << ": A service browser for service type "
|
||||
<< service_type << " already exists at "
|
||||
<< object->getObjectPath();
|
||||
return false;
|
||||
@@ -158,7 +158,7 @@ bool WifiLanMedium::StartDiscovery(
|
||||
avahi_->ServiceBrowserPrepare(-1, // AVAHI_IF_UNSPEC
|
||||
-1, // AVAHI_PROTO_UNSPED
|
||||
service_type, std::string(), 0);
|
||||
NEARBY_LOGS(VERBOSE)
|
||||
LOG(INFO)
|
||||
<< __func__
|
||||
<< ": Created a new org.freedesktop.Avahi.ServiceBrowser object at "
|
||||
<< browser_object_path;
|
||||
@@ -178,7 +178,7 @@ bool WifiLanMedium::StartDiscovery(
|
||||
service_browsers_mutex_.ReaderUnlock();
|
||||
|
||||
try {
|
||||
NEARBY_LOGS(VERBOSE) << __func__ << ": Starting service discovery for "
|
||||
LOG(INFO) << __func__ << ": Starting service discovery for "
|
||||
<< browser->getObjectPath();
|
||||
browser->Start();
|
||||
} catch (const sdbus::Error &e) {
|
||||
@@ -193,7 +193,7 @@ bool WifiLanMedium::StopDiscovery(const std::string &service_type) {
|
||||
absl::MutexLock l(&service_browsers_mutex_);
|
||||
|
||||
if (service_browsers_.count(service_type) == 0) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": Service type " << service_type
|
||||
LOG(ERROR) << __func__ << ": Service type " << service_type
|
||||
<< " has not been registered for discovery";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ std::string WifiLanServerSocket::GetIPAddress() const {
|
||||
}
|
||||
}
|
||||
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": Could not find any active IP addresses for this device";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -94,12 +94,12 @@ api::WifiInformation &NetworkManagerWifiMedium::GetInformation() {
|
||||
information_.ip_address_4_bytes = std::string(addr_bytes, 4);
|
||||
}
|
||||
} else {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << getObjectPath()
|
||||
LOG(ERROR) << __func__ << ": " << getObjectPath()
|
||||
<< ": Could not find the Ip4Config object for "
|
||||
<< active_access_point->getObjectPath();
|
||||
}
|
||||
} catch (const sdbus::Error &e) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": " << getObjectPath() << ": Got error '" << e.getName()
|
||||
<< "' with message '" << e.getMessage()
|
||||
<< "' while populating network information for access point "
|
||||
@@ -166,7 +166,7 @@ NetworkManagerWifiMedium::SearchBySSID(absl::string_view ssid,
|
||||
return ap;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": " << getObjectPath() << ": SSID " << ssid
|
||||
LOG(INFO) << __func__ << ": " << getObjectPath() << ": SSID " << ssid
|
||||
<< " not currently known by device " << getObjectPath()
|
||||
<< ", requesting a scan";
|
||||
|
||||
@@ -194,13 +194,13 @@ NetworkManagerWifiMedium::SearchBySSID(absl::string_view ssid,
|
||||
last_scan_lock_.ReaderUnlock();
|
||||
|
||||
if (!success) {
|
||||
NEARBY_LOGS(WARNING) << __func__ << ": " << getObjectPath()
|
||||
LOG(WARNING) << __func__ << ": " << getObjectPath()
|
||||
<< ": timed out waiting for scan to finish";
|
||||
}
|
||||
|
||||
ap = SearchBySSIDNoScan(ssid_bytes);
|
||||
if (ap == nullptr) {
|
||||
NEARBY_LOGS(WARNING) << __func__ << ": " << getObjectPath()
|
||||
LOG(WARNING) << __func__ << ": " << getObjectPath()
|
||||
<< ": Couldn't find SSID " << ssid;
|
||||
}
|
||||
|
||||
@@ -225,14 +225,14 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork(
|
||||
api::WifiAuthType auth_type) {
|
||||
auto ap = SearchBySSID(ssid);
|
||||
if (ap == nullptr) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << getObjectPath()
|
||||
LOG(ERROR) << __func__ << ": " << getObjectPath()
|
||||
<< ": Couldn't find SSID " << ssid;
|
||||
return api::WifiConnectionStatus::kConnectionFailure;
|
||||
}
|
||||
|
||||
auto connection_id = NewUuidStr();
|
||||
if (!connection_id.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": could not generate a connection UUID";
|
||||
LOG(ERROR) << __func__ << ": could not generate a connection UUID";
|
||||
return api::WifiConnectionStatus::kUnknown;
|
||||
}
|
||||
|
||||
@@ -276,13 +276,13 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork(
|
||||
return api::WifiConnectionStatus::kUnknown;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": " << getObjectPath()
|
||||
LOG(INFO) << __func__ << ": " << 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) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__ << ": " << getObjectPath()
|
||||
<< ": timed out while waiting for connection " << active_conn_path
|
||||
<< " to be activated, last NMActiveConnectionStateReason: "
|
||||
@@ -291,7 +291,7 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork(
|
||||
}
|
||||
|
||||
if (reason.has_value()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": " << getObjectPath() << ": connection "
|
||||
LOG(ERROR) << __func__ << ": " << getObjectPath() << ": connection "
|
||||
<< active_conn_path
|
||||
<< " failed to activate, NMActiveConnectionStateReason:"
|
||||
<< reason->ToString();
|
||||
@@ -304,7 +304,7 @@ api::WifiConnectionStatus NetworkManagerWifiMedium::ConnectToNetwork(
|
||||
return api::WifiConnectionStatus::kAuthFailure;
|
||||
}
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Activated connection " << connection_path;
|
||||
LOG(INFO) << __func__ << ": Activated connection " << connection_path;
|
||||
return api::WifiConnectionStatus::kConnected;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ NetworkManagerWifiMedium::GetActiveConnection() {
|
||||
try {
|
||||
active_ap_path = ActiveAccessPoint();
|
||||
if (active_ap_path.empty()) {
|
||||
NEARBY_LOGS(ERROR) << __func__ << ": No active access points on "
|
||||
LOG(ERROR) << __func__ << ": No active access points on "
|
||||
<< getObjectPath();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ NetworkManagerWifiMedium::GetActiveConnection() {
|
||||
getObjectPath());
|
||||
|
||||
if (conn == nullptr) {
|
||||
NEARBY_LOGS(ERROR)
|
||||
LOG(ERROR)
|
||||
<< __func__
|
||||
<< ": Could not find an active connection using the access point "
|
||||
<< active_ap_path << " and device " << getObjectPath();
|
||||
|
||||
Reference in New Issue
Block a user