27 #include <tqstringlist.h>
29 #include <dbus/dbus.h>
35 : msg(0), reply(0), q(qq), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), ref(1)
42 dbus_message_unref(
msg);
44 dbus_message_unref(
reply);
51 const TQString &member)
54 message.
d->
type = DBUS_MESSAGE_TYPE_SIGNAL;
63 const TQString &interface,
const TQString &method)
66 message.
d->
type = DBUS_MESSAGE_TYPE_METHOD_CALL;
77 Q_ASSERT(other.
d->
msg);
80 message.
d->
type = DBUS_MESSAGE_TYPE_METHOD_RETURN;
81 message.
d->
reply = dbus_message_ref(other.
d->
msg);
88 Q_ASSERT(other.
d->
msg);
93 tqWarning(
"TQT_DBusMessage: error passed to methodError() is not valid!");
97 message.
d->
type = DBUS_MESSAGE_TYPE_ERROR;
98 message.
d->
reply = dbus_message_ref(other.
d->
msg);
136 DBusMessage *msg = 0;
138 case DBUS_MESSAGE_TYPE_METHOD_CALL:
139 msg = dbus_message_new_method_call(
d->
service.utf8().data(),
143 case DBUS_MESSAGE_TYPE_SIGNAL:
144 msg = dbus_message_new_signal(
d->
path.utf8().data(),
147 case DBUS_MESSAGE_TYPE_METHOD_RETURN:
148 msg = dbus_message_new_method_return(
d->
reply);
150 case DBUS_MESSAGE_TYPE_ERROR:
168 message.
d->
type = dbus_message_get_type(dmsg);
169 message.
d->
path = TQString::fromUtf8(dbus_message_get_path(dmsg));
170 message.
d->
interface = TQString::fromUtf8(dbus_message_get_interface(dmsg));
171 message.
d->
member = TQString::fromUtf8(dbus_message_get_member(dmsg));
172 message.
d->
sender = TQString::fromUtf8(dbus_message_get_sender(dmsg));
173 message.
d->
msg = dbus_message_ref(dmsg);
176 dbus_error_init(&dbusError);
177 if (dbus_set_error_from_message(&dbusError, dmsg))
230 return dbus_message_get_serial(
d->
msg);
245 return dbus_message_get_reply_serial(
d->
msg);
251 case DBUS_MESSAGE_TYPE_METHOD_CALL:
253 case DBUS_MESSAGE_TYPE_METHOD_RETURN:
255 case DBUS_MESSAGE_TYPE_ERROR:
257 case DBUS_MESSAGE_TYPE_SIGNAL:
Class for accurately representing D-Bus data types.
Class for transporting D-Bus errors.
TQString name() const
Returns the D-Bus error name.
TQString message() const
Returns a string describing the error.
bool isValid() const
Returns whether the error object is valid.
static void messageToList(TQValueList< TQT_DBusData > &list, DBusMessage *message)
static void listToMessage(const TQValueList< TQT_DBusData > &list, DBusMessage *message)
A message converts and transports data over D-Bus.
TQT_DBusMessagePrivate * d
static TQT_DBusMessage methodError(const TQT_DBusMessage &other, const TQT_DBusError &error)
Creates a message for replying to a D-Bus method call.
static TQT_DBusMessage methodCall(const TQString &service, const TQString &path, const TQString &interface, const TQString &method)
Creates a message for sending a D-Bus method call.
TQT_DBusError error() const
Returns the error of an error message.
TQT_DBusMessage & operator=(const TQT_DBusMessage &other)
Creates a shallow copy of the given message.
TQString interface() const
Returns the message's interface name.
TQT_DBusMessage()
Creates an empty and invalid message.
void setTimeout(int ms)
Sets the message's timeout.
static TQT_DBusMessage methodReply(const TQT_DBusMessage &other)
Creates a message for replying to a D-Bus method call.
TQString sender() const
Returns the name of the message sender.
int timeout() const
Returns the message's timeout.
TQString member() const
Returns the message's member name.
~TQT_DBusMessage()
Destroys a message.
static TQT_DBusMessage signal(const TQString &path, const TQString &interface, const TQString &member)
Creates a message for sending a D-Bus signal.
int replySerialNumber() const
Returns the message's reply serial number.
MessageType
D-Bus message types.
int serialNumber() const
Returns the message's serial number.
MessageType type() const
Returns which kind of message this is.
TQString path() const
Returns the message's object path.
DBusMessage * toDBusMessage() const
Creates a raw D-Bus message from this TQt3-bindings message.
static TQT_DBusMessage fromDBusMessage(DBusMessage *dmsg)
Creates a TQt3-bindings message from the given raw D-Bus message.
~TQT_DBusMessagePrivate()
TQT_DBusMessagePrivate(TQT_DBusMessage *qq)