8#include <QtCore/qcoreapplication.h>
9#include <QtCore/qmetaobject.h>
10#include <QtCore/qstringlist.h>
11#include <QtCore/qthread.h>
37 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
38 " <method name=\"Introspect\">\n"
39 " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n"
44 " <interface name=\"org.freedesktop.DBus.Properties\">\n"
45 " <method name=\"Get\">\n"
46 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
47 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"
48 " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n"
50 " <method name=\"Set\">\n"
51 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
52 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"
53 " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n"
55 " <method name=\"GetAll\">\n"
56 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
57 " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n"
58 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"
60 " <signal name=\"PropertiesChanged\">\n"
61 " <arg name=\"interface_name\" type=\"s\" direction=\"out\"/>\n"
62 " <arg name=\"changed_properties\" type=\"a{sv}\" direction=\"out\"/>\n"
63 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out1\" value=\"QVariantMap\"/>\n"
64 " <arg name=\"invalidated_properties\" type=\"as\" direction=\"out\"/>\n"
69 " <interface name=\"org.freedesktop.DBus.Peer\">\n"
70 " <method name=\"Ping\"/>\n"
71 " <method name=\"GetMachineId\">\n"
72 " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n"
82 retval +=
" <node name=\""_L1 +
name +
"\"/>\n"_L1;
94 xml_data +=
"<node>\n"_L1;
98 "QDBusConnection: internal threading error",
99 "function called for an object that is in another thread!!");
105 for ( ;
mo != &QObject::staticMetaObject;
mo =
mo->superClass())
117 std::as_const(connector->
adaptors)) {
125 adaptorData.adaptor->metaObject(),
126 &QDBusAbstractAdaptor::staticMetaObject,
134 xml_data += ifaceXml;
155 xml_data +=
" <node name=\""_L1 + node.
name +
"\"/>\n"_L1;
159 xml_data +=
"</node>\n"_L1;
168 "Interface %1 was not found in object %2"_L1
169 .
arg(interface_name, msg.
path()));
176 "Property %1%2%3 was not found in object %4"_L1
178 interface_name.
isEmpty() ?
""_L1 :
"."_L1,
188 "QDBusConnection: internal threading error",
189 "function called for an object that is in another thread!!");
196 bool interfaceFound =
false;
202 if (interface_name.
isEmpty()) {
205 int pidx =
mo->indexOfProperty(property_name);
207 value =
mo->property(pidx).read(adaptorData.adaptor);
216 interfaceFound =
true;
217 value =
it->adaptor->property(property_name);
222 if (!interfaceFound && !
value.isValid()
229 if (interfaceFound) {
230 int pidx = node.
obj->metaObject()->indexOfProperty(property_name);
240 if (!
value.isValid()) {
266 "Invalid arguments for writing to property %1%2%3"_L1
268 interface_name.
isEmpty() ?
""_L1 :
"."_L1,
272 "Property %1%2%3 is read-only"_L1
274 interface_name.
isEmpty() ?
""_L1 :
"."_L1,
283 Q_ASSERT_X(
false,
"",
"Should not be reached");
291 int pidx =
mo->indexOfProperty(property_name);
315 qWarning(
"QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
324 qWarning(
"QDBusConnection: type '%s' (%d) is not registered with QtDBus. "
325 "Use qDBusRegisterMetaType to register it",
333 if (mp.
metaType() == QMetaType::fromType<QDBusVariant>())
345 "QDBusConnection: internal threading error",
346 "function called for an object that is in another thread!!");
358 if (interface_name.
isEmpty()) {
360 std::as_const(connector->
adaptors)) {
380 bool interfaceFound =
true;
384 if (interfaceFound) {
410 for (
int i = QObject::staticMetaObject.propertyCount();
i <
mo->propertyCount(); ++
i) {
443 "QDBusConnection: internal threading error",
444 "function called for an object that is in another thread!!");
448 bool interfaceFound =
false;
455 if (interface_name.
isEmpty()) {
458 std::as_const(connector->
adaptors)) {
468 interfaceFound =
true;
475 (!interfaceFound || interface_name.
isEmpty())) {
478 interfaceFound =
true;
481 if (!interfaceFound && !interface_name.
isEmpty()) {
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
static void saveIntrospectionXml(QDBusAbstractAdaptor *adaptor, const QString &xml)
static QString retrieveIntrospectionXml(QDBusAbstractAdaptor *adaptor)
@ ExportNonScriptableContents
@ ExportNonScriptableProperties
@ ExportScriptableContents
@ ExportScriptableProperties
QDBusMessage createReply(const QList< QVariant > &arguments=QList< QVariant >()) const
Constructs a new DBus message representing a reply, with the given arguments.
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
QString path() const
Returns the path of the object that this message is being sent to (in the case of a method call) or b...
QDBusMessage createErrorReply(const QString &name, const QString &msg) const
Constructs a new DBus message representing an error reply message, with the given name and msg.
virtual QString introspect(const QString &path) const =0
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
const_iterator constBegin() const noexcept
const_iterator cend() const noexcept
const_iterator constEnd() const noexcept
const_iterator ConstIterator
iterator insert(const Key &key, const T &value)
QThread * thread() const
Returns the thread in which the object lives.
QVariant property(const char *name) const
Returns the value of the object's name property.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QByteArray toUtf8() const &
static QThread * currentThread()
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
QSet< QString >::iterator it
bool isValidPartOfObjectPath(QStringView part)
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char * interface
QDBusAdaptorConnector * qDBusFindAdaptorConnector(QObject *obj)
bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name)
static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name, int status)
static QVariantMap & operator+=(QVariantMap &lhs, const QVariantMap &rhs)
static QString generateSubObjectXml(QObject *object)
Q_DBUS_EXPORT QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, const QMetaObject *base, int flags)
static QVariantMap readAllProperties(QObject *object, int flags)
QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, int propFlags=QDBusConnection::ExportAllProperties)
QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
static const char introspectableInterfaceXml[]
static const char propertiesInterfaceXml[]
static QDBusMessage propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)
QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
static const char peerInterfaceXml[]
static QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLchar *const * path
#define Q_ASSERT_X(cond, x, msg)
QDBusVirtualObject * treeNode