OpenZWave Library  1.6.1392
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 {
38  namespace Internal
39  {
40  namespace CC
41  {
42  class ApplicationStatus;
43  class Basic;
44  class ManufacturerSpecific;
45  class NodeNaming;
46  class SceneActivation;
47  class WakeUp;
48  }
49  namespace VC
50  {
51  class Value;
52  class ValueStore;
53  }
54  class ManufacturerSpecificDB;
55  }
63  {
64  friend class Manager;
65  friend class Driver;
66  friend class Node;
67  friend class Group;
68  friend class Internal::VC::Value;
70  friend class Internal::CC::Basic;
74  friend class Internal::CC::WakeUp;
77  /* allow us to Stream a Notification */
78  //friend std::ostream &operator<<(std::ostream &os, const Notification &dt);
79 
80  public:
89  {
90  Type_ValueAdded = 0,
118  Type_ControllerCommand,
122  Type_ManufacturerSpecificDBReady
123  };
124 
131  {
132  Code_MsgComplete = 0,
138  Code_Alive
139  };
140 
146  {
157  };
158 
165  {
166  return m_type;
167  }
168 
174  {
175  return m_valueId.GetHomeId();
176  }
177 
182  uint8 GetNodeId() const
183  {
184  return m_valueId.GetNodeId();
185  }
186 
191  ValueID const& GetValueID() const
192  {
193  return m_valueId;
194  }
195 
201  {
202  assert(Type_Group == m_type);
203  return m_byte;
204  }
205 
210  uint8 GetEvent() const
211  {
212  assert((Type_NodeEvent == m_type) || (Type_ControllerCommand == m_type));
213  return m_event;
214  }
215 
222  {
223  assert(Type_CreateButton == m_type || Type_DeleteButton == m_type || Type_ButtonOn == m_type || Type_ButtonOff == m_type);
224  return m_byte;
225  }
226 
233  {
234  assert(Type_SceneEvent == m_type);
235  return m_byte;
236  }
237 
243  {
244  assert((Type_Notification == m_type) || (Type_ControllerCommand == m_type));
245  return m_byte;
246  }
247 
253  {
254  assert(Type_ControllerCommand == m_type);
255  return m_command;
256  }
257 
262  uint8 GetByte() const
263  {
264  return m_byte;
265  }
266 
271  uint8 GetRetry() const
272  {
273  assert((Type_UserAlerts == m_type) && (Alert_ApplicationStatus_Retry == m_useralerttype));
274  return m_byte;
275  }
276 
281  string GetAsString() const;
282 
288  {
289  return m_useralerttype;
290  }
291  ;
292 
297  string GetComPort() const
298  {
299  return m_comport;
300  }
301  ;
302 
303  private:
304  Notification(NotificationType _type) :
305  m_type(_type), m_byte(0), m_event(0), m_command(0), m_useralerttype(Alert_None)
306  {
307  }
308  ~Notification()
309  {
310  }
311 
312  void SetHomeAndNodeIds(uint32 const _homeId, uint8 const _nodeId)
313  {
314  m_valueId = ValueID(_homeId, _nodeId);
315  }
316  void SetHomeNodeIdAndInstance(uint32 const _homeId, uint8 const _nodeId, uint32 const _instance)
317  {
318  m_valueId = ValueID(_homeId, _nodeId, _instance);
319  }
320  void SetValueId(ValueID const& _valueId)
321  {
322  m_valueId = _valueId;
323  }
324  void SetGroupIdx(uint8 const _groupIdx)
325  {
326  assert(Type_Group == m_type);
327  m_byte = _groupIdx;
328  }
329  void SetEvent(uint8 const _event)
330  {
331  assert(Type_NodeEvent == m_type || Type_ControllerCommand == m_type);
332  m_event = _event;
333  }
334  void SetSceneId(uint8 const _sceneId)
335  {
336  assert(Type_SceneEvent == m_type);
337  m_byte = _sceneId;
338  }
339  void SetButtonId(uint8 const _buttonId)
340  {
341  assert(Type_CreateButton == m_type || Type_DeleteButton == m_type || Type_ButtonOn == m_type || Type_ButtonOff == m_type);
342  m_byte = _buttonId;
343  }
344  void SetNotification(uint8 const _noteId)
345  {
346  assert((Type_Notification == m_type) || (Type_ControllerCommand == m_type));
347  m_byte = _noteId;
348  }
349  void SetUserAlertNotification(UserAlertNotification const alerttype)
350  {
351  assert(Type_UserAlerts == m_type);
352  m_useralerttype = alerttype;
353  }
354  void SetCommand(uint8 const _command)
355  {
356  assert(Type_ControllerCommand == m_type);
357  m_command = _command;
358  }
359  void SetComPort(string comport)
360  {
361  assert(Type_DriverFailed == m_type);
362  m_comport = comport;
363  }
364  void SetRetry(uint8 const timeout)
365  {
366  assert(Type_UserAlerts == m_type);
367  m_byte = timeout;
368  }
369 
370  NotificationType m_type;
371  ValueID m_valueId;
372  uint8 m_byte;
373  uint8 m_event;
374  uint8 m_command;
375  UserAlertNotification m_useralerttype;
376  string m_comport;
377  };
378 
379 } //namespace OpenZWave
380 
381 std::ostream& operator<<(std::ostream &os, const OpenZWave::Notification &dt);
382 std::ostream& operator<<(std::ostream &os, const OpenZWave::Notification *dt);
383 
384 #endif //_Notification_H
385 
uint32
unsigned int uint32
Definition: Defs.h:91
OpenZWave::Notification::GetCommand
uint8 GetCommand() const
Definition: Notification.h:252
OpenZWave::Notification::Type_DriverReset
@ Type_DriverReset
Definition: Notification.h:110
OpenZWave::Notification::Type_Group
@ Type_Group
Definition: Notification.h:94
OpenZWave::Notification::Alert_ApplicationStatus_Rejected
@ Alert_ApplicationStatus_Rejected
Definition: Notification.h:156
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:82
OpenZWave::Internal::CC::SceneActivation
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:45
OpenZWave::Notification::Type_NodeNaming
@ Type_NodeNaming
Definition: Notification.h:99
OpenZWave::Notification::Type_NodeReset
@ Type_NodeReset
Definition: Notification.h:120
OpenZWave::Internal::VC::ValueStore
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:50
ValueID.h
OpenZWave::ValueID
Provides a unique ID for a value reported by a Z-Wave device.
Definition: ValueID.h:77
OpenZWave::Notification::Type_NodeQueriesComplete
@ Type_NodeQueriesComplete
Definition: Notification.h:112
OpenZWave::Notification::Alert_ApplicationStatus_Queued
@ Alert_ApplicationStatus_Queued
Definition: Notification.h:155
uint8
unsigned char uint8
Definition: Defs.h:85
OpenZWave::Notification::Type_AwakeNodesQueried
@ Type_AwakeNodesQueried
Definition: Notification.h:113
OpenZWave::Notification::Type_ValueChanged
@ Type_ValueChanged
Definition: Notification.h:92
OpenZWave::Notification::Type_CreateButton
@ Type_CreateButton
Definition: Notification.h:104
OpenZWave::Internal::ManufacturerSpecificDB
The _ManufacturerSpecificDB class handles the Config File Database that we use to configure devices.
Definition: ManufacturerSpecificDB.h:117
operator<<
std::ostream & operator<<(std::ostream &os, const OpenZWave::Notification &dt)
Definition: Notification.cpp:345
OpenZWave::Notification::GetUserAlertType
UserAlertNotification GetUserAlertType() const
Definition: Notification.h:287
OpenZWave::Notification::NotificationType
NotificationType
Definition: Notification.h:89
OpenZWave::Notification::Code_Timeout
@ Code_Timeout
Definition: Notification.h:133
OpenZWave::Internal::CC::ManufacturerSpecific
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:45
OpenZWave::Notification::Alert_UnsupportedController
@ Alert_UnsupportedController
Definition: Notification.h:153
OpenZWave::Notification::GetSceneId
DEPRECATED uint8 GetSceneId() const
Definition: Notification.h:232
OpenZWave::Notification::Type_NodeNew
@ Type_NodeNew
Definition: Notification.h:95
OpenZWave::Notification::Type_EssentialNodeQueriesComplete
@ Type_EssentialNodeQueriesComplete
Definition: Notification.h:111
OpenZWave::Notification::GetRetry
uint8 GetRetry() const
Definition: Notification.h:271
OpenZWave::Notification::GetNodeId
uint8 GetNodeId() const
Definition: Notification.h:182
OpenZWave::Notification
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition: Notification.h:63
OpenZWave::Notification::Alert_DNSError
@ Alert_DNSError
Definition: Notification.h:151
OpenZWave::Notification::Type_PollingEnabled
@ Type_PollingEnabled
Definition: Notification.h:102
OpenZWave::Notification::Code_Awake
@ Code_Awake
Definition: Notification.h:135
OpenZWave::Notification::Alert_ApplicationStatus_Retry
@ Alert_ApplicationStatus_Retry
Definition: Notification.h:154
OpenZWave::Notification::Alert_MFSOutOfDate
@ Alert_MFSOutOfDate
Definition: Notification.h:149
OpenZWave::Notification::GetComPort
string GetComPort() const
Definition: Notification.h:297
OpenZWave::Notification::Type_UserAlerts
@ Type_UserAlerts
Definition: Notification.h:121
OpenZWave::Notification::Type_DriverRemoved
@ Type_DriverRemoved
Definition: Notification.h:117
OpenZWave::Notification::GetType
NotificationType GetType() const
Definition: Notification.h:164
OpenZWave::Notification::Code_Sleep
@ Code_Sleep
Definition: Notification.h:136
OpenZWave::Notification::Type_DriverReady
@ Type_DriverReady
Definition: Notification.h:108
OpenZWave::Notification::GetNotification
uint8 GetNotification() const
Definition: Notification.h:242
OpenZWave::Notification::UserAlertNotification
UserAlertNotification
Definition: Notification.h:146
OpenZWave::Notification::Type_DriverFailed
@ Type_DriverFailed
Definition: Notification.h:109
OpenZWave::Notification::GetValueID
ValueID const & GetValueID() const
Definition: Notification.h:191
OpenZWave::Notification::Alert_ConfigFileDownloadFailed
@ Alert_ConfigFileDownloadFailed
Definition: Notification.h:150
OpenZWave::Notification::GetButtonId
uint8 GetButtonId() const
Definition: Notification.h:221
OpenZWave::Notification::Type_DeleteButton
@ Type_DeleteButton
Definition: Notification.h:105
OpenZWave::Internal::CC::WakeUp
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:52
OpenZWave::Notification::Type_ValueRefreshed
@ Type_ValueRefreshed
Definition: Notification.h:93
OpenZWave::Internal::CC::NodeNaming
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:57
OpenZWave::Notification::Type_PollingDisabled
@ Type_PollingDisabled
Definition: Notification.h:101
OpenZWave::Notification::Alert_None
@ Alert_None
Definition: Notification.h:147
OpenZWave::Manager
The main public interface to OpenZWave.
Definition: Manager.h:109
OpenZWave::Notification::GetGroupIdx
uint8 GetGroupIdx() const
Definition: Notification.h:200
OpenZWave::Notification::Alert_ConfigOutOfDate
@ Alert_ConfigOutOfDate
Definition: Notification.h:148
OpenZWave::Notification::Type_NodeProtocolInfo
@ Type_NodeProtocolInfo
Definition: Notification.h:98
OpenZWave::Notification::GetByte
uint8 GetByte() const
Definition: Notification.h:262
OpenZWave::Internal::CC::Basic
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:43
OpenZWave::Notification::Type_NodeRemoved
@ Type_NodeRemoved
Definition: Notification.h:97
OPENZWAVE_EXPORT
#define OPENZWAVE_EXPORT
Definition: Defs.h:52
OpenZWave::Internal::CC::ApplicationStatus
Implements COMMAND_CLASS_APPLICATION_STATUS (0x22), a Z-Wave device command class.
Definition: ApplicationStatus.h:43
OpenZWave::Notification::Type_ValueRemoved
@ Type_ValueRemoved
Definition: Notification.h:91
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:85
OpenZWave::Notification::Type_NodeEvent
@ Type_NodeEvent
Definition: Notification.h:100
OpenZWave::Notification::Code_NoOperation
@ Code_NoOperation
Definition: Notification.h:134
OpenZWave::Group
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:72
OpenZWave::Internal::VC::Value
Base class for values associated with a node.
Definition: Value.h:55
OpenZWave::Notification::Type_ButtonOff
@ Type_ButtonOff
Definition: Notification.h:107
OpenZWave::Notification::Type_AllNodesQueried
@ Type_AllNodesQueried
Definition: Notification.h:115
OpenZWave::Notification::NotificationCode
NotificationCode
Definition: Notification.h:131
OpenZWave::Notification::Type_NodeAdded
@ Type_NodeAdded
Definition: Notification.h:96
OpenZWave::Notification::Alert_NodeReloadRequired
@ Alert_NodeReloadRequired
Definition: Notification.h:152
OpenZWave::Notification::Type_Notification
@ Type_Notification
Definition: Notification.h:116
OpenZWave::Notification::GetEvent
uint8 GetEvent() const
Definition: Notification.h:210
Defs.h
OpenZWave::Notification::Code_Dead
@ Code_Dead
Definition: Notification.h:137
OpenZWave::Notification::Type_ButtonOn
@ Type_ButtonOn
Definition: Notification.h:106
DEPRECATED
#define DEPRECATED
Definition: Defs.h:61
OpenZWave::Notification::Type_SceneEvent
@ Type_SceneEvent
Definition: Notification.h:103
OpenZWave
Definition: Bitfield.cpp:31
OpenZWave::Notification::Type_AllNodesQueriedSomeDead
@ Type_AllNodesQueriedSomeDead
Definition: Notification.h:114
OpenZWave::Notification::GetHomeId
uint32 GetHomeId() const
Definition: Notification.h:173