/usr/include/openzwave/Group.h is in libopenzwave1.5-dev 1.5+ds-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | //-----------------------------------------------------------------------------
//
// Group.h
//
// A set of associations in a Z-Wave device.
//
// 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 _Group_H
#define _Group_H
#include <string>
#include <vector>
#include <map>
#include "Defs.h"
class TiXmlElement;
namespace OpenZWave
{
class Node;
typedef struct InstanceAssociation {
uint8 m_nodeId;
uint8 m_instance;
} InstanceAssociation;
/** \brief Manages a group of devices (various nodes associated with each other).
*/
class Group
{
friend class Node;
friend class Association;
friend class MultiInstanceAssociation;
//-----------------------------------------------------------------------------
// Construction
//-----------------------------------------------------------------------------
public:
Group( uint32 const _homeId, uint8 const _nodeId, uint8 const _groupIdx, uint8 const _maxAssociations );
Group( uint32 const _homeId, uint8 const _nodeId, TiXmlElement const* _valueElement );
~Group(){}
void WriteXML( TiXmlElement* _groupElement );
//-----------------------------------------------------------------------------
// Association methods (COMMAND_CLASS_ASSOCIATION)
//-----------------------------------------------------------------------------
public:
string const& GetLabel()const{ return m_label; }
uint32 GetAssociations( uint8** o_associations );
uint32 GetAssociations( InstanceAssociation** o_associations );
uint8 GetMaxAssociations()const{ return m_maxAssociations; }
uint8 GetIdx()const{ return m_groupIdx; }
bool Contains( uint8 const _nodeId, uint8 const _instance = 0x00 );
private:
bool IsAuto()const{ return m_auto; }
void SetAuto( bool const _state ){ m_auto = _state; }
void CheckAuto();
bool IsMultiInstance()const{ return m_multiInstance; }
void SetMultiInstance( bool const _state ){ m_multiInstance = _state; }
void AddAssociation( uint8 const _nodeId, uint8 const _instance = 0x00 );
void RemoveAssociation( uint8 const _nodeId, uint8 const _instance = 0x00 );
void OnGroupChanged( vector<uint8> const& _associations );
void OnGroupChanged( vector<InstanceAssociation> const& _associations );
//-----------------------------------------------------------------------------
// Command methods (COMMAND_CLASS_ASSOCIATION_COMMAND_CONFIGURATION)
//-----------------------------------------------------------------------------
public:
bool ClearCommands( uint8 const _nodeId, uint8 const _instance = 0x00 );
bool AddCommand( uint8 const _nodeId, uint8 const _length, uint8 const* _data, uint8 const _instance = 0x00 );
private:
class AssociationCommand
{
public:
AssociationCommand( uint8 const _length, uint8 const* _data );
~AssociationCommand();
private:
uint8 m_length;
uint8* m_data;
};
typedef vector<AssociationCommand> AssociationCommandVec;
struct classcomp {
bool operator() (const InstanceAssociation& lhs, const InstanceAssociation& rhs) const
{return lhs.m_nodeId == rhs.m_nodeId ? lhs.m_instance < rhs.m_instance : lhs.m_nodeId < rhs.m_nodeId;}
};
//-----------------------------------------------------------------------------
// Member variables
//-----------------------------------------------------------------------------
private:
string m_label;
uint32 m_homeId;
uint8 m_nodeId;
uint8 m_groupIdx;
uint8 m_maxAssociations;
bool m_auto; // If true, the controller will automatically be associated with the group
bool m_multiInstance; // If true, the group is MultiInstance capable
map<InstanceAssociation,AssociationCommandVec,classcomp> m_associations;
};
} //namespace OpenZWave
#endif //_Group_H
|