using System; namespace SmartRoom { /// /// Antwort von GET /api/unity des gemeinsamen Backends (backend/raum.js → unity()). /// Das Backend entscheidet für Webinterface und Unity gemeinsam; Unity zeigt nur an und führt aus. /// Das Backend liefert keine null-Werte (in "manuell" bedeutet -1 bzw. "" Automatik). /// Die Sensorwerte ("sensor") liest separat in ein . /// [Serializable] public class CentralState { public string zeit, szenario, status, detail, ton, prioritaet; public int prioritaetNummer; public float zielTemperatur; public bool sensorOnline, fensterGesperrt; public CentralCommand steuerung = new CentralCommand(); public CentralSources quellen = new CentralSources(); public CentralVetos vetos = new CentralVetos(); public CentralLimits grenzwerte = new CentralLimits(); public CentralVotes stimmen = new CentralVotes(); public CentralTimer vortrag = new CentralTimer(); public CentralManual manuell = new CentralManual(); public CentralCheck pruefung = new CentralCheck(); public string[] pfad = new string[0]; public CentralEntry[] verlauf = new CentralEntry[0]; public CentralScenario[] szenarien = new CentralScenario[0]; /// Quelle eines Sensorkanals: "sensor", "wetter", "demo" oder null. public string SourceOf(string channel) { switch (channel) { case "t": return quellen.t; case "co2": return quellen.co2; case "rh": return quellen.rh; case "tvoc": return quellen.tvoc; case "lightpct": case "lux": return quellen.lightpct; case "nout": return quellen.nout; case "tout": return quellen.tout; case "wind": return quellen.wind; case "sun": return quellen.sun; case "aq": return quellen.aq; default: return null; } } } /// Steuerbefehl, gleiches Format wie . [Serializable] public class CentralCommand { public string window = "closed"; public float blind, heat, vent, light; public int beamer; } [Serializable] public class CentralSources { public string t, co2, rh, tvoc, lightpct, nout, tout, wind, sun, aq; } [Serializable] public class CentralVetos { public bool co2, laerm, wind, aussenluft; } [Serializable] public class CentralLimits { public float co2Ppm = 1000f, laermDb = 70f, windKmh = 60f; } [Serializable] public class CentralVotes { public int kuehler, angenehm, waermer, auf, zu, gesamt; } [Serializable] public class CentralTimer { public bool aktiv; public int restMinuten, dauerMinuten; } /// Manuelle Dozenteneinstellungen aus dem Webinterface (-1 bzw. "" = Automatik). [Serializable] public class CentralManual { public bool aktiv; public string fenster = "", bis = ""; public int jalousie = -1, licht = -1, lueftung = -1; } /// Prüfzyklus des Backends (alle 2 min, Zeitraffer 1×/5×/10×). [Serializable] public class CentralCheck { public int intervallSekunden = 120, zeitraffer = 1, abstandSekunden = 120, restSekunden; public string letzteUhrzeit = ""; } [Serializable] public class CentralEntry { public string uhrzeit, titel, grund, ton; } [Serializable] public class CentralScenario { public string id, text, beschreibung; } }