|
@ -30,13 +30,8 @@ bool webSocketSend(uint8_t num, char * payload) { |
|
|
void webSocketParse(uint8_t num, uint8_t * payload, size_t length) { |
|
|
void webSocketParse(uint8_t num, uint8_t * payload, size_t length) { |
|
|
|
|
|
|
|
|
// Parse JSON input
|
|
|
// Parse JSON input
|
|
|
|
|
|
|
|
|
char buffer[length+1]; |
|
|
|
|
|
memcpy(buffer, payload, length); |
|
|
|
|
|
buffer[length] = 0; |
|
|
|
|
|
|
|
|
|
|
|
DynamicJsonBuffer jsonBuffer; |
|
|
DynamicJsonBuffer jsonBuffer; |
|
|
JsonObject& root = jsonBuffer.parseObject(buffer); |
|
|
|
|
|
|
|
|
JsonObject& root = jsonBuffer.parseObject((char *) payload); |
|
|
if (!root.success()) { |
|
|
if (!root.success()) { |
|
|
DEBUG_MSG("[WEBSOCKET] Error parsing data\n"); |
|
|
DEBUG_MSG("[WEBSOCKET] Error parsing data\n"); |
|
|
return; |
|
|
return; |
|
@ -67,6 +62,8 @@ void webSocketParse(uint8_t num, uint8_t * payload, size_t length) { |
|
|
|
|
|
|
|
|
for (unsigned int i=0; i<config.size(); i++) { |
|
|
for (unsigned int i=0; i<config.size(); i++) { |
|
|
|
|
|
|
|
|
|
|
|
yield(); |
|
|
|
|
|
|
|
|
String key = config[i]["name"]; |
|
|
String key = config[i]["name"]; |
|
|
String value = config[i]["value"]; |
|
|
String value = config[i]["value"]; |
|
|
|
|
|
|
|
|