OpenZWave Library  1.2
ValueRaw.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // ValueRaw.h
4 //
5 // Represents a collection of 8-bit values
6 //
7 // Copyright (c) 2013 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 _ValueRaw_H
29 #define _ValueRaw_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 
44  class ValueRaw: public Value
45  {
46  public:
47  ValueRaw( 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, uint8 const* _value, uint8 const _length, uint8 const _pollIntensity );
48  ValueRaw();
49  virtual ~ValueRaw();
50 
51  bool Set( uint8 const* _value, uint8 const _length );
52  void OnValueRefreshed( uint8 const* _value, uint8 const _length );
53 
54  // From Value
55  virtual string const GetAsString() const;
56  virtual bool SetFromString( string const& _value );
57  virtual void ReadXML( uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const* _valueElement );
58  virtual void WriteXML( TiXmlElement* _valueElement );
59 
60  uint8* GetValue()const{ return m_value; }
61  uint8 GetLength()const{ return m_valueLength; }
62 
63  private:
64  uint8* m_value; // the current value
65  uint8 m_valueLength; // fixed length for this instance
66  uint8* m_valueCheck; // the previous value (used for double-checking spurious value reads)
67  uint8* m_newValue; // a new value to be set on the appropriate device
68  };
69 
70 } // namespace OpenZWave
71 
72 #endif
73 
74 
75 
A collection of bytes sent to/received from a node.
Definition: ValueRaw.h:44
Definition: Bitfield.h:34
virtual ~ValueRaw()
Definition: ValueRaw.cpp:91
virtual void ReadXML(uint32 const _homeId, uint8 const _nodeId, uint8 const _commandClassId, TiXmlElement const *_valueElement)
Definition: ValueRaw.cpp:161
virtual bool SetFromString(string const &_value)
Definition: ValueRaw.cpp:118
uint8 GetLength() const
Definition: ValueRaw.h:61
uint8 * GetValue() const
Definition: ValueRaw.h:60
void OnValueRefreshed()
Definition: Value.cpp:410
unsigned int uint32
Definition: Defs.h:69
ValueRaw()
Definition: ValueRaw.cpp:75
Base class for values associated with a node.
Definition: Value.h:44
virtual string const GetAsString() const
Definition: ValueRaw.cpp:98
virtual void WriteXML(TiXmlElement *_valueElement)
Definition: ValueRaw.cpp:215
bool Set()
Definition: Value.cpp:349
ValueGenre
Definition: ValueID.h:71
unsigned char uint8
Definition: Defs.h:63