2016-11-19 19:39:17 +01:00
|
|
|
void XML_response()
|
|
|
|
{
|
|
|
|
String resp;
|
|
|
|
resp = resp + "<?xml version = \"1.0\" ?>";
|
|
|
|
resp = resp + "<vs>";
|
|
|
|
resp = resp + "<act>";
|
2016-11-27 16:45:54 +01:00
|
|
|
if (nightlightActive && nightlightFade)
|
|
|
|
{
|
|
|
|
resp = resp + bri_t;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp = resp + bri;
|
|
|
|
}
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "</act>";
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
resp = resp + "<cl>";
|
|
|
|
resp = resp + col[i];
|
|
|
|
resp = resp + "</cl>";
|
|
|
|
}
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + "<ns>";
|
|
|
|
resp = resp + notifyMaster;
|
|
|
|
resp = resp + "</ns>";
|
|
|
|
resp = resp + "<nr>";
|
|
|
|
resp = resp + receiveNotifications;
|
|
|
|
resp = resp + "</nr>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "<nl>";
|
|
|
|
resp = resp + nightlightActive;
|
|
|
|
resp = resp + "</nl>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + "<fx>";
|
|
|
|
resp = resp + effectCurrent;
|
|
|
|
resp = resp + "</fx>";
|
2016-12-29 00:03:58 +01:00
|
|
|
resp = resp + "<sx>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + effectSpeed;
|
2016-12-29 00:03:58 +01:00
|
|
|
resp = resp + "</sx>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "<desc>";
|
|
|
|
resp = resp + serverDescription;
|
|
|
|
resp = resp + "</desc>";
|
2016-11-19 19:39:17 +01:00
|
|
|
//enable toolbar here
|
|
|
|
resp = resp + "</vs>";
|
|
|
|
server.send(200, "text/xml", resp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void XML_response_settings()
|
|
|
|
{
|
|
|
|
Serial.println("XML settings response");
|
|
|
|
String resp;
|
|
|
|
resp = resp + "<?xml version = \"1.0\" ?>";
|
|
|
|
resp = resp + "<vs>";
|
|
|
|
resp = resp + "<cssid>";
|
|
|
|
resp = resp + clientssid;
|
|
|
|
resp = resp + "</cssid>";
|
|
|
|
resp = resp + "<cpass>";
|
|
|
|
for (int i = 0; i < clientpass.length(); i++)
|
|
|
|
{
|
|
|
|
resp = resp + "*";
|
|
|
|
}
|
|
|
|
resp = resp + "</cpass>";
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
resp = resp + "<csips>";
|
|
|
|
resp = resp + staticip[i];
|
|
|
|
resp = resp + "</csips>";
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
resp = resp + "<csgws>";
|
|
|
|
resp = resp + staticgateway[i];
|
|
|
|
resp = resp + "</csgws>";
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
resp = resp + "<cssns>";
|
|
|
|
resp = resp + staticsubnet[i];
|
|
|
|
resp = resp + "</cssns>";
|
|
|
|
}
|
|
|
|
resp = resp + "<cmdns>";
|
|
|
|
resp = resp + cmdns;
|
|
|
|
resp = resp + "</cmdns>";
|
|
|
|
resp = resp + "<apssid>";
|
|
|
|
resp = resp + apssid;
|
|
|
|
resp = resp + "</apssid>";
|
|
|
|
resp = resp + "<aphssid>";
|
|
|
|
resp = resp + aphide;
|
|
|
|
resp = resp + "</aphssid>";
|
|
|
|
resp = resp + "<appass>";
|
|
|
|
for (int i = 0; i < appass.length(); i++)
|
|
|
|
{
|
|
|
|
resp = resp + "*";
|
|
|
|
}
|
|
|
|
resp = resp + "</appass>";
|
|
|
|
resp = resp + "<apchan>";
|
|
|
|
resp = resp + apchannel;
|
|
|
|
resp = resp + "</apchan>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "<desc>";
|
2016-12-29 00:03:58 +01:00
|
|
|
resp = resp + serverDescription;
|
|
|
|
resp = resp + "</desc>";
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
resp = resp + "<cldef>";
|
|
|
|
resp = resp + col_s[i];
|
|
|
|
resp = resp + "</cldef>";
|
|
|
|
}
|
|
|
|
resp = resp + "<cldfa>";
|
|
|
|
resp = resp + bri_s;
|
|
|
|
resp = resp + "</cldfa>";
|
|
|
|
resp = resp + "<fxdef>";
|
|
|
|
resp = resp + effectDefault;
|
|
|
|
resp = resp + "</fxdef>";
|
|
|
|
resp = resp + "<sxdef>";
|
|
|
|
resp = resp + effectSpeedDefault;
|
|
|
|
resp = resp + "</sxdef>";
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "<btnon>";
|
|
|
|
resp = resp + bool2int(buttonEnabled);
|
|
|
|
resp = resp + "</btnon><tfade>";
|
|
|
|
resp = resp + bool2int(fadeTransition);
|
|
|
|
resp = resp + "</tfade><tdlay>";
|
|
|
|
resp = resp + transitionDelay;
|
|
|
|
resp = resp + "</tdlay>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "<tlbri>";
|
|
|
|
resp = resp + bri_nl;
|
|
|
|
resp = resp + "</tlbri>";
|
2016-11-20 00:07:04 +01:00
|
|
|
resp = resp + "<tldur>";
|
|
|
|
resp = resp + nightlightDelayMins;
|
|
|
|
resp = resp + "</tldur>";
|
|
|
|
resp = resp + "<tlfde>";
|
|
|
|
resp = resp + bool2int(nightlightFade);
|
|
|
|
resp = resp + "</tlfde>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "<nudpp>";
|
|
|
|
resp = resp + udpPort;
|
|
|
|
resp = resp + "</nudpp>";
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "<nrcve>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + bool2int(receiveNotificationsDefault);
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "</nrcve><nrbri>";
|
|
|
|
resp = resp + bri_n;
|
|
|
|
resp = resp + "</nrbri><nsdir>";
|
|
|
|
resp = resp + bool2int(notifyDirect);
|
|
|
|
resp = resp + "</nsdir><nsbtn>";
|
|
|
|
resp = resp + bool2int(notifyButton);
|
|
|
|
resp = resp + "</nsbtn><nsfwd>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + bool2int(notifyNightlight);
|
|
|
|
resp = resp + "</nsfwd>";
|
2016-12-29 00:03:58 +01:00
|
|
|
resp = resp + "<ntpon>";
|
|
|
|
resp = resp + bool2int(ntpEnabled);
|
|
|
|
resp = resp + "</ntpon>";
|
|
|
|
Serial.println("pretime");
|
|
|
|
resp = resp + "<times>";
|
|
|
|
resp = resp + getTimeString();
|
|
|
|
resp = resp + "</times>";
|
|
|
|
Serial.println("posttime");
|
2016-11-20 01:47:15 +01:00
|
|
|
resp = resp + "<noota>";
|
|
|
|
resp = resp + bool2int(ota_lock);
|
|
|
|
resp = resp +"</noota>";
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "<norap>0</norap>"; //NI
|
|
|
|
resp = resp + "<sip>";
|
|
|
|
if (!WiFi.localIP()[0] == 0)
|
|
|
|
{
|
|
|
|
resp = resp + WiFi.localIP()[0];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.localIP()[1];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.localIP()[2];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.localIP()[3];
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp = resp + "Not connected";
|
|
|
|
}
|
|
|
|
resp = resp + "</sip><sip>";
|
|
|
|
if (!WiFi.softAPIP()[0] == 0)
|
|
|
|
{
|
|
|
|
resp = resp + WiFi.softAPIP()[0];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.softAPIP()[1];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.softAPIP()[2];
|
|
|
|
resp = resp + ".";
|
|
|
|
resp = resp + WiFi.softAPIP()[3];
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp = resp + "Not active";
|
|
|
|
}
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + "</sip>";
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "<msg>WLED 0.3pd OK</msg>";
|
|
|
|
resp = resp + "</vs>";
|
|
|
|
Serial.println(resp);
|
|
|
|
server.send(200, "text/xml", resp);
|
|
|
|
}
|