OpenZWave Library 1.2
ManufacturerSpecific.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// ManufacturerSpecific.h
4//
5// Implementation of the Z-Wave COMMAND_CLASS_MANUFACTURER_SPECIFIC
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 _ManufacturerSpecific_H
29#define _ManufacturerSpecific_H
30
31#include <map>
33
34namespace OpenZWave
35{
39 {
40 public:
41 static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new ManufacturerSpecific( _homeId, _nodeId ); }
42 virtual ~ManufacturerSpecific(){ UnloadProductXML(); }
43
44 static uint8 const StaticGetCommandClassId(){ return 0x72; }
45 static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_MANUFACTURER_SPECIFIC"; }
46
47 // From CommandClass
48 virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue );
49 virtual bool RequestValue( uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue );
50 virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
51 virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
52 virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
53
54 static string SetProductDetails( Node *_node, uint16 _manufacturerId, uint16 _productType, uint16 _productId );
55 static bool LoadConfigXML( Node* _node, string const& _configXML );
56
57 void ReLoadConfigXML();
58
59 private:
60 ManufacturerSpecific( uint32 const _homeId, uint8 const _nodeId ): CommandClass( _homeId, _nodeId ){ SetStaticRequest( StaticRequest_Values ); }
61 static bool LoadProductXML();
62 static void UnloadProductXML();
63
64 class Product
65 {
66 public:
67 Product
68 (
69 uint16 _manufacturerId,
70 uint16 _productType,
71 uint16 _productId,
72 string const& _productName,
73 string const& _configPath
74 ):
75 m_manufacturerId( _manufacturerId ),
76 m_productType( _productType ),
77 m_productId( _productId ),
78 m_productName( _productName ),
79 m_configPath( _configPath )
80 {
81 }
82
83 int64 GetKey()const
84 {
85 return( GetKey( m_manufacturerId, m_productType, m_productId ) );
86 }
87
88 static int64 GetKey( uint16 _manufacturerId, uint16 _productType, uint16 _productId )
89 {
90 int64 key = (((int64)_manufacturerId)<<32) | (((int64)_productType)<<16) | (int64)_productId;
91 return key;
92 }
93
94 uint16 GetManufacturerId()const{ return m_manufacturerId; }
95 uint16 GetProductType()const{ return m_productType; }
96 uint16 GetProductId()const{ return m_productId; }
97 string GetProductName()const{ return m_productName; }
98 string GetConfigPath()const{ return m_configPath; }
99
100 private:
101 uint16 m_manufacturerId;
102 uint16 m_productType;
103 uint16 m_productId;
104 string m_productName;
105 string m_configPath;
106 };
107
108 static map<uint16,string> s_manufacturerMap;
109 static map<int64,Product*> s_productMap;
110 static bool s_bXmlLoaded;
111 };
112
113} // namespace OpenZWave
114
115#endif
116
unsigned short uint16
Definition: Defs.h:66
unsigned int uint32
Definition: Defs.h:69
unsigned char uint8
Definition: Defs.h:63
Base class for all Z-Wave command classes.
Definition: CommandClass.h:47
void SetStaticRequest(uint8 _request)
Definition: CommandClass.h:176
@ StaticRequest_Values
Definition: CommandClass.h:171
MsgQueue
Definition: Driver.h:584
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:39
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: ManufacturerSpecific.cpp:61
virtual ~ManufacturerSpecific()
Definition: ManufacturerSpecific.h:42
void ReLoadConfigXML()
Definition: ManufacturerSpecific.cpp:419
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: ManufacturerSpecific.h:41
virtual bool RequestValue(uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: ManufacturerSpecific.cpp:80
static bool LoadConfigXML(Node *_node, string const &_configXML)
Definition: ManufacturerSpecific.cpp:377
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: ManufacturerSpecific.cpp:176
virtual string const GetCommandClassName() const
Definition: ManufacturerSpecific.h:51
virtual uint8 const GetCommandClassId() const
Definition: ManufacturerSpecific.h:50
static string const StaticGetCommandClassName()
Definition: ManufacturerSpecific.h:45
static uint8 const StaticGetCommandClassId()
Definition: ManufacturerSpecific.h:44
static string SetProductDetails(Node *_node, uint16 _manufacturerId, uint16 _productType, uint16 _productId)
Definition: ManufacturerSpecific.cpp:109
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:64
Definition: Bitfield.h:35