ManufacturerSpecific.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// ManufacturerSpecific.h
//
// Implementation of the Z-Wave COMMAND_CLASS_MANUFACTURER_SPECIFIC
//
// 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 _ManufacturerSpecific_H
#define _ManufacturerSpecific_H
#include <map>
#include "command_classes/CommandClass.h"
namespace OpenZWave
{
class ManufacturerSpecific: public CommandClass
{
public:
static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new ManufacturerSpecific( _homeId, _nodeId ); }
virtual ~ManufacturerSpecific(){ UnloadProductXML(); }
static uint8 const StaticGetCommandClassId(){ return 0x72; }
static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_MANUFACTURER_SPECIFIC"; }
// From CommandClass
virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue );
virtual bool RequestValue( uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue );
virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
static string SetProductDetails( Node *_node, uint16 _manufacturerId, uint16 _productType, uint16 _productId );
static bool LoadConfigXML( Node* _node, string const& _configXML );
void ReLoadConfigXML();
private:
ManufacturerSpecific( uint32 const _homeId, uint8 const _nodeId ): CommandClass( _homeId, _nodeId ){ SetStaticRequest( StaticRequest_Values ); }
static bool LoadProductXML();
static void UnloadProductXML();
class Product
{
public:
Product
(
uint16 _manufacturerId,
uint16 _productType,
uint16 _productId,
string const& _productName,
string const& _configPath
):
m_manufacturerId( _manufacturerId ),
m_productType( _productType ),
m_productId( _productId ),
m_productName( _productName ),
m_configPath( _configPath )
{
}
int64 GetKey()const
{
return( GetKey( m_manufacturerId, m_productType, m_productId ) );
}
static int64 GetKey( uint16 _manufacturerId, uint16 _productType, uint16 _productId )
{
int64 key = (((int64)_manufacturerId)<<32) | (((int64)_productType)<<16) | (int64)_productId;
return key;
}
uint16 GetManufacturerId()const{ return m_manufacturerId; }
uint16 GetProductType()const{ return m_productType; }
uint16 GetProductId()const{ return m_productId; }
string GetProductName()const{ return m_productName; }
string GetConfigPath()const{ return m_configPath; }
private:
uint16 m_manufacturerId;
uint16 m_productType;
uint16 m_productId;
string m_productName;
string m_configPath;
};
static map<uint16,string> s_manufacturerMap;
static map<int64,Product*> s_productMap;
static bool s_bXmlLoaded;
};
} // namespace OpenZWave
#endif
OpenZWave
Definition: Bitfield.h:34
OpenZWave::Driver::MsgQueue
MsgQueue
Definition: Driver.h:565
OpenZWave::ManufacturerSpecific::RequestValue
virtual bool RequestValue(uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: ManufacturerSpecific.cpp:80
OpenZWave::CommandClass::StaticRequest_Values
Definition: CommandClass.h:174
OpenZWave::ManufacturerSpecific
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:38
uint16
unsigned short uint16
Definition: Defs.h:77
OpenZWave::ManufacturerSpecific::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition: ManufacturerSpecific.cpp:176
CommandClass.h
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:64
OpenZWave::ManufacturerSpecific::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Definition: ManufacturerSpecific.h:44
OpenZWave::CommandClass
Base class for all Z-Wave command classes.
Definition: CommandClass.h:46
OpenZWave::ManufacturerSpecific::SetProductDetails
static string SetProductDetails(Node *_node, uint16 _manufacturerId, uint16 _productType, uint16 _productId)
Definition: ManufacturerSpecific.cpp:109
OpenZWave::CommandClass::CommandClass
CommandClass(uint32 const _homeId, uint8 const _nodeId)
Definition: CommandClass.cpp:55
OpenZWave::ManufacturerSpecific::ReLoadConfigXML
void ReLoadConfigXML()
Definition: ManufacturerSpecific.cpp:419
OpenZWave::ManufacturerSpecific::~ManufacturerSpecific
virtual ~ManufacturerSpecific()
Definition: ManufacturerSpecific.h:42
OpenZWave::ManufacturerSpecific::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: ManufacturerSpecific.h:41
OpenZWave::ManufacturerSpecific::GetCommandClassName
virtual string const GetCommandClassName() const
Definition: ManufacturerSpecific.h:51
OpenZWave::ManufacturerSpecific::LoadConfigXML
static bool LoadConfigXML(Node *_node, string const &_configXML)
Definition: ManufacturerSpecific.cpp:378
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::ManufacturerSpecific::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Definition: ManufacturerSpecific.h:45
OpenZWave::CommandClass::SetStaticRequest
void SetStaticRequest(uint8 _request)
Definition: CommandClass.h:179
OpenZWave::ManufacturerSpecific::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Definition: ManufacturerSpecific.h:50
OpenZWave::ManufacturerSpecific::RequestState
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: ManufacturerSpecific.cpp:61
uint8
unsigned char uint8
Definition: Defs.h:74