This code client queries for the validity of codes with the RNLobby::CodeServer.
More...
#include <CodeClient.h>
This code client queries for the validity of codes with the RNLobby::CodeServer.
bool GetCompleted |
( |
void |
| ) |
|
Tests the completion state of the last query. When the query completes the result can be retrieved by using GetReply()
- Returns
- A completed query returns true, a pending query returns false.
CodeServer::Reply GetReply |
( |
void |
| ) |
|
Returns the last reply from a completed query.
- Returns
- The last reply from a completed query.
int GetUserSuppliedReply |
( |
void |
| ) |
|
Returns the last user supplied reply value from a completed query. See CodeServer::AddCode() for more details about a user supplied reply.
- Returns
- The user supplied reply.
void SetEncryptionKey |
( |
const void * |
data, |
|
|
const int |
length |
|
) |
| |
Sets the encryption key to be used by all queries for this client. The same key must be used with any RNLobby::CodeServer responding to queries from this client. The default encryption key is the same for RNLobby::CodeServer and RNLobby::CodeClient.
- Parameters
-
data | the data to use as a seed for the key. This can be NULL to use the default key. |
length | the length of the data to use for creating the key |
Sets the address and port of the server. The default for the instance of the class is localhost and port CodeServer::kDefaultPort or the address resolved by a successful BackendClient::Start().
- Parameters
-
address | The new address and port number to use for the server |
bool Start |
( |
const char * |
code, |
|
|
const int |
nOnce1 = 0 , |
|
|
const int |
nOnce2 = 0 |
|
) |
| |
Starts a code query. This query is asynchronous and can be stopped by using Stop(). If a code is requested for the same key within the CodeServer timeout period without supplying valid nonce values the key query will result in kReply_KeyInUse. If these values are used for future CodeClient::Start() calls with the same code value then the result will be a successful key query.
- Parameters
-
code | The code to query with the server. This buffer must be a null terminated string. The buffer contents is copied by a pending query so it can be deallocated after using this call. |
nOnce1 | The first nonce. |
nOnce2 | The second nonce. |
- Returns
- Success returns true, failure returns false.
bool Stop |
( |
bool |
hardware = false | ) |
|
Stops the current code query thread.
- Parameters
-
hardware | If true this stops the network hardware. The default is false. |
- Returns
- Success returns true, failure returns false.