#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); /** * Display instance */ DisplayProxy *display; }; #endif