OpenZWave Library 1.4.0
Loading...
Searching...
No Matches
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"
33
34namespace OpenZWave
35{
42 class OPENZWAVE_EXPORT Notification
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;
52 friend class NodeNaming;
53 friend class NoOperation;
54 friend class SceneActivation;
55 friend class WakeUp;
56
57 public:
99
115
121 NotificationType GetType()const{ return m_type; }
122
127 uint32 GetHomeId()const{ return m_valueId.GetHomeId(); }
128
133 uint8 GetNodeId()const{ return m_valueId.GetNodeId(); }
134
139 ValueID const& GetValueID()const{ return m_valueId; }
140
145 uint8 GetGroupIdx()const{ assert(Type_Group==m_type); return m_byte; }
146
151 uint8 GetEvent()const{ assert((Type_NodeEvent==m_type) || (Type_ControllerCommand == m_type)); return m_event; }
152
158 uint8 GetButtonId()const{ assert(Type_CreateButton==m_type || Type_DeleteButton==m_type || Type_ButtonOn==m_type || Type_ButtonOff==m_type); return m_byte; }
159
164 uint8 GetSceneId()const{ assert(Type_SceneEvent==m_type); return m_byte; }
165
170 uint8 GetNotification()const{ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); return m_byte; }
171
176 uint8 GetByte()const{ return m_byte; }
177
182 string GetAsString()const;
183
184
185 private:
186 Notification( NotificationType _type ): m_type( _type ), m_byte(0), m_event(0) {}
187 ~Notification(){}
188
189 void SetHomeAndNodeIds( uint32 const _homeId, uint8 const _nodeId ){ m_valueId = ValueID( _homeId, _nodeId ); }
190 void SetHomeNodeIdAndInstance ( uint32 const _homeId, uint8 const _nodeId, uint32 const _instance ){ m_valueId = ValueID( _homeId, _nodeId, _instance ); }
191 void SetValueId( ValueID const& _valueId ){ m_valueId = _valueId; }
192 void SetGroupIdx( uint8 const _groupIdx ){ assert(Type_Group==m_type); m_byte = _groupIdx; }
193 void SetEvent( uint8 const _event ){ assert(Type_NodeEvent==m_type || Type_ControllerCommand == m_type); m_event = _event; }
194 void SetSceneId( uint8 const _sceneId ){ assert(Type_SceneEvent==m_type); m_byte = _sceneId; }
195 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; }
196 void SetNotification( uint8 const _noteId ){ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); m_byte = _noteId; }
197
198 NotificationType m_type;
199 ValueID m_valueId;
200 uint8 m_byte;
201 uint8 m_event;
202 };
203
204} //namespace OpenZWave
205
206#endif //_Notification_H
207
unsigned int uint32
Definition Defs.h:80
#define OPENZWAVE_EXPORT
Definition Defs.h:52
unsigned char uint8
Definition Defs.h:74
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition Notification.h:43
friend class SceneActivation
Definition Notification.h:54
friend class NoOperation
Definition Notification.h:53
friend class Group
Definition Notification.h:47
NotificationType
Definition Notification.h:66
@ Type_SceneEvent
Definition Notification.h:80
@ Type_DriverReady
Definition Notification.h:85
@ Type_DriverReset
Definition Notification.h:87
@ Type_NodeProtocolInfo
Definition Notification.h:75
@ Type_NodeAdded
Definition Notification.h:73
@ Type_CreateButton
Definition Notification.h:81
@ Type_EssentialNodeQueriesComplete
Definition Notification.h:88
@ Type_ValueRefreshed
Definition Notification.h:70
@ Type_ButtonOff
Definition Notification.h:84
@ Type_DriverFailed
Definition Notification.h:86
@ Type_AwakeNodesQueried
Definition Notification.h:90
@ Type_ValueAdded
Definition Notification.h:67
@ Type_ButtonOn
Definition Notification.h:83
@ Type_NodeEvent
Definition Notification.h:77
@ Type_DriverRemoved
Definition Notification.h:94
@ Type_Group
Definition Notification.h:71
@ Type_PollingDisabled
Definition Notification.h:78
@ Type_NodeQueriesComplete
Definition Notification.h:89
@ Type_AllNodesQueried
Definition Notification.h:92
@ Type_ValueChanged
Definition Notification.h:69
@ Type_ControllerCommand
Definition Notification.h:95
@ Type_PollingEnabled
Definition Notification.h:79
@ Type_NodeNew
Definition Notification.h:72
@ Type_DeleteButton
Definition Notification.h:82
@ Type_AllNodesQueriedSomeDead
Definition Notification.h:91
@ Type_Notification
Definition Notification.h:93
@ Type_NodeReset
Definition Notification.h:97
@ Type_NodeNaming
Definition Notification.h:76
@ Type_NodeRemoved
Definition Notification.h:74
@ Type_ValueRemoved
Definition Notification.h:68
friend class Basic
Definition Notification.h:50
friend class ManufacturerSpecific
Definition Notification.h:51
friend class Node
Definition Notification.h:46
friend class NodeNaming
Definition Notification.h:52
uint8 GetEvent() const
Definition Notification.h:151
uint8 GetGroupIdx() const
Definition Notification.h:145
uint8 GetButtonId() const
Definition Notification.h:158
ValueID const & GetValueID() const
Definition Notification.h:139
friend class Driver
Definition Notification.h:45
uint8 GetNodeId() const
Definition Notification.h:133
friend class ValueStore
Definition Notification.h:49
uint8 GetSceneId() const
Definition Notification.h:164
friend class WakeUp
Definition Notification.h:55
uint8 GetNotification() const
Definition Notification.h:170
friend class Manager
Definition Notification.h:44
NotificationCode
Definition Notification.h:106
@ Code_Dead
Definition Notification.h:112
@ Code_NoOperation
Definition Notification.h:109
@ Code_Timeout
Definition Notification.h:108
@ Code_Alive
Definition Notification.h:113
@ Code_MsgComplete
Definition Notification.h:107
@ Code_Sleep
Definition Notification.h:111
@ Code_Awake
Definition Notification.h:110
NotificationType GetType() const
Definition Notification.h:121
uint32 GetHomeId() const
Definition Notification.h:127
friend class Value
Definition Notification.h:48
uint8 GetByte() const
Definition Notification.h:176
Provides a unique ID for a value reported by a Z-Wave device.
Definition ValueID.h:54
Definition Bitfield.h:35