|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectModel
jhomenet.hw.HomenetHardware
jhomenet.hw.sensor.Sensor
public abstract class Sensor
This is the superclass of all sensor hardware as part of the Homenet
system. It extends the HomenetHardware class that provides
general functionality to all registered hardware. The Sensor
class adds additional functionality common to all sensors including reading
data from the sensor, storing data, and the sensor polling type.
ID: $Id: Sensor.java,v 1.24 2005/11/10 03:36:00 dhirwinjr Exp $
| Field Summary | |
|---|---|
protected HardwareData |
currentData
The sensor values and ounded bean data property names. |
static float |
INVALID_DATA
Define an unknown value |
protected HardwareData |
maxData
The sensor values and ounded bean data property names. |
protected HardwareData |
minData
The sensor values and ounded bean data property names. |
protected PollingService.PollingTypes |
pollingType
The desired polling type of the hardware and binding information |
static java.lang.String |
PROPERTYNAME_CURRENTDATA
|
static java.lang.String |
PROPERTYNAME_MAXDATA
|
static java.lang.String |
PROPERTYNAME_MINDATA
|
static java.lang.String |
PROPERTYNAME_POLLINGTYPE
|
protected boolean |
readFailed
Flag indicating whether the sensor read was successful or not. |
| Fields inherited from class jhomenet.hw.HomenetHardware |
|---|
configuration, driver, errorTracker, hardwareDescription, hardwareId, PROPERTYNAME_CONFIGURATION, PROPERTYNAME_SETUPDESC, setupDescription |
| Constructor Summary | |
|---|---|
Sensor()
Constructor (used when creating the sensor hardware from the persistence layer using Hibernate). |
|
Sensor(java.lang.String hardwareID,
java.lang.String description)
Default constructor. |
|
| Method Summary | |
|---|---|
void |
capture()
Reads states from the sensor and in the process stores the data retrieved from the sensor in the jHomeNet database. |
java.lang.String |
getCurrentAsString()
Returns the current sensor value as a string (includes the unit). |
HardwareData |
getCurrentData()
Return the current hardware data value. |
HardwareData |
getMaxData()
|
HardwareData |
getMinData()
|
PollingService.PollingTypes |
getPollingType()
Get the polling type if the hardware is registered. |
javax.swing.ListModel |
getPollingTypeListModel()
Get the polling type list model. |
protected boolean |
isFirstPoll()
Whether this is the first time the hardware has been polled. |
protected abstract double |
readFromDriver()
Read the raw value from the driver. |
abstract HardwareData |
readSensor()
Capture the sensor's data in the sensor's current unit (if applicable). |
void |
resetData()
Reset the hardware data values. |
protected void |
setCurrentData(HardwareData currentData)
Set the current data value. |
protected void |
setMaxData(HardwareData maxData)
|
protected void |
setMinData(HardwareData minData)
|
void |
setPollingType(PollingService.PollingTypes pollingType)
Set the sensor hardware polling type. |
java.lang.String |
toString()
Returns the string equivalent of the sensor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected PollingService.PollingTypes pollingType
public static final java.lang.String PROPERTYNAME_POLLINGTYPE
public static final float INVALID_DATA
protected HardwareData currentData
protected HardwareData maxData
protected HardwareData minData
public static final java.lang.String PROPERTYNAME_CURRENTDATA
public static final java.lang.String PROPERTYNAME_MAXDATA
public static final java.lang.String PROPERTYNAME_MINDATA
protected boolean readFailed
| Constructor Detail |
|---|
public Sensor(java.lang.String hardwareID,
java.lang.String description)
hardwareID - The 1-Wire address of the sensor.description - The name of the sensor.public Sensor()
| Method Detail |
|---|
public void resetData()
public void setPollingType(PollingService.PollingTypes pollingType)
pollingType - public PollingService.PollingTypes getPollingType()
public javax.swing.ListModel getPollingTypeListModel()
public abstract HardwareData readSensor()
throws SensorException
SensorException
protected abstract double readFromDriver()
throws SensorException
SensorExceptionpublic void capture()
protected boolean isFirstPoll()
public java.lang.String getCurrentAsString()
protected void setCurrentData(HardwareData currentData)
currentData - The current data valuepublic HardwareData getCurrentData()
public HardwareData getMaxData()
protected void setMaxData(HardwareData maxData)
public HardwareData getMinData()
protected void setMinData(HardwareData minData)
public java.lang.String toString()
Object.toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||