jhomenet.commons.hw
Class HomenetHardware

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

public abstract class HomenetHardware
extends Model
implements RegisteredHardware, 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 and is a the default implementation of the RegisteredHardware interface.

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 1235 2006-01-26 04:04:07Z dhirwinjr $

Author:
Dave Irwin (jhomenet at gmail dot com)

Field Summary
protected  java.lang.String hardwareAddr
          The physical hardware address.
protected  java.lang.String hardwareSetupDescription
           
static java.lang.String PROPERTYNAME_CHANNELDESC
           
static java.lang.String PROPERTYNAME_HWSETUPDESC
           
 
Constructor Summary
HomenetHardware(HomenetHardware hardware)
          A constructor used to make an identical copy of the hardware object.
HomenetHardware(java.lang.String hardwareAppDescription, java.lang.Integer numChannels)
          Constructor.
HomenetHardware(java.lang.String hardwareAddr, java.lang.String hardwareSetupDescription, java.lang.String hardwareAppDescription, java.lang.Integer numChannels)
          Default constructor.
 
Method Summary
 void addHardwareListener(HardwareListener hardwareListener)
           
abstract  HomenetHardware copy()
          Make a copy of the hardware object.
 boolean equals(java.lang.Object obj)
          Used to check for hardware equality.
 java.lang.String getAppHardwareDescription()
          Get the application hardware description.
 Channel getChannel(java.lang.Integer channel)
           
 java.lang.String getChannelDescription(java.lang.Integer channel)
          Get the channel description
 java.util.List<Channel> getChannels()
           
 java.lang.String getHardwareAddr()
          Get the hardware address.
 java.lang.String getHardwareClassname()
          Get the jHomenet hardware classname.
 java.lang.String getHardwareSetupDescription()
          Get the hardware setup description.
 java.lang.Long getId()
          Get the hardware ID.
 java.lang.Integer getNumChannels()
          Get the number of input channels the sensor supports.
 int hashCode()
           
protected  void initializeHardware()
          Initialize the hardware.
 void removeHardwareListener(HardwareListener hardwareListener)
           
 void setChannelDescription(java.lang.Integer channel, java.lang.String description)
          Set the channel description.
 void setHardwareSetupDescription(java.lang.String desc)
          Set the hardware setup description.
 java.lang.String toString()
          Return the string representation of the hardware object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hardwareAddr

protected java.lang.String hardwareAddr
The physical hardware address.


hardwareSetupDescription

protected java.lang.String hardwareSetupDescription

PROPERTYNAME_HWSETUPDESC

public static final java.lang.String PROPERTYNAME_HWSETUPDESC
See Also:
Constant Field Values

PROPERTYNAME_CHANNELDESC

public static final java.lang.String PROPERTYNAME_CHANNELDESC
See Also:
Constant Field Values
Constructor Detail

HomenetHardware

public HomenetHardware(java.lang.String hardwareAddr,
                       java.lang.String hardwareSetupDescription,
                       java.lang.String hardwareAppDescription,
                       java.lang.Integer numChannels)
Default constructor.

Parameters:
hardwareAddr - The physical hardware address
hardwareSetupDescription - The hardware setup description
hardwareappDescription - The application hardware description
numChannels - The number of communication channels

HomenetHardware

public HomenetHardware(java.lang.String hardwareAppDescription,
                       java.lang.Integer numChannels)
Constructor.

Parameters:
hardwareAppDescription -
numChannels -

HomenetHardware

public HomenetHardware(HomenetHardware hardware)
A constructor used to make an identical copy of the hardware object.

Parameters:
hardware -
Method Detail

initializeHardware

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


getId

public java.lang.Long getId()
Get the hardware ID.

Returns:

getAppHardwareDescription

public final java.lang.String getAppHardwareDescription()
Description copied from interface: RegisteredHardware
Get the application hardware description.

Specified by:
getAppHardwareDescription in interface RegisteredHardware
Returns:
The application hardware description
See Also:
RegisteredHardware.getAppHardwareDescription()

copy

public abstract HomenetHardware copy()
Make a copy of the hardware object.

Specified by:
copy in interface RegisteredHardware
Returns:
A copy of the hardware object

addHardwareListener

public void addHardwareListener(HardwareListener hardwareListener)
Specified by:
addHardwareListener in interface RegisteredHardware
See Also:
RegisteredHardware.addHardwareListener(jhomenet.commons.hw.HardwareListener)

removeHardwareListener

public void removeHardwareListener(HardwareListener hardwareListener)
Specified by:
removeHardwareListener in interface RegisteredHardware
See Also:
jhomenet.commons.hw.RegisteredHardware#remoteHardwareListener(jhomenet.commons.hw.HardwareListener)

getHardwareAddr

public java.lang.String getHardwareAddr()
Description copied from interface: Hardware
Get the hardware address.

Specified by:
getHardwareAddr in interface Hardware
Returns:
The hardware address
See Also:
Hardware.getHardwareAddr()

setHardwareSetupDescription

public void setHardwareSetupDescription(java.lang.String desc)
Description copied from interface: RegisteredHardware
Set the hardware setup description.

Specified by:
setHardwareSetupDescription in interface RegisteredHardware
Parameters:
desc - The hardware setup description
See Also:
RegisteredHardware.setHardwareSetupDescription(java.lang.String)

getHardwareSetupDescription

public java.lang.String getHardwareSetupDescription()
Description copied from interface: RegisteredHardware
Get the hardware setup description.

Specified by:
getHardwareSetupDescription in interface RegisteredHardware
Returns:
The hardware setup description
See Also:
RegisteredHardware.getHardwareSetupDescription()

getHardwareClassname

public java.lang.String getHardwareClassname()
Description copied from interface: RegisteredHardware
Get the jHomenet hardware classname.

Specified by:
getHardwareClassname in interface RegisteredHardware
Returns:
The jHomenet hardware classname
See Also:
RegisteredHardware.getHardwareClassname()

getNumChannels

public java.lang.Integer getNumChannels()
Get the number of input channels the sensor supports.

Specified by:
getNumChannels in interface RegisteredHardware
Returns:
The number of input channels the sensor supports

setChannelDescription

public void setChannelDescription(java.lang.Integer channel,
                                  java.lang.String description)
Description copied from interface: RegisteredHardware
Set the channel description.

Specified by:
setChannelDescription in interface RegisteredHardware
Parameters:
channel - The communication channel
description - The channel description
See Also:
RegisteredHardware.setChannelDescription(java.lang.Integer, java.lang.String)

getChannelDescription

public java.lang.String getChannelDescription(java.lang.Integer channel)
Description copied from interface: RegisteredHardware
Get the channel description

Specified by:
getChannelDescription in interface RegisteredHardware
Parameters:
channel - The communication channel
Returns:
The channel description
See Also:
RegisteredHardware.getChannelDescription(java.lang.Integer)

getChannels

public java.util.List<Channel> getChannels()
Specified by:
getChannels in interface RegisteredHardware
Returns:
See Also:
RegisteredHardware.getChannels()

getChannel

public Channel getChannel(java.lang.Integer channel)
Specified by:
getChannel in interface RegisteredHardware
Returns:
See Also:
RegisteredHardware.getChannel(java.lang.Integer)

equals

public final boolean equals(java.lang.Object obj)
Description copied from interface: RegisteredHardware
Used to check for hardware equality.

Specified by:
equals in interface RegisteredHardware
Returns:
Boolean.True if two hardware objects are equal, Boolean.False otherwise
See Also:
Object.equals(java.lang.Object)

hashCode

public final int hashCode()
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Return the string representation of the hardware object.

See Also:
Object.toString()


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