| OpenZWave Library 1.6.0

MultiInstance.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // MultiInstance.h
4 //
5 // Implementation of the Z-Wave COMMAND_CLASS_MULTI_INSTANCE
6 //
7 // Copyright (c) 2010 Mal Lansell <openzwave@lansell.org>
8 //
9 // SOFTWARE NOTICE AND LICENSE
10 //
11 // This file is part of OpenZWave.
12 //
13 // OpenZWave is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU Lesser General Public License as published
15 // by the Free Software Foundation, either version 3 of the License,
16 // or (at your option) any later version.
17 //
18 // OpenZWave is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public License
24 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
25 //
26 //-----------------------------------------------------------------------------
27
28 #ifndef _MultiInstance_H
29 #define _MultiInstance_H
30
31 #include <set>
32 #include "command_classes/CommandClass.h"
33
34 namespace OpenZWave
35 {
39 class MultiInstance: public CommandClass
40 {
41 public:
42 enum MultiInstanceCmd
43 {
44 MultiInstanceCmd_Get = 0x04,
45 MultiInstanceCmd_Report = 0x05,
46 MultiInstanceCmd_Encap = 0x06,
47
48 // Version 2
49 MultiChannelCmd_EndPointGet = 0x07,
50 MultiChannelCmd_EndPointReport = 0x08,
51 MultiChannelCmd_CapabilityGet = 0x09,
52 MultiChannelCmd_CapabilityReport = 0x0a,
53 MultiChannelCmd_EndPointFind = 0x0b,
54 MultiChannelCmd_EndPointFindReport = 0x0c,
55 MultiChannelCmd_Encap = 0x0d
56 };
57
58 static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new MultiInstance( _homeId, _nodeId ); }
59 virtual ~MultiInstance(){}
60
61 static uint8 const StaticGetCommandClassId(){ return 0x60; }
62 static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_MULTI_INSTANCE/CHANNEL"; }
63
64 bool RequestInstances();
65
66 // From CommandClass
67 virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
68 virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
69 virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
70 virtual bool HandleIncomingMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
71 virtual uint8 GetMaxVersion(){ return 2; }
72 void SetInstanceLabel(uint8 const _instance, char *label);
73
74 private:
75 MultiInstance( uint32 const _homeId, uint8 const _nodeId );
76
77 void HandleMultiInstanceReport( uint8 const* _data, uint32 const _length );
78 void HandleMultiInstanceEncap( uint8 const* _data, uint32 const _length );
79 void HandleMultiChannelEndPointReport( uint8 const* _data, uint32 const _length );
80 void HandleMultiChannelCapabilityReport( uint8 const* _data, uint32 const _length );
81 void HandleMultiChannelEndPointFindReport( uint8 const* _data, uint32 const _length );
82 void HandleMultiChannelEncap( uint8 const* _data, uint32 const _length );
83
84 bool m_numEndPointsCanChange;
85 bool m_endPointsAreSameClass;
86 uint8 m_numEndPoints;
87 bool m_useDestAsSrc;
88
89 // Finding endpoints
90 uint8 m_endPointFindIndex;
91 uint8 m_numEndPointsFound;
92 set<uint8> m_endPointCommandClasses;
93
94 };
95
96 } // namespace OpenZWave
97
98 #endif
99
uint32
unsigned int uint32
Definition: Defs.h:95
OpenZWave::MultiInstance::MultiInstanceCmd_Get
@ MultiInstanceCmd_Get
Definition: MultiInstance.h:44
OpenZWave::CommandClass
Base class for all Z-Wave command classes.
Definition: CommandClass.h:56
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::MultiInstance::RequestInstances
bool RequestInstances()
Definition: MultiInstance.cpp:105
OpenZWave::MultiInstance
Implements COMMAND_CLASS_MULTI_INSTANCE (0x60), a Z-Wave device command class.
Definition: MultiInstance.h:40
OpenZWave::MultiInstance::MultiChannelCmd_EndPointFindReport
@ MultiChannelCmd_EndPointFindReport
Definition: MultiInstance.h:54
OpenZWave::MultiInstance::SetInstanceLabel
void SetInstanceLabel(uint8 const _instance, char *label)
Definition: MultiInstance.cpp:671
OpenZWave::MultiInstance::MultiChannelCmd_CapabilityReport
@ MultiChannelCmd_CapabilityReport
Definition: MultiInstance.h:52
OpenZWave::MultiInstance::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Definition: MultiInstance.h:62
OpenZWave::MultiInstance::MultiChannelCmd_EndPointFind
@ MultiChannelCmd_EndPointFind
Definition: MultiInstance.h:53
OpenZWave::MultiInstance::HandleIncomingMsg
virtual bool HandleIncomingMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: MultiInstance.cpp:159
OpenZWave::MultiInstance::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Definition: MultiInstance.h:67
OpenZWave::MultiInstance::MultiInstanceCmd_Encap
@ MultiInstanceCmd_Encap
Definition: MultiInstance.h:46
OpenZWave::MultiInstance::~MultiInstance
virtual ~MultiInstance()
Definition: MultiInstance.h:59
CommandClass.h
OpenZWave::MultiInstance::GetCommandClassName
virtual string const GetCommandClassName() const
Definition: MultiInstance.h:68
OpenZWave::MultiInstance::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: MultiInstance.cpp:174
OpenZWave::MultiInstance::MultiInstanceCmd
MultiInstanceCmd
Definition: MultiInstance.h:43
OpenZWave::MultiInstance::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: MultiInstance.h:58
OpenZWave::MultiInstance::MultiInstanceCmd_Report
@ MultiInstanceCmd_Report
Definition: MultiInstance.h:45
OpenZWave::MultiInstance::MultiChannelCmd_Encap
@ MultiChannelCmd_Encap
Definition: MultiInstance.h:55
OpenZWave::MultiInstance::MultiChannelCmd_EndPointReport
@ MultiChannelCmd_EndPointReport
Definition: MultiInstance.h:50
OpenZWave::MultiInstance::MultiChannelCmd_EndPointGet
@ MultiChannelCmd_EndPointGet
Definition: MultiInstance.h:49
OpenZWave::MultiInstance::GetMaxVersion
virtual uint8 GetMaxVersion()
Definition: MultiInstance.h:71
OpenZWave::MultiInstance::MultiChannelCmd_CapabilityGet
@ MultiChannelCmd_CapabilityGet
Definition: MultiInstance.h:51
OpenZWave
Definition: Bitfield.h:35
OpenZWave::MultiInstance::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Definition: MultiInstance.h:61