OpenZWave Library
1.4.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cpp
src
command_classes
UserCode.h
Go to the documentation of this file.
1
//-----------------------------------------------------------------------------
2
//
3
// UserCode.h
4
//
5
// Implementation of the Z-Wave COMMAND_CLASS_USER_CODE
6
//
7
// Copyright (c) 2012 Greg Satz <satz@iranger.com>
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 _UserCode_H
29
#define _UserCode_H
30
31
#include "
command_classes/CommandClass.h
"
32
33
namespace
OpenZWave
34
{
37
class
UserCode:
public
CommandClass
38
{
39
public
:
40
enum
UserCodeStatus
41
{
42
UserCode_Available
= 0x00,
43
UserCode_Occupied
= 0x01,
44
UserCode_Reserved
= 0x02,
45
UserCode_NotAvailable
= 0xfe,
46
UserCode_Unset
= 0xff
47
};
48
49
static
CommandClass
*
Create
(
uint32
const
_homeId,
uint8
const
_nodeId ){
return
new
UserCode( _homeId, _nodeId ); }
50
virtual
~UserCode
(){}
51
52
static
uint8
const
StaticGetCommandClassId
(){
return
0x63; }
53
static
string
const
StaticGetCommandClassName
(){
return
"COMMAND_CLASS_USER_CODE"
; }
54
55
// From CommandClass
56
virtual
void
ReadXML
( TiXmlElement
const
* _ccElement );
57
virtual
void
WriteXML
( TiXmlElement* _ccElement );
58
virtual
bool
RequestState
(
uint32
const
_requestFlags,
uint8
const
_instance,
Driver::MsgQueue
const
_queue );
59
virtual
bool
RequestValue
(
uint32
const
_requestFlags,
uint8
const
_index,
uint8
const
_instance,
Driver::MsgQueue
const
_queue );
60
virtual
uint8
const
GetCommandClassId
()
const
{
return
StaticGetCommandClassId
(); }
61
virtual
string
const
GetCommandClassName
()
const
{
return
StaticGetCommandClassName
(); }
62
virtual
bool
HandleMsg
(
uint8
const
* _data,
uint32
const
_length,
uint32
const
_instance = 1 );
63
virtual
bool
SetValue
(
Value
const
& _value );
64
65
protected
:
66
virtual
void
CreateVars
(
uint8
const
_instance );
67
68
private
:
69
UserCode
(
uint32
const
_homeId,
uint8
const
_nodeId );
70
71
string
CodeStatus(
uint8
const
_byte )
72
{
73
switch
( _byte )
74
{
75
case
UserCode_Available
:
76
{
77
return
"Available"
;
78
}
79
case
UserCode_Occupied
:
80
{
81
return
"Occupied"
;
82
}
83
case
UserCode_Reserved
:
84
{
85
return
"Reserved"
;
86
}
87
case
UserCode_NotAvailable
:
88
{
89
return
"Not Available"
;
90
}
91
case
UserCode_Unset
:
92
{
93
return
"Unset"
;
94
}
95
default
:
96
{
97
return
"Unknown"
;
98
}
99
}
100
}
101
102
bool
m_queryAll;
// True while we are requesting all the user codes.
103
uint8
m_currentCode;
104
uint8
m_userCodeCount;
105
uint8
m_userCodesStatus[256];
106
bool
m_refreshUserCodes;
107
};
108
109
}
// namespace OpenZWave
110
111
#endif
112
113
CommandClass.h
uint32
unsigned int uint32
Definition
Defs.h:80
uint8
unsigned char uint8
Definition
Defs.h:74
OpenZWave::CommandClass::CommandClass
CommandClass(uint32 const _homeId, uint8 const _nodeId)
Definition
CommandClass.cpp:55
OpenZWave::Driver::MsgQueue
MsgQueue
Definition
Driver.h:566
OpenZWave::UserCode
Implements COMMAND_CLASS_USER_CODE (0x63), a Z-Wave device command class.
Definition
UserCode.h:38
OpenZWave::UserCode::UserCodeStatus
UserCodeStatus
Definition
UserCode.h:41
OpenZWave::UserCode::UserCode_Unset
@ UserCode_Unset
Definition
UserCode.h:46
OpenZWave::UserCode::UserCode_Occupied
@ UserCode_Occupied
Definition
UserCode.h:43
OpenZWave::UserCode::UserCode_NotAvailable
@ UserCode_NotAvailable
Definition
UserCode.h:45
OpenZWave::UserCode::UserCode_Available
@ UserCode_Available
Definition
UserCode.h:42
OpenZWave::UserCode::UserCode_Reserved
@ UserCode_Reserved
Definition
UserCode.h:44
OpenZWave::UserCode::~UserCode
virtual ~UserCode()
Definition
UserCode.h:50
OpenZWave::UserCode::GetCommandClassName
virtual string const GetCommandClassName() const
Definition
UserCode.h:61
OpenZWave::UserCode::WriteXML
virtual void WriteXML(TiXmlElement *_ccElement)
Definition
UserCode.cpp:101
OpenZWave::UserCode::CreateVars
virtual void CreateVars(uint8 const _instance)
Definition
UserCode.cpp:351
OpenZWave::UserCode::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Definition
UserCode.cpp:197
OpenZWave::UserCode::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Definition
UserCode.h:60
OpenZWave::UserCode::RequestState
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue)
Definition
UserCode.cpp:117
OpenZWave::UserCode::ReadXML
virtual void ReadXML(TiXmlElement const *_ccElement)
Definition
UserCode.cpp:83
OpenZWave::UserCode::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Definition
UserCode.h:52
OpenZWave::UserCode::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition
UserCode.h:49
OpenZWave::UserCode::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Definition
UserCode.h:53
OpenZWave::UserCode::RequestValue
virtual bool RequestValue(uint32 const _requestFlags, uint8 const _index, uint8 const _instance, Driver::MsgQueue const _queue)
Definition
UserCode.cpp:147
OpenZWave::UserCode::SetValue
virtual bool SetValue(Value const &_value)
Definition
UserCode.cpp:304
OpenZWave::Value
Base class for values associated with a node.
Definition
Value.h:48
OpenZWave
Definition
Bitfield.h:35
Generated on
for OpenZWave Library by
1.18.0