diff --git a/internal/platform/implementation/linux/bluetooth_classic_device.cc b/internal/platform/implementation/linux/bluetooth_classic_device.cc index 1b8dd78e..b74dce6b 100644 --- a/internal/platform/implementation/linux/bluetooth_classic_device.cc +++ b/internal/platform/implementation/linux/bluetooth_classic_device.cc @@ -99,6 +99,30 @@ std::string BluetoothDevice::GetAddressType() const { } } +std::optional BluetoothDevice::GetRssi() const { + auto device = device_; + if (device == nullptr) return std::nullopt; + + try { + return device->RSSI(); + } catch (const sdbus::Error& e) { + DBUS_LOG_PROPERTY_GET_ERROR(device, "RSSI", e); + return std::nullopt; + } +} + +std::optional BluetoothDevice::GetTxPower() const { + auto device = device_; + if (device == nullptr) return std::nullopt; + + try { + return device->TxPower(); + } catch (const sdbus::Error& e) { + DBUS_LOG_PROPERTY_GET_ERROR(device, "TxPower", e); + return std::nullopt; + } +} + bool BluetoothDevice::ConnectToProfile(absl::string_view service_uuid) { auto device = device_; if (device == nullptr) return false; diff --git a/internal/platform/implementation/linux/bluetooth_classic_device.h b/internal/platform/implementation/linux/bluetooth_classic_device.h index 03db8bf7..cd0aef92 100644 --- a/internal/platform/implementation/linux/bluetooth_classic_device.h +++ b/internal/platform/implementation/linux/bluetooth_classic_device.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -53,6 +54,8 @@ class BluetoothDevice : public api::BluetoothDevice { std::string GetName() const override; MacAddress GetMacAddress() const override; std::string GetAddressType() const; + std::optional GetRssi() const; + std::optional GetTxPower() const; MacAddress GetAddress() const { return last_known_address_; }