Commander-API
V2.1.0
Simple Command Parser
|
#include "Arduino.h"
#include "Wire.h"
#include <math.h>
#include <avr/wdt.h>
#include "time.h"
#include "Commander-API.hpp"
Go to the source code of this file.
Macros | |
#define | API_ELEMENT_REBOOT apiElement( "reboot", "Reboots the device.", commander_reboot_func ) |
Arduino detection. More... | |
#define | API_ELEMENT_P_REBOOT(element) apiElement_P( element, "reboot", "Reboots the device.", commander_reboot_func ) |
#define | API_ELEMENT_MICROS apiElement( "micros", "Returns the number of microseconds passed since the program started.", commander_micros_func ) |
#define | API_ELEMENT_P_MICROS(element) apiElement_P( element, "micros", "Returns the number of microseconds passed since the program started.", commander_micros_func ) |
#define | API_ELEMENT_MILLIS apiElement( "millis", "Returns the number of milliseconds passed since the program started.", commander_millis_func ) |
#define | API_ELEMENT_P_MILLIS(element) apiElement_P( element, "millis", "Returns the number of milliseconds passed since the program started.", commander_millis_func ) |
#define | API_ELEMENT_UPTIME apiElement( "uptime", "Returns the time passed since the program started.", commander_uptime_func ) |
#define | API_ELEMENT_P_UPTIME(element) apiElement_P( element, "uptime", "Returns the time passed since the program started.", commander_uptime_func ) |
#define | API_ELEMENT_NEOFETCH apiElement( "neofetch", "Nice looking system information.", commander_neofetch_func ) |
#define | API_ELEMENT_P_NEOFETCH(element) apiElement_P( element, "neofetch", "Nice looking system information.", commander_neofetch_func ) |
#define | API_ELEMENT_PINMODE apiElement( "pinMode", "Set the direction of a pin.\r\n\tExample: pinMode [ Pin Number ] [ Direction ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Direction ] - 0 means input, 1 means output.", commander_pinMode_func ) |
#define | API_ELEMENT_P_PINMODE(element) apiElement_P( element, "pinMode", "Set the direction of a pin.\r\n\tExample: pinMode [ Pin Number ] [ Direction ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Direction ] - 0 means input, 1 means output.", commander_pinMode_func ) |
#define | API_ELEMENT_DIGITALWRITE apiElement( "digitalWrite", "Set the state of an output pin.\r\n\tExample: digitalWrite [ Pin Number ] [ State ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ State ] - 0 means low, 1 means high.", commander_digitalWrite_func ) |
#define | API_ELEMENT_P_DIGITALWRITE(element) apiElement_P( element, "digitalWrite", "Set the state of an output pin.\r\n\tExample: digitalWrite [ Pin Number ] [ State ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ State ] - 0 means low, 1 means high.", commander_digitalWrite_func ) |
#define | API_ELEMENT_DIGITALREAD apiElement( "digitalRead", "Read the state of a pin.\r\n\tExample: digitalRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - 0 means low, 1 means high.", commander_digitalRead_func ) |
#define | API_ELEMENT_P_DIGITALREAD(element) apiElement_P( element, "digitalRead", "Read the state of a pin.\r\n\tExample: digitalRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - 0 means low, 1 means high.", commander_digitalRead_func ) |
#define | API_ELEMENT_ANALOGREAD apiElement( "analogRead", "Generate an ADC measurement on a pin.\r\n\tExample: analogRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - The raw ADC sample.", commander_analogRead_func ) |
#define | API_ELEMENT_P_ANALOGREAD(element) apiElement_P( element, "analogRead", "Generate an ADC measurement on a pin.\r\n\tExample: analogRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - The raw ADC sample.", commander_analogRead_func ) |
#define | API_ELEMENT_IPCONFIG apiElement( "ipconfig", "Print network information.", commander_ipconfig_func ) |
#define | API_ELEMENT_WIFISTAT apiElement( "wifiStat", "Print WiFi information.", commander_wifiStat_func ) |
#define | API_ELEMENT_WIFISCAN apiElement( "wifiScan", "Search for available networks around.", commander_wifiScan_func ) |
#define | API_ELEMENT_CONFIGTIME apiElement( "configTime", "Configure NTP time settings.\r\n\tExample: configTime [ GMT Offset Sec ] [ DL Offset Sec ] [ Server ]\r\n\t[ GMT Offset Sec ] - UTC offset for your timezone in seconds.\r\n\t[ GMT Offset Sec ] - Daylight offset in sec.\r\n\t[ Server ] - NTP Server Address( optional, default: pool.ntp.org )", commander_configTime_func ) |
#define | API_ELEMENT_DATETIME apiElement( "dateTime", "Returns the NTP synchronised date and time.", commander_dateTime_func ) |
#define | API_ELEMENT_SIN apiElement( "sin", "Sine function. The input is in radians.", commander_sin_func ) |
#define | API_ELEMENT_P_SIN(element) apiElement_P( element, "sin", "Sine function. The input is in radians.", commander_sin_func ) |
#define | API_ELEMENT_COS apiElement( "cos", "Cosine function. The input is in radians.", commander_cos_func ) |
#define | API_ELEMENT_P_COS(element) apiElement_P( element, "cos", "Cosine function. The input is in radians.", commander_cos_func ) |
#define | API_ELEMENT_ABS apiElement( "abs", "Calculates the absolute value of a number.", commander_abs_func ) |
#define | API_ELEMENT_P_ABS(element) apiElement_P( element, "abs", "Calculates the absolute value of a number.", commander_abs_func ) |
#define | API_ELEMENT_RANDOM apiElement( "random", "Generates a random number between the parameters.\r\n\tExample: random [ min ] [ max ]\r\n\t[ min ] - Lower integer bound\r\n\t[ max ] - Upper integer bound", commander_random_func ) |
#define | API_ELEMENT_P_RANDOM(element) apiElement_P( element, "random", "Generates a random number between the parameters.\r\n\tExample: random [ min ] [ max ]\r\n\t[ min ] - Lower integer bound\r\n\t[ max ] - Upper integer bound", commander_random_func ) |
#define | API_ELEMENT_NOT apiElement( "not", "Logical not. If the input is 0 returns 1. Any other cases it returns 0.", commander_not_func ) |
#define | API_ELEMENT_P_NOT(element) apiElement_P( element, "not", "Logical not. If the input is 0 returns 1. Any other cases it returns 0.", commander_not_func ) |
#define | NEOFETCH_LOGO_HEIGHT 12 |
The neofetch logo have this many lines. More... | |
#define | NEOFETCH_FW_NAME "Firmware-name" |
#define | NEOFETCH_CPU_TYPE_AUTO |
#define | NEOFETCH_COMPILER __VERSION__ |
#define | NEOFETCH_COMPILE_DATE __DATE__ |
#define | NEOFETCH_TERMINAL "Shellminator" |
#define | NEOFETCH_COMMAND_PARSER "Commander" |
#define | NEOFETCH_AUTHOR "Daniel Hajnal" |
#define | NEOFETCH_LICENSE "MIT" |
Functions | |
void | commander_reboot_func (char *args, Stream *response) |
Premade function for reboot command. More... | |
void | commander_micros_func (char *args, Stream *response) |
Premade function for micros command. More... | |
void | commander_millis_func (char *args, Stream *response) |
Premade function for millis command. More... | |
void | commander_uptime_func (char *args, Stream *response) |
Premade function for uptime command. More... | |
void | commander_neofetch_func (char *args, Stream *response) |
Premade function for neofetch command. More... | |
void | commander_pinMode_func (char *args, Stream *response) |
Premade function for pinMode command. More... | |
void | commander_digitalWrite_func (char *args, Stream *response) |
Premade function for digitalWrite command. More... | |
void | commander_digitalRead_func (char *args, Stream *response) |
Premade function for digitalRead command. More... | |
void | commander_analogRead_func (char *args, Stream *response) |
Premade function for analogRead command. More... | |
void | commander_ipconfig_func (char *args, Stream *response) |
Premade function for ipconfig command. More... | |
void | commander_wifiStat_func (char *args, Stream *response) |
Premade function for wifiStat command. More... | |
void | commander_wifiScan_func (char *args, Stream *response) |
Premade function for wifiScan command. More... | |
void | commander_configTime_func (char *args, Stream *response) |
Premade function for wifiScan command. More... | |
void | commander_dateTime_func (char *args, Stream *response) |
Premade function for wifiScan command. More... | |
void | commander_sin_func (char *args, Stream *response) |
Premade function for sin command. More... | |
void | commander_cos_func (char *args, Stream *response) |
Premade function for cos command. More... | |
void | commander_abs_func (char *args, Stream *response) |
Premade function for abs command. More... | |
void | commander_random_func (char *args, Stream *response) |
Premade function for random command. More... | |
void | commander_not_func (char *args, Stream *response) |
Premade function for not command. More... | |
#define API_ELEMENT_ABS apiElement( "abs", "Calculates the absolute value of a number.", commander_abs_func ) |
Definition at line 207 of file Commander-API-Commands.hpp.
#define API_ELEMENT_ANALOGREAD apiElement( "analogRead", "Generate an ADC measurement on a pin.\r\n\tExample: analogRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - The raw ADC sample.", commander_analogRead_func ) |
Definition at line 138 of file Commander-API-Commands.hpp.
#define API_ELEMENT_CONFIGTIME apiElement( "configTime", "Configure NTP time settings.\r\n\tExample: configTime [ GMT Offset Sec ] [ DL Offset Sec ] [ Server ]\r\n\t[ GMT Offset Sec ] - UTC offset for your timezone in seconds.\r\n\t[ GMT Offset Sec ] - Daylight offset in sec.\r\n\t[ Server ] - NTP Server Address( optional, default: pool.ntp.org )", commander_configTime_func ) |
Definition at line 173 of file Commander-API-Commands.hpp.
#define API_ELEMENT_COS apiElement( "cos", "Cosine function. The input is in radians.", commander_cos_func ) |
Definition at line 198 of file Commander-API-Commands.hpp.
#define API_ELEMENT_DATETIME apiElement( "dateTime", "Returns the NTP synchronised date and time.", commander_dateTime_func ) |
Definition at line 179 of file Commander-API-Commands.hpp.
#define API_ELEMENT_DIGITALREAD apiElement( "digitalRead", "Read the state of a pin.\r\n\tExample: digitalRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - 0 means low, 1 means high.", commander_digitalRead_func ) |
Definition at line 127 of file Commander-API-Commands.hpp.
#define API_ELEMENT_DIGITALWRITE apiElement( "digitalWrite", "Set the state of an output pin.\r\n\tExample: digitalWrite [ Pin Number ] [ State ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ State ] - 0 means low, 1 means high.", commander_digitalWrite_func ) |
Definition at line 118 of file Commander-API-Commands.hpp.
#define API_ELEMENT_IPCONFIG apiElement( "ipconfig", "Print network information.", commander_ipconfig_func ) |
Definition at line 151 of file Commander-API-Commands.hpp.
#define API_ELEMENT_MICROS apiElement( "micros", "Returns the number of microseconds passed since the program started.", commander_micros_func ) |
Definition at line 67 of file Commander-API-Commands.hpp.
#define API_ELEMENT_MILLIS apiElement( "millis", "Returns the number of milliseconds passed since the program started.", commander_millis_func ) |
Definition at line 76 of file Commander-API-Commands.hpp.
#define API_ELEMENT_NEOFETCH apiElement( "neofetch", "Nice looking system information.", commander_neofetch_func ) |
Definition at line 96 of file Commander-API-Commands.hpp.
#define API_ELEMENT_NOT apiElement( "not", "Logical not. If the input is 0 returns 1. Any other cases it returns 0.", commander_not_func ) |
Definition at line 225 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_ABS | ( | element | ) | apiElement_P( element, "abs", "Calculates the absolute value of a number.", commander_abs_func ) |
Definition at line 209 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_ANALOGREAD | ( | element | ) | apiElement_P( element, "analogRead", "Generate an ADC measurement on a pin.\r\n\tExample: analogRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - The raw ADC sample.", commander_analogRead_func ) |
Definition at line 140 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_COS | ( | element | ) | apiElement_P( element, "cos", "Cosine function. The input is in radians.", commander_cos_func ) |
Definition at line 200 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_DIGITALREAD | ( | element | ) | apiElement_P( element, "digitalRead", "Read the state of a pin.\r\n\tExample: digitalRead [ Pin Number ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Returns ] - 0 means low, 1 means high.", commander_digitalRead_func ) |
Definition at line 129 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_DIGITALWRITE | ( | element | ) | apiElement_P( element, "digitalWrite", "Set the state of an output pin.\r\n\tExample: digitalWrite [ Pin Number ] [ State ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ State ] - 0 means low, 1 means high.", commander_digitalWrite_func ) |
Definition at line 120 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_MICROS | ( | element | ) | apiElement_P( element, "micros", "Returns the number of microseconds passed since the program started.", commander_micros_func ) |
Definition at line 69 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_MILLIS | ( | element | ) | apiElement_P( element, "millis", "Returns the number of milliseconds passed since the program started.", commander_millis_func ) |
Definition at line 78 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_NEOFETCH | ( | element | ) | apiElement_P( element, "neofetch", "Nice looking system information.", commander_neofetch_func ) |
Definition at line 98 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_NOT | ( | element | ) | apiElement_P( element, "not", "Logical not. If the input is 0 returns 1. Any other cases it returns 0.", commander_not_func ) |
Definition at line 227 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_PINMODE | ( | element | ) | apiElement_P( element, "pinMode", "Set the direction of a pin.\r\n\tExample: pinMode [ Pin Number ] [ Direction ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Direction ] - 0 means input, 1 means output.", commander_pinMode_func ) |
Definition at line 111 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_RANDOM | ( | element | ) | apiElement_P( element, "random", "Generates a random number between the parameters.\r\n\tExample: random [ min ] [ max ]\r\n\t[ min ] - Lower integer bound\r\n\t[ max ] - Upper integer bound", commander_random_func ) |
Definition at line 218 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_REBOOT | ( | element | ) | apiElement_P( element, "reboot", "Reboots the device.", commander_reboot_func ) |
Definition at line 58 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_SIN | ( | element | ) | apiElement_P( element, "sin", "Sine function. The input is in radians.", commander_sin_func ) |
Definition at line 191 of file Commander-API-Commands.hpp.
#define API_ELEMENT_P_UPTIME | ( | element | ) | apiElement_P( element, "uptime", "Returns the time passed since the program started.", commander_uptime_func ) |
Definition at line 87 of file Commander-API-Commands.hpp.
#define API_ELEMENT_PINMODE apiElement( "pinMode", "Set the direction of a pin.\r\n\tExample: pinMode [ Pin Number ] [ Direction ]\r\n\t[ Pin Number ] - The number ofthe pin. Typically printed on the board.\r\n\t[ Direction ] - 0 means input, 1 means output.", commander_pinMode_func ) |
Definition at line 109 of file Commander-API-Commands.hpp.
#define API_ELEMENT_RANDOM apiElement( "random", "Generates a random number between the parameters.\r\n\tExample: random [ min ] [ max ]\r\n\t[ min ] - Lower integer bound\r\n\t[ max ] - Upper integer bound", commander_random_func ) |
Definition at line 216 of file Commander-API-Commands.hpp.
#define API_ELEMENT_REBOOT apiElement( "reboot", "Reboots the device.", commander_reboot_func ) |
Arduino detection.
Definition at line 56 of file Commander-API-Commands.hpp.
#define API_ELEMENT_SIN apiElement( "sin", "Sine function. The input is in radians.", commander_sin_func ) |
Definition at line 189 of file Commander-API-Commands.hpp.
#define API_ELEMENT_UPTIME apiElement( "uptime", "Returns the time passed since the program started.", commander_uptime_func ) |
Definition at line 85 of file Commander-API-Commands.hpp.
#define API_ELEMENT_WIFISCAN apiElement( "wifiScan", "Search for available networks around.", commander_wifiScan_func ) |
Definition at line 163 of file Commander-API-Commands.hpp.
#define API_ELEMENT_WIFISTAT apiElement( "wifiStat", "Print WiFi information.", commander_wifiStat_func ) |
Definition at line 157 of file Commander-API-Commands.hpp.
#define NEOFETCH_AUTHOR "Daniel Hajnal" |
Definition at line 246 of file Commander-API-Commands.hpp.
#define NEOFETCH_COMMAND_PARSER "Commander" |
Definition at line 245 of file Commander-API-Commands.hpp.
#define NEOFETCH_COMPILE_DATE __DATE__ |
Definition at line 243 of file Commander-API-Commands.hpp.
#define NEOFETCH_COMPILER __VERSION__ |
Definition at line 242 of file Commander-API-Commands.hpp.
#define NEOFETCH_CPU_TYPE_AUTO |
Definition at line 241 of file Commander-API-Commands.hpp.
#define NEOFETCH_FW_NAME "Firmware-name" |
Definition at line 239 of file Commander-API-Commands.hpp.
#define NEOFETCH_LICENSE "MIT" |
Definition at line 247 of file Commander-API-Commands.hpp.
#define NEOFETCH_LOGO_HEIGHT 12 |
The neofetch logo have this many lines.
Definition at line 235 of file Commander-API-Commands.hpp.
#define NEOFETCH_TERMINAL "Shellminator" |
Definition at line 244 of file Commander-API-Commands.hpp.
void commander_abs_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for abs command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 861 of file Commander-API-Commands.cpp.
void commander_analogRead_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for analogRead command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 292 of file Commander-API-Commands.cpp.
void commander_configTime_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for wifiScan command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 494 of file Commander-API-Commands.cpp.
void commander_cos_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for cos command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 794 of file Commander-API-Commands.cpp.
void commander_dateTime_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for wifiScan command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 530 of file Commander-API-Commands.cpp.
void commander_digitalRead_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for digitalRead command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 199 of file Commander-API-Commands.cpp.
void commander_digitalWrite_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for digitalWrite command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 142 of file Commander-API-Commands.cpp.
void commander_ipconfig_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for ipconfig command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 401 of file Commander-API-Commands.cpp.
void commander_micros_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for micros command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 46 of file Commander-API-Commands.cpp.
void commander_millis_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for millis command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 36 of file Commander-API-Commands.cpp.
void commander_neofetch_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for neofetch command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 549 of file Commander-API-Commands.cpp.
void commander_not_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for not command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 802 of file Commander-API-Commands.cpp.
void commander_pinMode_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for pinMode command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 85 of file Commander-API-Commands.cpp.
void commander_random_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for random command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 825 of file Commander-API-Commands.cpp.
void commander_reboot_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for reboot command.
It reboots the core.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 758 of file Commander-API-Commands.cpp.
void commander_sin_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for sin command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 786 of file Commander-API-Commands.cpp.
void commander_uptime_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for uptime command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 56 of file Commander-API-Commands.cpp.
void commander_wifiScan_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for wifiScan command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 451 of file Commander-API-Commands.cpp.
void commander_wifiStat_func | ( | char * | args, |
Stream * | response | ||
) |
Premade function for wifiStat command.
args | Pointer to the argument string. |
response | Response channel for messages. |
Definition at line 416 of file Commander-API-Commands.cpp.