Class Channels
- java.lang.Object
-
- com.inhousegreenhouse.ch.backend.model.util.Channels
-
public class Channels extends java.lang.Object
A utility class used to assign channels to sensors.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeMaxNumberOfChannels(int numberOfChannels)
Set the maximum number of channels.void
clear()
Clear the registered channelsint
getNextChannel(SensorType type)
Get the next channel for a sensor type.void
registerSensor(SensorType type, int startChannel, int endChannel)
Register a sensor with the channel manager.
-
-
-
Method Detail
-
registerSensor
public void registerSensor(SensorType type, int startChannel, int endChannel) throws java.lang.IllegalArgumentException
Register a sensor with the channel manager.- Parameters:
type
- the sensor typestartChannel
- the start channelendChannel
- the end channel- Throws:
java.lang.IllegalArgumentException
- if was passed a sensor type that is already registered or if channel are messed up
-
clear
public void clear()
Clear the registered channels
-
changeMaxNumberOfChannels
public void changeMaxNumberOfChannels(int numberOfChannels)
Set the maximum number of channels.- Parameters:
numberOfChannels
- the number of channels
-
getNextChannel
public int getNextChannel(SensorType type) throws java.lang.NullPointerException, java.lang.IllegalCallerException
Get the next channel for a sensor type.- Parameters:
type
- the sensor type- Returns:
- the next channel
- Throws:
java.lang.IllegalCallerException
- if the sensor type is not registeredjava.lang.NullPointerException
- if the there are any more channels registered for the sensor type
-
-