Skip to content

Commit 80dff2c

Browse files
committed
bluetooth: mark rssi as a non-required property
1 parent 689c203 commit 80dff2c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/bluetooth/device.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class BluetoothDevice: public QObject {
222222
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, pWakeAllowed, bWakeAllowed, properties, "WakeAllowed");
223223
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, pIcon, bIcon, properties, "Icon");
224224
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, pAdapterPath, bAdapterPath, properties, "Adapter");
225-
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, pRssi, bRssi, properties, "RSSI", true);
225+
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, pRssi, bRssi, properties, "RSSI", false);
226226

227227
QS_DBUS_BINDABLE_PROPERTY_GROUP(BluetoothDevice, batteryProperties);
228228
QS_DBUS_PROPERTY_BINDING(BluetoothDevice, BatteryPercentage, pBattery, bBattery, batteryProperties, "Percentage", true);

src/dbus/properties.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ void DBusPropertyGroup::updatePropertySet(const QVariantMap& properties, bool co
214214
}
215215
}
216216

217-
void DBusPropertyGroup::tryUpdateProperty(DBusPropertyCore* property, const QVariant& variant)
218-
const {
217+
void DBusPropertyGroup::tryUpdateProperty(
218+
DBusPropertyCore* property,
219+
const QVariant& variant
220+
) const {
219221
property->mExists = true;
220222

221223
auto error = property->store(variant);
@@ -246,8 +248,17 @@ void DBusPropertyGroup::requestPropertyUpdate(DBusPropertyCore* property) {
246248
const QDBusPendingReply<QDBusVariant> reply = *call;
247249

248250
if (reply.isError()) {
249-
qCWarning(logDbusProperties).noquote() << "Error updating property" << propStr;
250-
qCWarning(logDbusProperties) << reply.error();
251+
const auto& error = reply.error();
252+
// For optional properties, suppress "No such property" errors specifically
253+
if (!property->isRequired() && error.type() == QDBusError::InvalidArgs
254+
&& error.message().contains("No such property"))
255+
{
256+
qCDebug(logDbusProperties).noquote() << "Error updating optional property" << propStr;
257+
qCDebug(logDbusProperties) << error;
258+
} else {
259+
qCWarning(logDbusProperties).noquote() << "Error updating property" << propStr;
260+
qCWarning(logDbusProperties) << error;
261+
}
251262
} else {
252263
this->tryUpdateProperty(property, reply.value().variant());
253264
}

0 commit comments

Comments
 (0)