Some small updates and fixes for Zigbee
This commit is contained in:
parent
326d773741
commit
65581f13d5
12 changed files with 77 additions and 38 deletions
|
|
@ -19,7 +19,6 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* This class manages all SensorController and EventController objects
|
||||
*/
|
||||
@SuppressWarnings("RedundantCast")
|
||||
public class ControllerManager implements HalSensorReportListener,
|
||||
HalEventReportListener,
|
||||
PreConfigurationActionListener,
|
||||
|
|
@ -31,21 +30,21 @@ public class ControllerManager implements HalSensorReportListener,
|
|||
/** All available sensor plugins **/
|
||||
private List<Class<? extends HalSensorConfig>> availableSensors = new ArrayList<>();
|
||||
/** List of all registered sensors **/
|
||||
private List<Sensor> registeredSensors = Collections.synchronizedList(new ArrayList<Sensor>());
|
||||
private List<Sensor> registeredSensors = Collections.synchronizedList(new ArrayList<>());
|
||||
/** List of auto detected sensors **/
|
||||
private List<Sensor> detectedSensors = Collections.synchronizedList(new ArrayList<Sensor>());
|
||||
private List<Sensor> detectedSensors = Collections.synchronizedList(new ArrayList<>());
|
||||
/** List of sensors that are currently being reconfigured **/
|
||||
private List<Sensor> limboSensors = Collections.synchronizedList(new LinkedList<Sensor>());
|
||||
private List<Sensor> limboSensors = Collections.synchronizedList(new LinkedList<>());
|
||||
|
||||
|
||||
/** All available event plugins **/
|
||||
private List<Class<? extends HalEventConfig>> availableEvents = new ArrayList<>();
|
||||
/** List of all registered events **/
|
||||
private List<Event> registeredEvents = Collections.synchronizedList(new ArrayList<Event>());
|
||||
private List<Event> registeredEvents = Collections.synchronizedList(new ArrayList<>());
|
||||
/** List of auto detected events **/
|
||||
private List<Event> detectedEvents = Collections.synchronizedList(new ArrayList<Event>());
|
||||
private List<Event> detectedEvents = Collections.synchronizedList(new ArrayList<>());
|
||||
/** List of all registered events **/
|
||||
private List<Event> limboEvents = Collections.synchronizedList(new LinkedList<Event>());
|
||||
private List<Event> limboEvents = Collections.synchronizedList(new LinkedList<>());
|
||||
|
||||
|
||||
/** A map of all instantiated controllers **/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
package se.hal.intf;
|
||||
|
||||
public interface HalAbstractController {
|
||||
|
||||
public interface HalAbstractController<C, L> {
|
||||
|
||||
/**
|
||||
* The framework might create dummy objects so any type of
|
||||
|
|
@ -33,13 +34,11 @@ public interface HalAbstractController {
|
|||
*/
|
||||
void initialize() throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* @return the number of registered devices.
|
||||
*/
|
||||
int size();
|
||||
|
||||
|
||||
/**
|
||||
* Close any resources associated with this controller.
|
||||
* This method could be called multiple times, first time
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package se.hal.intf;
|
||||
|
||||
/**
|
||||
* Controller interface for handling event based devices.
|
||||
*/
|
||||
public interface HalEventController extends HalAbstractController {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package se.hal.intf;
|
||||
|
||||
/**
|
||||
* Controller interface for handling Sensor devices.
|
||||
*/
|
||||
public interface HalSensorController extends HalAbstractController {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ public class EventConfigWebPage extends HalWebPage {
|
|||
tmpl.set("availableEvents", ControllerManager.getInstance().getAvailableEvents());
|
||||
|
||||
return tmpl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package se.hal.struct;
|
|||
|
||||
import se.hal.ControllerManager;
|
||||
import se.hal.HalContext;
|
||||
import se.hal.intf.HalAbstractController;
|
||||
import se.hal.intf.HalDeviceData;
|
||||
import se.hal.intf.HalDeviceReportListener;
|
||||
import zutil.db.DBConnection;
|
||||
|
|
@ -50,7 +51,9 @@ public abstract class AbstractDevice<T extends AbstractDevice, C,D extends HalDe
|
|||
protected transient List<HalDeviceReportListener<T>> listeners = new LinkedList<>();
|
||||
|
||||
|
||||
/**************** DEVICE CONFIG ******************/
|
||||
// ----------------------------------------------------
|
||||
// Device config methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
public Configurator<C> getDeviceConfigurator() {
|
||||
C obj = getDeviceConfig();
|
||||
|
|
@ -123,9 +126,11 @@ public abstract class AbstractDevice<T extends AbstractDevice, C,D extends HalDe
|
|||
}
|
||||
}
|
||||
|
||||
public abstract Class<?> getController();
|
||||
public abstract Class<? extends HalAbstractController> getController();
|
||||
|
||||
/**************** DEVICE DATA ******************/
|
||||
// ----------------------------------------------------
|
||||
// Device data methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
/**
|
||||
* @return the latest known data from the device
|
||||
|
|
@ -143,7 +148,9 @@ public abstract class AbstractDevice<T extends AbstractDevice, C,D extends HalDe
|
|||
*/
|
||||
protected abstract D getLatestDeviceData(DBConnection db);
|
||||
|
||||
/**************** OTHER ******************/
|
||||
// ----------------------------------------------------
|
||||
// Other methods
|
||||
// ----------------------------------------------------
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class EventControllerManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TestController implements HalEventController{
|
||||
public static class TestController implements HalEventController {
|
||||
int size;
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue