jhomenet.hw
Class HomenetHardware

java.lang.Object
  extended by Model
      extended by jhomenet.hw.HomenetHardware
All Implemented Interfaces:
java.io.Serializable, Hardware
Direct Known Subclasses:
Device, Sensor

public abstract class HomenetHardware
extends Model
implements Hardware, java.io.Serializable

This is the superclass of all registered hardware as part of the jHomenet system. It provides general functionality required for all hardware.
The class extends the JGoodies abstract Model superclass used to minimizes the effort required to provide change support for bound and constrained Bean properties.
ID: $Id: HomenetHardware.java,v 1.16 2005/11/07 01:17:42 dhirwinjr Exp $

Author:
David Irwin

Field Summary
protected  java.util.HashMap<java.lang.String,java.lang.String> configuration
          Configuration (to be used as needed by the hardware).
protected  HardwareDriver driver
          Reference to the hardware driver.
protected  ErrorTracker errorTracker
          Used to maintain a list of the hardware's errors.
protected  java.lang.String hardwareDescription
          A description of the actual hardware itself.
protected  java.lang.String hardwareId
          The hardware ID
static java.lang.String PROPERTYNAME_CONFIGURATION
          Bounded bean property name.
static java.lang.String PROPERTYNAME_SETUPDESC
          Bounded bean property name.
protected  java.lang.String setupDescription
          A general description about the hardware.
 
Constructor Summary
HomenetHardware()
          Constructor (required for use with Hibernate).
HomenetHardware(java.lang.String hardwareID, java.lang.String setupDescription)
          Default constructor.
 
Method Summary
 boolean equals(Hardware hardware)
          Used to check for equality.
 java.lang.String getConfiguration()
          Get a semicolon deliminated list of the hardware's configuration.
 java.lang.String getConfiguration(java.lang.String keyName)
          Get the hardware configuration.
 java.lang.String getDriverHardwareDescription()
          Get the driver hardware type.
 java.lang.String getDriverName()
          Return the hardware driver name.
 long getErrorCount()
          Returns the number of error from the beginning of the server start.
 java.lang.String getHardwareClassname()
          Get the jHomenetHardware type if the hardware is registered.
 java.lang.String getHardwareDescription()
          Get the hardware description.
 java.lang.String getHardwareId()
          Get the hardware ID.
 java.lang.String getSetupDescription()
          Get a description of the hardware if it's registered.
protected  void initializeHardware()
          Initialize the hardware.
protected abstract  void initializeHardwareDescription()
          Set the hardware description.
 boolean isRegistered()
          Whether the hardware is registered or not.
 void setConfiguration(java.lang.String configString)
          Passes an entire configuration string.
 void setConfiguration(java.lang.String configKey, java.lang.String configValue)
          Set the hardware configuration if it's registered.
protected  void setDriver()
          Set the hardware driver.
 void setHardwareId(java.lang.String hardwareId)
          Set the hardware ID.
 void setSetupDescription(java.lang.String desc)
          Set the hardware setup description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hardwareId

protected java.lang.String hardwareId
The hardware ID


setupDescription

protected java.lang.String setupDescription
A general description about the hardware. Examples might include Roof Temperature Sensor or Basement Humidity Sensor or Garage Light Switch.


PROPERTYNAME_SETUPDESC

public static final java.lang.String PROPERTYNAME_SETUPDESC
Bounded bean property name.

See Also:
Constant Field Values

hardwareDescription

protected java.lang.String hardwareDescription
A description of the actual hardware itself. This is not edittable and is set by the system. Examples include LightSensor, TempSensor, DoorSensor, or LightSwitch.


configuration

protected java.util.HashMap<java.lang.String,java.lang.String> configuration
Configuration (to be used as needed by the hardware).


PROPERTYNAME_CONFIGURATION

public static final java.lang.String PROPERTYNAME_CONFIGURATION
Bounded bean property name.

See Also:
Constant Field Values

driver

protected transient HardwareDriver driver
Reference to the hardware driver.


errorTracker

protected ErrorTracker errorTracker
Used to maintain a list of the hardware's errors.

Constructor Detail

HomenetHardware

public HomenetHardware(java.lang.String hardwareID,
                       java.lang.String setupDescription)
Default constructor.

Parameters:
hardwareID -

HomenetHardware

public HomenetHardware()
Constructor (required for use with Hibernate).

Method Detail

initializeHardware

protected void initializeHardware()
Initialize the hardware. Classes may override this method in order to run initialization code.


isRegistered

public boolean isRegistered()
Description copied from interface: Hardware
Whether the hardware is registered or not.

Specified by:
isRegistered in interface Hardware
Returns:
true if the hardware is registered
See Also:
Hardware.isRegistered()

setHardwareId

public void setHardwareId(java.lang.String hardwareId)
Set the hardware ID.

Parameters:
hardwareId -

getHardwareId

public java.lang.String getHardwareId()
Get the hardware ID.

Specified by:
getHardwareId in interface Hardware
Returns:
The hardware ID
See Also:
Hardware.getHardwareId()

initializeHardwareDescription

protected abstract void initializeHardwareDescription()
Set the hardware description.


getHardwareDescription

public java.lang.String getHardwareDescription()
Get the hardware description.

Returns:
A description of the hardware

setSetupDescription

public void setSetupDescription(java.lang.String desc)
Set the hardware setup description.

Parameters:
desc -

getSetupDescription

public java.lang.String getSetupDescription()
Get a description of the hardware if it's registered.

Returns:
A description of the hardware.

setDriver

protected void setDriver()
Set the hardware driver. This is based on how the how the hardware ID is mapped in the hardware driver manager.


getDriverName

public java.lang.String getDriverName()
Return the hardware driver name.

Specified by:
getDriverName in interface Hardware
Returns:
Hardware driver name
See Also:
Hardware.getDriverName()

getHardwareClassname

public java.lang.String getHardwareClassname()
Get the jHomenetHardware type if the hardware is registered.

Specified by:
getHardwareClassname in interface Hardware
Returns:
The jHomenetHardware type.

setConfiguration

public void setConfiguration(java.lang.String configKey,
                             java.lang.String configValue)
Set the hardware configuration if it's registered.

Parameters:
configKey -
configValue -

setConfiguration

public void setConfiguration(java.lang.String configString)
Passes an entire configuration string. The configuration string is assumed to be a semicolon deliminated string. For example: keyName1=value1;keyName2=value2

Parameters:
configString -

getConfiguration

public java.lang.String getConfiguration(java.lang.String keyName)
Get the hardware configuration.

Returns:
The hardware configuration

getConfiguration

public java.lang.String getConfiguration()
Get a semicolon deliminated list of the hardware's configuration.

Returns:
The hardware's configuration as a string.

equals

public boolean equals(Hardware hardware)
Description copied from interface: Hardware
Used to check for equality.

Specified by:
equals in interface Hardware
Returns:
True if the hardware is considered equal
See Also:
Hardware.equals(jhomenet.hw.Hardware)

getDriverHardwareDescription

public java.lang.String getDriverHardwareDescription()
Get the driver hardware type.

Specified by:
getDriverHardwareDescription in interface Hardware
Returns:
Driver hardware description
See Also:
Hardware.getDriverHardwareDescription()

getErrorCount

public long getErrorCount()
Returns the number of error from the beginning of the server start.

Returns:
The number of errors.


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