@@ -99,6 +99,9 @@ class BluetoothDevice: public QObject {
9999 Q_PROPERTY (bool batteryAvailable READ batteryAvailable NOTIFY batteryAvailableChanged);
100100 // / Battery level of the connected device, from `0.0` to `1.0`. Only valid if @@batteryAvailable is true.
101101 Q_PROPERTY (qreal battery READ default NOTIFY batteryChanged BINDABLE bindableBattery);
102+ // / Received Signal Strength Indicator in dBm. Only valid when device is discoverable/advertising.
103+ // / Typical values range from -30 (very close) to -90 (far away). Values of 0 indicate no signal data.
104+ Q_PROPERTY (qint16 rssi READ rssi NOTIFY rssiChanged BINDABLE bindableRssi);
102105 // / The Bluetooth adapter this device belongs to.
103106 Q_PROPERTY (BluetoothAdapter* adapter READ adapter NOTIFY adapterChanged);
104107 // / DBus path of the device under the `org.bluez` system service.
@@ -145,6 +148,8 @@ class BluetoothDevice: public QObject {
145148 [[nodiscard]] bool wakeAllowed () const { return this ->bWakeAllowed ; }
146149 void setWakeAllowed (bool wakeAllowed);
147150
151+ [[nodiscard]] qint16 rssi () const { return this ->bRssi ; }
152+
148153 [[nodiscard]] bool pairing () const { return this ->bPairing ; }
149154
150155 [[nodiscard]] QBindable<QString> bindableAddress () { return &this ->bAddress ; }
@@ -159,6 +164,7 @@ class BluetoothDevice: public QObject {
159164 [[nodiscard]] QBindable<QString> bindableIcon () { return &this ->bIcon ; }
160165 [[nodiscard]] QBindable<qreal> bindableBattery () { return &this ->bBattery ; }
161166 [[nodiscard]] QBindable<BluetoothDeviceState::Enum> bindableState () { return &this ->bState ; }
167+ [[nodiscard]] QBindable<qint16> bindableRssi () { return &this ->bRssi ; }
162168
163169 void addInterface (const QString& interface, const QVariantMap& properties);
164170 void removeInterface (const QString& interface);
@@ -178,6 +184,7 @@ class BluetoothDevice: public QObject {
178184 void iconChanged ();
179185 void batteryAvailableChanged ();
180186 void batteryChanged ();
187+ void rssiChanged ();
181188 void adapterChanged ();
182189
183190private:
@@ -201,6 +208,7 @@ class BluetoothDevice: public QObject {
201208 Q_OBJECT_BINDABLE_PROPERTY (BluetoothDevice, qreal, bBattery, &BluetoothDevice::batteryChanged);
202209 Q_OBJECT_BINDABLE_PROPERTY (BluetoothDevice, BluetoothDeviceState::Enum, bState, &BluetoothDevice::stateChanged);
203210 Q_OBJECT_BINDABLE_PROPERTY (BluetoothDevice, bool , bPairing, &BluetoothDevice::pairingChanged);
211+ Q_OBJECT_BINDABLE_PROPERTY (BluetoothDevice, qint16, bRssi, &BluetoothDevice::rssiChanged);
204212
205213 QS_DBUS_BINDABLE_PROPERTY_GROUP (BluetoothDevice, properties);
206214 QS_DBUS_PROPERTY_BINDING (BluetoothDevice, pAddress, bAddress, properties, " Address" );
@@ -214,6 +222,7 @@ class BluetoothDevice: public QObject {
214222 QS_DBUS_PROPERTY_BINDING (BluetoothDevice, pWakeAllowed, bWakeAllowed, properties, " WakeAllowed" );
215223 QS_DBUS_PROPERTY_BINDING (BluetoothDevice, pIcon, bIcon, properties, " Icon" );
216224 QS_DBUS_PROPERTY_BINDING (BluetoothDevice, pAdapterPath, bAdapterPath, properties, " Adapter" );
225+ QS_DBUS_PROPERTY_BINDING (BluetoothDevice, pRssi, bRssi, properties, " RSSI" , true );
217226
218227 QS_DBUS_BINDABLE_PROPERTY_GROUP (BluetoothDevice, batteryProperties);
219228 QS_DBUS_PROPERTY_BINDING (BluetoothDevice, BatteryPercentage, pBattery, bBattery, batteryProperties, " Percentage" , true );
0 commit comments