Merge branch 'reporting'
Former-commit-id: f403fab0c01dd863a3c803eb5573c39a517945ad
This commit is contained in:
@@ -43,7 +43,7 @@ static int ICACHE_FLASH_ATTR checkEspfsHeader(void *buf) {
|
||||
|
||||
|
||||
// Cgi to query which firmware needs to be uploaded next
|
||||
int ICACHE_FLASH_ATTR cgiGetFirmwareNext(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiGetFirmwareNext(HttpdConnData *connData) {
|
||||
if (connData->conn==NULL) {
|
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE;
|
||||
@@ -62,7 +62,7 @@ int ICACHE_FLASH_ATTR cgiGetFirmwareNext(HttpdConnData *connData) {
|
||||
|
||||
//Cgi that reads the SPI flash. Assumes 512KByte flash.
|
||||
//ToDo: Figure out real flash size somehow?
|
||||
int ICACHE_FLASH_ATTR cgiReadFlash(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiReadFlash(HttpdConnData *connData) {
|
||||
int *pos=(int *)&connData->cgiData;
|
||||
if (connData->conn==NULL) {
|
||||
//Connection aborted. Clean up.
|
||||
@@ -123,7 +123,7 @@ typedef struct __attribute__((packed)) {
|
||||
} OtaHeader;
|
||||
|
||||
|
||||
int ICACHE_FLASH_ATTR cgiUploadFirmware(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiUploadFirmware(HttpdConnData *connData) {
|
||||
CgiUploadFlashDef *def=(CgiUploadFlashDef*)connData->cgiArg;
|
||||
UploadState *state=(UploadState *)connData->cgiData;
|
||||
int len;
|
||||
@@ -302,7 +302,7 @@ static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {
|
||||
}
|
||||
|
||||
// Handle request to reboot into the new firmware
|
||||
int ICACHE_FLASH_ATTR cgiRebootFirmware(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiRebootFirmware(HttpdConnData *connData) {
|
||||
if (connData->conn==NULL) {
|
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE;
|
||||
|
||||
@@ -119,26 +119,27 @@ int ICACHE_FLASH_ATTR cgiWebsocketSend(Websock *ws, char *data, int len, int fla
|
||||
return r;
|
||||
}
|
||||
|
||||
//Broadcast data to all websockets at a specific url. Returns the amount of connections sent to.
|
||||
int ICACHE_FLASH_ATTR cgiWebsockBroadcast(char *resource, char *data, int len, int flags) {
|
||||
//This is majorly broken (and actually, always, it just tended to work because the circumstances
|
||||
//were juuuust right). Because the socket is used outside of the httpd send/receive context, it
|
||||
//will not have an associated send buffer. This means httpdSend will write to a dangling pointer!
|
||||
//Disabled for now. If you really need this, open an issue on github or otherwise poke me and I'll
|
||||
//see what I can do.
|
||||
/*
|
||||
Websock *lw=llStart;
|
||||
int ret=0;
|
||||
while (lw!=NULL) {
|
||||
if (strcmp(lw->conn->url, resource)==0) {
|
||||
cgiWebsocketSend(lw, data, len, flags);
|
||||
ret++;
|
||||
}
|
||||
lw=lw->priv->next;
|
||||
}
|
||||
return ret;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
////Broadcast data to all websockets at a specific url. Returns the amount of connections sent to.
|
||||
//int ICACHE_FLASH_ATTR cgiWebsockBroadcast(char *resource, char *data, int len, int flags) {
|
||||
////This is majorly broken (and actually, always, it just tended to work because the circumstances
|
||||
////were juuuust right). Because the socket is used outside of the httpd send/receive context, it
|
||||
////will not have an associated send buffer. This means httpdSend will write to a dangling pointer!
|
||||
////Disabled for now. If you really need this, open an issue on github or otherwise poke me and I'll
|
||||
////see what I can do.
|
||||
///*
|
||||
// Websock *lw=llStart;
|
||||
// int ret=0;
|
||||
// while (lw!=NULL) {
|
||||
// if (strcmp(lw->conn->url, resource)==0) {
|
||||
// cgiWebsocketSend(lw, data, len, flags);
|
||||
// ret++;
|
||||
// }
|
||||
// lw=lw->priv->next;
|
||||
// }
|
||||
// return ret;*/
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
void ICACHE_FLASH_ATTR cgiWebsocketClose(Websock *ws, int reason) {
|
||||
@@ -167,7 +168,7 @@ static void ICACHE_FLASH_ATTR websockFree(Websock *ws) {
|
||||
if (ws->priv) free(ws->priv);
|
||||
}
|
||||
|
||||
int ICACHE_FLASH_ATTR cgiWebSocketRecv(HttpdConnData *connData, char *data, int len) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWebSocketRecv(HttpdConnData *connData, char *data, int len) {
|
||||
int i, j, sl;
|
||||
int r=HTTPD_CGI_MORE;
|
||||
int wasHeaderByte;
|
||||
@@ -280,7 +281,7 @@ int ICACHE_FLASH_ATTR cgiWebSocketRecv(HttpdConnData *connData, char *data, int
|
||||
}
|
||||
|
||||
//Websocket 'cgi' implementation
|
||||
int ICACHE_FLASH_ATTR cgiWebsocket(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWebsocket(HttpdConnData *connData) {
|
||||
char buff[256];
|
||||
int i;
|
||||
sha1nfo s;
|
||||
|
||||
@@ -130,7 +130,7 @@ static void ICACHE_FLASH_ATTR wifiStartScan() {
|
||||
//This CGI is called from the bit of AJAX-code in wifi.tpl. It will initiate a
|
||||
//scan for access points and if available will return the result of an earlier scan.
|
||||
//The result is embedded in a bit of JSON parsed by the javascript in wifi.tpl.
|
||||
int ICACHE_FLASH_ATTR cgiWiFiScan(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiScan(HttpdConnData *connData) {
|
||||
int pos=(int)connData->cgiData;
|
||||
int len;
|
||||
char buff[256];
|
||||
@@ -226,7 +226,7 @@ static void ICACHE_FLASH_ATTR reassTimerCb(void *arg) {
|
||||
|
||||
//This cgi uses the routines above to connect to a specific access point with the
|
||||
//given ESSID using the given password.
|
||||
int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
|
||||
char essid[128];
|
||||
char passwd[128];
|
||||
static os_timer_t reassTimer;
|
||||
@@ -258,7 +258,7 @@ int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
|
||||
|
||||
//This cgi uses the routines above to connect to a specific access point with the
|
||||
//given ESSID using the given password.
|
||||
int ICACHE_FLASH_ATTR cgiWiFiSetMode(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiSetMode(HttpdConnData *connData) {
|
||||
int len;
|
||||
char buff[64];
|
||||
|
||||
@@ -282,7 +282,7 @@ int ICACHE_FLASH_ATTR cgiWiFiSetMode(HttpdConnData *connData) {
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
int ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData) {
|
||||
char buff[256];
|
||||
int len;
|
||||
struct ip_info info;
|
||||
@@ -314,7 +314,7 @@ int ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData) {
|
||||
}
|
||||
|
||||
//Template code for the WLAN page.
|
||||
int ICACHE_FLASH_ATTR tplWlan(HttpdConnData *connData, char *token, void **arg) {
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR tplWlan(HttpdConnData *connData, char *token, void **arg) {
|
||||
char buff[256];
|
||||
int x;
|
||||
static struct station_config stconf;
|
||||
|
||||
Reference in New Issue
Block a user