parent
2ffaf1a4af
commit
7a6bdef334
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 2.5 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,16 @@ |
||||
#include "cgi_ping.h" |
||||
|
||||
int FLASH_FN cgiPing(HttpdConnData *connData) |
||||
{ |
||||
if (connData->conn==NULL) { |
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE; |
||||
} |
||||
|
||||
httpdStartResponse(connData, 200); |
||||
httpdEndHeaders(connData); |
||||
|
||||
httpdSend(connData, "pong\n", -1); |
||||
|
||||
return HTTPD_CGI_DONE; |
||||
} |
@ -0,0 +1,11 @@ |
||||
#ifndef CGI_PING_H |
||||
#define CGI_PING_H |
||||
|
||||
#include <esp8266.h> |
||||
#include <httpd.h> |
||||
|
||||
// this is used by the UI to check if server is already restarted and working again.
|
||||
|
||||
int cgiPing(HttpdConnData *connData); |
||||
|
||||
#endif // CGI_PING_H
|
@ -0,0 +1,27 @@ |
||||
#include "cgi_reset.h" |
||||
|
||||
static ETSTimer tmr; |
||||
|
||||
static void FLASH_FN tmrCb(void *arg) |
||||
{ |
||||
system_restart(); |
||||
} |
||||
|
||||
int FLASH_FN cgiResetDevice(HttpdConnData *connData) |
||||
{ |
||||
if (connData->conn==NULL) { |
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE; |
||||
} |
||||
|
||||
httpdStartResponse(connData, 200); |
||||
httpdEndHeaders(connData); |
||||
|
||||
os_timer_disarm(&tmr); |
||||
os_timer_setfn(&tmr, tmrCb, NULL); |
||||
os_timer_arm(&tmr, 100, false); |
||||
|
||||
httpdSend(connData, "system reset\n", -1); |
||||
|
||||
return HTTPD_CGI_DONE; |
||||
} |
@ -0,0 +1,9 @@ |
||||
#ifndef CGI_RESET_H |
||||
#define CGI_RESET_H |
||||
|
||||
#include <esp8266.h> |
||||
#include <httpd.h> |
||||
|
||||
int cgiResetDevice(HttpdConnData *connData); |
||||
|
||||
#endif // CGI_RESET_H
|
Loading…
Reference in new issue