defuze.me  Client
Public Types | Signals | Public Member Functions | Friends
Network::RemoteEvent Class Reference

The RemotEvent class define an event occuring between the mobile app and the client. More...

#include <remoteevent.hpp>

List of all members.

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
RemoteEventgetRequest () const
const QString & getEvent () const
RemoteSockgetRemote () 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.
RemoteEventnewReply (const QString &name) const
 Create a reply event.
void autoReply (AutoReplyType type) const

Friends

class RemoteSock
class Doorman

Detailed Description

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.


The documentation for this class was generated from the following files: