OpenZWave Library: Scene.h Source File

| OpenZWave Library 1.6.0

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 class ValueID;
41
44 class Scene
45 {
46 friend class Manager;
47 friend class Driver;
48 friend class Node;
49
50 //-----------------------------------------------------------------------------
51 // Construction
52 //-----------------------------------------------------------------------------
53 private:
54 Scene( uint8 const _sceneId );
55 ~Scene();
56
57 static void WriteXML( string const& _name );
58 static bool ReadScenes();
59
60 //-----------------------------------------------------------------------------
61 // Scene functions
62 //-----------------------------------------------------------------------------
63 private:
64 static Scene* Get( uint8 const _sceneId );
65 static uint8 GetAllScenes( uint8** _sceneIds );
66
67 string const& GetLabel()const{ return m_label; }
68 void SetLabel( string const &_label ){ m_label = _label; }
69
70 bool AddValue( ValueID const& _valueId, string const& _value );
71 bool RemoveValue( ValueID const& _valueId );
72 void RemoveValues( uint32 const _homeId );
73 static void RemoveValues( uint32 const _homeId, uint8 const _nodeId );
74 int GetValues( vector<ValueID>* o_value );
75 bool GetValue( ValueID const& _valueId, string* o_value );
76 bool SetValue( ValueID const& _valueId, string const& _value );
77 bool Activate();
78
79 //-----------------------------------------------------------------------------
80 // ValueID/value storage
81 //-----------------------------------------------------------------------------
82 private:
83 class SceneStorage
84 {
85 public:
86 SceneStorage( ValueID const& _id, string const& _value ): m_id( _id ), m_value( _value ) {};
87 ~SceneStorage() {};
88
89 ValueID const m_id;
90 string m_value;
91 };
92 //-----------------------------------------------------------------------------
93 // Member variables
94 //-----------------------------------------------------------------------------
95 private:
96 uint8 m_sceneId;
97 string m_label;
98 vector<SceneStorage*> m_values;
99 static uint8 s_sceneCnt;
100 static Scene* s_scenes[256];
101 };
102
103 } //namespace OpenZWave
104
105 #endif //_Scene_H
uint32
unsigned int uint32
Definition: Defs.h:95
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:66
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::Scene
Collection of ValueIDs to be treated as a unit.
Definition: Scene.h:45
OpenZWave::Manager
The main public interface to OpenZWave.
Definition: Manager.h:111
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:65
Defs.h
OpenZWave
Definition: Bitfield.h:35