OpenZWave Library 1.4.0
Loading...
Searching...
No Matches
ValueBool.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// ValueBool.h
4//
5// Represents a boolean value
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 _ValueBool_H
29#define _ValueBool_H
30
31#include <string>
32#include "Defs.h"
33#include "value_classes/Value.h"
34
35class TiXmlElement;
36
37namespace OpenZWave
38{
39 class Msg;
40 class Node;
41 class CommandClass;
42
45 class ValueBool: public Value
46 {
47 public:
48 ValueBool( uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _index, string const& _label, string const& _units, bool const _readOnly, bool const _writeOnly, bool const _value, uint8 const _pollIntensity );
50 virtual ~ValueBool(){}
51
52 bool Set( bool const _value );
53 void OnValueRefreshed( bool const _value );
54
55 // From Value
56 virtual string const GetAsString() const { return ( GetValue() ? "True" : "False" ); }
57 virtual bool SetFromString( string const& _value );
58 virtual void ReadXML( uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const* _valueElement );
59 virtual void WriteXML( TiXmlElement* _valueElement );
60
61 bool GetValue()const{ return m_value; }
62
63 private:
64 bool m_value; // the current index in the m_items vector
65 bool m_valueCheck; // the previous value (used for double-checking spurious value reads)
66 };
67
68} // namespace OpenZWave
69
70#endif
71
72
73
unsigned int uint32
Definition Defs.h:80
unsigned char uint8
Definition Defs.h:74
Base class for all Z-Wave command classes.
Definition CommandClass.h:47
Message object to be passed to and from devices on the Z-Wave network.
Definition Msg.h:45
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition Node.h:65
virtual bool SetFromString(string const &_value)
Definition ValueBool.cpp:65
ValueBool(uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _index, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, bool const _value, uint8 const _pollIntensity)
Definition ValueBool.cpp:44
virtual string const GetAsString() const
Definition ValueBool.h:56
virtual void WriteXML(TiXmlElement *_valueElement)
Definition ValueBool.cpp:108
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition ValueBool.cpp:83
virtual ~ValueBool()
Definition ValueBool.h:50
bool GetValue() const
Definition ValueBool.h:61
ValueBool()
Definition ValueBool.h:49
ValueGenre
Definition ValueID.h:72
void OnValueRefreshed()
Definition Value.cpp:412
Value(uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint8 const _index, ValueID::ValueType const _type, string const &_label, string const &_units, bool const _readOnly, bool const _writeOnly, bool const _isset, uint8 const _pollIntensity)
Definition Value.cpp:71
bool Set()
Definition Value.cpp:350
Definition Bitfield.h:35