 |
Commander-API
V2.0.0
Commander-API is a C++ API, that parses character based commands.
|
Go to the documentation of this file.
35 #ifndef COMMANDER_API_SRC_COMMANDER_HPP_
36 #define COMMANDER_API_SRC_COMMANDER_HPP_
38 #define COMMANDER_API_VERSION (const char*)"2.0.0"
47 #ifdef COMMANDER_USE_SERIAL_RESPONSE
61 #define apiElement( name, desc, func ) { 0, NULL, NULL, (const char*)name, (const char*)desc, func }
67 #define attachTree( name ) attachTreeFunction( name, sizeof( name ) / sizeof( name[ 0 ] ) )
152 void execute(
const char *cmd );
154 #ifdef COMMANDER_USE_SERIAL_RESPONSE
155 void execute(
char *cmd, Serial *resp );
171 void execute(
const char *cmd, Serial *resp );
178 void attachDebugChannel( Serial *resp );
181 #ifdef COMMANDER_USE_ARDUINO_SERIAL_RESPONSE
182 void execute(
char *cmd, HardwareSerial *resp );
198 void execute(
const char *cmd, HardwareSerial *resp );
205 void attachDebugChannel( HardwareSerial *resp );
208 #ifdef COMMANDER_USE_WIFI_CLIENT_RESPONSE
217 void execute(
char *cmd, WiFiClient *resp );
225 void execute(
const char *cmd, WiFiClient *resp );
232 void attachDebugChannel( WiFiClient *resp );
244 API_t *API_tree = NULL;
247 uint32_t API_tree_size = 0;
250 uint32_t elementCounter;
261 #ifdef COMMANDER_USE_SERIAL_RESPONSE
262 commandResponseSerial serialResponse;
266 #ifdef COMMANDER_USE_ARDUINO_SERIAL_RESPONSE
267 commandResponseArduinoSerial arduinoSerialResponse;
271 #ifdef COMMANDER_USE_WIFI_CLIENT_RESPONSE
272 commandResponseWiFiClient WiFiClientResponse;
281 bool debugEnabled =
false;
286 #ifdef COMMANDER_USE_SERIAL_RESPONSE
287 commandResponseSerial serialDebugResponse;
291 #ifdef COMMANDER_USE_ARDUINO_SERIAL_RESPONSE
292 commandResponseArduinoSerial arduinoSerialDebugResponse;
296 #ifdef COMMANDER_USE_WIFI_CLIENT_RESPONSE
297 commandResponseWiFiClient WiFiClientDebugResponse;
306 uint16_t find_api_index_by_place( uint16_t place );
309 void swap_api_elements( uint16_t index, uint16_t place );
312 void optimize_api_tree();
320 void recursive_optimizer( int32_t start_index, int32_t stop_index );
327 void executeCommand(
char *cmd );
335 void helpFunction(
bool description =
false );
Commander class.
Definition: Commander-API.hpp:78
static const char * version
Library version string.
Definition: Commander-API.hpp:83
const char * name
Definition: Commander-API.hpp:95
#define COMMANDER_MAX_COMMAND_SIZE
Maximum length of the terminal command.
Definition: Commander-Settings.hpp:52
Structure for command data.
Definition: Commander-API.hpp:90
struct Commander::API_t API_t
Structure for command data.
const char * desc
Definition: Commander-API.hpp:96
API_t * operator[](int i)
Array index operator overload for int type.
Definition: Commander-API.cpp:489
void attachTreeFunction(API_t *API_tree_p, uint32_t API_tree_size_p)
Attach API-tree to the object.
Definition: Commander-API.cpp:39
void disableDebug()
Disables debug messages.
Definition: Commander-API.cpp:483
void execute(char *cmd)
Default execution function.
Definition: Commander-API.cpp:331
struct API_t * right
Definition: Commander-API.hpp:94
void enableDebug()
Enables debug messages.
Definition: Commander-API.cpp:477
void init()
Initializer.
Definition: Commander-API.cpp:49
Default response class.
Definition: Commander-IO.hpp:64
struct API_t * left
Definition: Commander-API.hpp:93
void(* func)(char *, commandResponse *response)
Definition: Commander-API.hpp:97
uint16_t place
Definition: Commander-API.hpp:92