QcControlInterface Class
Machine-readable control of a client session: newline-delimited JSON requests in, one JSON response line per request out. More...
| Header: | #include <clientcore/control/QcControlInterface.h> |
| Inherits: | QObject |
Public Types
Public Functions
| int | failedRequests() const |
| void | feed(const QByteArray &data) |
| QcGamepadControls & | gamepadControls() |
| bool | isIdle() const |
| void | setExtensionHandler(QcControlInterface::ExtensionHandler handler) |
| void | setSession(QcClientSession *session) |
| void | submit(const QJsonObject &request) |
| QcVirtualGamepadSource & | virtualGamepads() |
Signals
| void | idle() |
| void | quitRequested() |
Static Public Members
| const char *const | parseErrorKey |
Detailed Description
Acts only through the session (i.e. through the protocol), exactly like a player would. Commands are documented in docs/Steuerschnittstelle.md. The virtual pads steer the player like a real one in the game (QcGamepadControls, applied once per session tick).
Member Type Documentation
[alias] QcControlInterface::ExtensionHandler
Optional hook for commands the session cannot serve itself (screenshots, world management): the response (with "ok": false and "error" for a failure), none for a command it does not know.
Member Function Documentation
int QcControlInterface::failedRequests() const
Returns the number of requests that failed.
void QcControlInterface::feed(const QByteArray &data)
Appends data, raw bytes of newline-delimited requests, for sources that are not a QIODevice.
QcGamepadControls &QcControlInterface::gamepadControls()
Returns the pad steering of the virtual pads.
[signal] void QcControlInterface::idle()
No command runs and no request waits any more.
bool QcControlInterface::isIdle() const
Returns whether no command runs and no request waits.
[signal] void QcControlInterface::quitRequested()
The quit command asked to end the program.
void QcControlInterface::setExtensionHandler(QcControlInterface::ExtensionHandler handler)
Sets the hook for commands the session cannot serve to handler.
void QcControlInterface::setSession(QcClientSession *session)
Switches to session, e.g. after the world changed.
void QcControlInterface::submit(const QJsonObject &request)
Executes request; the response is written to the output device (possibly later).
QcVirtualGamepadSource &QcControlInterface::virtualGamepads()
Returns the pads of the gamepad commands (decision E-540); they steer the player (E-541).
Member Variable Documentation
const char *const QcControlInterface::parseErrorKey
Internal marker of a queued request that failed to parse.