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