OpenZWave Library  1.6.0
ValueInt.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // ValueInt.h
4 //
5 // Represents a 32-bit 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 _ValueInt_H
29 #define _ValueInt_H
30 
31 #include <string>
32 #include "Defs.h"
33 #include "value_classes/Value.h"
34 
35 class TiXmlElement;
36 
37 namespace OpenZWave
38 {
39  class Msg;
40  class Node;
41 
45  class ValueInt: public Value
46  {
47  public:
48  ValueInt( uint32 const _homeId, uint8 const _nodeId, ValueID::ValueGenre const _genre, uint8 const _commandClassId, uint8 const _instance, uint16 const _index, string const& _label, string const& _units, bool const _readOnly, bool const _writeOnly, int32 const _value, uint8 const _pollIntensity );
49  ValueInt();
50  virtual ~ValueInt(){}
51 
52  bool Set( int32 const _value );
53  void OnValueRefreshed( int32 const _value );
54 
55  // From Value
56  virtual string const GetAsString() const;
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  int32 GetValue()const{ return m_value; }
62 
63  private:
64  int32 m_value; // the current value
65  int32 m_valueCheck; // the previous value (used for double-checking spurious value reads)
66  };
67 
68 } // namespace OpenZWave
69 
70 #endif
uint32
unsigned int uint32
Definition: Defs.h:95
OpenZWave::ValueID::ValueGenre
ValueGenre
Definition: ValueID.h:81
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::ValueInt
Integer value sent to/received from a node.
Definition: ValueInt.h:46
OpenZWave::ValueInt::GetValue
int32 GetValue() const
Definition: ValueInt.h:61
int32
signed int int32
Definition: Defs.h:94
OpenZWave::Value::Set
bool Set()
Definition: Value.cpp:343
OpenZWave::ValueInt::ReadXML
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition: ValueInt.cpp:106
OpenZWave::ValueInt::WriteXML
virtual void WriteXML(TiXmlElement *_valueElement)
Definition: ValueInt.cpp:131
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:49
OpenZWave::Value::OnValueRefreshed
void OnValueRefreshed()
Definition: Value.cpp:405
OpenZWave::ValueInt::SetFromString
virtual bool SetFromString(string const &_value)
Definition: ValueInt.cpp:93
OpenZWave::ValueInt::ValueInt
ValueInt()
Definition: ValueInt.cpp:72
OpenZWave::ValueInt::~ValueInt
virtual ~ValueInt()
Definition: ValueInt.h:50
Defs.h
Value.h
uint16
unsigned short uint16
Definition: Defs.h:92
OpenZWave
Definition: Bitfield.h:35
OpenZWave::ValueInt::GetAsString
virtual string const GetAsString() const
Definition: ValueInt.cpp:84