OpenZWave Library  1.6.992
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 {
36  namespace Internal
37  {
38  namespace CC
39  {
40 
45  {
46  public:
48  {
52 
53  // Version 2
61  };
62 
63  static CommandClass* Create(uint32 const _homeId, uint8 const _nodeId)
64  {
65  return new MultiInstance(_homeId, _nodeId);
66  }
67  virtual ~MultiInstance()
68  {
69  }
70 
72  {
73  return 0x60;
74  }
75  static string const StaticGetCommandClassName()
76  {
77  return "COMMAND_CLASS_MULTI_INSTANCE/CHANNEL";
78  }
79 
80  bool RequestInstances();
81 
82  // From CommandClass
83  virtual uint8 const GetCommandClassId() const override
84  {
85  return StaticGetCommandClassId();
86  }
87  virtual string const GetCommandClassName() const override
88  {
90  }
91  virtual bool HandleMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override;
92  virtual bool HandleIncomingMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override;
93  virtual uint8 GetMaxVersion() override
94  {
95  return 2;
96  }
97  void SetInstanceLabel(uint8 const _instance, char *label) override;
98 
101 
102  private:
103  MultiInstance(uint32 const _homeId, uint8 const _nodeId);
104 
105  void HandleMultiInstanceReport(uint8 const* _data, uint32 const _length);
106  void HandleMultiInstanceEncap(uint8 const* _data, uint32 const _length);
107  void HandleMultiChannelEndPointReport(uint8 const* _data, uint32 const _length);
108  void HandleMultiChannelCapabilityReport(uint8 const* _data, uint32 const _length);
109  void HandleMultiChannelEndPointFindReport(uint8 const* _data, uint32 const _length);
110  void HandleMultiChannelEncap(uint8 const* _data, uint32 const _length);
111 
112  bool m_numEndPointsCanChange;
113  bool m_endPointsAreSameClass;
114  uint8 m_numEndPoints;
115 
116  // Finding endpoints
117  uint8 m_endPointFindIndex;
118  uint8 m_numEndPointsFound;
119  set<uint8> m_endPointCommandClasses;
120  map<uint8, uint8> m_endPointGenericType;
121  map<uint8, uint8> m_endPointSpecificType;
122  };
123  } // namespace CC
124  } // namespace Internal
125 } // namespace OpenZWave
126 
127 #endif
128 
static uint8 const StaticGetCommandClassId()
Definition: MultiInstance.h:71
bool RequestInstances()
Definition: MultiInstance.cpp:88
Definition: Bitfield.cpp:30
static string const StaticGetCommandClassName()
Definition: MultiInstance.h:75
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: MultiInstance.h:63
uint8 GetSpecificInstanceDeviceType(uint8)
Definition: MultiInstance.cpp:648
Base class for all Z-Wave command classes.
Definition: CommandClass.h:60
void SetInstanceLabel(uint8 const _instance, char *label) override
Definition: MultiInstance.cpp:624
Implements COMMAND_CLASS_MULTI_INSTANCE (0x60), a Z-Wave device command class.
Definition: MultiInstance.h:44
virtual bool HandleIncomingMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1) override
Definition: MultiInstance.cpp:140
unsigned int uint32
Definition: Defs.h:91
virtual uint8 const GetCommandClassId() const override
Definition: MultiInstance.h:83
MultiInstanceCmd
Definition: MultiInstance.h:47
uint8 GetGenericInstanceDeviceType(uint8)
Definition: MultiInstance.cpp:637
virtual ~MultiInstance()
Definition: MultiInstance.h:67
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1) override
Definition: MultiInstance.cpp:149
virtual string const GetCommandClassName() const override
Definition: MultiInstance.h:87
virtual uint8 GetMaxVersion() override
Definition: MultiInstance.h:93
unsigned char uint8
Definition: Defs.h:85