45 #include <QtCore/qcoreapplication.h> 46 #include <QtCore/qmetaobject.h> 47 #include <QtCore/qstringlist.h> 48 #include <QtCore/qthread.h> 70 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" 71 " <method name=\"Introspect\">\n" 72 " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n" 77 " <interface name=\"org.freedesktop.DBus.Properties\">\n" 78 " <method name=\"Get\">\n" 79 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" 80 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" 81 " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n" 83 " <method name=\"Set\">\n" 84 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" 85 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" 86 " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n" 88 " <method name=\"GetAll\">\n" 89 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" 90 " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n" 91 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n" 96 " <interface name=\"org.freedesktop.DBus.Peer\">\n" 97 " <method name=\"Ping\"/>\n" 98 " <method name=\"GetMachineId\">\n" 99 " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n" 109 for ( ; it !=
end; ++
it) {
129 "QDBusConnection: internal threading error",
130 "function called for an object that is in another thread!!");
149 for ( ; it !=
end; ++
it) {
155 it->adaptor->metaObject(),
163 xml_data += ifaceXml;
186 for ( ; it !=
end; ++
it)
187 if (it->obj || !it->children.isEmpty())
222 "QDBusConnection: internal threading error",
223 "function called for an object that is in another thread!!");
230 bool interfaceFound =
false;
236 if (interface_name.isEmpty()) {
251 interfaceFound =
true;
252 value = it->adaptor->property(property_name);
257 if (!interfaceFound && !value.
isValid()
261 if (!interface_name.isEmpty())
264 if (interfaceFound) {
311 Q_ASSERT_X(
false,
"",
"Should not be reached");
342 qWarning(
"QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
353 qWarning(
"QDBusConnection: type `%s' (%d) is not registered with QtDBus. " 354 "Use qDBusRegisterMetaType to register it",
371 "QDBusConnection: internal threading error",
372 "function called for an object that is in another thread!!");
384 if (interface_name.isEmpty()) {
406 bool interfaceFound =
true;
407 if (!interface_name.isEmpty())
410 if (interfaceFound) {
417 if (!interface_name.isEmpty())
427 for ( ; it !=
end; ++
it)
428 lhs.
insert(it.key(), it.value());
471 "QDBusConnection: internal threading error",
472 "function called for an object that is in another thread!!");
476 bool interfaceFound =
false;
483 if (interface_name.isEmpty()) {
495 interfaceFound =
true;
502 (!interfaceFound || interface_name.isEmpty())) {
505 interfaceFound =
true;
508 if (!interfaceFound && !interface_name.isEmpty()) {
The QVariant class acts like a union for the most common Qt data types.
static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name, int status)
#define QT_END_NAMESPACE
This macro expands to.
QDBusAdaptorConnector * qDBusFindAdaptorConnector(QObject *obj)
static QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name)
#define it(className, varName)
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
The QByteArray class provides an array of bytes.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
static LibLoadStatus status
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QDBusVirtualObject * treeNode
int count(const T &t) const
Returns the number of occurrences of value in the list.
QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, const QMetaObject *base, int flags)
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
static const char peerInterfaceXml[]
QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
static QDBusMessage propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)
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...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
#define QT_BEGIN_NAMESPACE
This macro expands to.
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...
const_iterator ConstIterator
Qt-style synonym for QMap::const_iterator.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
virtual QString introspect(const QString &path) const =0
This function needs to handle the introspection of the virtual object.
Q_CORE_EXPORT void qWarning(const char *,...)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, const QDBusMessage &msg)
QDBusMessage createReply(const QList< QVariant > &arguments=QList< QVariant >()) const
Constructs a new DBus message representing a reply, with the given arguments.
const char * constData() const
Returns a pointer to the data stored in the byte array.
int qDBusNameToTypeId(const char *name)
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
#define Q_ASSERT_X(cond, where, what)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
int userType() const
Returns the storage type of the value stored in the variant.
QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
static QString generateSubObjectXml(QObject *object)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name)
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, int propFlags=QDBusConnection::ExportAllProperties)
static void saveIntrospectionXml(QDBusAbstractAdaptor *adaptor, const QString &xml)
static const char introspectableInterfaceXml[]
The QDBusMessage class represents one message sent or received over the D-Bus bus.
static const char propertiesInterfaceXml[]
bool isValidPartOfObjectPath(const QString &part)
const_iterator ConstIterator
Qt-style synonym for QVector::const_iterator.
QThread * thread() const
Returns the thread in which the object lives.
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
static const KeyPair *const end
static QVariantMap & operator+=(QVariantMap &lhs, const QVariantMap &rhs)
The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus type...
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
static QVariantMap readAllProperties(QObject *object, int flags)
static QString retrieveIntrospectionXml(QDBusAbstractAdaptor *adaptor)
T qvariant_cast(const QVariant &value)
Returns the given value converted to the template type T.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...