OpenZWave Library 1.6.1914
ValueButton.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// ValueButton.h
4//
5// Represents a write-only value that triggers activity in a device
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 _ValueButton_H
29#define _ValueButton_H
30
31#include <string>
32#include "Defs.h"
33#include "value_classes/Value.h"
34
35class TiXmlElement;
36
37namespace OpenZWave
38{
39 namespace Internal
40 {
41 namespace VC
42 {
43
47 class ValueButton: public Value
48 {
49 public:
50 ValueButton(uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint16 const _index, string const& _label, uint8 const _pollIntensity);
52 m_pressed(false)
53 {
54 }
55 virtual ~ValueButton()
56 {
57 }
58
59 bool PressButton();
60 bool ReleaseButton();
61
62 virtual string const GetAsString() const
63 {
64 return (IsPressed() ? "true" : "false");
65 }
66
67 // From Value
68 virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const* _valueElement);
69 virtual void WriteXML(TiXmlElement* _valueElement);
70
71 bool IsPressed() const
72 {
73 return m_pressed;
74 }
75
76 private:
77 bool m_pressed;
78 };
79 } // namespace VC
80 } // namespace Internal
81} // namespace OpenZWave
82
83#endif
84
unsigned short uint16
Definition: Defs.h:88
unsigned int uint32
Definition: Defs.h:91
unsigned char uint8
Definition: Defs.h:85
Button value.
Definition: ValueButton.h:48
bool IsPressed() const
Definition: ValueButton.h:71
virtual void WriteXML(TiXmlElement *_valueElement)
Definition: ValueButton.cpp:64
bool PressButton()
Definition: ValueButton.cpp:73
ValueButton()
Definition: ValueButton.h:51
bool ReleaseButton()
Definition: ValueButton.cpp:84
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition: ValueButton.cpp:55
virtual string const GetAsString() const
Definition: ValueButton.h:62
virtual ~ValueButton()
Definition: ValueButton.h:55
Base class for values associated with a node.
Definition: Value.h:55
ValueGenre
Definition: ValueID.h:85
Definition: Bitfield.cpp:31