OpenZWave Library  1.6.770
ValueString.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // ValueString.h
4 //
5 // Represents a string 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 _ValueString_H
29 #define _ValueString_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  namespace Internal
40  {
41  namespace VC
42  {
43 
47  class ValueString: public Value
48  {
49  public:
50  ValueString(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, string const& _value, uint8 const _pollIntensity);
52  {
53  }
54  virtual ~ValueString()
55  {
56  }
57 
58  bool Set(string const& _value);
59  void OnValueRefreshed(string const& _value);
60 
61  // From Value
62  virtual string const GetAsString() const
63  {
64  return GetValue();
65  }
66  virtual bool SetFromString(string const& _value)
67  {
68  return Set(_value);
69  }
70  virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const* _valueElement);
71  virtual void WriteXML(TiXmlElement* _valueElement);
72 
73  string GetValue() const
74  {
75  return m_value;
76  }
77 
78  private:
79  string m_value; // the current value
80  string m_valueCheck; // the previous value (used for double-checking spurious value reads)
81  string m_newValue; // a new value to be set on the appropriate device
82  };
83  } // namespace VC
84  } // namespace Internal
85 } // namespace OpenZWave
86 
87 #endif
String value sent to/received from a node.
Definition: ValueString.h:47
Definition: Bitfield.cpp:30
bool Set()
Definition: Value.cpp:276
unsigned short uint16
Definition: Defs.h:88
virtual ~ValueString()
Definition: ValueString.h:54
virtual string const GetAsString() const
Definition: ValueString.h:62
void OnValueRefreshed()
Definition: Value.cpp:336
ValueString()
Definition: ValueString.h:51
unsigned int uint32
Definition: Defs.h:91
string GetValue() const
Definition: ValueString.h:73
virtual bool SetFromString(string const &_value)
Definition: ValueString.h:66
virtual void WriteXML(TiXmlElement *_valueElement)
Definition: ValueString.cpp:73
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition: ValueString.cpp:54
ValueGenre
Definition: ValueID.h:92
Base class for values associated with a node.
Definition: Value.h:52
unsigned char uint8
Definition: Defs.h:85