updated some log traces and plugin files
This commit is contained in:
parent
253e359483
commit
6b4b565a62
3 changed files with 21 additions and 12 deletions
|
|
@ -57,7 +57,7 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
|
||||
public void register(Sensor sensor) {
|
||||
if(sensor.getDeviceConfig() == null) {
|
||||
logger.warning("Sensor data is null: "+ sensor);
|
||||
logger.warning("Sensor config is null: "+ sensor);
|
||||
return;
|
||||
}
|
||||
if(!availableSensors.contains(sensor.getDeviceConfig().getClass())) {
|
||||
|
|
@ -77,7 +77,7 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
|
||||
public void deregister(Sensor sensor){
|
||||
if(sensor.getDeviceConfig() == null) {
|
||||
logger.warning("Sensor data is null: "+ sensor);
|
||||
logger.warning("Sensor config is null: "+ sensor);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
|
||||
public void register(Event event) {
|
||||
if(event.getDeviceConfig() == null) {
|
||||
logger.warning("Event data is null: "+ event);
|
||||
logger.warning("Event config is null: "+ event);
|
||||
return;
|
||||
}
|
||||
if(!availableEvents.contains(event.getDeviceConfig().getClass())) {
|
||||
|
|
@ -167,7 +167,7 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
|
||||
public void deregister(Event event){
|
||||
if(event.getDeviceConfig() == null) {
|
||||
logger.warning("Event data is null: "+ event);
|
||||
logger.warning("Event config is null: "+ event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
controller = c.newInstance();
|
||||
if (controller instanceof HalAutoScannableController &&
|
||||
! ((HalAutoScannableController)controller).isAvailable()) {
|
||||
logger.warning("Controller not available: "+c.getName());
|
||||
logger.warning("Controller is not available: "+c.getName());
|
||||
return null;
|
||||
}
|
||||
logger.info("Instantiating new controller: " + c.getName());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"interfaces": [
|
||||
{"se.hal.intf.HalAutoScannableController": "se.hal.plugin.tellstick.TellstickSerialComm"},
|
||||
|
||||
{"se.hal.intf.HalSensorData": "se.hal.plugin.tellstick.protocols.Oregon0x1A2D"},
|
||||
{"se.hal.intf.HalEventData": "se.hal.plugin.tellstick.protocols.NexaSelfLearning"}
|
||||
{"se.hal.intf.HalSensorData": "se.hal.plugin.tellstick.device.Oregon0x1A2D"},
|
||||
{"se.hal.intf.HalEventData": "se.hal.plugin.tellstick.device.NexaSelfLearning"}
|
||||
]
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ public abstract class AbstractDevice<T,D> extends DBBean {
|
|||
/** Sensor specific configuration **/
|
||||
private transient T deviceConfig;
|
||||
/** latest device data received **/
|
||||
private transient D latestDeviceData;
|
||||
private transient D deviceData;
|
||||
|
||||
// User configuration
|
||||
@DBColumn("user_id")
|
||||
|
|
@ -72,10 +72,12 @@ public abstract class AbstractDevice<T,D> extends DBBean {
|
|||
*/
|
||||
public void setDeviceConfig(T data) {
|
||||
if(data != null) {
|
||||
deviceConfig = data;
|
||||
type = data.getClass().getName();
|
||||
deviceConfig = data;
|
||||
deviceData = readDeviceData();
|
||||
} else {
|
||||
deviceConfig = null;
|
||||
deviceData = null;
|
||||
type = null;
|
||||
config = null;
|
||||
}
|
||||
|
|
@ -115,14 +117,21 @@ public abstract class AbstractDevice<T,D> extends DBBean {
|
|||
* @return the latest known data from the device
|
||||
*/
|
||||
public D getDeviceData(){
|
||||
return latestDeviceData;
|
||||
return deviceData;
|
||||
}
|
||||
|
||||
public void setDeviceData(D latest){
|
||||
this.latestDeviceData = latest;
|
||||
this.deviceData = latest;
|
||||
}
|
||||
|
||||
/**************** OTHER VALUES ******************/
|
||||
/**
|
||||
* Reads latest device data from DB
|
||||
*/
|
||||
private D readDeviceData(){
|
||||
return null; // TODO: how to do this in a good way?
|
||||
}
|
||||
|
||||
/**************** OTHER ******************/
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue