OpenZWave Library 1.6.0
Loading...
Searching...
No Matches
CommandClasses.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// CommandClasses.h
4//
5// Singleton holding methods to create each command class object
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 _CommandClasses_H
29#define _CommandClasses_H
30
31#include <string>
32#include <map>
33#include <list>
34#include "Defs.h"
35
36namespace OpenZWave
37{
38 class CommandClass;
39
44 {
45 public:
46 typedef CommandClass* (*pfnCreateCommandClass_t)( uint32 const _homeId, uint8 const _nodeId );
47
48 static void RegisterCommandClasses();
49 static CommandClass* CreateCommandClass( uint8 const _commandClassId, uint32 const _homeId, uint8 const _nodeId );
50
51 static bool IsSupported( uint8 const _commandClassId );
52 static string GetName(uint8 const _commandClassId);
53 static list<uint8> GetAdvertisedCommandClasses();
54 private:
56 CommandClasses( CommandClasses const& ); // prevent copy
57 CommandClasses& operator = ( CommandClasses const& ); // prevent assignment
58
59 static CommandClasses& Get()
60 {
61 static CommandClasses instance;
62 return instance;
63 }
64
65 void Register( uint8 const _commandClassId, string const& _commandClassName, pfnCreateCommandClass_t _create, bool advertised = false );
66 void ParseCommandClassOption( string const& _optionStr, bool const _include );
67 uint8 GetCommandClassId( string const& _name );
68
69 pfnCreateCommandClass_t m_commandClassCreators[256];
70 map<string,uint8> m_namesToIDs;
71 /* a list of CommandClasses that are advertised on the controllers NIF packet and can be controlled
72 * via other Nodes
73 */
74 list<uint8> m_advertisedCommandClasses;
75
76 // m_supportedCommandClasses uses single bits to mark whether OpenZWave supports a command class
77 // Checking this is not the same as looking for non-NULL entried in m_commandClassCreators, since
78 // this may be modified by the program options --Include and --Ingnore to filter out support
79 // for unwanted command classes.
80 uint32 m_supportedCommandClasses[8];
81 };
82
83} // namespace OpenZWave
84
85
86#endif
unsigned int uint32
Definition Defs.h:95
unsigned char uint8
Definition Defs.h:89
Base class for all Z-Wave command classes.
Definition CommandClass.h:56
Manages a map of command classes supported by a specific Z-Wave node.
Definition CommandClasses.h:44
static CommandClass * CreateCommandClass(uint8 const _commandClassId, uint32 const _homeId, uint8 const _nodeId)
Definition CommandClasses.cpp:175
static bool IsSupported(uint8 const _commandClassId)
Definition CommandClasses.cpp:124
static list< uint8 > GetAdvertisedCommandClasses()
Definition CommandClasses.cpp:350
static void RegisterCommandClasses()
Definition CommandClasses.cpp:199
CommandClass *(* pfnCreateCommandClass_t)(uint32 const _homeId, uint8 const _nodeId)
Definition CommandClasses.h:46
static string GetName(uint8 const _commandClassId)
Definition CommandClasses.cpp:132
Definition Bitfield.h:35