![]() |
Beaming Scene Service
2.0
RakNet wrapper for managing data communications between multiple Beaming clients
|
Use PHPConnections as a C++ client to Connections.php. More...
#include <PHPConnections.h>
Public Member Functions | |
PHPConnections () | |
virtual | ~PHPConnections () |
void | Init (HTTPConnection *_http, const char *_path) |
void | SetField (RakNet::RakString columnName, RakNet::RakString value) |
unsigned int | GetFieldCount (void) const |
Returns the number of fields set with SetField() | |
void | GetField (unsigned int index, RakNet::RakString &columnName, RakNet::RakString &value) |
void | SetFields (DataStructures::Table *table) |
void | ClearFields (void) |
Clear all fields. | |
void | UploadTable (RakNet::RakString uploadPassword, RakNet::RakString clientName, unsigned short clientPort, bool autoRepost) |
void | DownloadTable (RakNet::RakString downloadPassword) |
void | UploadAndDownloadTable (RakNet::RakString uploadPassword, RakNet::RakString downloadPassword, RakNet::RakString clientName, unsigned short clientPort, bool autoRepost) |
HTTPReadResult | ProcessHTTPRead (RakNet::RakString httpRead) |
const DataStructures::Table * | GetLastDownloadedTable (void) const |
void | Update (void) |
Call this periodically - it will handle connection states and refreshing updates to the server. |
Use PHPConnections as a C++ client to Connections.php.
PHPConnections works with the HTTPConnection class (which works with the TCPInterface class) in order to communiate with Connections.php
Definition at line 40 of file PHPConnections.h.
Definition at line 43 of file PHPConnections.cpp.
PHPConnections::~PHPConnections | ( | ) | [virtual] |
Definition at line 48 of file PHPConnections.cpp.
void PHPConnections::ClearFields | ( | void | ) |
Clear all fields.
Definition at line 99 of file PHPConnections.cpp.
void PHPConnections::DownloadTable | ( | RakNet::RakString | downloadPassword | ) |
Send a download request to the PHP server. On success: 1. HTTPConnection::HasRead() will return true. 2. Pass the value returned by HTTPConnection::Read() to PHPConnections::ProcessHTTPRead(). 3. The return value of PHPConnections::ProcessHTTPRead() will be HTTP_RESULT_GOT_TABLE or HTTP_RESULT_EMPTY 4. On HTTP_RESULT_GOT_TABLE, use GetLastDownloadedTable() to read the results.
[in] | downloadPassword | The download password set in the PHP page itself when you first uploaded and viewed it in the webpage. |
Definition at line 119 of file PHPConnections.cpp.
void PHPConnections::GetField | ( | unsigned int | index, |
RakNet::RakString & | columnName, | ||
RakNet::RakString & | value | ||
) |
Returns a field set with SetField()
[in] | index | The 0 based index into the field list |
[out] | columnName | The columnName parameter passed to SetField() |
[out] | value | The value parameter passed to SetField() |
Definition at line 76 of file PHPConnections.cpp.
unsigned int PHPConnections::GetFieldCount | ( | void | ) | const |
Returns the number of fields set with SetField()
Definition at line 72 of file PHPConnections.cpp.
const DataStructures::Table * PHPConnections::GetLastDownloadedTable | ( | void | ) | const |
Returns the last value returned from ProcessHTTPString Default columns are "__CLIENT_NAME", "__CLIENT_PORT", "_System_Address"
Definition at line 246 of file PHPConnections.cpp.
void PHPConnections::Init | ( | HTTPConnection * | _http, |
const char * | _path | ||
) |
Associate PHPConnections with the HTTPConnection class it will communicate through
[in] | _http | The instance of HTTP connection we will communicate through |
[in] | _path | The path to the PHP file on the remote server. For example, if the path is mysite.com/raknet/Connections.php then you would enter raknet/Connections.php |
Definition at line 51 of file PHPConnections.cpp.
HTTPReadResult PHPConnections::ProcessHTTPRead | ( | RakNet::RakString | httpRead | ) |
When HTTPConnection::ProcessDataPacket() returns true, and not an error, pass HTTPConnection::Read() to this function The message will be parsed into DataStructures::Table, and a copy stored internally which can be retrieved by GetLastDownloadedTable();
[in] | packetData | Returned from HTTPInterface::Read() |
Definition at line 142 of file PHPConnections.cpp.
void PHPConnections::SetField | ( | RakNet::RakString | columnName, |
RakNet::RakString | value | ||
) |
Set a parameter (these are passed to the server) To delete a column, just pass an empty string for value Store the client name and port with UploadTable, rather than SetField, as these columns are required and use reserved column names
[in] | columnName | The name of the column to store |
[in] | value | What value to hold for the uploaded row (only one row can be uploaded at a time) |
Definition at line 57 of file PHPConnections.cpp.
void PHPConnections::SetFields | ( | DataStructures::Table * | table | ) |
Set all parameters at once from a table
[in] | table | A table containing the values you want to send. Note that all values are stored as strings in PHP |
Definition at line 82 of file PHPConnections.cpp.
void PHPConnections::Update | ( | void | ) |
Call this periodically - it will handle connection states and refreshing updates to the server.
Definition at line 278 of file PHPConnections.cpp.
void PHPConnections::UploadAndDownloadTable | ( | RakNet::RakString | uploadPassword, |
RakNet::RakString | downloadPassword, | ||
RakNet::RakString | clientName, | ||
unsigned short | clientPort, | ||
bool | autoRepost | ||
) |
Same as calling DownloadTable immediately followed by UploadTable, except only the download result is returned
[in] | uploadPassword | The upload password set in the PHP page itself when you first uploaded and viewed it in the webpage. |
[in] | downloadPassword | The download password set in the PHP page itself when you first uploaded and viewed it in the webpage. |
[in] | clientName | Every entry must have a client name. Pass it here. |
[in] | clientPort | Every entry must have a client port. Pass it here. The IP address will be stored automatically, or you can manually set it by passing a field named _System_Address |
[in] | autoRepost | Tables must be uploaded every 60 seconds or they get dropped. Set autoRepost to true to automatically reupload the most recent table. |
Definition at line 125 of file PHPConnections.cpp.
void PHPConnections::UploadTable | ( | RakNet::RakString | uploadPassword, |
RakNet::RakString | clientName, | ||
unsigned short | clientPort, | ||
bool | autoRepost | ||
) |
Upload the values set with SetFields() or SetField() On success: 1. HTTPConnection::HasRead() will return true. 2. Pass the value returned by HTTPConnection::Read() to PHPConnections::ProcessHTTPRead(). 3. The return value of PHPConnections::ProcessHTTPRead() will be HTTP_RESULT_EMPTY
[in] | uploadPassword | The upload password set in the PHP page itself when you first uploaded and viewed it in the webpage. |
[in] | clientName | Every entry must have a client name. Pass it here. |
[in] | clientPort | Every entry must have a client port. Pass it here. The IP address will be stored automatically, or you can manually set it by passing a field named _System_Address |
[in] | autoRepost | Tables must be uploaded every 60 seconds or they get dropped. Set autoRepost to true to automatically reupload the most recent table. |
Definition at line 105 of file PHPConnections.cpp.