com.universaldevices.device.model
Class UDNode

java.lang.Object
  extended by com.universaldevices.device.model.UDNode
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
UDFolder, UDGroup

public class UDNode
extends java.lang.Object
implements java.lang.Comparable

UDNode represents a node in the device tree.

Each node, essentially, is a logical representation of a device which is linked to the system. Note: UDNode is created/instantiated by the underlying UD Network and Services Layers and should not be created independently

Author:
UD Architect

Field Summary
 java.lang.String address
          Node's address
 int dcPeriod
          Duty Cycle period is used to calculate the amount of ON vs.
 int deviceClass
          Device classes (such as heat pump, pool pump, washer, dryer, etc.) may be used as hints on how to duty cycle in DR mode
 boolean isEnabled
          Whether or not the node is enabled.
 java.lang.String name
          Node's name
 java.lang.String parent
          The parent's id in a hierarchy
 java.lang.String parentName
          Node's parent name
 int parentType
          The parent's hiearchy type
 java.lang.String type
          Node's type which identifies the type of device.
 java.lang.String typeReadable
          The Nodes type in a readable format.
static int UD_HIERARCHY_NODE_TYPE_FOLDER
          The parent is a folder
static int UD_HIERARCHY_NODE_TYPE_GROUP
          The parent is a scene/group
static int UD_HIERARCHY_NODE_TYPE_NODE
          The parent is another node
static int UD_HIERARCHY_NODE_TYPE_NOTSET
          There's no hierarchy associated with node
static java.lang.String UD_PRODUCT_FAMILY_ADR
          The Auto DR product family (used for group nodes)
static java.lang.String UD_PRODUCT_FAMILY_BRULTECH
          The Brultech product family
static java.lang.String UD_PRODUCT_FAMILY_DEFAULT
          The default product family
static java.lang.String UD_PRODUCT_FAMILY_GNC
          Generic family (used for groups containing nodes of different families)
static java.lang.String UD_PRODUCT_FAMILY_INSTEON
          The Insteon product family
static java.lang.String UD_PRODUCT_FAMILY_RCS
          The RCS product family
static java.lang.String UD_PRODUCT_FAMILY_UDI
          The UDI product family
static java.lang.String UD_PRODUCT_FAMILY_UPB
          The UPB product family
static java.lang.String UD_PRODUCT_FAMILY_ZWAVE
          Brultech ECM1240 Energy Monitor
 java.lang.String uuid
          The uuid of the UDProxyDevice which this node belongs to
 int wattage
          The approximate wattage which may be used for calculating energy utilization
 
Constructor Summary
UDNode()
          Constructor
UDNode(java.lang.String address, java.lang.String name)
          Constructor
UDNode(XMLElement node, java.lang.Object dev)
          Constructor
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this node with another node.
 boolean equals(java.lang.String s)
          Tests for equality
 java.lang.String getAction(java.lang.String control)
          Returns the current action value associated for the given control for this node
 java.util.Enumeration getControls()
           
 UDDeviceType getDeviceType()
          return
 java.lang.String getFamilyId()
          Returns the Family ID for this node, or null indicating the default family (e.g.
 java.lang.String getFormattedDeviceId()
          Returns a formatted device Id to be used only for display.
 boolean getHasPendingDeviceWrites()
           
 UDNodeDeviceProperties getNodeDeviceProperties()
          Get the node device properties for this node.
 char getNodeFlag()
          Gets the node flag
 java.lang.String getPrimaryNode()
          Returns the primary node from of all the nodes partially representing the underlying device.
 java.lang.String getResponderType()
          Gets the Responder Type.
 long getRxEndpointMask()
          Return the set of receiver device endpoints owned by this node, where the bit position indicates the endpoint number.
 java.lang.String getSubgroup()
          Returns the subgroup number for the portion of the device that this node represents.
 long getTxEndpointMask()
          Return the set of transmitter device endpoints owned by this node, where the bit position indicates the endpoint number.
 void init()
          Library use only
 boolean isController()
          Returns true if this node can be used as a controller.
 boolean isDefaultFamilyId()
          Returns true if the family for this node is the default family (e.g.
 boolean isDevicePrimaryNode()
          Whether or not this is the node the represents the device.
 boolean isInError()
          Returns whether or not the node has encountered an error
 boolean isQueryable()
          Returns true if this node can be queried
 boolean isResponder()
          Returns true if this node can be used as a responder
 boolean isRootNode()
          Whether or not this is the root node.
 boolean isWritingToDevice()
           
 void processElement(XMLElement child, java.lang.Object dev)
          Library use only
 void refresh(java.lang.Object dev, XMLElement node)
          Refreshes the current node with data from a DIML/XML representation of a node.
 void revise(XMLElement node, java.lang.Object dev)
          Revises the contents of the node.
 void setDeviceType(UDDeviceType t)
          Sets a more complete device type of the node (as compared to setType())
 void setDeviceType(XMLElement xml)
          Sets a more complete device type of the node (as compared to setType())
 void setFamilyId(java.lang.String v)
          Sets the Family ID for this node with null indicating the default product (e.g.
 void setFormattedDeviceId(java.lang.String formattedDeviceId)
          Sets a formatted device Id to be used only for display.
 void setHasPendingDeviceWrites(boolean v)
           
 void setIsController(boolean v)
          Sets whether this node can be used as a controller or not.
 void setIsInError(boolean b)
          Sets whether or not the node is in error
 void setIsQueryable(boolean v)
          Sets whether this node can be used as a controller or not.
 void setIsResponder(boolean v)
          Sets whether this node can be used as a controller or not.
 void setIsWritingToDevice(boolean v)
           
 void setNodeDeviceProperties(UDNodeDeviceProperties v)
          Set the node device properties for this node.
 void setNodeFlag(char flag, java.lang.Object dev)
          Sets the operational flag for this node
 void setParentType(java.lang.String t)
          Sets the parent hierarchy type
 void setPrimaryNode(java.lang.String primaryNode)
          Sets the primary node from of all the nodes partially representing the underlying device.
 void setResponderType(java.lang.String v)
          Sets the Responder Type.
 void setRxEndpointMask(long mask)
          Set the set of receiver device endpoints owned by this node, where the bit position indicates the endpoint number.
 void setSubgroup(java.lang.String subgroup)
          Sets the subgroup number for the portion of the device that this node represents.
 void setTxEndpointMask(long mask)
          Set the set of transmitter device endpoints owned by this node, where the bit position indicates the endpoint number.
 void setType(java.lang.String t)
          Set's the node's type which identifies the type of device.
 java.lang.String toString()
           
 java.lang.Object updateState(java.lang.String control, java.lang.String value)
          Updates the current value for the control for this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UD_HIERARCHY_NODE_TYPE_NOTSET

public static final int UD_HIERARCHY_NODE_TYPE_NOTSET
There's no hierarchy associated with node

See Also:
Constant Field Values

UD_HIERARCHY_NODE_TYPE_NODE

public static final int UD_HIERARCHY_NODE_TYPE_NODE
The parent is another node

See Also:
Constant Field Values

UD_HIERARCHY_NODE_TYPE_GROUP

public static final int UD_HIERARCHY_NODE_TYPE_GROUP
The parent is a scene/group

See Also:
Constant Field Values

UD_HIERARCHY_NODE_TYPE_FOLDER

public static final int UD_HIERARCHY_NODE_TYPE_FOLDER
The parent is a folder

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_DEFAULT

public static final java.lang.String UD_PRODUCT_FAMILY_DEFAULT
The default product family

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_INSTEON

public static final java.lang.String UD_PRODUCT_FAMILY_INSTEON
The Insteon product family

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_UPB

public static final java.lang.String UD_PRODUCT_FAMILY_UPB
The UPB product family

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_RCS

public static final java.lang.String UD_PRODUCT_FAMILY_RCS
The RCS product family

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_ZWAVE

public static final java.lang.String UD_PRODUCT_FAMILY_ZWAVE
Brultech ECM1240 Energy Monitor

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_ADR

public static final java.lang.String UD_PRODUCT_FAMILY_ADR
The Auto DR product family (used for group nodes)

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_GNC

public static final java.lang.String UD_PRODUCT_FAMILY_GNC
Generic family (used for groups containing nodes of different families)

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_UDI

public static final java.lang.String UD_PRODUCT_FAMILY_UDI
The UDI product family

See Also:
Constant Field Values

UD_PRODUCT_FAMILY_BRULTECH

public static final java.lang.String UD_PRODUCT_FAMILY_BRULTECH
The Brultech product family

See Also:
Constant Field Values

address

public java.lang.String address
Node's address


name

public java.lang.String name
Node's name


parentName

public java.lang.String parentName
Node's parent name

This attribute is used in the presentation layer only and should be disregarded


type

public java.lang.String type
Node's type which identifies the type of device.

The permissible values for this attrbute are device specific and are included in each device package (DeviceTypes.java)


parent

public java.lang.String parent
The parent's id in a hierarchy


parentType

public int parentType
The parent's hiearchy type


typeReadable

public java.lang.String typeReadable
The Nodes type in a readable format.


isEnabled

public boolean isEnabled
Whether or not the node is enabled. Default is true

This feature is only available on 99 series


deviceClass

public int deviceClass
Device classes (such as heat pump, pool pump, washer, dryer, etc.) may be used as hints on how to duty cycle in DR mode

This feature is only available on 992 series


wattage

public int wattage
The approximate wattage which may be used for calculating energy utilization

This feature is only available on 992 series


dcPeriod

public int dcPeriod
Duty Cycle period is used to calculate the amount of ON vs. OFF time

This feature is only available on 992 series


uuid

public java.lang.String uuid
The uuid of the UDProxyDevice which this node belongs to

Constructor Detail

UDNode

public UDNode(java.lang.String address,
              java.lang.String name)
Constructor

This constructor is invoked/instantiated by UD Network and Services Layer and, as such, should not be invoked independently

Parameters:
address - - the address for this node
name - - the name for this noe

UDNode

public UDNode(XMLElement node,
              java.lang.Object dev)
Constructor

This constructor is invoked/instantiated by UD Network and Services Layer and, as such, should not be invoked independently

Parameters:
node - - the DIML/XML representation of the node
dev - - the UDProxyDevice which this node belongs to

UDNode

public UDNode()
Constructor

This constructor is invoked/instantiated by UD Network and Services Layer and, as such, should,not be invoked independently

Method Detail

getSubgroup

public java.lang.String getSubgroup()
Returns the subgroup number for the portion of the device that this node represents.

Returns:
The subgroup number for the portion of the device that this node represents.

setSubgroup

public void setSubgroup(java.lang.String subgroup)
Sets the subgroup number for the portion of the device that this node represents.

Parameters:
subgroup - - The subgroup number for the portion of the device that this node represents.

getPrimaryNode

public java.lang.String getPrimaryNode()
Returns the primary node from of all the nodes partially representing the underlying device.

Returns:
The primary node from of all the nodes partially representing the underlying device.

setPrimaryNode

public void setPrimaryNode(java.lang.String primaryNode)
Sets the primary node from of all the nodes partially representing the underlying device.

Parameters:
primaryNode - - The primary node from of all the nodes partially representing the underlying device.

isDefaultFamilyId

public boolean isDefaultFamilyId()
Returns true if the family for this node is the default family (e.g. Insteon, UPB, etc.)

Returns:
true if the family for this node is the default family

getFamilyId

public java.lang.String getFamilyId()
Returns the Family ID for this node, or null indicating the default family (e.g. Insteon, UPB, etc.)

Returns:
the Family ID for this node

setFamilyId

public void setFamilyId(java.lang.String v)
Sets the Family ID for this node with null indicating the default product (e.g. Insteon, UPB, etc.)

Parameters:
v - The product ID (e.g. "ELK", "RCS", etc.)

getFormattedDeviceId

public java.lang.String getFormattedDeviceId()
Returns a formatted device Id to be used only for display. This value is not to be used for programmatically as its content and scope may change from release to release.

Returns:
The formatted device Id.

setFormattedDeviceId

public void setFormattedDeviceId(java.lang.String formattedDeviceId)
Sets a formatted device Id to be used only for display. This value is not to be used for programmatically as its content and scope may change from release to release.

Parameters:
formattedDeviceId - - The formatted device Id.

getHasPendingDeviceWrites

public boolean getHasPendingDeviceWrites()

setHasPendingDeviceWrites

public void setHasPendingDeviceWrites(boolean v)

isWritingToDevice

public boolean isWritingToDevice()

setIsWritingToDevice

public void setIsWritingToDevice(boolean v)

revise

public void revise(XMLElement node,
                   java.lang.Object dev)
Revises the contents of the node.

This method is invoked/instantiated by UD Network and Services Layer and, as such, should not be invoked independently

Parameters:
node - - the DIML/XML representation of the node
dev - - the UDProxyDevice which this node belongs to

refresh

public void refresh(java.lang.Object dev,
                    XMLElement node)
Refreshes the current node with data from a DIML/XML representation of a node. This is used to update the node with minor changes such as when power attributes change

Parameters:
node - - the node representation in DIML/XML

setNodeFlag

public void setNodeFlag(char flag,
                        java.lang.Object dev)
Sets the operational flag for this node

Parameters:
flag - - the flag
dev - - the UDProxyDevice which this node belongs to

getNodeFlag

public char getNodeFlag()
Gets the node flag

Returns:
the node flag

setParentType

public void setParentType(java.lang.String t)
Sets the parent hierarchy type

Parameters:
t -

isRootNode

public boolean isRootNode()
Whether or not this is the root node.

Each system will have one and only one root node which is represented in a UDGroup

Returns:
true if root node, false otherwise

isDevicePrimaryNode

public boolean isDevicePrimaryNode()
Whether or not this is the node the represents the device.

Returns:
True if this is the node the represents the device.

isInError

public boolean isInError()
Returns whether or not the node has encountered an error

Returns:
true if in error, false otherwise

setIsInError

public void setIsInError(boolean b)
Sets whether or not the node is in error

Parameters:
b - - true to set the node in error, false otherwise

getAction

public java.lang.String getAction(java.lang.String control)
Returns the current action value associated for the given control for this node

Parameters:
control - - the UDControl name for which the action is requested
Returns:
the action value as captured in UDAction
See Also:
UDControl, UDAction

getControls

public java.util.Enumeration getControls()
Returns:
an enumeration of all the controls for this node

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the name of this node

updateState

public java.lang.Object updateState(java.lang.String control,
                                    java.lang.String value)
Updates the current value for the control for this node.

This method is invoked by UD Networ and Services Layers and, as such, should not be invoked independently

Parameters:
control - - the UDControl name
value - - the value for this control
See Also:
UDControl, UDAction

setType

public void setType(java.lang.String t)
Set's the node's type which identifies the type of device.

The permissible values for this attrbute are listed in package specific DeviceTypes.java


setDeviceType

public void setDeviceType(UDDeviceType t)
Sets a more complete device type of the node (as compared to setType())

Parameters:
t - The device type of the node

getDeviceType

public UDDeviceType getDeviceType()
return

Returns:

setDeviceType

public void setDeviceType(XMLElement xml)
Sets a more complete device type of the node (as compared to setType())

Parameters:
v - The XML describing the device type

processElement

public void processElement(XMLElement child,
                           java.lang.Object dev)
Library use only

Parameters:
child -
dev -

init

public void init()
Library use only


compareTo

public int compareTo(java.lang.Object o)
Compares this node with another node.

This is the implementation of the Comparable interface

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - - the other node to be compared to
Returns:
- negative (less), positive (greater), and 0 (equal)

equals

public boolean equals(java.lang.String s)
Tests for equality

Whether or not the given string is equal to the address of this node

Parameters:
s - - the String to be checked
Returns:
- true if successful, false otherwise

isController

public boolean isController()
Returns true if this node can be used as a controller.

Returns:
boolean

setIsController

public void setIsController(boolean v)
Sets whether this node can be used as a controller or not.

Parameters:
v -

isResponder

public boolean isResponder()
Returns true if this node can be used as a responder

Returns:
boolean

setIsResponder

public void setIsResponder(boolean v)
Sets whether this node can be used as a controller or not.

Parameters:
v -

setResponderType

public void setResponderType(java.lang.String v)
Sets the Responder Type.


getResponderType

public java.lang.String getResponderType()
Gets the Responder Type.

Returns:
The responder type, or null if not defined or not a responder.

isQueryable

public boolean isQueryable()
Returns true if this node can be queried

Returns:
boolean

setIsQueryable

public void setIsQueryable(boolean v)
Sets whether this node can be used as a controller or not.

Parameters:
v -

getNodeDeviceProperties

public UDNodeDeviceProperties getNodeDeviceProperties()
Get the node device properties for this node.

Returns:
UDNodeDeviceProperties

setNodeDeviceProperties

public void setNodeDeviceProperties(UDNodeDeviceProperties v)
Set the node device properties for this node.


setTxEndpointMask

public void setTxEndpointMask(long mask)
Set the set of transmitter device endpoints owned by this node, where the bit position indicates the endpoint number. For example, a node may represent the on/off/up/down buttons (endpoints).

Parameters:
mask - The endpoint mask.

getTxEndpointMask

public long getTxEndpointMask()
Return the set of transmitter device endpoints owned by this node, where the bit position indicates the endpoint number. For example, a node may represent the on/off/up/down buttons (endpoints).

Returns:
the set of transmitter device endpoints owned by this node.

setRxEndpointMask

public void setRxEndpointMask(long mask)
Set the set of receiver device endpoints owned by this node, where the bit position indicates the endpoint number. For example, for a device with 2 loads (e.g. lights), a node may represent one or both of the them.

Parameters:
mask - The endpoint mask.

getRxEndpointMask

public long getRxEndpointMask()
Return the set of receiver device endpoints owned by this node, where the bit position indicates the endpoint number. For example, for a device with 2 loads (e.g. lights), a node may represent one or both of the them.

Returns:
the set of receiver device endpoints owned by this node.