2016-12-31 00:38:51 +01:00
|
|
|
/*
|
|
|
|
* Sending XML status files to client
|
|
|
|
*/
|
|
|
|
|
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>";
|
2017-05-08 21:46:04 +02:00
|
|
|
resp = resp + notifyDirect;
|
2017-05-07 23:51:42 +02:00
|
|
|
resp = resp + "</ns><nr>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + receiveNotifications;
|
2017-05-07 23:51:42 +02:00
|
|
|
resp = resp + "</nr><nl>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + nightlightActive;
|
2017-05-07 23:51:42 +02:00
|
|
|
resp = resp + "</nl><fx>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + effectCurrent;
|
2017-05-07 23:51:42 +02:00
|
|
|
resp = resp + "</fx><sx>";
|
2016-12-14 21:40:09 +01:00
|
|
|
resp = resp + effectSpeed;
|
2017-09-27 21:45:58 +02:00
|
|
|
resp = resp + "</sx><wv>";
|
2017-10-12 22:20:37 +02:00
|
|
|
if (useRGBW) {
|
|
|
|
resp = resp + white;
|
|
|
|
} else {
|
|
|
|
resp = resp + "-1";
|
|
|
|
}
|
2017-09-27 21:45:58 +02:00
|
|
|
resp = resp + "</wv><md>";
|
2017-05-08 21:46:04 +02:00
|
|
|
resp = resp + useHSB;
|
2017-05-07 23:51:42 +02:00
|
|
|
resp = resp + "</md><desc>";
|
2016-12-11 20:11:14 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2017-11-20 00:07:37 +01:00
|
|
|
String getSettings()
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
DEBUG_PRINTLN("settings resp");
|
|
|
|
|
|
|
|
String resp = "";
|
|
|
|
String ds = "d.Sf.";
|
|
|
|
String dg = "d.getElementsByClassName";
|
|
|
|
String v = ".value=";
|
|
|
|
String c = ".checked=";
|
|
|
|
String ih = ".innerHTML=";
|
|
|
|
|
|
|
|
resp += ds + "CSSID" + v + "\"" + clientssid + "\";";
|
|
|
|
resp += ds + "CPASS" + v + "\"";
|
2016-11-19 19:39:17 +01:00
|
|
|
for (int i = 0; i < clientpass.length(); i++)
|
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "*";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "\";";
|
|
|
|
resp += ds + "CSIP0" + v + staticip[0] +";";
|
|
|
|
resp += ds + "CSIP1" + v + staticip[1] +";";
|
|
|
|
resp += ds + "CSIP2" + v + staticip[2] +";";
|
|
|
|
resp += ds + "CSIP3" + v + staticip[3] +";";
|
|
|
|
resp += ds + "CSGW0" + v + staticgateway[0] +";";
|
|
|
|
resp += ds + "CSGW1" + v + staticgateway[1] +";";
|
|
|
|
resp += ds + "CSGW2" + v + staticgateway[2] +";";
|
|
|
|
resp += ds + "CSGW3" + v + staticgateway[3] +";";
|
|
|
|
resp += ds + "CSSN0" + v + staticsubnet[0] +";";
|
|
|
|
resp += ds + "CSSN1" + v + staticsubnet[1] +";";
|
|
|
|
resp += ds + "CSSN2" + v + staticsubnet[2] +";";
|
|
|
|
resp += ds + "CSSN3" + v + staticsubnet[3] +";";
|
|
|
|
resp += ds + "CMDNS" + v + "\"" + cmdns + "\";";
|
|
|
|
resp += ds + "APWTM" + v + apWaitTimeSecs +";";
|
|
|
|
resp += ds + "APSSID" + v + "\"" + apssid + "\";";
|
|
|
|
resp += ds + "APHSSID" + c + aphide + ";";
|
|
|
|
resp += ds + "APPASS" + v + "\"";
|
|
|
|
for (int i = 0; i < clientpass.length(); i++)
|
2016-12-29 00:03:58 +01:00
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "*";
|
2016-12-29 00:03:58 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "\";";
|
|
|
|
resp += ds + "APCHAN" + v + apchannel +";";
|
|
|
|
|
|
|
|
resp += ds + "DESC" + v + "\"" + serverDescription + "\";";
|
|
|
|
resp += ds + "COLMD" + c + useHSBDefault + ";";
|
|
|
|
resp += ds + "LEDCN" + v + ledcount +";";
|
|
|
|
resp += ds + "CLDFR" + v + col_s[0] +";";
|
|
|
|
resp += ds + "CLDFG" + v + col_s[1] +";";
|
|
|
|
resp += ds + "CLDFB" + v + col_s[2] +";";
|
|
|
|
resp += ds + "CLDFA" + v + bri_s +";";
|
2017-10-12 22:20:37 +02:00
|
|
|
if (useRGBW) {
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += ds + "CLDFW" + v + white_s +";";
|
|
|
|
} else {
|
|
|
|
resp += ds + "CLDFW" + v + "-1;";
|
|
|
|
}
|
|
|
|
resp += ds + "BOOTN" + c + turnOnAtBoot +";";
|
2017-12-12 14:52:28 +01:00
|
|
|
resp += ds + "BOOTP" + v + bootPreset +";";
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += ds + "FXDEF" + v + effectDefault +";";
|
2017-11-20 21:13:56 +01:00
|
|
|
resp += ds + "SXDEF" + v + effectSpeedDefault +";";
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += ds + "GCBRI" + c + useGammaCorrectionBri +";";
|
|
|
|
resp += ds + "GCRGB" + c + useGammaCorrectionRGB +";";
|
|
|
|
resp += ds + "BTNON" + c + buttonEnabled +";";
|
|
|
|
resp += ds + "TFADE" + c + fadeTransition +";";
|
|
|
|
resp += ds + "TSWEE" + c + sweepTransition +";";
|
|
|
|
resp += ds + "TSDIR" + c + !sweepDirection +";";
|
|
|
|
resp += ds + "TDLAY" + v + transitionDelay +";";
|
|
|
|
resp += ds + "TLBRI" + v + bri_nl +";";
|
|
|
|
resp += ds + "TLDUR" + v + nightlightDelayMins +";";
|
|
|
|
resp += ds + "TLFDE" + c + nightlightFade +";";
|
|
|
|
resp += ds + "NUDPP" + v + udpPort +";";
|
|
|
|
resp += ds + "NRBRI" + v + bri_n +";";
|
|
|
|
resp += ds + "NRCVE" + c + receiveNotificationsDefault +";";
|
|
|
|
resp += ds + "NSDIR" + c + notifyDirectDefault +";";
|
|
|
|
resp += ds + "NSBTN" + c + notifyButton +";";
|
|
|
|
resp += ds + "NTPON" + c + ntpEnabled +";";
|
|
|
|
resp += ds + "ALEXA" + c + alexaEnabled +";";
|
|
|
|
resp += ds + "AINVN" + v + "\"" + alexaInvocationName + "\";";
|
|
|
|
resp += ds + "NSALX" + c + alexaNotify +";";
|
|
|
|
resp += dg + "(\"times\")[0]" + ih + "\"" + getTimeString() + "\";";
|
|
|
|
resp += ds + "OLDEF" + v + overlayDefault +";";
|
2017-12-16 00:04:04 +01:00
|
|
|
resp += ds + "WOFFS" + v + arlsOffset +";";
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += ds + "NOOTA" + c + otaLock +";";
|
|
|
|
resp += ds + "NORAP" + c + recoveryAPDisabled +";";
|
|
|
|
resp += dg + "(\"sip\")[0]" + ih + "\"";
|
2016-11-19 19:39:17 +01:00
|
|
|
if (!WiFi.localIP()[0] == 0)
|
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += WiFi.localIP()[0];
|
|
|
|
resp += + ".";
|
|
|
|
resp += WiFi.localIP()[1];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.localIP()[2];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.localIP()[3];
|
2016-11-19 19:39:17 +01:00
|
|
|
} else
|
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "Not connected";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "\";";
|
|
|
|
resp += dg + "(\"sip\")[1]" + ih + "\"";
|
2016-11-19 19:39:17 +01:00
|
|
|
if (!WiFi.softAPIP()[0] == 0)
|
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += WiFi.softAPIP()[0];
|
|
|
|
resp += + ".";
|
|
|
|
resp += WiFi.softAPIP()[1];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.softAPIP()[2];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.softAPIP()[3];
|
2016-11-19 19:39:17 +01:00
|
|
|
} else
|
|
|
|
{
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "Not active";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
resp += "\";";
|
2018-01-10 00:37:45 +01:00
|
|
|
resp += dg + "(\"msg\")[0]" + ih + "\""+ versionName +" (build " + VERSION + ") OK\";";
|
2017-11-20 00:07:37 +01:00
|
|
|
|
|
|
|
return resp;
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|