1
0
MAX7456JSON/lib/CommandHandler/CommandHandler.h
Jens True 79508f8912
Some checks failed
continuous-integration/drone/push Build is failing
File comments for all files
2021-11-10 09:35:27 +00:00

59 lines
1.2 KiB
C++

/**
* @file CommandHandler.h
* @author Jens True (jens.chr.true@gmail.com)
* @brief CommandHandler Header
* @version 0.1
* @date 2021-11-10
*
* @copyright Copyright (c) 2021
*
*/
#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}
* To display a string
*
* {"cmd":"write","x": 2, "y": 10, "text":"Hello World"}
*
* or to clear the display
*
* {"cmd":"clear"}
* @endcode
*
* @param cmd String to parse
* @return True if the input was parsed correctly.
*/
bool parseJSON(const char *cmd);
bool parse
private:
/**
* Internal helpers for printing debug strings
*/
void debugSerial(const char *text);
void debugSerial(const char *command, const char *text);
/**
* Display instance
*/
DisplayProxy *display;
};
#endif