Handles communication with the ManiaPlanet server. More...
#include <GbxRemote.h>
Public Member Functions | |
~GbxRemote () | |
bool | Init (int port) |
Initializes connection with the local server. More... | |
bool | InitWithIp (std::string address, int port) |
Initializes connection with the server. More... | |
void | Terminate () |
Closes the connection with the server. | |
bool | Query (GbxMessage query) |
Sends a GbxMessage to the server. More... | |
bool | ReadCallBacks () |
Read callbacks from the server. More... | |
void | HandleCallBack (std::string data) |
Handles callbacks (de-XML-fies them). More... | |
std::vector< GbxCallBack > | GetCBResponses () |
Returns the callbacks that have been received since last call. | |
void | ResetCBResponses () |
Resets list of current callbacks. | |
GbxResponse * | GetResponse () |
Returns the response from the server. | |
GbxError | GetCurrentError () |
Returns the current server error. More... | |
int | GetProtocol () |
Returns the current version number of the server protocol (1 or 2). | |
std::string | GetApiVersion () |
Returns the set API version. | |
Private Attributes | |
bool | connected = false |
Is the client connected with the server? | |
int | protocol = 0 |
Protocol version (0 = uninitialized, 1 or 2 = version). | |
std::string | apiVersion |
Server API version. | |
TcpClient | server |
Socket connection with the server. | |
GbxError | currentError = GbxError() |
Current server error. | |
GbxResponse * | currentResponse = new GbxResponse |
Current server response. | |
std::vector< GbxCallBack > | currentCallBacks = std::vector<GbxCallBack>() |
List of currently received callbacks. | |
Handles communication with the ManiaPlanet server.
GbxRemote::~GbxRemote | ( | ) |
Deletes and nullifies the currentError and currentResponse.
GbxError GbxRemote::GetCurrentError | ( | ) |
Returns the current server error.
Returns empty GbxError when there currently is no error.
void GbxRemote::HandleCallBack | ( | std::string | data | ) |
Handles callbacks (de-XML-fies them).
data | Raw response from the server. |
bool GbxRemote::Init | ( | int | port | ) |
Initializes connection with the local server.
port | XML-RPC port of the server. |
bool GbxRemote::InitWithIp | ( | std::string | address, |
int | port | ||
) |
Initializes connection with the server.
address | Address of the server. |
port | XML-RPC port of the server. |
bool GbxRemote::Query | ( | GbxMessage | query | ) |
Sends a GbxMessage to the server.
Returns whether the query was successfully sent.
query | Query to be send. |
bool GbxRemote::ReadCallBacks | ( | ) |
Read callbacks from the server.
Returns whether it found a callback.