20 #include "../include/esp3d_config.h"
40 String tmpbuf = (
const char*)sbuf;
41 if (tmpbuf.startsWith(
"echo: ")) {
42 tmpbuf.replace(
"echo: ",
"");
43 slen = tmpbuf.length();
53 execute_internal_command (String((
const char*)cmd).toInt(), (slen > 8)?(
const char*)&tmpbuf[8]:
"", auth, (outputonly ==
nullptr)?output:outputonly);
60 output->
printERROR(
"Wrong authentication!", 401);
64 if (outputonly ==
nullptr) {
67 outputonly->
write(sbuf, len);
80 if ((
char(sbuf[0]) ==
'[') && (
char(sbuf[1]) ==
'E') && (
char(sbuf[2]) ==
'S') && (
char(sbuf[3]) ==
'P') && (
char(sbuf[7]) ==
']')) {
83 if((
char(sbuf[0]) ==
'e') && (
char(sbuf[1]) ==
'c') && (
char(sbuf[2]) ==
'h') && (
char(sbuf[3]) ==
'o') && (
char(sbuf[4]) ==
':') && (
char(sbuf[5]) ==
' ') && (
char(sbuf[6]) ==
'[') && (
char(sbuf[7]) ==
'E')) {
85 if ((
char(sbuf[8]) ==
'S') && (
char(sbuf[9]) ==
'P') && (
char(sbuf[13]) ==
']')) {
97 uint len = strlen(
string);
101 for (uint i = from; i < len; i++) {
102 if (
string[i] ==
' ') {
108 if (
string[i-1] !=
'\\') {
117 const char*
Commands::get_label (
const char * cmd_params,
const char * labelseparator, uint8_t startindex)
125 res.replace(
"\r ",
"");
126 res.replace(
"\n ",
"");
128 if ((res.length() == 0) || (startindex >=res.length())) {
132 if (strlen(labelseparator) > 0) {
133 end = res.indexOf(labelseparator, startindex);
138 for (int8_t p = end; p >= startindex ; p--, start--) {
150 tmp = res.substring(start,end);
152 res =
get_label (cmd_params, labelseparator,end+1);
171 res.replace(
"\r ",
"");
172 res.replace(
"\n ",
"");
174 if (res.length() == 0) {
180 if (strlen(label) > 0) {
181 start = tmp.indexOf(slabel);
185 start+=slabel.length();
192 res = tmp.substring (start, end);
195 #ifdef AUTHENTICATION_FEATURE
197 if (strlen(label) == 0) {
200 start = tmp.indexOf (
" pwd=");
205 res = tmp.substring(0, start);
208 res +=
" " + tmp.substring(end+1, tmp.length());
212 #endif //AUTHENTICATION_FEATURE
214 res.replace(
"\\ ",
" ");
225 if ((strlen(cmd_params) == 0) || (strlen(tag) == 0)) {
232 if (tmp.indexOf(stag) == -1) {
242 #ifndef SERIAL_COMMAND_FEATURE
244 output->
printMSG(
"Feature disabled");
247 #endif //SERIAL_COMMAND_FEATURE
248 bool response =
true;
252 #ifdef AUTHENTICATION_FEATURE
256 String pwd=
get_param (cmd_params,
"pwd=");
259 #endif //AUTHENTICATION_FEATURE
263 #if defined (WIFI_FEATURE)
267 response =
ESP100(cmd_params, auth_type, output);
272 response =
ESP101(cmd_params, auth_type, output);
274 #endif //WIFI_FEATURE
275 #if defined (WIFI_FEATURE) || defined (ETH_FEATURE)
279 response =
ESP102(cmd_params, auth_type, output);
284 response =
ESP103(cmd_params, auth_type, output);
286 #endif //WIFI_FEATURE ||ETH_FEATURE
287 #if defined (WIFI_FEATURE)
291 response =
ESP105(cmd_params, auth_type, output);
296 response =
ESP106(cmd_params, auth_type, output);
301 response =
ESP107(cmd_params, auth_type, output);
306 response =
ESP108(cmd_params, auth_type, output);
308 #endif //WIFI_FEATURE
310 #if defined( WIFI_FEATURE) || defined( BLUETOOTH_FEATURE) || defined (ETH_FEATURE)
314 response =
ESP110(cmd_params, auth_type, output);
316 #endif //WIFI_FEATURE || BLUETOOTH_FEATURE || ETH_FEATURE)
318 #if defined(WIFI_FEATURE) || defined (ETH_FEATURE)
322 response =
ESP111(cmd_params, auth_type, output);
324 #endif //WIFI_FEATURE || ETH_FEATURE)
326 #if defined(WIFI_FEATURE) || defined(ETH_FEATURE) || defined(BT_FEATURE)
330 response =
ESP112(cmd_params, auth_type, output);
335 response =
ESP115(cmd_params, auth_type, output);
337 #endif //WIFI_FEATURE|| ETH_FEATURE || BT_FEATURE
343 response =
ESP120(cmd_params, auth_type, output);
348 response =
ESP121(cmd_params, auth_type, output);
350 #endif //HTTP_FEATURE
351 #ifdef TELNET_FEATURE
355 response =
ESP130(cmd_params, auth_type, output);
360 response =
ESP131(cmd_params, auth_type, output);
362 #endif //TELNET_FEATURE
363 #ifdef TIMESTAMP_FEATURE
367 response = ESP140(cmd_params, auth_type, output);
369 #endif //TIMESTAMP_FEATURE
373 response =
ESP150(cmd_params, auth_type, output);
375 #ifdef WS_DATA_FEATURE
379 response =
ESP160(cmd_params, auth_type, output);
384 response =
ESP161(cmd_params, auth_type, output);
386 #endif //WS_DATA_FEATURE
391 response = ESP170(cmd_params, auth_type, output);
394 response = ESP171(cmd_params, auth_type, output);
397 response = ESP172(cmd_params, auth_type, output);
399 #endif //CAMERA_DEVICE
404 response =
ESP180(cmd_params, auth_type, output);
409 response =
ESP181(cmd_params, auth_type, output);
412 #if defined (SD_DEVICE)
416 response =
ESP200(cmd_params, auth_type, output);
419 #ifdef DIRECT_PIN_FEATURE
423 response =
ESP201(cmd_params, auth_type, output);
425 #endif //DIRECT_PIN_FEATURE
430 response = ESP210(cmd_params, auth_type, output);
432 #endif //#ifdef DHT_DEVICE
433 #if defined (DISPLAY_DEVICE)
437 response = ESP214(cmd_params, auth_type, output);
439 #if defined(DISPLAY_TOUCH_DRIVER)
443 response = ESP215(cmd_params, auth_type, output);
445 #endif //DISPLAY_TOUCH_DRIVER
446 #if defined(DISPLAY_SNAPSHOT_FEATURE)
450 response = ESP216(cmd_params, auth_type, output);
452 #endif //DISPLAY_SNAPSHOT_FEATURE
457 response = ESP250(cmd_params, auth_type, output);
459 #endif //BUZZER_DEVICE
460 #endif //DISPLAY_DEVICE
464 response =
ESP290(cmd_params, auth_type, output);
469 response =
ESP400(cmd_params, auth_type, output);
474 response =
ESP401(cmd_params, auth_type, output);
476 #if defined (WIFI_FEATURE)
481 response =
ESP410(cmd_params, auth_type, output);
483 #endif //WIFI_FEATURE
488 response =
ESP420(cmd_params, auth_type, output);
494 response =
ESP444(cmd_params, auth_type, output);
496 #ifdef AUTHENTICATION_FEATURE
500 response = ESP550(cmd_params, auth_type, output);
505 response = ESP555(cmd_params, auth_type, output);
507 #endif //AUTHENTICATION_FEATURE
508 #if defined(NOTIFICATION_FEATURE)
512 response =
ESP600(cmd_params, auth_type, output);
518 response =
ESP610(cmd_params, auth_type, output);
520 #endif //NOTIFICATION_FEATURE
521 #if defined(FILESYSTEM_FEATURE)
525 response =
ESP710(cmd_params, auth_type, output);
527 #endif //FILESYSTEM_FEATURE
528 #if defined(SD_DEVICE)
532 response =
ESP715(cmd_params, auth_type, output);
535 #if defined(FILESYSTEM_FEATURE) && defined(ESP_GCODE_HOST_FEATURE)
539 response =
ESP700(cmd_params, auth_type, output);
545 response =
ESP720(cmd_params, auth_type, output);
551 response =
ESP730(cmd_params, auth_type, output);
553 #endif //FILESYSTEM_FEATURE
554 #if defined (SD_DEVICE)
558 response =
ESP740(cmd_params, auth_type, output);
564 response =
ESP750(cmd_params, auth_type, output);
567 #if defined (GLOBAL_FILESYSTEM_FEATURE)
571 response =
ESP780(cmd_params, auth_type, output);
577 response =
ESP790(cmd_params, auth_type, output);
579 #endif //GLOBAL_FILESYSTEM_FEATURE
585 response =
ESP800(cmd_params, auth_type, output);
591 response =
ESP900(cmd_params, auth_type, output);
597 response = ESP910(cmd_params, auth_type, output);
599 #endif //BUZZER_DEVICE