Преглед изворни кода

Adds basic room for sharing values between devices

Andreas T. Meyer-Berg пре 3 година
родитељ
комит
863e8f2b7c

+ 47 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/core/RoomStatus.java

@@ -0,0 +1,47 @@
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.core;
+
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.scheduler.Schedulable;
+
+/**
+ * Class for storing attributes of a room, and sharing it between different devices
+ *
+ */
+public class RoomStatus implements Schedulable {
+
+	/**
+	 * True if light is on
+	 */
+	private boolean lightOn = false;
+	
+	/**
+	 * Average temperature of the room
+	 */
+	private float temperature = 21f;
+	
+	@Override
+	public long getEventTime() {
+		return Long.MAX_VALUE;
+	}
+
+	@Override
+	public void simulateEvent(long time) {
+		// TODO: Maybe simulation? e.g. sharing temperature with other rooms, outside etc.
+	}
+
+	public boolean isLightOn() {
+		return lightOn;
+	}
+
+	public void setLightOn(boolean lightOn) {
+		this.lightOn = lightOn;
+	}
+
+	public float getTemperature() {
+		return temperature;
+	}
+
+	public void setTemperature(float temperature) {
+		this.temperature = temperature;
+	}
+
+}