jhomenet.hw.driver
Class OneWireDriver

java.lang.Object
  extended by jhomenet.hw.driver.OneWireDriver
All Implemented Interfaces:
HardwareDriver, OneWireDriverInterface

public class OneWireDriver
extends java.lang.Object
implements OneWireDriverInterface


Field Summary
static double INVALID_VALUE
          Define an invalid value.
static java.lang.String[] windDirectionTable
          Table used for finding the correct wind direction.
 
Method Summary
 double getCount(java.lang.String hardwareID)
          Get a count.
 java.lang.String getDriverHardwareDescription(java.lang.String hardwareID)
          Get the driver hardware description by hardware ID.
static OneWireDriver getDriverInstance()
          Get an instance of the OneWireDriver.
 java.lang.String getDriverName()
          Get the driver name.
 java.util.ArrayList<java.lang.String> getHardwareIDs()
          Return a list of hardware IDs currently on the 1-Wire network.
 boolean getSwitchState(java.lang.String hardwareID)
          Set the switches state.
 double getTemp(java.lang.String hardwareID)
          Read the temperature.
 double getVoltage(java.lang.String hardwareID)
          Get the voltage value.
 double getWindDirection(java.lang.String hardwareID)
          Get the wind direction.
 double getWindSpeed(java.lang.String hardwareID)
          Read the wind speed.
 boolean setSwitchState(java.lang.String hardwareID, boolean direction)
          Tell a DS2406 to switch ON or OFF.
 void switchDeviceOff(java.lang.String hardwareID)
          Switch the hardware device off.
 void switchDeviceOn(java.lang.String hardwareID)
          Switch the hardware device on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

windDirectionTable

public static final java.lang.String[] windDirectionTable
Table used for finding the correct wind direction.


INVALID_VALUE

public static final double INVALID_VALUE
Define an invalid value.

See Also:
Constant Field Values
Method Detail

getDriverInstance

public static OneWireDriver getDriverInstance()
Get an instance of the OneWireDriver.

Returns:
A reference to the hardware driver

getDriverName

public java.lang.String getDriverName()
Get the driver name.

Specified by:
getDriverName in interface HardwareDriver
Returns:
Driver name
See Also:
HardwareDriver.getDriverName()

getHardwareIDs

public java.util.ArrayList<java.lang.String> getHardwareIDs()
Return a list of hardware IDs currently on the 1-Wire network.

Specified by:
getHardwareIDs in interface HardwareDriver
Returns:
List of known hardware
See Also:
HardwareDriver.getHardwareIDs()

getDriverHardwareDescription

public java.lang.String getDriverHardwareDescription(java.lang.String hardwareID)
Get the driver hardware description by hardware ID.

Specified by:
getDriverHardwareDescription in interface HardwareDriver
Returns:
A description of the driver hardware
See Also:
HardwareDriver.getDriverHardwareDescription(java.lang.String)

getTemp

public double getTemp(java.lang.String hardwareID)
               throws HardwareDriverException
Read the temperature.

Specified by:
getTemp in interface HardwareDriver
Returns:
The temperature value
Throws:
HardwareDriverException
See Also:
HardwareDriver.getTemp(java.lang.String)

getVoltage

public double getVoltage(java.lang.String hardwareID)
                  throws HardwareDriverException
Get the voltage value.

Specified by:
getVoltage in interface HardwareDriver
Returns:
The voltage value
Throws:
HardwareDriverException
See Also:
HardwareDriver.getVoltage(java.lang.String)

getCount

public double getCount(java.lang.String hardwareID)
                throws OneWireDriverException
Get a count. Currently only works with DS2423 (OneWireContainer1D) hardware.

Specified by:
getCount in interface HardwareDriver
Returns:
The count value
Throws:
OneWireDriverException
See Also:
HardwareDriver.getCount(java.lang.String)

getWindSpeed

public double getWindSpeed(java.lang.String hardwareID)
                    throws OneWireDriverException
Read the wind speed. Returns the windspeed in meters per second measured during 1 sec period.

Specified by:
getWindSpeed in interface HardwareDriver
Returns:
The wind speed value
Throws:
OneWireDriverException
See Also:
HardwareDriver.getWindSpeed(java.lang.String)

getWindDirection

public double getWindDirection(java.lang.String hardwareID)
                        throws OneWireDriverException
Get the wind direction.

Specified by:
getWindDirection in interface HardwareDriver
Returns:
The wind direction value
Throws:
OneWireDriverException
See Also:
HardwareDriver.getWindDirection(java.lang.String)

switchDeviceOn

public void switchDeviceOn(java.lang.String hardwareID)
                    throws HardwareDriverException
Switch the hardware device on.

Specified by:
switchDeviceOn in interface HardwareDriver
Throws:
HardwareDriverException
See Also:
HardwareDriver.switchDeviceOn(java.lang.String)

switchDeviceOff

public void switchDeviceOff(java.lang.String hardwareID)
                     throws HardwareDriverException
Switch the hardware device off.

Specified by:
switchDeviceOff in interface HardwareDriver
Throws:
HardwareDriverException
See Also:
HardwareDriver.switchDeviceOff(java.lang.String)

getSwitchState

public boolean getSwitchState(java.lang.String hardwareID)
                       throws java.lang.Exception
Set the switches state. TODO: Needs an implementation.

Parameters:
hardwareID -
Returns:
Throws:
java.lang.Exception

setSwitchState

public boolean setSwitchState(java.lang.String hardwareID,
                              boolean direction)
                       throws java.lang.Exception
Tell a DS2406 to switch ON or OFF. public void switchDevice(int channel, boolean latchState, boolean doSmart, byte[] state) where channel - channel to execute this operation, in the range [0 to (getNumberChannels(byte[]) - 1)] latchState - true to set the channel latch 'on' (conducting) and false to set the channel latch 'off' (not conducting). Note that the actual output when the latch is 'on' is returned from the isHighSideSwitch() method. doSmart - If latchState is 'on'/true then doSmart indicates if a 'smart on' is to be done. To avoid an exception check the capabilities of this device using the hasSmartOn() method. state - current state of the device returned from readDevice()

Parameters:
hardwareID - - The hardware ID of the switching device
direction - - The direction the device should be switched
Throws:
java.lang.Exception


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