OpenZWave Library  1.2
Notification.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Notification.h
4 //
5 // Contains details of a Z-Wave event reported to the user
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 _Notification_H
29 #define _Notification_H
30 
31 #include "Defs.h"
32 #include "value_classes/ValueID.h"
33 
34 namespace OpenZWave
35 {
43  {
44  friend class Manager;
45  friend class Driver;
46  friend class Node;
47  friend class Group;
48  friend class Value;
49  friend class ValueStore;
50  friend class Basic;
51  friend class ManufacturerSpecific;
52  friend class NodeNaming;
53  friend class NoOperation;
54  friend class SceneActivation;
55  friend class WakeUp;
56 
57  public:
65  {
66  Type_ValueAdded = 0,
93  Type_DriverRemoved
94  };
95 
102  {
103  Code_MsgComplete = 0,
109  Code_Alive
110  };
111 
117  NotificationType GetType()const{ return m_type; }
118 
123  uint32 GetHomeId()const{ return m_valueId.GetHomeId(); }
124 
129  uint8 GetNodeId()const{ return m_valueId.GetNodeId(); }
130 
135  ValueID const& GetValueID()const{ return m_valueId; }
136 
141  uint8 GetGroupIdx()const{ assert(Type_Group==m_type); return m_byte; }
142 
147  uint8 GetEvent()const{ assert(Type_NodeEvent==m_type); return m_byte; }
148 
154  uint8 GetButtonId()const{ assert(Type_CreateButton==m_type || Type_DeleteButton==m_type || Type_ButtonOn==m_type || Type_ButtonOff==m_type); return m_byte; }
155 
160  uint8 GetSceneId()const{ assert(Type_SceneEvent==m_type); return m_byte; }
161 
166  uint8 GetNotification()const{ assert(Type_Notification==m_type); return m_byte; }
167 
172  uint8 GetByte()const{ return m_byte; }
173 
174  private:
175  Notification( NotificationType _type ): m_type( _type ), m_byte(0){}
176  ~Notification(){}
177 
178  void SetHomeAndNodeIds( uint32 const _homeId, uint8 const _nodeId ){ m_valueId = ValueID( _homeId, _nodeId ); }
179  void SetHomeNodeIdAndInstance ( uint32 const _homeId, uint8 const _nodeId, uint32 const _instance ){ m_valueId = ValueID( _homeId, _nodeId, _instance ); }
180  void SetValueId( ValueID const& _valueId ){ m_valueId = _valueId; }
181  void SetGroupIdx( uint8 const _groupIdx ){ assert(Type_Group==m_type); m_byte = _groupIdx; }
182  void SetEvent( uint8 const _event ){ assert(Type_NodeEvent==m_type); m_byte = _event; }
183  void SetSceneId( uint8 const _sceneId ){ assert(Type_SceneEvent==m_type); m_byte = _sceneId; }
184  void SetButtonId( uint8 const _buttonId ){ assert(Type_CreateButton==m_type||Type_DeleteButton==m_type||Type_ButtonOn==m_type||Type_ButtonOff==m_type); m_byte = _buttonId; }
185  void SetNotification( uint8 const _noteId ){ assert(Type_Notification==m_type); m_byte = _noteId; }
186 
187  NotificationType m_type;
188  ValueID m_valueId;
189  uint8 m_byte;
190  };
191 
192 } //namespace OpenZWave
193 
194 #endif //_Notification_H
195 
uint32
unsigned int uint32
Definition: Defs.h:69
OpenZWave::Notification::Type_DriverReset
@ Type_DriverReset
Definition: Notification.h:86
OpenZWave::Notification::Type_Group
@ Type_Group
Definition: Notification.h:70
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:63
OpenZWave::SceneActivation
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:39
OpenZWave::Notification::Type_NodeNaming
@ Type_NodeNaming
Definition: Notification.h:75
ValueID.h
OpenZWave::ValueID
Provides a unique ID for a value reported by a Z-Wave device.
Definition: ValueID.h:53
OpenZWave::Notification::Type_NodeQueriesComplete
@ Type_NodeQueriesComplete
Definition: Notification.h:88
uint8
unsigned char uint8
Definition: Defs.h:63
OpenZWave::Notification::Type_AwakeNodesQueried
@ Type_AwakeNodesQueried
Definition: Notification.h:89
OpenZWave::Notification::Type_ValueChanged
@ Type_ValueChanged
Definition: Notification.h:68
OpenZWave::Notification::Type_CreateButton
@ Type_CreateButton
Definition: Notification.h:80
OpenZWave::ManufacturerSpecific
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:38
OpenZWave::Notification::NotificationType
NotificationType
Definition: Notification.h:64
OpenZWave::Notification::Code_Timeout
@ Code_Timeout
Definition: Notification.h:104
OpenZWave::Notification::GetSceneId
uint8 GetSceneId() const
Definition: Notification.h:160
OpenZWave::Notification::Type_NodeNew
@ Type_NodeNew
Definition: Notification.h:71
OpenZWave::Notification::Type_EssentialNodeQueriesComplete
@ Type_EssentialNodeQueriesComplete
Definition: Notification.h:87
OpenZWave::ValueStore
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:43
OpenZWave::Notification::GetNodeId
uint8 GetNodeId() const
Definition: Notification.h:129
OpenZWave::Notification
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition: Notification.h:42
OpenZWave::Notification::Type_PollingEnabled
@ Type_PollingEnabled
Definition: Notification.h:78
OpenZWave::Notification::Code_Awake
@ Code_Awake
Definition: Notification.h:106
OpenZWave::Notification::GetType
NotificationType GetType() const
Definition: Notification.h:117
OpenZWave::Notification::Code_Sleep
@ Code_Sleep
Definition: Notification.h:107
OpenZWave::Notification::Type_DriverReady
@ Type_DriverReady
Definition: Notification.h:84
OpenZWave::Notification::GetNotification
uint8 GetNotification() const
Definition: Notification.h:166
OpenZWave::Notification::Type_DriverFailed
@ Type_DriverFailed
Definition: Notification.h:85
OpenZWave::Notification::GetValueID
ValueID const & GetValueID() const
Definition: Notification.h:135
OpenZWave::Notification::GetButtonId
uint8 GetButtonId() const
Definition: Notification.h:154
OpenZWave::Notification::Type_DeleteButton
@ Type_DeleteButton
Definition: Notification.h:81
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:44
OpenZWave::Notification::Type_ValueRefreshed
@ Type_ValueRefreshed
Definition: Notification.h:69
OpenZWave::Notification::Type_PollingDisabled
@ Type_PollingDisabled
Definition: Notification.h:77
OpenZWave::Manager
The main public interface to OpenZWave.
Definition: Manager.h:108
OpenZWave::Basic
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:39
OpenZWave::Notification::GetGroupIdx
uint8 GetGroupIdx() const
Definition: Notification.h:141
OpenZWave::Notification::Type_NodeProtocolInfo
@ Type_NodeProtocolInfo
Definition: Notification.h:74
OpenZWave::NoOperation
Implements COMMAND_CLASS_NO_OPERATION (0x00), a Z-Wave device command class.
Definition: NoOperation.h:37
OpenZWave::Notification::GetByte
uint8 GetByte() const
Definition: Notification.h:172
OpenZWave::NodeNaming
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:37
OpenZWave::Notification::Type_NodeRemoved
@ Type_NodeRemoved
Definition: Notification.h:73
OPENZWAVE_EXPORT
#define OPENZWAVE_EXPORT
Definition: Defs.h:51
OpenZWave::Notification::Type_ValueRemoved
@ Type_ValueRemoved
Definition: Notification.h:67
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:56
OpenZWave::Notification::Type_NodeEvent
@ Type_NodeEvent
Definition: Notification.h:76
OpenZWave::Notification::Code_NoOperation
@ Code_NoOperation
Definition: Notification.h:105
OpenZWave::Group
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:44
OpenZWave::Notification::Type_ButtonOff
@ Type_ButtonOff
Definition: Notification.h:83
OpenZWave::Notification::Type_AllNodesQueried
@ Type_AllNodesQueried
Definition: Notification.h:91
OpenZWave::Notification::NotificationCode
NotificationCode
Definition: Notification.h:101
OpenZWave::Notification::Type_NodeAdded
@ Type_NodeAdded
Definition: Notification.h:72
OpenZWave::Notification::Type_Notification
@ Type_Notification
Definition: Notification.h:92
OpenZWave::Notification::GetEvent
uint8 GetEvent() const
Definition: Notification.h:147
Defs.h
OpenZWave::Notification::Code_Dead
@ Code_Dead
Definition: Notification.h:108
OpenZWave::Notification::Type_ButtonOn
@ Type_ButtonOn
Definition: Notification.h:82
OpenZWave::WakeUp
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:43
OpenZWave::Notification::Type_SceneEvent
@ Type_SceneEvent
Definition: Notification.h:79
OpenZWave
Definition: Bitfield.h:34
OpenZWave::Notification::Type_AllNodesQueriedSomeDead
@ Type_AllNodesQueriedSomeDead
Definition: Notification.h:90
OpenZWave::Notification::GetHomeId
uint32 GetHomeId() const
Definition: Notification.h:123