OpenZWave Library  1.6.770
Scene.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Scene.h
4 //
5 // A collection of ValueIDs to be used together.
6 //
7 // Copyright (c) 2011 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 _Scene_H
29 #define _Scene_H
30 
31 #include <string>
32 #include <vector>
33 
34 #include "Defs.h"
35 
36 class TiXmlElement;
37 
38 namespace OpenZWave
39 {
40  namespace Internal
41  {
42 
45  class Scene
46  {
47  friend class OpenZWave::Manager;
48  friend class OpenZWave::Driver;
49  friend class OpenZWave::Node;
50 
51  //-----------------------------------------------------------------------------
52  // Construction
53  //-----------------------------------------------------------------------------
54  private:
55  Scene(uint8 const _sceneId);
56  ~Scene();
57 
58  static void WriteXML(string const& _name);
59  static bool ReadScenes();
60 
61  //-----------------------------------------------------------------------------
62  // Scene functions
63  //-----------------------------------------------------------------------------
64  private:
65  static Scene* Get(uint8 const _sceneId);
66  static uint8 GetAllScenes(uint8** _sceneIds);
67 
68  string const& GetLabel() const
69  {
70  return m_label;
71  }
72  void SetLabel(string const &_label)
73  {
74  m_label = _label;
75  }
76 
77  bool AddValue(ValueID const& _valueId, string const& _value);
78  bool RemoveValue(ValueID const& _valueId);
79  void RemoveValues(uint32 const _homeId);
80  static void RemoveValues(uint32 const _homeId, uint8 const _nodeId);
81  int GetValues(vector<ValueID>* o_value);
82  bool GetValue(ValueID const& _valueId, string* o_value);
83  bool SetValue(ValueID const& _valueId, string const& _value);
84  bool Activate();
85 
86  //-----------------------------------------------------------------------------
87  // ValueID/value storage
88  //-----------------------------------------------------------------------------
89  private:
90  class SceneStorage
91  {
92  public:
93  SceneStorage(ValueID const& _id, string const& _value) :
94  m_id(_id), m_value(_value)
95  {
96  }
97  ;
98  ~SceneStorage()
99  {
100  }
101  ;
102 
103  ValueID const m_id;
104  string m_value;
105  };
106  //-----------------------------------------------------------------------------
107  // Member variables
108  //-----------------------------------------------------------------------------
109  private:
110  uint8 m_sceneId;
111  string m_label;
112  vector<SceneStorage*> m_values;
113  static uint8 s_sceneCnt;
114  static Scene* s_scenes[256];
115  };
116  } // namespace Internal
117 } //namespace OpenZWave
118 
119 #endif //_Scene_H
Internal::VC::Value * GetValue(ValueID const &_id)
Definition: Node.cpp:2624
Definition: Bitfield.cpp:30
Collection of ValueIDs to be treated as a unit.
Definition: Scene.h:45
The main public interface to OpenZWave.
Definition: Manager.h:108
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:81
bool RemoveValue(uint8 const _commandClassId, uint8 const _instance, uint16 const _valueIndex)
Definition: Node.cpp:2647
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:84
unsigned int uint32
Definition: Defs.h:91
Provides a unique ID for a value reported by a Z-Wave device.The ValueID is used to uniquely identify...
Definition: ValueID.h:76
unsigned char uint8
Definition: Defs.h:85