OpenZWave Library  1.4.2944
Classes | Public Types | Public Member Functions | Friends | List of all members
OpenZWave::Node Class Reference

The Node class describes a Z-Wave node object...typically a device on the Z-Wave network. More...

#include <Node.h>

Classes

struct  CommandClassData
 
struct  NodeData
 

Public Types

enum  QueryStage {
  QueryStage_None, QueryStage_ProtocolInfo, QueryStage_Probe, QueryStage_WakeUp,
  QueryStage_ManufacturerSpecific1, QueryStage_NodeInfo, QueryStage_NodePlusInfo, QueryStage_SecurityReport,
  QueryStage_ManufacturerSpecific2, QueryStage_Versions, QueryStage_Instances, QueryStage_Static,
  QueryStage_CacheLoad, QueryStage_Probe1 = QueryStage_CacheLoad, QueryStage_Associations, QueryStage_Neighbors,
  QueryStage_Session, QueryStage_Dynamic, QueryStage_Configuration, QueryStage_Complete
}
 
enum  {
  SecurityFlag_Security = 0x01, SecurityFlag_Controller = 0x02, SecurityFlag_SpecificDevice = 0x04, SecurityFlag_RoutingSlave = 0x08,
  SecurityFlag_BeamCapability = 0x10, SecurityFlag_Sensor250ms = 0x20, SecurityFlag_Sensor1000ms = 0x40, SecurityFlag_OptionalFunctionality = 0x80
}
 
enum  { NodeBroadcast = 0xff }
 

Public Member Functions

 Node (uint32 const _homeId, uint8 const _nodeId)
 
virtual ~Node ()
 
void AdvanceQueries ()
 
void QueryStageComplete (QueryStage const _stage)
 
void QueryStageRetry (QueryStage const _stage, uint8 const _maxAttempts=0)
 
void SetQueryStage (QueryStage const _stage, bool const _advance=true)
 
Node::QueryStage GetCurrentQueryStage ()
 
string GetQueryStageName (QueryStage const _stage)
 
bool IsNodeAlive () const
 
void UpdateProtocolInfo (uint8 const *_data)
 
void SetProtocolInfo (uint8 const *_protocolInfo, uint8 const _length)
 
void UpdateNodeInfo (uint8 const *_data, uint8 const _length)
 
bool ProtocolInfoReceived () const
 
bool NodeInfoReceived () const
 
bool IsNodeZWavePlus () const
 
bool AllQueriesCompleted () const
 
void SetNodePlusInfoReceived (const bool _received)
 
void SetNodeAlive (bool const _isAlive)
 
bool IsListeningDevice () const
 
bool IsFrequentListeningDevice () const
 
bool IsBeamingDevice () const
 
bool IsRoutingDevice () const
 
bool IsSecurityDevice () const
 
uint32 GetMaxBaudRate () const
 
uint8 GetVersion () const
 
uint8 GetSecurity () const
 
uint8 GetNodeId () const
 
uint8 GetBasic () const
 
uint8 GetGeneric () const
 
uint8 GetSpecific () const
 
string const & GetType () const
 
uint32 GetNeighbors (uint8 **o_associations)
 
bool IsController () const
 
bool IsAddingNode () const
 
void SetAddingNode ()
 
void ClearAddingNode ()
 
bool IsNodeReset ()
 
CommandClassGetCommandClass (uint8 const _commandClassId) const
 
void ApplicationCommandHandler (uint8 const *_data, bool encrypted)
 
void SetSecuredClasses (uint8 const *_data, uint8 const _length)
 
void SetSecured (bool secure)
 
void SetLevel (uint8 const _level)
 
void SetNodeOn ()
 
void SetNodeOff ()
 
ValueID CreateValueID (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, ValueID::ValueType const _type)
 
ValueGetValue (ValueID const &_id)
 
ValueGetValue (uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex)
 
bool RemoveValue (uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex)
 
bool CreateValueBool (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, bool const _default, uint8 const _pollIntensity)
 
bool CreateValueButton (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, uint8 const _pollIntensity)
 
bool CreateValueByte (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, uint8 const _default, uint8 const _pollIntensity)
 
bool CreateValueDecimal (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, string const &_default, uint8 const _pollIntensity)
 
bool CreateValueInt (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, int32 const _default, uint8 const _pollIntensity)
 
bool CreateValueList (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, uint8 const _size, vector< ValueList::Item > const &_items, int32 const _default, uint8 const _pollIntensity)
 
bool CreateValueRaw (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, uint8 const *_default, uint8 const _length, uint8 const _pollIntensity)
 
bool CreateValueSchedule (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, uint8 const _pollIntensity)
 
bool CreateValueShort (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, int16 const _default, uint8 const _pollIntensity)
 
bool CreateValueString (ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _valueIndex, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, string const &_default, uint8 const _pollIntensity)
 
void RemoveValueList (ValueList *_value)
 
void ReadValueFromXML (uint8 const _commandClassId, TiXmlElement const *_valueElement)
 
bool CreateValueFromXML (uint8 const _commandClassId, TiXmlElement const *_valueElement)
 
uint8GenerateNonceKey ()
 
uint8GetNonceKey (uint32 nonceid)
 

Friends

class Manager
 
class Driver
 
class Group
 
class Value
 
class ValueButton
 
class Alarm
 
class Association
 
class AssociationCommandConfiguration
 
class Basic
 
class Battery
 
class ClimateControlSchedule
 
class Clock
 
class CommandClass
 
class ControllerReplication
 
class EnergyProduction
 
class Hail
 
class Indicator
 
class Language
 
class Lock
 
class ManufacturerSpecific
 
class Meter
 
class MeterPulse
 
class MultiInstance
 
class MultiChannelAssociation
 
class NodeNaming
 
class Protection
 
class Security
 
class SensorAlarm
 
class SensorBinary
 
class SensorMultilevel
 
class SwitchAll
 
class SwitchBinary
 
class SwitchMultilevel
 
class SwitchToggleBinary
 
class SwitchToggleMultilevel
 
class ThermostatFanMode
 
class ThermostatFanState
 
class ThermostatMode
 
class ThermostatOperatingState
 
class ThermostatSetpoint
 
class Version
 
class WakeUp
 
class ZWavePlusInfo
 

Detailed Description

The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.

Member Enumeration Documentation

anonymous enum
Enumerator
SecurityFlag_Security 
SecurityFlag_Controller 
SecurityFlag_SpecificDevice 
SecurityFlag_RoutingSlave 
SecurityFlag_BeamCapability 
SecurityFlag_Sensor250ms 
SecurityFlag_Sensor1000ms 
SecurityFlag_OptionalFunctionality 
anonymous enum
Enumerator
NodeBroadcast 
Enumerator
QueryStage_None 

Query process hasn't started for this node

QueryStage_ProtocolInfo 

Retrieve protocol information

QueryStage_Probe 

Ping device to see if alive

QueryStage_WakeUp 

Start wake up process if a sleeping node

QueryStage_ManufacturerSpecific1 

Retrieve manufacturer name and product ids if ProtocolInfo lets us

QueryStage_NodeInfo 

Retrieve info about supported, controlled command classes

QueryStage_NodePlusInfo 

Retrieve ZWave+ info and update device classes

QueryStage_SecurityReport 

Retrieve a list of Command Classes that require Security

QueryStage_ManufacturerSpecific2 

Retrieve manufacturer name and product ids

QueryStage_Versions 

Retrieve version information

QueryStage_Instances 

Retrieve information about multiple command class instances

QueryStage_Static 

Retrieve static information (doesn't change)

QueryStage_CacheLoad 

Ping a device upon restarting with cached config for the device

QueryStage_Probe1 
QueryStage_Associations 

< Depreciated name. /todo Remove in 2.0 timeframe Retrieve information about associations

QueryStage_Neighbors 

Retrieve node neighbor list

QueryStage_Session 

Retrieve session information (changes infrequently)

QueryStage_Dynamic 

Retrieve dynamic information (changes frequently)

QueryStage_Configuration 

Retrieve configurable parameter information (only done on request)

QueryStage_Complete 

Query process is completed for this node

Constructor & Destructor Documentation

Node::Node ( uint32 const  _homeId,
uint8 const  _nodeId 
)

Constructor initializes the node object, associating it with a specific network (_homeId) and network node (_nodeId).

Parameters
_homeIdThe homeId of the network to which this node is connected.
_nodeIdThe nodeId of this node.
Node::~Node ( )
virtual

Destructor cleans up memory allocated to node and its child objects.

Member Function Documentation

void Node::AdvanceQueries ( )

This function advances the query process (see Remarks below for more detail on the process). It iterates through the various query stages enumerated in Node::QueryStage.

Remarks
For OpenZWave to discover everything about a node, we have to follow a certain order of queries, because the results of one stage may affect what is requested in the next stage. The stage is saved with the node data, so that any incomplete queries can be restarted the next time the application runs.

The individual command classes also store some state information as to whether they have had a response to certain queries. This state information is initialized by the SetStaticRequests call in QueryStage_None. It is also saved, so we do not need to request state from every command class if some have previously responded.

bool OpenZWave::Node::AllQueriesCompleted ( ) const
inline
void Node::ApplicationCommandHandler ( uint8 const *  _data,
bool  encrypted 
)
void OpenZWave::Node::ClearAddingNode ( )
inline
bool Node::CreateValueBool ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
bool const  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueButton ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
uint8 const  _pollIntensity 
)
bool Node::CreateValueByte ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
uint8 const  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueDecimal ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
string const &  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueFromXML ( uint8 const  _commandClassId,
TiXmlElement const *  _valueElement 
)
ValueID Node::CreateValueID ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
ValueID::ValueType const  _type 
)
bool Node::CreateValueInt ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
int32 const  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueList ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
uint8 const  _size,
vector< ValueList::Item > const &  _items,
int32 const  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueRaw ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
uint8 const *  _default,
uint8 const  _length,
uint8 const  _pollIntensity 
)
bool Node::CreateValueSchedule ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
uint8 const  _pollIntensity 
)
bool Node::CreateValueShort ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
int16 const  _default,
uint8 const  _pollIntensity 
)
bool Node::CreateValueString ( ValueID::ValueGenre const  _genre,
uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex,
string const &  _label,
string const &  _units,
bool const  _readOnly,
bool const  _writeOnly,
string const &  _default,
uint8 const  _pollIntensity 
)
uint8 * Node::GenerateNonceKey ( )
uint8 OpenZWave::Node::GetBasic ( ) const
inline
CommandClass * Node::GetCommandClass ( uint8 const  _commandClassId) const

This function retrieves a pointer to the requested command class object (if supported by this node).

Parameters
_commandClassIdClass ID (a single byte value) identifying the command class requested.
Returns
Pointer to the requested CommandClass object if supported, otherwise NULL.
See also
CommandClass, m_commandClassMap
Node::QueryStage OpenZWave::Node::GetCurrentQueryStage ( )
inline

Returns the current query stage enum.

Returns
Enum value with the current query stage.
See also
m_queryStage
uint8 OpenZWave::Node::GetGeneric ( ) const
inline
uint32 OpenZWave::Node::GetMaxBaudRate ( ) const
inline
uint32 Node::GetNeighbors ( uint8 **  o_associations)
uint8 OpenZWave::Node::GetNodeId ( ) const
inline
uint8 * Node::GetNonceKey ( uint32  nonceid)
string Node::GetQueryStageName ( QueryStage const  _stage)

Returns the specified query stage string.

Parameters
_stageThe query stage.
Returns
Specified query stage string.
See also
m_queryStage, m_queryPending
uint8 OpenZWave::Node::GetSecurity ( ) const
inline
uint8 OpenZWave::Node::GetSpecific ( ) const
inline
string const& OpenZWave::Node::GetType ( ) const
inline
Value * Node::GetValue ( ValueID const &  _id)
Value * Node::GetValue ( uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex 
)
uint8 OpenZWave::Node::GetVersion ( ) const
inline
bool OpenZWave::Node::IsAddingNode ( ) const
inline
bool OpenZWave::Node::IsBeamingDevice ( ) const
inline
bool OpenZWave::Node::IsController ( ) const
inline
bool OpenZWave::Node::IsFrequentListeningDevice ( ) const
inline
bool OpenZWave::Node::IsListeningDevice ( ) const
inline
bool OpenZWave::Node::IsNodeAlive ( ) const
inline

Returns whether the library thinks a node is functioning properly

Returns
boolean status of node.
bool Node::IsNodeReset ( )
bool OpenZWave::Node::IsNodeZWavePlus ( ) const
inline
bool OpenZWave::Node::IsRoutingDevice ( ) const
inline
bool OpenZWave::Node::IsSecurityDevice ( ) const
inline
bool OpenZWave::Node::NodeInfoReceived ( ) const
inline
bool OpenZWave::Node::ProtocolInfoReceived ( ) const
inline
void Node::QueryStageComplete ( QueryStage const  _stage)

Signal that a specific query stage has been completed for this node. This will only work if the query process for this node is indeed at the specified stage. Otherwise, the function returns with no action.

Parameters
_stageThe current stage of the query process.
void Node::QueryStageRetry ( QueryStage const  _stage,
uint8 const  _maxAttempts = 0 
)

Retry the specified query stage (up to _maxAttempts retries). This will only work if the query process for this node is indeed at the specified stage. Otherwise, the function returns with no action.

Parameters
_stageThe query stage to retry.
_maxAttempts
void Node::ReadValueFromXML ( uint8 const  _commandClassId,
TiXmlElement const *  _valueElement 
)
bool Node::RemoveValue ( uint8 const  _commandClassId,
uint8 const  _instance,
uint8 const  _valueIndex 
)
void Node::RemoveValueList ( ValueList _value)
void OpenZWave::Node::SetAddingNode ( )
inline
void Node::SetLevel ( uint8 const  _level)
void Node::SetNodeAlive ( bool const  _isAlive)

Handle dead node detection tracking. Use this routine to set state of nodes. Tracks state as well as send notifications.

void Node::SetNodeOff ( )
void Node::SetNodeOn ( )
void OpenZWave::Node::SetNodePlusInfoReceived ( const bool  _received)
inline
void Node::SetProtocolInfo ( uint8 const *  _protocolInfo,
uint8 const  _length 
)

this function is called when the Node is added via a AddNode request. the ProtocolInfo field contains the devices classes and the CommandClasses that the node supports, so we can build a pretty good Node out of that info.

Parameters
_protocolInfoByte 0 - Basic Device Class Byte 1 - Generic Device Class, Byte 2 - Specific Device Classes Remaining Bytes - Supported Command Classes
_lengthlength of the _protocolInfo field.
void Node::SetQueryStage ( QueryStage const  _stage,
bool const  _advance = true 
)

This function sets the query stage for the node (but only to an earlier stage). If a later stage is specified than the current one, it is ignored.

Parameters
_stageThe desired query stage.
See also
m_queryStage, m_queryPending
void Node::SetSecured ( bool  secure)
void Node::SetSecuredClasses ( uint8 const *  _data,
uint8 const  _length 
)

This function sets up Secured Command Classes. It iterates over the existing command classes marking them as Secured if they exist, and if they don't, it creates new Command Classes and sets them up as Secured

Parameters
_dataa list of Command Classes that are Secured by the Device
_lengththe length of the _data string
void Node::UpdateNodeInfo ( uint8 const *  _data,
uint8 const  _length 
)
void Node::UpdateProtocolInfo ( uint8 const *  _data)

This function handles a response to the FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO command for this node. If protocol information has already been retrieved for the node, the function simply returns. Otherwise, it populates several member variables about the device at this node:

  • m_routing (whether it is a routing node (capable of passing commands along to other nodes in the network) or not
  • m_maxBaudRate (the maximum baud rate at which this device can communicate)
  • m_version (TODO)
  • m_security (whether device supports security features)
  • m_listening (device is powered and listening constantly)
  • m_frequentListening (device can be woken up with a beam)
  • m_beaming (device is beam capable)

Friends And Related Function Documentation

friend class Alarm
friend
friend class Association
friend
friend class AssociationCommandConfiguration
friend
friend class Basic
friend
friend class Battery
friend
friend class ClimateControlSchedule
friend
friend class Clock
friend
friend class CommandClass
friend
friend class ControllerReplication
friend
friend class Driver
friend
friend class EnergyProduction
friend
friend class Group
friend
friend class Hail
friend
friend class Indicator
friend
friend class Language
friend
friend class Lock
friend
friend class Manager
friend
friend class ManufacturerSpecific
friend
friend class Meter
friend
friend class MeterPulse
friend
friend class MultiChannelAssociation
friend
friend class MultiInstance
friend
friend class NodeNaming
friend
friend class Protection
friend
friend class Security
friend
friend class SensorAlarm
friend
friend class SensorBinary
friend
friend class SensorMultilevel
friend
friend class SwitchAll
friend
friend class SwitchBinary
friend
friend class SwitchMultilevel
friend
friend class SwitchToggleBinary
friend
friend class SwitchToggleMultilevel
friend
friend class ThermostatFanMode
friend
friend class ThermostatFanState
friend
friend class ThermostatMode
friend
friend class ThermostatOperatingState
friend
friend class ThermostatSetpoint
friend
friend class Value
friend
friend class ValueButton
friend
friend class Version
friend
friend class WakeUp
friend
friend class ZWavePlusInfo
friend

The documentation for this class was generated from the following files: