OpenZWave Library 1.6.1914
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 namespace Internal
39 {
40 namespace CC
41 {
42 class CommandClass;
43
48 {
49 public:
50 typedef CommandClass* (*pfnCreateCommandClass_t)(uint32 const _homeId, uint8 const _nodeId);
51
52 static void RegisterCommandClasses();
53 static CommandClass* CreateCommandClass(uint8 const _commandClassId, uint32 const _homeId, uint8 const _nodeId);
54
55 static bool IsSupported(uint8 const _commandClassId);
56 static string GetName(uint8 const _commandClassId);
57 static list<uint8> GetAdvertisedCommandClasses();
58 private:
60 CommandClasses(CommandClasses const&); // prevent copy
61 CommandClasses& operator =(CommandClasses const&); // prevent assignment
62
63 static CommandClasses& Get()
64 {
65 static CommandClasses instance;
66 return instance;
67 }
68
69 void Register(uint8 const _commandClassId, string const& _commandClassName, pfnCreateCommandClass_t _create, bool advertised = false);
70 void ParseCommandClassOption(string const& _optionStr, bool const _include);
71 uint8 GetCommandClassId(string const& _name);
72
73 pfnCreateCommandClass_t m_commandClassCreators[256];
74 map<string, uint8> m_namesToIDs;
75 /* a list of CommandClasses that are advertised on the controllers NIF packet and can be controlled
76 * via other Nodes
77 */
78 list<uint8> m_advertisedCommandClasses;
79
80 // m_supportedCommandClasses uses single bits to mark whether OpenZWave supports a command class
81 // Checking this is not the same as looking for non-NULL entried in m_commandClassCreators, since
82 // this may be modified by the program options --Include and --Ingnore to filter out support
83 // for unwanted command classes.
84 uint32 m_supportedCommandClasses[8];
85 };
86 } // namespace CC
87 } // namespace Internal
88} // namespace OpenZWave
89
90#endif
unsigned int uint32
Definition Defs.h:91
unsigned char uint8
Definition Defs.h:85
Base class for all Z-Wave command classes.
Definition CommandClass.h:61
Manages a map of command classes supported by a specific Z-Wave node.
Definition CommandClasses.h:48
static void RegisterCommandClasses()
Definition CommandClasses.cpp:184
static CommandClass * CreateCommandClass(uint8 const _commandClassId, uint32 const _homeId, uint8 const _nodeId)
Definition CommandClasses.cpp:165
CommandClass *(* pfnCreateCommandClass_t)(uint32 const _homeId, uint8 const _nodeId)
Definition CommandClasses.h:50
static list< uint8 > GetAdvertisedCommandClasses()
Definition CommandClasses.cpp:326
static string GetName(uint8 const _commandClassId)
Definition CommandClasses.cpp:130
static bool IsSupported(uint8 const _commandClassId)
Definition CommandClasses.cpp:125
Definition Bitfield.cpp:31