upstream changes applied to linux impl

This commit is contained in:
kidfromjupiter
2026-02-04 22:04:03 +00:00
parent 5ec5b2b10f
commit 4d2f34ccfb
50 changed files with 505 additions and 10803 deletions
@@ -69,7 +69,7 @@ std::shared_ptr<BluetoothDevice> BluetoothDevices::get_device_by_path(
return devices_by_path_[device_object_path];
}
std::shared_ptr<BluetoothDevice> BluetoothDevices::get_device_by_unique_id(
api::ble_v2::BlePeripheral::UniqueId id)
api::ble::BlePeripheral::UniqueId id)
{
// converting from stoull to mac again
id &= 0x0000FFFFFFFFFFFFULL; // keep 48 bits
@@ -77,17 +77,22 @@ std::shared_ptr<BluetoothDevice> BluetoothDevices::get_device_by_unique_id(
oss << std::hex << std::setfill('0') << std::setw(12) << id;
std::string hex = oss.str(); // e.g. "aabbccddeeff"
std::string mac;
for (int i = 0; i < 6; ++i) {
if (i) mac.push_back(':');
mac.append(hex.substr(i * 2, 2));
MacAddress addr;
{
std::string mac;
for (int i = 0; i < 6; ++i) {
if (i) mac.push_back(':');
mac.append(hex.substr(i * 2, 2));
}
MacAddress::FromString(mac, addr);
}
return get_device_by_address(mac);
return get_device_by_address(addr);
}
std::shared_ptr<BluetoothDevice> BluetoothDevices::get_device_by_address(
const std::string &addr) {
const MacAddress &addr) {
auto device_object_path =
bluez::device_object_path(adapter_object_path_, addr);
bluez::device_object_path(adapter_object_path_, addr.ToString());
return get_device_by_path(device_object_path);
}