public class Controller
extends java.lang.Object
Constructor and Description |
---|
Controller() |
Modifier and Type | Method and Description |
---|---|
boolean |
addDevice(main.ControlDeviceType deviceType,
java.lang.String deviceID,
int operatingMin,
int operatingMax,
int safeMin,
int safeMax)
Add a device to the list of devices to be controlled by this controller.
|
boolean |
doControl(java.lang.String deviceID,
int inputVal)
Activate control of a device by sending it a new input value.
|
int |
getNumDevices() |
boolean |
isDeviceInList(java.lang.String deviceID) |
boolean |
removeDevice(java.lang.String deviceID)
Remove a device from the list of devices to be controlled by this controller.
|
public boolean addDevice(main.ControlDeviceType deviceType, java.lang.String deviceID, int operatingMin, int operatingMax, int safeMin, int safeMax) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
deviceType
- The type of device to be controlled (enumerated in 'ControlledDeviceTypes')deviceID
- Unique identifier for the physical device. This is a 4-digit string.operatingMin
- Minimum value accepted by the device i.e. operating range floor. Non-negative integer value expected.operatingMax
- Maximum value accepted by the device i.e. operating range ceiling. Non-negative integer value expected.safeMin
- Minimum 'safe' operating value for the device. Expected >= 'operatingMin'.safeMax
- Maximum 'safe' operating value accepted by the device. Expected <= operatingMax'.java.lang.IllegalArgumentException
- if 'deviceID' is invalid or is already in the listjava.lang.NullPointerException
- if 'deviceID' is nulljava.lang.IllegalArgumentException
- if 'operatingMin' or 'operatingMax' is negativejava.lang.IllegalArgumentException
- if 'operatingMin' is greater than 'operatingMax'java.lang.IllegalArgumentException
- if 'safeMin' is greater than 'safeMax'java.lang.IllegalArgumentException
- if 'safeMin' or 'safeMax' are outside 'operatingMin' and 'operatingMax'public boolean removeDevice(java.lang.String deviceID) throws java.lang.NullPointerException
deviceID
- Unique identifier for the physical device. This is a 4-digit string.java.lang.NullPointerException
- if "deviceID" is nullpublic boolean doControl(java.lang.String deviceID, int inputVal)
deviceID
- Unique identifier for the physical device. This is a 4-digit string.inputVal
- The value to be passed to the device.public boolean isDeviceInList(java.lang.String deviceID)
public int getNumDevices()