bunti/src/main/java/de/ctdo/bunti/model/BuntiDevice.java

58 lines
1.2 KiB
Java
Raw Normal View History

2012-03-02 21:09:43 +00:00
package de.ctdo.bunti.model;
import java.util.Map;
public abstract class BuntiDevice {
2012-03-04 09:50:50 +00:00
private int deviceId;
private String deviceName;
private long lastChanged;
2012-03-04 09:50:50 +00:00
public BuntiDevice(int deviceId, String deviceName, long lastChanged) {
this.deviceId = deviceId;
this.deviceName = deviceName;
this.lastChanged = lastChanged;
}
public BuntiDevice(int deviceId, String deviceName) {
this(deviceId,deviceName,System.currentTimeMillis());
2012-03-04 09:50:50 +00:00
}
public final int getDeviceId() {
return deviceId;
2012-03-02 21:09:43 +00:00
}
2012-03-04 09:50:50 +00:00
public final long getLastChanged() {
return lastChanged;
}
2012-03-04 09:50:50 +00:00
protected final void lastChangedNow() {
this.lastChanged = System.currentTimeMillis();
}
2012-03-04 09:50:50 +00:00
public final String getDeviceName() {
return deviceName;
}
2012-03-04 09:50:50 +00:00
public final void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
/**
* Switch this device off.
*/
public abstract void switchOff();
/**
* Switch this device on.
*/
public abstract void switchOn();
2012-03-02 21:09:43 +00:00
/**
* The the internal options corresponding to the given Key Value Map
* @param options The options Map.
* @return True on success. False otherwise.
*/
public abstract boolean setValuesFromOptions(Map<String, Object> options);
2012-03-02 21:09:43 +00:00
}