defuze.me
Client
|
The RemotEvent class define an event occuring between the mobile app and the client. More...
#include <remoteevent.hpp>
Public Types | |
enum | AutoReplyType { OK, NO_CHANGES, ERROR } |
Signals | |
void | receiveReply (const RemoteEvent &) |
Signal called when a reply to this event is received. | |
Public Member Functions | |
unsigned | getUid () const |
bool | isReply () const |
unsigned | getRequestId () const |
RemoteEvent * | getRequest () const |
const QString & | getEvent () const |
RemoteSock * | getRemote () const |
void | setData (const QVariantMap &data) |
QVariant & | operator[] (const QString &key) |
QVariant | operator[] (const QString &key) const |
void | send () |
send the event to the saved remote | |
void | sendWithReply (const QObject *, const char *) |
send the event and connect the reply callback | |
QByteArray | toStream () const |
Turn the event into a formated json stream. | |
RemoteEvent & | newReply (const QString &name) const |
Create a reply event. | |
void | autoReply (AutoReplyType type) const |
Friends | |
class | RemoteSock |
class | Doorman |
The RemotEvent class define an event occuring between the mobile app and the client.
To send an event you should follow this pattern:
// Create an event associated to the client RemoteEvent *event = client->newEvent("authenticationRequest"); // Fill any data field you want (*event)["msg"] = "All right sir!"; // Send it to the client event->send(); // You MUST not delete the event by hand, the remote sock will do it when it's done.
To send an event waiting for a reply you should send it like this:
// This will link the given callback to the first received reply event->sendWithReply(this, SLOT(replyReceived(const RemoteEvent&)));
Definition at line 45 of file remoteevent.hpp.