OpenZWave Library
1.6.1914
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp
src
Group.h
Go to the documentation of this file.
1
//-----------------------------------------------------------------------------
2
//
3
// Group.h
4
//
5
// A set of associations in a Z-Wave device.
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 _Group_H
29
#define _Group_H
30
31
#include <string>
32
#include <vector>
33
#include <map>
34
#include "
Defs.h
"
35
36
class
TiXmlElement;
37
38
namespace
OpenZWave
39
{
40
namespace
Internal
41
{
42
namespace
CC
43
{
44
class
Association
;
45
class
MultiChannelAssociation
;
46
}
47
}
48
49
class
Node
;
50
51
// When dealing with MultiInstance Devices,
52
// OpenZWave uses "Instance" to identify a subdevice.
53
// The public interface maps an Instance ID to an "End Point", which in turn
54
// gets used to build Z-Wave packets.
55
// Config files and by extension ozwcache store this map per CC, for example:
56
// <Instance index="1" endpoint="1" />
57
// The Group Aka Association commands, however, expect "End Points"
58
// It would make sense to change "Instance" to "End Point" in all related code but...
59
// InstanceAssociation is exposed by the API in Manager::GetAssociations
60
// Because of its exposure, m_instance cannot be renamed to m_endPoint without
61
// breaking existing code.
62
63
typedef
struct
InstanceAssociation
64
{
65
uint8
m_nodeId
;
66
uint8
m_instance
;
// "End Point" as defined in SDS13782-11B, Multi Channel Association Command Class.
67
}
InstanceAssociation
;
68
71
class
Group
72
{
73
friend
class
Node
;
74
friend
class
Internal::CC::Association
;
75
friend
class
Internal::CC::MultiChannelAssociation
;
76
77
//-----------------------------------------------------------------------------
78
// Construction
79
//-----------------------------------------------------------------------------
80
public
:
81
Group
(
uint32
const
_homeId,
uint8
const
_nodeId,
uint8
const
_groupIdx,
uint8
const
_maxAssociations);
82
Group
(
uint32
const
_homeId,
uint8
const
_nodeId, TiXmlElement
const
* _valueElement);
83
~Group
()
84
{
85
}
86
87
void
WriteXML
(TiXmlElement* _groupElement);
88
89
//-----------------------------------------------------------------------------
90
// Association methods (COMMAND_CLASS_ASSOCIATION)
91
//-----------------------------------------------------------------------------
92
public
:
93
string
const
&
GetLabel
()
const
94
{
95
return
m_label;
96
}
97
uint32
GetAssociations
(
uint8
** o_associations);
98
uint32
GetAssociations
(
InstanceAssociation
** o_associations);
99
uint8
GetMaxAssociations
()
const
100
{
101
return
m_maxAssociations;
102
}
103
uint8
GetIdx
()
const
104
{
105
return
m_groupIdx;
106
}
107
bool
Contains
(
uint8
const
_nodeId,
uint8
const
_endPoint= 0x00);
108
bool
IsMultiInstance
()
const
109
{
110
return
m_multiInstance;
111
}
112
113
private
:
114
bool
IsAuto()
const
115
{
116
return
m_auto;
117
}
118
void
SetAuto(
bool
const
_state)
119
{
120
m_auto = _state;
121
}
122
void
CheckAuto();
123
124
void
SetMultiInstance(
bool
const
_state)
125
{
126
m_multiInstance = _state;
127
}
128
129
void
AddAssociation(
uint8
const
_nodeId,
uint8
const
endPoint = 0x00);
130
void
RemoveAssociation(
uint8
const
_nodeId,
uint8
const
_endPoint = 0x00);
131
void
OnGroupChanged(vector<uint8>
const
& _associations);
132
void
OnGroupChanged(vector<InstanceAssociation>
const
& _associations);
133
134
//-----------------------------------------------------------------------------
135
// Command methods (COMMAND_CLASS_ASSOCIATION_COMMAND_CONFIGURATION)
136
//-----------------------------------------------------------------------------
137
public
:
138
bool
ClearCommands
(
uint8
const
_nodeId,
uint8
const
_endPoint = 0x00);
139
bool
AddCommand
(
uint8
const
_nodeId,
uint8
const
_length,
uint8
const
* _data,
uint8
const
_endPoint = 0x00);
140
141
private
:
142
class
AssociationCommand
143
{
144
public
:
145
AssociationCommand(
uint8
const
_length,
uint8
const
* _data);
146
~AssociationCommand();
147
148
private
:
149
uint8
* m_data;
150
};
151
152
typedef
vector<AssociationCommand> AssociationCommandVec;
153
struct
classcomp
154
{
155
bool
operator()(
const
InstanceAssociation
& lhs,
const
InstanceAssociation
& rhs)
const
156
{
157
return
lhs.m_nodeId == rhs.m_nodeId ? lhs.m_instance < rhs.m_instance : lhs.m_nodeId < rhs.m_nodeId;
158
}
159
};
160
161
//-----------------------------------------------------------------------------
162
// Member variables
163
//-----------------------------------------------------------------------------
164
private
:
165
string
m_label;
166
uint32
m_homeId;
167
uint8
m_nodeId;
168
uint8
m_groupIdx;
169
uint8
m_maxAssociations;
170
bool
m_auto;
// If true, the controller will automatically be associated with the group
171
bool
m_multiInstance;
// If true, the group is MultiInstance capable
172
map<InstanceAssociation, AssociationCommandVec, classcomp> m_associations;
173
};
174
175
}
//namespace OpenZWave
176
177
#endif
//_Group_H
178
Defs.h
uint32
unsigned int uint32
Definition
Defs.h:91
uint8
unsigned char uint8
Definition
Defs.h:85
OpenZWave::Group::Group
Group(uint32 const _homeId, uint8 const _nodeId, uint8 const _groupIdx, uint8 const _maxAssociations)
Definition
Group.cpp:49
OpenZWave::Group::GetMaxAssociations
uint8 GetMaxAssociations() const
Definition
Group.h:99
OpenZWave::Group::GetIdx
uint8 GetIdx() const
Definition
Group.h:103
OpenZWave::Group::~Group
~Group()
Definition
Group.h:83
OpenZWave::Group::ClearCommands
bool ClearCommands(uint8 const _nodeId, uint8 const _endPoint=0x00)
Definition
Group.cpp:456
OpenZWave::Group::WriteXML
void WriteXML(TiXmlElement *_groupElement)
Definition
Group.cpp:176
OpenZWave::Group::Node
friend class Node
Definition
Group.h:73
OpenZWave::Group::Contains
bool Contains(uint8 const _nodeId, uint8 const _endPoint=0x00)
Definition
Group.cpp:216
OpenZWave::Group::IsMultiInstance
bool IsMultiInstance() const
Definition
Group.h:108
OpenZWave::Group::GetAssociations
uint32 GetAssociations(uint8 **o_associations)
Definition
Group.cpp:401
OpenZWave::Group::GetLabel
string const & GetLabel() const
Definition
Group.h:93
OpenZWave::Group::AddCommand
bool AddCommand(uint8 const _nodeId, uint8 const _length, uint8 const *_data, uint8 const _endPoint=0x00)
Definition
Group.cpp:474
OpenZWave::Internal::CC::Association
Implements COMMAND_CLASS_ASSOCIATION (0x85), a Z-Wave device command class.
Definition
Association.h:44
OpenZWave::Internal::CC::MultiChannelAssociation
Implements COMMAND_CLASS_MULTI_CHANNEL_ASSOCIATION (0x8E), a Z-Wave device command class.
Definition
MultiChannelAssociation.h:46
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition
Node.h:82
OpenZWave::Internal::CC
Definition
Alarm.cpp:54
OpenZWave::Internal
Definition
Bitfield.cpp:33
OpenZWave
Definition
Bitfield.cpp:31
OpenZWave::InstanceAssociation
struct OpenZWave::InstanceAssociation InstanceAssociation
OpenZWave::InstanceAssociation
Definition
Group.h:64
OpenZWave::InstanceAssociation::m_instance
uint8 m_instance
Definition
Group.h:66
OpenZWave::InstanceAssociation::m_nodeId
uint8 m_nodeId
Definition
Group.h:65
Generated on
for OpenZWave Library by
1.17.0