1
0
MAX7456JSON/lib/CommandHandler/CommandHandler.h
Jens True b8eccbe162
All checks were successful
continuous-integration/drone/push Build is passing
Documentation cleanup
2021-11-03 10:13:25 +00:00

36 lines
810 B
C++

#ifndef COMMANDHANDLER_H
#define COMMANDHANDLER_H
#include "DisplayProxy.h"
/**
* Parse a JSON command and convert it into display command(s)
*/
class CommandHandler
{
public:
/**
* Constructor.
*
* @param display Takes an implementation of DisplayProxy through polymorphism.
*/
explicit CommandHandler(DisplayProxy *display);
/**
* Parse a command in JSON format
* @code{.json}
* {"cmd":"write","x": 2, "y": 10, "text":"Hello World"}
* @endcode
*
* @param cmd String to parse
* @return True if the input was parsed correctly.
*/
bool parseJSON(const char *cmd);
private:
/**
* Internal helper for printing debug strings
*/
void debugWrite(int x, int y, const char *text);
DisplayProxy *display;
};
#endif