| OpenZWave Library 1.6.0

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 <iostream>
32
33 #include "Defs.h"
34 #include "value_classes/ValueID.h"
35
36 namespace OpenZWave
37 {
44 class OPENZWAVE_EXPORT Notification
45 {
46 friend class Manager;
47 friend class Driver;
48 friend class Node;
49 friend class Group;
50 friend class Value;
51 friend class ValueStore;
52 friend class Basic;
53 friend class ManufacturerSpecific;
54 friend class NodeNaming;
55 friend class NoOperation;
56 friend class SceneActivation;
57 friend class WakeUp;
58 friend class ApplicationStatus;
59 friend class ManufacturerSpecificDB;
60 /* allow us to Stream a Notification */
61 //friend std::ostream &operator<<(std::ostream &os, const Notification &dt);
62
63
64 public:
72 enum NotificationType
73 {
74 Type_ValueAdded = 0,
75 Type_ValueRemoved,
76 Type_ValueChanged,
77 Type_ValueRefreshed,
78 Type_Group,
79 Type_NodeNew,
80 Type_NodeAdded,
81 Type_NodeRemoved,
82 Type_NodeProtocolInfo,
83 Type_NodeNaming,
84 Type_NodeEvent,
85 Type_PollingDisabled,
86 Type_PollingEnabled,
87 Type_SceneEvent,
88 Type_CreateButton,
89 Type_DeleteButton,
90 Type_ButtonOn,
91 Type_ButtonOff,
92 Type_DriverReady,
93 Type_DriverFailed,
94 Type_DriverReset,
95 Type_EssentialNodeQueriesComplete,
96 Type_NodeQueriesComplete,
97 Type_AwakeNodesQueried,
98 Type_AllNodesQueriedSomeDead,
99 Type_AllNodesQueried,
100 Type_Notification,
101 Type_DriverRemoved,
102 Type_ControllerCommand,
104 Type_NodeReset,
105 Type_UserAlerts,
106 Type_ManufacturerSpecificDBReady
107 };
108
114 enum NotificationCode
115 {
116 Code_MsgComplete = 0,
117 Code_Timeout,
118 Code_NoOperation,
119 Code_Awake,
120 Code_Sleep,
121 Code_Dead,
122 Code_Alive
123 };
124
129 enum UserAlertNofification
130 {
131 Alert_None,
132 Alert_ConfigOutOfDate,
133 Alert_MFSOutOfDate,
134 Alert_ConfigFileDownloadFailed,
135 Alert_DNSError,
136 Alert_NodeReloadReqired,
137 Alert_UnsupportedController,
138 Alert_ApplicationStatus_Retry,
139 Alert_ApplicationStatus_Queued,
140 Alert_ApplicationStatus_Rejected,
141 };
142
148 NotificationType GetType()const{ return m_type; }
149
154 uint32 GetHomeId()const{ return m_valueId.GetHomeId(); }
155
160 uint8 GetNodeId()const{ return m_valueId.GetNodeId(); }
161
166 ValueID const& GetValueID()const{ return m_valueId; }
167
172 uint8 GetGroupIdx()const{ assert(Type_Group==m_type); return m_byte; }
173
178 uint8 GetEvent()const{ assert((Type_NodeEvent==m_type) || (Type_ControllerCommand == m_type)); return m_event; }
179
185 uint8 GetButtonId()const{ assert(Type_CreateButton==m_type || Type_DeleteButton==m_type || Type_ButtonOn==m_type || Type_ButtonOff==m_type); return m_byte; }
186
192 DEPRECATED uint8 GetSceneId()const{ assert(Type_SceneEvent==m_type); return m_byte; }
193
198 uint8 GetNotification()const{ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); return m_byte; }
199
204 uint8 GetCommand()const{ assert(Type_ControllerCommand == m_type); return m_command; }
205
210 uint8 GetByte()const{ return m_byte; }
211
216 uint8 GetRetry()const{ assert((Type_UserAlerts == m_type) && (Alert_ApplicationStatus_Retry == m_useralerttype)); return m_byte; }
217
222 string GetAsString()const;
223
228 UserAlertNofification GetUserAlertType()const {return m_useralerttype;};
229
234 string GetComPort()const { return m_comport; };
235
236 private:
237 Notification( NotificationType _type ): m_type( _type ), m_byte(0), m_event(0), m_command(0), m_useralerttype(Alert_None) {}
238 ~Notification(){}
239
240 void SetHomeAndNodeIds( uint32 const _homeId, uint8 const _nodeId ){ m_valueId = ValueID( _homeId, _nodeId ); }
241 void SetHomeNodeIdAndInstance ( uint32 const _homeId, uint8 const _nodeId, uint32 const _instance ){ m_valueId = ValueID( _homeId, _nodeId, _instance ); }
242 void SetValueId( ValueID const& _valueId ){ m_valueId = _valueId; }
243 void SetGroupIdx( uint8 const _groupIdx ){ assert(Type_Group==m_type); m_byte = _groupIdx; }
244 void SetEvent( uint8 const _event ){ assert(Type_NodeEvent==m_type || Type_ControllerCommand == m_type); m_event = _event; }
245 void SetSceneId( uint8 const _sceneId ){ assert(Type_SceneEvent==m_type); m_byte = _sceneId; }
246 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; }
247 void SetNotification( uint8 const _noteId ){ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); m_byte = _noteId; }
248 void SetUserAlertNofification(UserAlertNofification const alerttype){ assert(Type_UserAlerts==m_type); m_useralerttype = alerttype; }
249 void SetCommand( uint8 const _command ){ assert(Type_ControllerCommand == m_type); m_command = _command; }
250 void SetComPort( string comport) { assert(Type_DriverFailed == m_type); m_comport = comport; }
251 void SetRetry (uint8 const timeout) { assert(Type_UserAlerts == m_type); m_byte = timeout; }
252
253 NotificationType m_type;
254 ValueID m_valueId;
255 uint8 m_byte;
256 uint8 m_event;
257 uint8 m_command;
258 UserAlertNofification m_useralerttype;
259 string m_comport;
260 };
261
262 } //namespace OpenZWave
263
264 std::ostream& operator<<(std::ostream &os, const OpenZWave::Notification &dt);
265 std::ostream& operator<<(std::ostream &os, const OpenZWave::Notification *dt);
266
267 #endif //_Notification_H
268
uint32
unsigned int uint32
Definition: Defs.h:95
OpenZWave::Notification::GetCommand
uint8 GetCommand() const
Definition: Notification.h:204
OpenZWave::Notification::Type_DriverReset
@ Type_DriverReset
Definition: Notification.h:94
OpenZWave::Notification::Type_Group
@ Type_Group
Definition: Notification.h:78
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:66
OpenZWave::Notification::Alert_UnsupportedController
@ Alert_UnsupportedController
Definition: Notification.h:137
OpenZWave::SceneActivation
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:42
OpenZWave::Notification::GetUserAlertType
UserAlertNofification GetUserAlertType() const
Definition: Notification.h:228
OpenZWave::Notification::Type_NodeNaming
@ Type_NodeNaming
Definition: Notification.h:83
OpenZWave::Notification::Type_NodeReset
@ Type_NodeReset
Definition: Notification.h:104
ValueID.h
OpenZWave::Notification::Alert_ConfigOutOfDate
@ Alert_ConfigOutOfDate
Definition: Notification.h:132
OpenZWave::ApplicationStatus
Implements COMMAND_CLASS_APPLICATION_STATUS (0x22), a Z-Wave device command class.
Definition: ApplicationStatus.h:39
OpenZWave::ValueID
Provides a unique ID for a value reported by a Z-Wave device.
Definition: ValueID.h:63
OpenZWave::Notification::Type_NodeQueriesComplete
@ Type_NodeQueriesComplete
Definition: Notification.h:96
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::Notification::Type_AwakeNodesQueried
@ Type_AwakeNodesQueried
Definition: Notification.h:97
OpenZWave::Notification::Type_ValueChanged
@ Type_ValueChanged
Definition: Notification.h:76
OpenZWave::Notification::Type_CreateButton
@ Type_CreateButton
Definition: Notification.h:88
operator<<
std::ostream & operator<<(std::ostream &os, const OpenZWave::Notification &dt)
Definition: Notification.cpp:324
OpenZWave::Notification::UserAlertNofification
UserAlertNofification
Definition: Notification.h:130
OpenZWave::ManufacturerSpecific
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:40
OpenZWave::ManufacturerSpecificDB
The _ManufacturerSpecificDB class handles the Config File Database that we use to configure devices.
Definition: ManufacturerSpecificDB.h:106
OpenZWave::Notification::NotificationType
NotificationType
Definition: Notification.h:73
OpenZWave::Notification::Code_Timeout
@ Code_Timeout
Definition: Notification.h:117
OpenZWave::Notification::GetSceneId
DEPRECATED uint8 GetSceneId() const
Definition: Notification.h:192
OpenZWave::Notification::Type_NodeNew
@ Type_NodeNew
Definition: Notification.h:79
OpenZWave::Notification::Type_EssentialNodeQueriesComplete
@ Type_EssentialNodeQueriesComplete
Definition: Notification.h:95
OpenZWave::ValueStore
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:45
OpenZWave::Notification::GetRetry
uint8 GetRetry() const
Definition: Notification.h:216
OpenZWave::Notification::GetNodeId
uint8 GetNodeId() const
Definition: Notification.h:160
OpenZWave::Notification
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition: Notification.h:45
OpenZWave::Notification::Type_PollingEnabled
@ Type_PollingEnabled
Definition: Notification.h:86
OpenZWave::Notification::Code_Awake
@ Code_Awake
Definition: Notification.h:119
OpenZWave::Notification::Alert_ApplicationStatus_Retry
@ Alert_ApplicationStatus_Retry
Definition: Notification.h:138
OpenZWave::Notification::GetComPort
string GetComPort() const
Definition: Notification.h:234
OpenZWave::Notification::Type_UserAlerts
@ Type_UserAlerts
Definition: Notification.h:105
OpenZWave::Notification::Type_DriverRemoved
@ Type_DriverRemoved
Definition: Notification.h:101
OpenZWave::Notification::GetType
NotificationType GetType() const
Definition: Notification.h:148
OpenZWave::Notification::Code_Sleep
@ Code_Sleep
Definition: Notification.h:120
OpenZWave::Notification::Type_DriverReady
@ Type_DriverReady
Definition: Notification.h:92
OpenZWave::Notification::GetNotification
uint8 GetNotification() const
Definition: Notification.h:198
OpenZWave::Notification::Type_DriverFailed
@ Type_DriverFailed
Definition: Notification.h:93
OpenZWave::Notification::GetValueID
ValueID const & GetValueID() const
Definition: Notification.h:166
OpenZWave::Notification::GetButtonId
uint8 GetButtonId() const
Definition: Notification.h:185
OpenZWave::Notification::Alert_ApplicationStatus_Queued
@ Alert_ApplicationStatus_Queued
Definition: Notification.h:139
OpenZWave::Notification::Type_DeleteButton
@ Type_DeleteButton
Definition: Notification.h:89
OpenZWave::Notification::Alert_None
@ Alert_None
Definition: Notification.h:131
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:49
OpenZWave::Notification::Type_ValueRefreshed
@ Type_ValueRefreshed
Definition: Notification.h:77
OpenZWave::Notification::Type_PollingDisabled
@ Type_PollingDisabled
Definition: Notification.h:85
OpenZWave::Notification::Alert_ConfigFileDownloadFailed
@ Alert_ConfigFileDownloadFailed
Definition: Notification.h:134
OpenZWave::Manager
The main public interface to OpenZWave.
Definition: Manager.h:111
OpenZWave::Basic
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:41
OpenZWave::Notification::GetGroupIdx
uint8 GetGroupIdx() const
Definition: Notification.h:172
OpenZWave::Notification::Type_NodeProtocolInfo
@ Type_NodeProtocolInfo
Definition: Notification.h:82
OpenZWave::NoOperation
Implements COMMAND_CLASS_NO_OPERATION (0x00), a Z-Wave device command class.
Definition: NoOperation.h:39
OpenZWave::Notification::GetByte
uint8 GetByte() const
Definition: Notification.h:210
OpenZWave::NodeNaming
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:55
OpenZWave::Notification::Type_NodeRemoved
@ Type_NodeRemoved
Definition: Notification.h:81
OPENZWAVE_EXPORT
#define OPENZWAVE_EXPORT
Definition: Defs.h:51
OpenZWave::Notification::Type_ValueRemoved
@ Type_ValueRemoved
Definition: Notification.h:75
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:65
OpenZWave::Notification::Alert_ApplicationStatus_Rejected
@ Alert_ApplicationStatus_Rejected
Definition: Notification.h:140
OpenZWave::Notification::Type_NodeEvent
@ Type_NodeEvent
Definition: Notification.h:84
OpenZWave::Notification::Code_NoOperation
@ Code_NoOperation
Definition: Notification.h:118
OpenZWave::Group
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:50
OpenZWave::Notification::Type_ButtonOff
@ Type_ButtonOff
Definition: Notification.h:91
OpenZWave::Notification::Type_AllNodesQueried
@ Type_AllNodesQueried
Definition: Notification.h:99
OpenZWave::Notification::NotificationCode
NotificationCode
Definition: Notification.h:115
OpenZWave::Notification::Type_NodeAdded
@ Type_NodeAdded
Definition: Notification.h:80
OpenZWave::Notification::Type_Notification
@ Type_Notification
Definition: Notification.h:100
OpenZWave::Notification::GetEvent
uint8 GetEvent() const
Definition: Notification.h:178
OpenZWave::Notification::Alert_MFSOutOfDate
@ Alert_MFSOutOfDate
Definition: Notification.h:133
Defs.h
OpenZWave::Notification::Code_Dead
@ Code_Dead
Definition: Notification.h:121
OpenZWave::Notification::Type_ButtonOn
@ Type_ButtonOn
Definition: Notification.h:90
DEPRECATED
#define DEPRECATED
Definition: Defs.h:62
OpenZWave::WakeUp
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:46
OpenZWave::Notification::Type_SceneEvent
@ Type_SceneEvent
Definition: Notification.h:87
OpenZWave
Definition: Bitfield.h:35
OpenZWave::Notification::Alert_NodeReloadReqired
@ Alert_NodeReloadReqired
Definition: Notification.h:136
OpenZWave::Notification::Type_AllNodesQueriedSomeDead
@ Type_AllNodesQueriedSomeDead
Definition: Notification.h:98
OpenZWave::Notification::GetHomeId
uint32 GetHomeId() const
Definition: Notification.h:154
OpenZWave::Notification::Alert_DNSError
@ Alert_DNSError
Definition: Notification.h:135