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>";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp = resp + "<ac>";
|
2016-11-27 16:45:54 +01:00
|
|
|
if (nightlightActive && nightlightFade)
|
|
|
|
{
|
2018-03-14 13:16:28 +01:00
|
|
|
resp = resp + briT;
|
2016-11-27 16:45:54 +01:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp = resp + bri;
|
|
|
|
}
|
2018-03-14 19:05:51 +01:00
|
|
|
resp = resp + "</ac>";
|
2016-11-19 19:39:17 +01:00
|
|
|
|
|
|
|
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;
|
2018-02-20 22:29:48 +01:00
|
|
|
resp = resp + "</nl><nf>";
|
|
|
|
resp = resp + nightlightFade;
|
|
|
|
resp = resp + "</nf><nd>";
|
|
|
|
resp = resp + nightlightDelayMins;
|
|
|
|
resp = resp + "</nd><nt>";
|
|
|
|
resp = resp + nightlightTargetBri;
|
|
|
|
resp = resp + "</nt><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;
|
2018-01-27 23:28:20 +01:00
|
|
|
resp = resp + "</sx><ix>";
|
|
|
|
resp = resp + effectIntensity;
|
|
|
|
resp = resp + "</ix><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;
|
2018-03-14 19:05:51 +01:00
|
|
|
resp = resp + "</md><ds>";
|
2016-12-11 20:11:14 +01:00
|
|
|
resp = resp + serverDescription;
|
2018-03-14 19:05:51 +01:00
|
|
|
resp = resp + "</ds>";
|
2016-11-19 19:39:17 +01:00
|
|
|
resp = resp + "</vs>";
|
|
|
|
server.send(200, "text/xml", resp);
|
|
|
|
}
|
|
|
|
|
2018-03-14 13:16:28 +01:00
|
|
|
String getSettings(byte subPage)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-01-27 23:28:20 +01:00
|
|
|
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
|
|
|
|
DEBUG_PRINT("settings resp");
|
|
|
|
DEBUG_PRINTLN(subPage);
|
2017-11-20 00:07:37 +01:00
|
|
|
|
|
|
|
String resp = "";
|
2018-02-20 22:29:48 +01:00
|
|
|
if (subPage <1 || subPage >6) return resp;
|
|
|
|
|
2017-11-20 00:07:37 +01:00
|
|
|
String ds = "d.Sf.";
|
|
|
|
String dg = "d.getElementsByClassName";
|
|
|
|
String v = ".value=";
|
|
|
|
String c = ".checked=";
|
|
|
|
String ih = ".innerHTML=";
|
2018-03-06 23:47:08 +01:00
|
|
|
String si = ".selectedIndex=";
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 1) {
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "CS" + v + "\"" + clientSSID + "\";";
|
|
|
|
resp += ds + "CP" + v + "\"";
|
2018-03-14 13:16:28 +01:00
|
|
|
for (int i = 0; i < clientPass.length(); i++)
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
|
|
|
resp += "*";
|
|
|
|
}
|
|
|
|
resp += "\";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "I0" + v + staticIP[0] +";";
|
|
|
|
resp += ds + "I1" + v + staticIP[1] +";";
|
|
|
|
resp += ds + "I2" + v + staticIP[2] +";";
|
|
|
|
resp += ds + "I3" + v + staticIP[3] +";";
|
|
|
|
resp += ds + "G0" + v + staticGateway[0] +";";
|
|
|
|
resp += ds + "G1" + v + staticGateway[1] +";";
|
|
|
|
resp += ds + "G2" + v + staticGateway[2] +";";
|
|
|
|
resp += ds + "G3" + v + staticGateway[3] +";";
|
|
|
|
resp += ds + "S0" + v + staticSubnet[0] +";";
|
|
|
|
resp += ds + "S1" + v + staticSubnet[1] +";";
|
|
|
|
resp += ds + "S2" + v + staticSubnet[2] +";";
|
|
|
|
resp += ds + "S3" + v + staticSubnet[3] +";";
|
|
|
|
resp += ds + "CM" + v + "\"" + cmDNS + "\";";
|
|
|
|
resp += ds + "AT" + v + apWaitTimeSecs +";";
|
|
|
|
resp += ds + "AS" + v + "\"" + apSSID + "\";";
|
|
|
|
resp += ds + "AH" + c + apHide + ";";
|
|
|
|
resp += ds + "AP" + v + "\"";
|
2018-03-14 13:16:28 +01:00
|
|
|
for (int i = 0; i < apPass.length(); i++)
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
|
|
|
resp += "*";
|
|
|
|
}
|
|
|
|
resp += "\";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "AC" + v + apChannel +";";
|
2018-02-20 22:29:48 +01:00
|
|
|
resp += dg + "(\"sip\")[0]" + ih + "\"";
|
|
|
|
if (!WiFi.localIP()[0] == 0)
|
|
|
|
{
|
|
|
|
resp += WiFi.localIP()[0];
|
|
|
|
resp += + ".";
|
|
|
|
resp += WiFi.localIP()[1];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.localIP()[2];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.localIP()[3];
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp += "Not connected";
|
|
|
|
}
|
|
|
|
resp += "\";";
|
|
|
|
resp += dg + "(\"sip\")[1]" + ih + "\"";
|
|
|
|
if (!WiFi.softAPIP()[0] == 0)
|
|
|
|
{
|
|
|
|
resp += WiFi.softAPIP()[0];
|
|
|
|
resp += + ".";
|
|
|
|
resp += WiFi.softAPIP()[1];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.softAPIP()[2];
|
|
|
|
resp += ".";
|
|
|
|
resp += WiFi.softAPIP()[3];
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
resp += "Not active";
|
|
|
|
}
|
|
|
|
resp += "\";";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 2) {
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "LC" + v + ledCount +";";
|
|
|
|
resp += ds + "CR" + v + colS[0] +";";
|
|
|
|
resp += ds + "CG" + v + colS[1] +";";
|
|
|
|
resp += ds + "CB" + v + colS[2] +";";
|
|
|
|
resp += ds + "CA" + v + briS +";";
|
2018-04-14 18:56:35 +02:00
|
|
|
resp += ds + "EW" + c + useRGBW +";";
|
2018-05-31 19:26:16 +02:00
|
|
|
resp += ds + "AW" + c + autoRGBtoRGBW +";";
|
2018-04-14 18:56:35 +02:00
|
|
|
resp += ds + "CW" + v + whiteS +";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "SR" + v + colSecS[0] +";";
|
|
|
|
resp += ds + "SG" + v + colSecS[1] +";";
|
|
|
|
resp += ds + "SB" + v + colSecS[2] +";";
|
|
|
|
resp += ds + "SW" + v + whiteSecS +";";
|
|
|
|
resp += ds + "BO" + c + turnOnAtBoot +";";
|
|
|
|
resp += ds + "BP" + v + bootPreset +";";
|
|
|
|
resp += ds + "FX" + v + effectDefault +";";
|
|
|
|
resp += ds + "SX" + v + effectSpeedDefault +";";
|
|
|
|
resp += ds + "IX" + v + effectIntensityDefault +";";
|
|
|
|
resp += ds + "GB" + c + useGammaCorrectionBri +";";
|
|
|
|
resp += ds + "GC" + c + useGammaCorrectionRGB +";";
|
|
|
|
resp += ds + "TF" + c + fadeTransition +";";
|
|
|
|
resp += ds + "TS" + c + sweepTransition +";";
|
|
|
|
resp += ds + "TI" + c + !sweepDirection +";";
|
|
|
|
resp += ds + "TD" + v + transitionDelay +";";
|
2018-05-10 19:55:58 +02:00
|
|
|
resp += ds + "T2" + c + !disableSecTransition +";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "BF" + v + briMultiplier +";";
|
|
|
|
resp += ds + "TB" + v + nightlightTargetBri +";";
|
|
|
|
resp += ds + "TL" + v + nightlightDelayMins +";";
|
|
|
|
resp += ds + "TW" + c + nightlightFade +";";
|
|
|
|
resp += ds + "RV" + c + reverseMode +";";
|
2018-03-15 12:04:14 +01:00
|
|
|
resp += ds + "EI" + c + initLedsLast +";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "WO" + v + arlsOffset +";";
|
2018-06-24 01:20:15 +02:00
|
|
|
resp += ds + "SL" + c + skipFirstLed +";";
|
2016-12-29 00:03:58 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
|
2018-02-20 22:29:48 +01:00
|
|
|
if (subPage == 3)
|
|
|
|
{
|
2018-05-22 21:11:19 +02:00
|
|
|
resp += ds + "UI" + si + String(uiConfiguration) + ";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "DS" + v + "\"" + serverDescription + "\";";
|
|
|
|
resp += ds + "MD" + c + useHSBDefault + ";";
|
|
|
|
resp += ds + "TH" + si + String(currentTheme) + ";";
|
2018-02-23 01:33:32 +01:00
|
|
|
for(int i=0;i<6;i++)
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "C" + i + v + "\"" + cssCol[i] + "\";";
|
|
|
|
resp += ds + "CF" + v + "\"" + cssFont + "\";";
|
2017-11-20 00:07:37 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 4)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "BT" + c + buttonEnabled +";";
|
|
|
|
resp += ds + "UP" + v + udpPort +";";
|
|
|
|
resp += ds + "RB" + c + receiveNotificationBrightness +";";
|
|
|
|
resp += ds + "RC" + c + receiveNotificationColor +";";
|
|
|
|
resp += ds + "RX" + c + receiveNotificationEffects +";";
|
|
|
|
resp += ds + "SD" + c + notifyDirectDefault +";";
|
|
|
|
resp += ds + "SB" + c + notifyButton +";";
|
|
|
|
resp += ds + "SH" + c + notifyHue +";";
|
|
|
|
resp += ds + "S2" + c + notifyTwice +";";
|
2018-05-10 19:55:58 +02:00
|
|
|
resp += ds + "RD" + c + receiveDirect +";";
|
|
|
|
resp += ds + "RU" + c + enableRealtimeUI +";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "AL" + c + alexaEnabled +";";
|
|
|
|
resp += ds + "AI" + v + "\"" + alexaInvocationName + "\";";
|
|
|
|
resp += ds + "SA" + c + alexaNotify +";";
|
|
|
|
resp += ds + "H0" + v + hueIP[0] +";";
|
|
|
|
resp += ds + "H1" + v + hueIP[1] +";";
|
|
|
|
resp += ds + "H2" + v + hueIP[2] +";";
|
|
|
|
resp += ds + "H3" + v + hueIP[3] +";";
|
|
|
|
resp += ds + "HL" + v + huePollLightId +";";
|
|
|
|
resp += ds + "HI" + v + huePollIntervalMs +";";
|
|
|
|
resp += ds + "HP" + c + huePollingEnabled +";";
|
|
|
|
resp += ds + "HO" + c + hueApplyOnOff +";";
|
|
|
|
resp += ds + "HB" + c + hueApplyBri +";";
|
|
|
|
resp += ds + "HC" + c + hueApplyColor +";";
|
2018-02-28 00:27:10 +01:00
|
|
|
resp += dg + "(\"hms\")[0]" + ih + "\"" + hueError + "\";";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 5)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "NT" + c + ntpEnabled +";";
|
|
|
|
resp += ds + "CF" + c + !useAMPM +";";
|
|
|
|
resp += ds + "TZ" + si + String(currentTimezone) + ";";
|
|
|
|
resp += ds + "UO" + v + utcOffsetSecs +";";
|
2018-02-20 22:29:48 +01:00
|
|
|
resp += dg + "(\"times\")[0]" + ih + "\"" + getTimeString() + "\";";
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "OL" + si + String(overlayCurrent) + ";";
|
|
|
|
resp += ds + "O1" + v + overlayMin +";";
|
|
|
|
resp += ds + "O2" + v + overlayMax +";";
|
|
|
|
resp += ds + "OM" + v + analogClock12pixel +";";
|
|
|
|
resp += ds + "OS" + c + analogClockSecondsTrail +";";
|
|
|
|
resp += ds + "O5" + c + analogClock5MinuteMarks +";";
|
|
|
|
resp += ds + "CX" + v + "\"" + cronixieDisplay + "\";";
|
|
|
|
resp += ds + "CB" + c + cronixieBacklight +";";
|
|
|
|
resp += ds + "CE" + c + countdownMode +";";
|
|
|
|
resp += ds + "CY" + v + countdownYear +";";
|
|
|
|
resp += ds + "CI" + v + countdownMonth +";";
|
|
|
|
resp += ds + "CD" + v + countdownDay +";";
|
|
|
|
resp += ds + "CH" + v + countdownHour +";";
|
|
|
|
resp += ds + "CM" + v + countdownMin +";";
|
|
|
|
resp += ds + "CS" + v + countdownSec +";";
|
2018-03-06 23:47:08 +01:00
|
|
|
for (int i=1;i<17;i++)
|
|
|
|
{
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "M" + String(i) + v + "\"" + loadMacro(i) + "\";";
|
2018-03-06 23:47:08 +01:00
|
|
|
}
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "MB" + v + macroBoot +";";
|
|
|
|
resp += ds + "A0" + v + macroAlexaOn +";";
|
|
|
|
resp += ds + "A1" + v + macroAlexaOff +";";
|
|
|
|
resp += ds + "MP" + v + macroButton +";";
|
|
|
|
resp += ds + "ML" + v + macroLongPress +";";
|
|
|
|
resp += ds + "MC" + v + macroCountdown +";";
|
|
|
|
resp += ds + "MN" + v + macroNl +";";
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (subPage == 6)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-03-14 19:05:51 +01:00
|
|
|
resp += ds + "NO" + c + otaLock +";";
|
|
|
|
resp += ds + "OW" + c + wifiLock +";";
|
|
|
|
resp += ds + "AO" + c + aOtaEnabled +";";
|
|
|
|
resp += ds + "NA" + c + recoveryAPDisabled +";";
|
2018-02-23 01:33:32 +01:00
|
|
|
resp += dg + "(\"msg\")[0]" + ih + "\"WLED "+ versionString +" (build " + VERSION + ") OK\";";
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
resp += "}</script>";
|
2017-11-20 00:07:37 +01:00
|
|
|
|
|
|
|
return resp;
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|