Class Device

java.lang.Object
org.shredzone.geordi.device.Device
Direct Known Subclasses:
AquaeroDevice, AvmDevice, Ccu2Device, DustyDevice, KaminariDevice

public abstract class Device
extends Object
A Device is some kind of hardware that is to be frequently polled for new sensor data. A device can have one or more sensors.

Even though all Geordi devices use the network to access sensor data, this is not a requirement. A Device implementation could also read hardware sensors directly.

  • Constructor Summary

    Constructors 
    Constructor Description
    Device()  
  • Method Summary

    Modifier and Type Method Description
    org.json.JSONObject getConfig()
    Reads the JSON configuration of the device.
    org.quartz.CronExpression getCron()
    Reads the CronExpression that is used for polling the device sensors.
    int getId()
    Reads the device ID.
    String getName()
    Reads a human-readable device name.
    abstract List<Sample> readSensors()
    Reads all sensors of this device.
    void setConfig​(org.json.JSONObject config)
    Sets the JSON configuration of the device.
    void setCron​(org.quartz.CronExpression cron)
    Sets the CronExpression that is used for polling the device sensors.
    void setId​(int id)
    Sets the device ID.
    void setName​(String name)
    Sets the device name.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getId

      public int getId()
      Reads the device ID.
    • setId

      public void setId​(int id)
      Sets the device ID. It must be unique.
    • getName

      public String getName()
      Reads a human-readable device name.
    • setName

      public void setName​(String name)
      Sets the device name.
    • getCron

      public org.quartz.CronExpression getCron()
      Reads the CronExpression that is used for polling the device sensors.
    • setCron

      public void setCron​(org.quartz.CronExpression cron)
      Sets the CronExpression that is used for polling the device sensors.
    • getConfig

      public org.json.JSONObject getConfig()
      Reads the JSON configuration of the device.
    • setConfig

      public void setConfig​(org.json.JSONObject config)
      Sets the JSON configuration of the device.
    • readSensors

      public abstract List<Sample> readSensors()
      Reads all sensors of this device.
      Returns:
      List of Sample objects containing all current sensor values that have been read.