Hi all,
I'm having some difficulties in implementing a QDS service in qtopia, precisely how to send and retrieve the actual data.
I've been following http://doc.trolltech.com/qtopia4.2/datasharing.html, with these results:
1. The service is being called successfully by my application (despite ignoring any streamed data)
2. The service does require some data to be sent to it, but it is somewhat empty when its read.
3. The service responds with no errors to my application
Here's some pseudo-code of what I'm doing:
My application calling the service:
action = new QDSAction(service); // it is a valid service
// the response and error signals are properly attached to slots
stream << response; // some random string (the request type specified by service)
data = QDSData(array, QMimeType("text/x-qstring"));
data.store();
action->invoke(data);
action = new QDSAction(service); // it is a valid service
// the response and error signals are properly attached to slots
QByteArray array;
QDataStream stream(&array, QIODevice::WriteOnly);
stream << response; // some random string (the request type specified by service)
data = QDSData(array, QMimeType("text/x-qstring"));
data.store();
action->invoke(data);
To copy to clipboard, switch view to plain text mode
In the service:
QDSActionRequest requestCopy(request);
// requestCopy.requestData().data() is ""
// I ignore this and try to send a response
stream << response; // some random string (the return type specified by service)
data = QDSData(array, QMimeType("text/x-qstring"));
data.store();
requestCopy.respond(data);
QDSActionRequest requestCopy(request);
// requestCopy.requestData().data() is ""
// I ignore this and try to send a response
QByteArray array;
QDataStream stream(&array, QIODevice::WriteOnly);
stream << response; // some random string (the return type specified by service)
data = QDSData(array, QMimeType("text/x-qstring"));
data.store();
requestCopy.respond(data);
To copy to clipboard, switch view to plain text mode
In the response signal of my application:
// the copy is necessary to run anything in responseData
// copy.data() is ""
QDSData copy = QDSData(responseData);
// the copy is necessary to run anything in responseData
// copy.data() is ""
QDSData copy = QDSData(responseData);
To copy to clipboard, switch view to plain text mode
In the link above, it is said to create a QByteArray with the method QDSData.store(), but the following line is troublesome:
// responseData is a reference, thus need a copy to execute store()
// store() does not return a QByteArray
// responseData is a reference, thus need a copy to execute store()
// store() does not return a QByteArray
QByteArray imageKey = responseData.store();
To copy to clipboard, switch view to plain text mode
What am I doing wrong? How can I actually see the data the service gets, and the data the service responds?
I think all the relevant information is said, as this post seems rather long, but I can provide more if requested. I'm using Qtopia 4.2.
Thanks in advance.
Bookmarks