OpenZWave Library  1.5.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>
33 
34 namespace OpenZWave
35 {
40  {
41  public:
43  {
47 
48  // Version 2
56  };
57 
59  {
63  };
64 
65  static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new MultiInstance( _homeId, _nodeId ); }
66  virtual ~MultiInstance(){}
67 
68  static uint8 const StaticGetCommandClassId(){ return 0x60; }
69  static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_MULTI_INSTANCE/CHANNEL"; }
70 
71  bool RequestInstances();
72 
73  // From CommandClass
74  virtual void ReadXML( TiXmlElement const* _ccElement );
75  virtual void WriteXML( TiXmlElement* _ccElement );
76  virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
77  virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
78  virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
79  virtual uint8 GetMaxVersion(){ return 2; }
80 
81  MultiInstanceMapping GetEndPointMap(){ return m_endPointMap; }
82 
83  private:
84  MultiInstance( uint32 const _homeId, uint8 const _nodeId );
85 
86  void HandleMultiInstanceReport( uint8 const* _data, uint32 const _length );
87  void HandleMultiInstanceEncap( uint8 const* _data, uint32 const _length );
88  void HandleMultiChannelEndPointReport( uint8 const* _data, uint32 const _length );
89  void HandleMultiChannelCapabilityReport( uint8 const* _data, uint32 const _length );
90  void HandleMultiChannelEndPointFindReport( uint8 const* _data, uint32 const _length );
91  void HandleMultiChannelEncap( uint8 const* _data, uint32 const _length );
92 
93  bool m_numEndPointsCanChange;
94  bool m_endPointsAreSameClass;
95  uint8 m_numEndPoints;
96 
97  // Finding endpoints
98  uint8 m_endPointFindIndex;
99  uint8 m_numEndPointsFound;
100  set<uint8> m_endPointCommandClasses;
101 
102  // configuration
103  uint8 m_numEndPointsHint; // for nodes that do not report correct number of end points
104  MultiInstanceMapping m_endPointMap; // Determine how to map end points to value id instances
105  bool m_endPointFindSupported; // for nodes that (someday may) support endpointfind
106  bool m_ignoreUnsolicitedMultiChannelCapabilityReport;
107  bool m_uniqueendpoints;
108  };
109 
110 } // namespace OpenZWave
111 
112 #endif
113 
virtual void ReadXML(TiXmlElement const *_ccElement)
Definition: MultiInstance.cpp:104
Definition: Bitfield.h:34
bool RequestInstances()
Definition: MultiInstance.cpp:192
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: MultiInstance.cpp:250
static string const StaticGetCommandClassName()
Definition: MultiInstance.h:69
Definition: MultiInstance.h:60
MultiInstanceMapping GetEndPointMap()
Definition: MultiInstance.h:81
virtual uint8 const GetCommandClassId() const
Definition: MultiInstance.h:76
virtual uint8 GetMaxVersion()
Definition: MultiInstance.h:79
virtual void WriteXML(TiXmlElement *_ccElement)
Definition: MultiInstance.cpp:157
Base class for all Z-Wave command classes.
Definition: CommandClass.h:54
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: MultiInstance.h:65
unsigned int uint32
Definition: Defs.h:96
MultiInstanceMapping
Definition: MultiInstance.h:58
static uint8 const StaticGetCommandClassId()
Definition: MultiInstance.h:68
virtual ~MultiInstance()
Definition: MultiInstance.h:66
virtual string const GetCommandClassName() const
Definition: MultiInstance.h:77
Implements COMMAND_CLASS_MULTI_INSTANCE (0x60), a Z-Wave device command class.
Definition: MultiInstance.h:39
MultiInstanceCmd
Definition: MultiInstance.h:42
unsigned char uint8
Definition: Defs.h:90