Class Channels


  • public class Channels
    extends java.lang.Object
    A utility class used to assign channels to sensors.
    • Constructor Summary

      Constructors 
      Constructor Description
      Channels()
      Default constructor.
      Channels​(int numberOfChannels)
      Constructor.
    • 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 channels
      int 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Channels

        public Channels​(int numberOfChannels)
        Constructor.
        Parameters:
        numberOfChannels - the number of channels to be used
      • Channels

        public Channels()
        Default constructor.
    • 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 type
        startChannel - the start channel
        endChannel - 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 registered
        java.lang.NullPointerException - if the there are any more channels registered for the sensor type