|
@@ -1,7 +1,7 @@
|
|
|
-fetch("https://169.254.175.168:8888/device").then( function(text) { return text.text() } ).then( function(text2) { element = document.getElementById("deviceheader"); element.innerText = text2} )
|
|
|
+fetch("../device").then( function(text) { return text.text() } ).then( function(text2) { element = document.getElementById("deviceheader"); element.innerText = text2} )
|
|
|
|
|
|
function getTime() {
|
|
|
- fetch("https://169.254.175.168:8888/time"). then( function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { timeobj = JSON.parse(text2); element = document.getElementById("rtc"); element.innerText = timeobj.mday + "." + (timeobj.month +1) + "." + (timeobj.year + 1900) + " " + addZero(timeobj.hour) + ":" + addZero(timeobj.minutes) + ":" + addZero(timeobj.seconds) }).catch(function(error) { console.log("failed to fetch the time") })
|
|
|
+ fetch("../time"). then( function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { timeobj = JSON.parse(text2); element = document.getElementById("rtc"); element.innerText = timeobj.mday + "." + (timeobj.month +1) + "." + (timeobj.year + 1900) + " " + addZero(timeobj.hour) + ":" + addZero(timeobj.minutes) + ":" + addZero(timeobj.seconds) }).catch(function(error) { console.log("failed to fetch the time") })
|
|
|
}
|
|
|
|
|
|
function addZero(num) {
|
|
@@ -18,7 +18,7 @@ function getSystemTime() {
|
|
|
}
|
|
|
|
|
|
function getAlarm() {
|
|
|
- fetch("https://169.254.175.168:8888/wkalrm").then(function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { alarmdiv = document.getElementById("alarm"); alarmdiv.style.visibility="visible"; alarmtime=document.getElementById("alarm-time"); alarmobj=JSON.parse(text2); alarmtime.innerText = alarmobj.mday + "." + (alarmobj.month +1) + "." + (alarmobj.year + 1900) + " " + addZero(alarmobj.hour) + ":" + addZero(alarmobj.minutes) + ":" + addZero(alarmobj.seconds); alarm_status=document.getElementById("alarm-status"); alarm_status.innerText="Status: "; alarm_status.innerText += alarmobj.enabled ? " aktiviert" : " deaktiviert"; alarm_status.innerText += "\nAusgelöst: "; alarm_status.innerText += alarmobj.pending ? " ja" : " nein"}).catch( function(error) { console.log("alarm access failed") })
|
|
|
+ fetch("../wkalrm").then(function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { alarmdiv = document.getElementById("alarm"); alarmdiv.style.visibility="visible"; alarmtime=document.getElementById("alarm-time"); alarmobj=JSON.parse(text2); alarmtime.innerText = alarmobj.mday + "." + (alarmobj.month +1) + "." + (alarmobj.year + 1900) + " " + addZero(alarmobj.hour) + ":" + addZero(alarmobj.minutes) + ":" + addZero(alarmobj.seconds); alarm_status=document.getElementById("alarm-status"); alarm_status.innerText="Status: "; alarm_status.innerText += alarmobj.enabled ? " aktiviert" : " deaktiviert"; alarm_status.innerText += "\nAusgelöst: "; alarm_status.innerText += alarmobj.pending ? " ja" : " nein"}).catch( function(error) { console.log("alarm access failed") })
|
|
|
}
|
|
|
getSystemTime()
|
|
|
getNVRAM()
|
|
@@ -26,20 +26,20 @@ getAlarm()
|
|
|
getTime()
|
|
|
|
|
|
function getNVRAM() {
|
|
|
- fetch("https://169.254.175.168:8888/nvmem").then(function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { nvobj = JSON.parse(text2); element = document.getElementById("nvram-text"); element.innerText = nvobj.content; element2 = document.getElementById("nvram"); element2.style.visibility="visible"; }).catch( function(error) { console.log("error while reading nvram") })
|
|
|
+ fetch("../nvmem").then(function(text) { if(!text.ok) { throw text }; return text.text() }).then( function(text2) { nvobj = JSON.parse(text2); element = document.getElementById("nvram-text"); element.innerText = nvobj.content; element2 = document.getElementById("nvram"); element2.style.visibility="visible"; }).catch( function(error) { console.log("error while reading nvram") })
|
|
|
}
|
|
|
|
|
|
function submitNvRAM() {
|
|
|
nvobj = {};
|
|
|
element = document.getElementById("nvram-text");
|
|
|
nvobj.content = element.value;
|
|
|
- fetch("https://169.254.175.168:8888/nvmem", {method: "POST", body: JSON.stringify(nvobj)}).then( function(x) {alert("NVRAM erfolgreich geschrieben"); getNVRAM()}).catch( function(error) { alert("Fehler beim Schreiben in den NVRAM") })
|
|
|
+ fetch("../nvmem", {method: "POST", body: JSON.stringify(nvobj)}).then( function(x) {alert("NVRAM erfolgreich geschrieben"); getNVRAM()}).catch( function(error) { alert("Fehler beim Schreiben in den NVRAM") })
|
|
|
}
|
|
|
|
|
|
function changeAlarm() {
|
|
|
element = document.getElementById("alarm-time");
|
|
|
if (element.childElementCount === 0) {
|
|
|
- fetch("https://169.254.175.168:8888/wkalrm").then(function(text) {return text.text() }).then( function(text2) { element.innerText = ""; textarea = document.createElement("textarea"); textarea.id = "alarmtext"; textarea.rows=1; textarea.cols=20; alarmobj = JSON.parse(text2); textarea.innerText = alarmobj.mday + "." + (alarmobj.month +1) + "." + (alarmobj.year + 1900) + " " + addZero(alarmobj.hour) + ":" + addZero(alarmobj.minutes) + ":" + addZero(alarmobj.seconds); element.appendChild(textarea)})
|
|
|
+ fetch("../wkalrm").then(function(text) {return text.text() }).then( function(text2) { element.innerText = ""; textarea = document.createElement("textarea"); textarea.id = "alarmtext"; textarea.rows=1; textarea.cols=20; alarmobj = JSON.parse(text2); textarea.innerText = alarmobj.mday + "." + (alarmobj.month +1) + "." + (alarmobj.year + 1900) + " " + addZero(alarmobj.hour) + ":" + addZero(alarmobj.minutes) + ":" + addZero(alarmobj.seconds); element.appendChild(textarea)})
|
|
|
} else {
|
|
|
textelement = document.getElementById("alarmtext");
|
|
|
alstring = textelement.value.split(" ");
|
|
@@ -56,14 +56,14 @@ function changeAlarm() {
|
|
|
"enabled": 1,
|
|
|
"pending": 0
|
|
|
}
|
|
|
- fetch("https://169.254.175.168:8888/wkalrm", {method: "POST", body: JSON.stringify(alobj)}).then(function() {textelement.remove(); getAlarm();}).then(function(x) {alert("Alarmzeitpunkt erfolgreich geändert!")}).catch(function(y) {alert("Fehler beim Schreiben des Alarms!")})
|
|
|
+ fetch("../wkalrm", {method: "POST", body: JSON.stringify(alobj)}).then(function() {textelement.remove(); getAlarm();}).then(function(x) {alert("Alarmzeitpunkt erfolgreich geändert!")}).catch(function(y) {alert("Fehler beim Schreiben des Alarms!")})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function changeRTC() {
|
|
|
element = document.getElementById("rtc");
|
|
|
if (element.childElementCount === 0) {
|
|
|
- fetch("https://169.254.175.168:8888/time").then(function(text) {return text.text() }).then( function(text2) { element.innerText = ""; textarea = document.createElement("textarea"); textarea.id = "rtctext"; textarea.rows=1; textarea.cols=20; timeobj = JSON.parse(text2); textarea.innerText = timeobj.mday + "." + (timeobj.month +1) + "." + (timeobj.year + 1900) + " " + addZero(timeobj.hour) + ":" + addZero(timeobj.minutes) + ":" + addZero(timeobj.seconds); element.appendChild(textarea);})
|
|
|
+ fetch("../time").then(function(text) {return text.text() }).then( function(text2) { element.innerText = ""; textarea = document.createElement("textarea"); textarea.id = "rtctext"; textarea.rows=1; textarea.cols=20; timeobj = JSON.parse(text2); textarea.innerText = timeobj.mday + "." + (timeobj.month +1) + "." + (timeobj.year + 1900) + " " + addZero(timeobj.hour) + ":" + addZero(timeobj.minutes) + ":" + addZero(timeobj.seconds); element.appendChild(textarea);})
|
|
|
} else {
|
|
|
textelement = document.getElementById("rtctext");
|
|
|
alstring = textelement.value.split(" ");
|
|
@@ -78,7 +78,7 @@ function changeRTC() {
|
|
|
"year": parseInt(date[2]) -1900,
|
|
|
"wday": 1
|
|
|
}
|
|
|
- fetch("https://169.254.175.168:8888/time", {method: "POST", body: JSON.stringify(tobj)}).then(function() {textelement.remove(); getTime();}).then(function(x) {alert("Zeit/Datum erfolgreich geschrieben!")}).catch(function(x) {alert("Fehler beim Schreiben von Uhrzeit bzw. Datum!")})
|
|
|
+ fetch("../time", {method: "POST", body: JSON.stringify(tobj)}).then(function() {textelement.remove(); getTime();}).then(function(x) {alert("Zeit/Datum erfolgreich geschrieben!")}).catch(function(x) {alert("Fehler beim Schreiben von Uhrzeit bzw. Datum!")})
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -93,8 +93,7 @@ function systoHC() {
|
|
|
"year": date.getYear(),
|
|
|
"wday": 6
|
|
|
}
|
|
|
- console.log(tobj)
|
|
|
- fetch("https://169.254.175.168:8888/time", {method: "POST", body: JSON.stringify(tobj)}).then(function() {getTime();alert("Zeit erfolgreich mit RTC synchronisiert")}).catch(function(error) {"Fehler beim Synchronisieren mit der RTC!"})
|
|
|
+ fetch("../time", {method: "POST", body: JSON.stringify(tobj)}).then(function() {getTime();alert("Zeit erfolgreich mit RTC synchronisiert")}).catch(function(error) {"Fehler beim Synchronisieren mit der RTC!"})
|
|
|
}
|
|
|
|
|
|
function updateAll() {
|