CSCI3081W Drone Delivery System
Public Member Functions | List of all members
JsonSession Class Referenceabstract

Abstract class for a session supporting JSON communication with command handling, inherits from JSONSession. More...

#include <WebServer.h>

Inheritance diagram for JsonSession:
Inheritance graph
[legend]
Collaboration diagram for JsonSession:
Collaboration graph
[legend]

Public Member Functions

void receiveJSON (picojson::value &val)
 Receive a command from the web server. More...
 
virtual void receiveCommand (const std::string &cmd, const JsonObject &data, JsonObject &returnValue)=0
 Handles specific commands from the web server. More...
 
- Public Member Functions inherited from JSONSession
virtual void sendJSON (picojson::value &val)
 Sends a JSON message to the client. More...
 
void receiveMessage (const std::string &msg)
 Receives a message from the client and parses it as JSON. More...
 
- Public Member Functions inherited from WebServerBase::Session
 Session ()
 Constructor for Session.
 
virtual ~Session ()
 Destructor.
 
virtual int getId () const
 Returns the ID of the session.
 
virtual void sendMessage (const std::string &msg)
 Sends a message to the client. More...
 
virtual void update ()
 Performs any necessary updates for the session.
 
virtual void onWrite ()
 Function called when the session is ready to write.
 

Detailed Description

Abstract class for a session supporting JSON communication with command handling, inherits from JSONSession.

Member Function Documentation

◆ receiveCommand()

virtual void JsonSession::receiveCommand ( const std::string &  cmd,
const JsonObject data,
JsonObject returnValue 
)
pure virtual

Handles specific commands from the web server.

Parameters
cmdcommand
datadata (JSON)
returnValuereturn value (JSON) which will be sent back to the server

◆ receiveJSON()

void JsonSession::receiveJSON ( picojson::value &  val)
inlinevirtual

Receive a command from the web server.

Parameters
valthe command (in JSON format)

Reimplemented from JSONSession.


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