MultiInstance.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// MultiInstance.h
//
// Implementation of the Z-Wave COMMAND_CLASS_MULTI_INSTANCE
//
// Copyright (c) 2010 Mal Lansell <openzwave@lansell.org>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _MultiInstance_H
#define _MultiInstance_H
#include <set>
#include "command_classes/CommandClass.h"
namespace OpenZWave
{
class MultiInstance: public CommandClass
{
public:
enum MultiInstanceCmd
{
MultiInstanceCmd_Get = 0x04,
MultiInstanceCmd_Report = 0x05,
MultiInstanceCmd_Encap = 0x06,
// Version 2
MultiChannelCmd_EndPointGet = 0x07,
MultiChannelCmd_EndPointReport = 0x08,
MultiChannelCmd_CapabilityGet = 0x09,
MultiChannelCmd_CapabilityReport = 0x0a,
MultiChannelCmd_EndPointFind = 0x0b,
MultiChannelCmd_EndPointFindReport = 0x0c,
MultiChannelCmd_Encap = 0x0d
};
enum MultiInstanceMapping
{
MultiInstanceMapAll,
MultiInstanceMapEndPoints,
MultiInstanceMapOther
};
static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new MultiInstance( _homeId, _nodeId ); }
virtual ~MultiInstance(){}
static uint8 const StaticGetCommandClassId(){ return 0x60; }
static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_MULTI_INSTANCE/CHANNEL"; }
bool RequestInstances();
// From CommandClass
virtual void ReadXML( TiXmlElement const* _ccElement );
virtual void WriteXML( TiXmlElement* _ccElement );
virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
virtual uint8 GetMaxVersion(){ return 2; }
MultiInstanceMapping GetEndPointMap(){ return m_endPointMap; }
private:
MultiInstance( uint32 const _homeId, uint8 const _nodeId );
void HandleMultiInstanceReport( uint8 const* _data, uint32 const _length );
void HandleMultiInstanceEncap( uint8 const* _data, uint32 const _length );
void HandleMultiChannelEndPointReport( uint8 const* _data, uint32 const _length );
void HandleMultiChannelCapabilityReport( uint8 const* _data, uint32 const _length );
void HandleMultiChannelEndPointFindReport( uint8 const* _data, uint32 const _length );
void HandleMultiChannelEncap( uint8 const* _data, uint32 const _length );
bool m_numEndPointsCanChange;
bool m_endPointsAreSameClass;
uint8 m_numEndPoints;
// Finding endpoints
uint8 m_endPointFindIndex;
uint8 m_numEndPointsFound;
set<uint8> m_endPointCommandClasses;
// configuration
uint8 m_numEndPointsHint; // for nodes that do not report correct number of end points
MultiInstanceMapping m_endPointMap; // Determine how to map end points to value id instances
bool m_endPointFindSupported; // for nodes that (someday may) support endpointfind
bool m_ignoreUnsolicitedMultiChannelCapabilityReport;
bool m_uniqueendpoints;
};
} // namespace OpenZWave
#endif
OpenZWave::MultiInstance::MultiChannelCmd_CapabilityGet
Definition: MultiInstance.h:50
OpenZWave::MultiInstance::ReadXML
virtual void ReadXML(TiXmlElement const *_ccElement)
Definition: MultiInstance.cpp:104
OpenZWave
Definition: Bitfield.h:34
OpenZWave::MultiInstance::RequestInstances
bool RequestInstances()
Definition: MultiInstance.cpp:192
OpenZWave::MultiInstance::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: MultiInstance.cpp:250
OpenZWave::MultiInstance::MultiInstanceMapOther
Definition: MultiInstance.h:61
OpenZWave::MultiInstance::MultiInstanceCmd_Get
Definition: MultiInstance.h:43
OpenZWave::MultiInstance::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Definition: MultiInstance.h:68
CommandClass.h
OpenZWave::MultiInstance::MultiInstanceMapAll
Definition: MultiInstance.h:59
OpenZWave::MultiInstance::GetEndPointMap
MultiInstanceMapping GetEndPointMap()
Definition: MultiInstance.h:80
OpenZWave::MultiInstance::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Definition: MultiInstance.h:75
OpenZWave::MultiInstance::GetMaxVersion
virtual uint8 GetMaxVersion()
Definition: MultiInstance.h:78
OpenZWave::MultiInstance::MultiChannelCmd_EndPointFindReport
Definition: MultiInstance.h:53
OpenZWave::MultiInstance::WriteXML
virtual void WriteXML(TiXmlElement *_ccElement)
Definition: MultiInstance.cpp:157
OpenZWave::MultiInstance::MultiChannelCmd_CapabilityReport
Definition: MultiInstance.h:51
OpenZWave::CommandClass
Base class for all Z-Wave command classes.
Definition: CommandClass.h:46
OpenZWave::MultiInstance::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: MultiInstance.h:64
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::MultiInstance::MultiChannelCmd_EndPointFind
Definition: MultiInstance.h:52
OpenZWave::MultiInstance::MultiInstanceMapping
MultiInstanceMapping
Definition: MultiInstance.h:57
OpenZWave::MultiInstance::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Definition: MultiInstance.h:67
OpenZWave::MultiInstance::MultiChannelCmd_EndPointReport
Definition: MultiInstance.h:49
OpenZWave::MultiInstance::MultiChannelCmd_EndPointGet
Definition: MultiInstance.h:48
OpenZWave::MultiInstance::MultiInstanceCmd_Encap
Definition: MultiInstance.h:45
OpenZWave::MultiInstance::~MultiInstance
virtual ~MultiInstance()
Definition: MultiInstance.h:65
OpenZWave::MultiInstance::MultiInstanceCmd_Report
Definition: MultiInstance.h:44
OpenZWave::MultiInstance::MultiInstanceMapEndPoints
Definition: MultiInstance.h:60
OpenZWave::MultiInstance::GetCommandClassName
virtual string const GetCommandClassName() const
Definition: MultiInstance.h:76
OpenZWave::MultiInstance
Implements COMMAND_CLASS_MULTI_INSTANCE (0x60), a Z-Wave device command class.
Definition: MultiInstance.h:38
OpenZWave::MultiInstance::MultiInstanceCmd
MultiInstanceCmd
Definition: MultiInstance.h:41
OpenZWave::MultiInstance::MultiChannelCmd_Encap
Definition: MultiInstance.h:54
uint8
unsigned char uint8
Definition: Defs.h:74