jhomenet.hw.sensor
Class WindDirectionSensor

java.lang.Object
  extended by Model
      extended by jhomenet.hw.HomenetHardware
          extended by jhomenet.hw.sensor.Sensor
              extended by jhomenet.hw.sensor.ValueSensor
                  extended by jhomenet.hw.sensor.WindDirectionSensor
All Implemented Interfaces:
java.io.Serializable, Hardware

public class WindDirectionSensor
extends ValueSensor
implements java.io.Serializable


Nested Class Summary
static class WindDirectionSensor.ConfigKeys
           
 
Field Summary
static double[] degrees
           
static java.lang.String[] roseta
          Used to indicate the current wind direction.
 
Fields inherited from class jhomenet.hw.sensor.Sensor
currentData, INVALID_DATA, maxData, minData, pollingType, PROPERTYNAME_CURRENTDATA, PROPERTYNAME_MAXDATA, PROPERTYNAME_MINDATA, PROPERTYNAME_POLLINGTYPE, readFailed
 
Fields inherited from class jhomenet.hw.HomenetHardware
configuration, driver, errorTracker, hardwareDescription, hardwareId, PROPERTYNAME_CONFIGURATION, PROPERTYNAME_SETUPDESC, setupDescription
 
Constructor Summary
WindDirectionSensor()
          Constructor.
WindDirectionSensor(java.lang.String hardwareID, java.lang.String description)
          Default constructor.
 
Method Summary
 double directionToDegrees(int value)
          Convert the value (int) to degrees.
 java.lang.String getCurrentAsString()
          Returns the current sensor value as a string (includes the unit).
protected  void initializeHardwareDescription()
          Set the hardware description.
 double readFromDriver()
          Read from the sensor.
 HardwareData readSensor()
          Retreives the offset used for northOffset detection.
 int readWindDirectionWithOffset()
          Read the wind direcction corrected by the northOffset offset.
 void setNorthoffset()
           
 void setNorthoffset(int north)
          Sets the value added to the actual lecture to obtain the true northOffset.
 void storeNorthOffset()
           
static java.lang.String toWindRose(int value)
           
 java.lang.String WindRose()
          Get the string value for the wind direction.
 
Methods inherited from class jhomenet.hw.sensor.Sensor
capture, getCurrentData, getMaxData, getMinData, getPollingType, getPollingTypeListModel, isFirstPoll, resetData, setCurrentData, setMaxData, setMinData, setPollingType, toString
 
Methods inherited from class jhomenet.hw.HomenetHardware
equals, getConfiguration, getConfiguration, getDriverHardwareDescription, getDriverName, getErrorCount, getHardwareClassname, getHardwareDescription, getHardwareId, getSetupDescription, initializeHardware, isRegistered, setConfiguration, setConfiguration, setDriver, setHardwareId, setSetupDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

roseta

public static final java.lang.String[] roseta
Used to indicate the current wind direction.


degrees

public static final double[] degrees
Constructor Detail

WindDirectionSensor

public WindDirectionSensor(java.lang.String hardwareID,
                           java.lang.String description)
Default constructor.

Parameters:
hardwareID -
description -

WindDirectionSensor

public WindDirectionSensor()
Constructor.

Method Detail

initializeHardwareDescription

protected void initializeHardwareDescription()
Description copied from class: HomenetHardware
Set the hardware description.

Specified by:
initializeHardwareDescription in class HomenetHardware
See Also:
HomenetHardware.initializeHardwareDescription()

storeNorthOffset

public void storeNorthOffset()

setNorthoffset

public void setNorthoffset(int north)
Sets the value added to the actual lecture to obtain the true northOffset.

Parameters:
north - Digit between 1 and 16 that indicates the northOffset

setNorthoffset

public void setNorthoffset()

readSensor

public HardwareData readSensor()
                        throws SensorException
Retreives the offset used for northOffset detection.

Specified by:
readSensor in class Sensor
Returns:
returns the northOffset offset as an integer
Throws:
SensorException

readWindDirectionWithOffset

public int readWindDirectionWithOffset()
                                throws SensorException
Read the wind direcction corrected by the northOffset offset.

Returns:
returns the northOffset corrected position as an integer increasing values counter clockwise
Throws:
SensorException

WindRose

public java.lang.String WindRose()
                          throws SensorException
Get the string value for the wind direction.

Returns:
returns the northOffset corrected wind direction as an string using rose-wind names
Throws:
SensorException

toWindRose

public static java.lang.String toWindRose(int value)

readFromDriver

public double readFromDriver()
                      throws SensorException
Read from the sensor.

Specified by:
readFromDriver in class Sensor
Returns:
The raw value read from the driver.
Throws:
SensorException
See Also:
Sensor.readSensor()

directionToDegrees

public double directionToDegrees(int value)
Convert the value (int) to degrees.

Parameters:
value - An integer value representation of the wind direction.
Returns:
The degrees representation of the wind direction.

getCurrentAsString

public java.lang.String getCurrentAsString()
Description copied from class: Sensor
Returns the current sensor value as a string (includes the unit).

Overrides:
getCurrentAsString in class Sensor
Returns:
The current value as a string with the current unit value
See Also:
Sensor.getCurrentAsString()


Copyright © 2004-2005 David Irwin. All Rights Reserved.