BlueZ: rename generated DBus propperites interface class

To avoid symbol clashing with the same interface added to QtGui in
qtbase/38251c36edf11316a2467169b1d491bf13520fd3.
Conveniently, qdbusxml2cpp already provides a command line option to
set a custom name for the generated class.

It's easier to fix it on QtBluetooth side, because the files are
generated by the script and later committed to the repo, while on
QtGui side they are handled directly by CMake, which for now provides
less granularity.

As a drive-by: fix an error in the DBus interface description.

Fixes: QTBUG-133553
Pick-to: 6.9 6.8
Change-Id: I2ab413bf617f53e26c37e430198e58071c84d49c
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ivan Solovev 2025-02-10 11:07:55 +01:00
parent 42cb59dcde
commit e3a72c6017
11 changed files with 41 additions and 41 deletions

View File

@ -254,7 +254,7 @@ public:
int reference; int reference;
bool wasListeningAlready; bool wasListeningAlready;
OrgFreedesktopDBusPropertiesInterface *propteryListener = nullptr; OrgFreedesktopDBusPropertiesInterfaceBluetooth *propteryListener = nullptr;
}; };
class QtBluezDiscoveryManagerPrivate class QtBluezDiscoveryManagerPrivate
@ -335,9 +335,9 @@ bool QtBluezDiscoveryManager::registerDiscoveryInterest(const QString &adapterPa
AdapterData *data = new AdapterData(); AdapterData *data = new AdapterData();
OrgFreedesktopDBusPropertiesInterface *propIface = new OrgFreedesktopDBusPropertiesInterface( OrgFreedesktopDBusPropertiesInterfaceBluetooth *propIface = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(
QStringLiteral("org.bluez"), adapterPath, QDBusConnection::systemBus()); QStringLiteral("org.bluez"), adapterPath, QDBusConnection::systemBus());
connect(propIface, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(propIface, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, &QtBluezDiscoveryManager::PropertiesChanged); this, &QtBluezDiscoveryManager::PropertiesChanged);
data->propteryListener = propIface; data->propteryListener = propIface;
@ -406,8 +406,8 @@ void QtBluezDiscoveryManager::PropertiesChanged(const QString &interface,
{ {
Q_UNUSED(invalidated_properties); Q_UNUSED(invalidated_properties);
OrgFreedesktopDBusPropertiesInterface *propIface = OrgFreedesktopDBusPropertiesInterfaceBluetooth *propIface =
qobject_cast<OrgFreedesktopDBusPropertiesInterface *>(sender()); qobject_cast<OrgFreedesktopDBusPropertiesInterfaceBluetooth *>(sender());
if (!propIface) if (!propIface)
return; return;

View File

@ -22,7 +22,7 @@ process profilemanager1 org.bluez.ProfileManager1.xml
process profile1 org.bluez.Profile1.xml process profile1 org.bluez.Profile1.xml
process objectmanager org.freedesktop.dbus.objectmanager.xml -i bluez5_helper_p.h process objectmanager org.freedesktop.dbus.objectmanager.xml -i bluez5_helper_p.h
process properties org.freedesktop.dbus.properties.xml process properties org.freedesktop.dbus.properties.xml -c OrgFreedesktopDBusPropertiesInterfaceBluetooth
process gattchar1 org.bluez.GattCharacteristic1.xml process gattchar1 org.bluez.GattCharacteristic1.xml
process gattdesc1 org.bluez.GattDescriptor1.xml process gattdesc1 org.bluez.GattDescriptor1.xml

View File

@ -20,7 +20,7 @@
<signal name="PropertiesChanged"> <signal name="PropertiesChanged">
<arg name="interface" type="s"/> <arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/> <arg name="changed_properties" type="a{sv}"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg name="invalidated_properties" type="as"/> <arg name="invalidated_properties" type="as"/>
</signal> </signal>
</interface> </interface>

View File

@ -1,8 +1,8 @@
/* /*
* This file was generated by qdbusxml2cpp version 0.8 * This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -I QtCore/private/qglobal_p.h -p properties_p.h:properties.cpp org.freedesktop.dbus.properties.xml * Source file was org.freedesktop.dbus.properties.xml
* *
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd. * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors.
* *
* This is an auto-generated file. * This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments * This file may have been hand-edited. Look for HAND-EDIT comments
@ -12,15 +12,15 @@
#include "properties_p.h" #include "properties_p.h"
/* /*
* Implementation of interface class OrgFreedesktopDBusPropertiesInterface * Implementation of interface class OrgFreedesktopDBusPropertiesInterfaceBluetooth
*/ */
OrgFreedesktopDBusPropertiesInterface::OrgFreedesktopDBusPropertiesInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) OrgFreedesktopDBusPropertiesInterfaceBluetooth::OrgFreedesktopDBusPropertiesInterfaceBluetooth(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{ {
} }
OrgFreedesktopDBusPropertiesInterface::~OrgFreedesktopDBusPropertiesInterface() OrgFreedesktopDBusPropertiesInterfaceBluetooth::~OrgFreedesktopDBusPropertiesInterfaceBluetooth()
{ {
} }

View File

@ -1,8 +1,8 @@
/* /*
* This file was generated by qdbusxml2cpp version 0.8 * This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -I QtCore/private/qglobal_p.h -p properties_p.h:properties.cpp org.freedesktop.dbus.properties.xml * Source file was org.freedesktop.dbus.properties.xml
* *
* qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd. * qdbusxml2cpp is Copyright (C) The Qt Company Ltd. and other contributors.
* *
* This is an auto-generated file. * This is an auto-generated file.
* Do not edit! All changes made to it will be lost. * Do not edit! All changes made to it will be lost.
@ -35,7 +35,7 @@
/* /*
* Proxy class for interface org.freedesktop.DBus.Properties * Proxy class for interface org.freedesktop.DBus.Properties
*/ */
class OrgFreedesktopDBusPropertiesInterface: public QDBusAbstractInterface class OrgFreedesktopDBusPropertiesInterfaceBluetooth: public QDBusAbstractInterface
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -43,9 +43,9 @@ public:
{ return "org.freedesktop.DBus.Properties"; } { return "org.freedesktop.DBus.Properties"; }
public: public:
OrgFreedesktopDBusPropertiesInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); OrgFreedesktopDBusPropertiesInterfaceBluetooth(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~OrgFreedesktopDBusPropertiesInterface(); ~OrgFreedesktopDBusPropertiesInterfaceBluetooth();
public Q_SLOTS: // METHODS public Q_SLOTS: // METHODS
inline QDBusPendingReply<QDBusVariant> Get(const QString &interface, const QString &name) inline QDBusPendingReply<QDBusVariant> Get(const QString &interface, const QString &name)
@ -77,7 +77,7 @@ Q_SIGNALS: // SIGNALS
namespace org { namespace org {
namespace freedesktop { namespace freedesktop {
namespace DBus { namespace DBus {
using Properties = ::OrgFreedesktopDBusPropertiesInterface; using Properties = ::OrgFreedesktopDBusPropertiesInterfaceBluetooth;
} }
} }
} }

View File

@ -139,9 +139,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
q, [this](const QString &path){ q, [this](const QString &path){
this->_q_discoveryInterrupted(path); this->_q_discoveryInterrupted(path);
}); });
OrgFreedesktopDBusPropertiesInterface *prop = new OrgFreedesktopDBusPropertiesInterface( OrgFreedesktopDBusPropertiesInterfaceBluetooth *prop = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(
QStringLiteral("org.bluez"), QStringLiteral(""), QDBusConnection::systemBus()); QStringLiteral("org.bluez"), QStringLiteral(""), QDBusConnection::systemBus());
QObject::connect(prop, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, QObject::connect(prop, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
q, [this](const QString &interface, const QVariantMap &changedProperties, q, [this](const QString &interface, const QVariantMap &changedProperties,
const QStringList &invalidatedProperties, const QStringList &invalidatedProperties,
const QDBusMessage &signal) { const QDBusMessage &signal) {

View File

@ -39,7 +39,7 @@
class OrgBluezManagerInterface; class OrgBluezManagerInterface;
class OrgBluezAdapterInterface; class OrgBluezAdapterInterface;
class OrgFreedesktopDBusObjectManagerInterface; class OrgFreedesktopDBusObjectManagerInterface;
class OrgFreedesktopDBusPropertiesInterface; class OrgFreedesktopDBusPropertiesInterfaceBluetooth;
class OrgBluezAdapter1Interface; class OrgBluezAdapter1Interface;
class OrgBluezDevice1Interface; class OrgBluezDevice1Interface;
@ -133,7 +133,7 @@ private:
OrgFreedesktopDBusObjectManagerInterface *manager = nullptr; OrgFreedesktopDBusObjectManagerInterface *manager = nullptr;
OrgBluezAdapter1Interface *adapter = nullptr; OrgBluezAdapter1Interface *adapter = nullptr;
QTimer *discoveryTimer = nullptr; QTimer *discoveryTimer = nullptr;
QList<OrgFreedesktopDBusPropertiesInterface *> propertyMonitors; QList<OrgFreedesktopDBusPropertiesInterfaceBluetooth *> propertyMonitors;
void deviceFound(const QString &devicePath, const QVariantMap &properties); void deviceFound(const QString &devicePath, const QVariantMap &properties);

View File

@ -407,7 +407,7 @@ void QBluetoothLocalDevicePrivate::connectDeviceChanges()
if (reply.isError()) if (reply.isError())
return; return;
OrgFreedesktopDBusPropertiesInterface *monitor = nullptr; OrgFreedesktopDBusPropertiesInterfaceBluetooth *monitor = nullptr;
ManagedObjectList managedObjectList = reply.value(); ManagedObjectList managedObjectList = reply.value();
for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) { for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) {
@ -423,10 +423,10 @@ void QBluetoothLocalDevicePrivate::connectDeviceChanges()
const QVariantMap &ifaceValues = jt.value(); const QVariantMap &ifaceValues = jt.value();
if (iface == QStringLiteral("org.bluez.Device1")) { if (iface == QStringLiteral("org.bluez.Device1")) {
monitor = new OrgFreedesktopDBusPropertiesInterface(QStringLiteral("org.bluez"), monitor = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(QStringLiteral("org.bluez"),
path.path(), path.path(),
QDBusConnection::systemBus(), this); QDBusConnection::systemBus(), this);
connect(monitor, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(monitor, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, &QBluetoothLocalDevicePrivate::PropertiesChanged); this, &QBluetoothLocalDevicePrivate::PropertiesChanged);
deviceChangeMonitors.insert(path.path(), monitor); deviceChangeMonitors.insert(path.path(), monitor);
@ -478,10 +478,10 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
if (adapter) { if (adapter) {
//hook up propertiesChanged for current adapter //hook up propertiesChanged for current adapter
adapterProperties = new OrgFreedesktopDBusPropertiesInterface( adapterProperties = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(
QStringLiteral("org.bluez"), adapter->path(), QStringLiteral("org.bluez"), adapter->path(),
QDBusConnection::systemBus(), this); QDBusConnection::systemBus(), this);
connect(adapterProperties, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(adapterProperties, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, &QBluetoothLocalDevicePrivate::PropertiesChanged); this, &QBluetoothLocalDevicePrivate::PropertiesChanged);
} }
} }
@ -528,8 +528,8 @@ void QBluetoothLocalDevicePrivate::PropertiesChanged(const QString &interface,
} else if (interface == QStringLiteral("org.bluez.Device1") } else if (interface == QStringLiteral("org.bluez.Device1")
&& changed_properties.contains(QStringLiteral("Connected"))) { && changed_properties.contains(QStringLiteral("Connected"))) {
// update list of connected devices // update list of connected devices
OrgFreedesktopDBusPropertiesInterface *senderIface = OrgFreedesktopDBusPropertiesInterfaceBluetooth *senderIface =
qobject_cast<OrgFreedesktopDBusPropertiesInterface*>(sender()); qobject_cast<OrgFreedesktopDBusPropertiesInterfaceBluetooth*>(sender());
if (!senderIface) if (!senderIface)
return; return;
@ -556,11 +556,11 @@ void QBluetoothLocalDevicePrivate::InterfacesAdded(const QDBusObjectPath &object
// a new device was added which we need to add to list of known devices // a new device was added which we need to add to list of known devices
if (objectPathIsForThisDevice(deviceAdapterPath, object_path.path())) { if (objectPathIsForThisDevice(deviceAdapterPath, object_path.path())) {
OrgFreedesktopDBusPropertiesInterface *monitor = new OrgFreedesktopDBusPropertiesInterface( OrgFreedesktopDBusPropertiesInterfaceBluetooth *monitor = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(
QStringLiteral("org.bluez"), QStringLiteral("org.bluez"),
object_path.path(), object_path.path(),
QDBusConnection::systemBus()); QDBusConnection::systemBus());
connect(monitor, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(monitor, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, &QBluetoothLocalDevicePrivate::PropertiesChanged); this, &QBluetoothLocalDevicePrivate::PropertiesChanged);
deviceChangeMonitors.insert(object_path.path(), monitor); deviceChangeMonitors.insert(object_path.path(), monitor);

View File

@ -28,7 +28,7 @@
#include "bluez/bluez5_helper_p.h" #include "bluez/bluez5_helper_p.h"
class OrgBluezAdapter1Interface; class OrgBluezAdapter1Interface;
class OrgFreedesktopDBusPropertiesInterface; class OrgFreedesktopDBusPropertiesInterfaceBluetooth;
class OrgFreedesktopDBusObjectManagerInterface; class OrgFreedesktopDBusObjectManagerInterface;
class OrgBluezDevice1Interface; class OrgBluezDevice1Interface;
@ -107,9 +107,9 @@ public:
QSet<QBluetoothAddress> connectedDevicesSet; QSet<QBluetoothAddress> connectedDevicesSet;
OrgBluezAdapter1Interface *adapter = nullptr; OrgBluezAdapter1Interface *adapter = nullptr;
OrgFreedesktopDBusPropertiesInterface *adapterProperties = nullptr; OrgFreedesktopDBusPropertiesInterfaceBluetooth *adapterProperties = nullptr;
OrgFreedesktopDBusObjectManagerInterface *manager = nullptr; OrgFreedesktopDBusObjectManagerInterface *manager = nullptr;
QMap<QString, OrgFreedesktopDBusPropertiesInterface *> deviceChangeMonitors; QMap<QString, OrgFreedesktopDBusPropertiesInterfaceBluetooth *> deviceChangeMonitors;
QList<QBluetoothAddress> connectedDevices() const; QList<QBluetoothAddress> connectedDevices() const;

View File

@ -340,10 +340,10 @@ void QLowEnergyControllerPrivateBluezDBus::connectToDeviceHelper()
device = new OrgBluezDevice1Interface( device = new OrgBluezDevice1Interface(
QStringLiteral("org.bluez"), devicePath, QStringLiteral("org.bluez"), devicePath,
QDBusConnection::systemBus(), this); QDBusConnection::systemBus(), this);
deviceMonitor = new OrgFreedesktopDBusPropertiesInterface( deviceMonitor = new OrgFreedesktopDBusPropertiesInterfaceBluetooth(
QStringLiteral("org.bluez"), devicePath, QStringLiteral("org.bluez"), devicePath,
QDBusConnection::systemBus(), this); QDBusConnection::systemBus(), this);
connect(deviceMonitor, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(deviceMonitor, &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, &QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged); this, &QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged);
} }
@ -736,11 +736,11 @@ void QLowEnergyControllerPrivateBluezDBus::discoverServiceDetails(
// every ClientCharacteristicConfiguration needs to track property changes // every ClientCharacteristicConfiguration needs to track property changes
if (descData.uuid if (descData.uuid
== QBluetoothUuid(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration)) { == QBluetoothUuid(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration)) {
dbusChar.charMonitor = QSharedPointer<OrgFreedesktopDBusPropertiesInterface>::create( dbusChar.charMonitor = QSharedPointer<OrgFreedesktopDBusPropertiesInterfaceBluetooth>::create(
QStringLiteral("org.bluez"), QStringLiteral("org.bluez"),
dbusChar.characteristic->path(), dbusChar.characteristic->path(),
QDBusConnection::systemBus(), this); QDBusConnection::systemBus(), this);
connect(dbusChar.charMonitor.data(), &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, connect(dbusChar.charMonitor.data(), &OrgFreedesktopDBusPropertiesInterfaceBluetooth::PropertiesChanged,
this, [this, indexHandle](const QString &interface, const QVariantMap &changedProperties, this, [this, indexHandle](const QString &interface, const QVariantMap &changedProperties,
const QStringList &removedProperties) { const QStringList &removedProperties) {

View File

@ -29,7 +29,7 @@ class OrgBluezGattCharacteristic1Interface;
class OrgBluezGattDescriptor1Interface; class OrgBluezGattDescriptor1Interface;
class OrgBluezGattService1Interface; class OrgBluezGattService1Interface;
class OrgFreedesktopDBusObjectManagerInterface; class OrgFreedesktopDBusObjectManagerInterface;
class OrgFreedesktopDBusPropertiesInterface; class OrgFreedesktopDBusPropertiesInterfaceBluetooth;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -108,7 +108,7 @@ private:
OrgBluezAdapter1Interface* adapter{}; OrgBluezAdapter1Interface* adapter{};
OrgBluezDevice1Interface* device{}; OrgBluezDevice1Interface* device{};
OrgFreedesktopDBusObjectManagerInterface* managerBluez{}; OrgFreedesktopDBusObjectManagerInterface* managerBluez{};
OrgFreedesktopDBusPropertiesInterface* deviceMonitor{}; OrgFreedesktopDBusPropertiesInterfaceBluetooth* deviceMonitor{};
QString adapterPathWithPeripheralSupport; QString adapterPathWithPeripheralSupport;
int remoteMtu{-1}; int remoteMtu{-1};
@ -133,7 +133,7 @@ private:
struct GattCharacteristic struct GattCharacteristic
{ {
QSharedPointer<OrgBluezGattCharacteristic1Interface> characteristic; QSharedPointer<OrgBluezGattCharacteristic1Interface> characteristic;
QSharedPointer<OrgFreedesktopDBusPropertiesInterface> charMonitor; QSharedPointer<OrgFreedesktopDBusPropertiesInterfaceBluetooth> charMonitor;
QList<QSharedPointer<OrgBluezGattDescriptor1Interface>> descriptors; QList<QSharedPointer<OrgBluezGattDescriptor1Interface>> descriptors;
}; };