Notification.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// Notification.h
//
// Contains details of a Z-Wave event reported to the user
//
// Copyright (c) 2010 Mal Lansell <openzwave@lansell.org>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _Notification_H
#define _Notification_H
#include "Defs.h"
#include "value_classes/ValueID.h"
namespace OpenZWave
{
class OPENZWAVE_EXPORT Notification
{
friend class Manager;
friend class Driver;
friend class Node;
friend class Group;
friend class Value;
friend class ValueStore;
friend class Basic;
friend class ManufacturerSpecific;
friend class NodeNaming;
friend class NoOperation;
friend class SceneActivation;
friend class WakeUp;
public:
enum NotificationType
{
Type_ValueAdded = 0,
Type_ValueRemoved,
Type_ValueChanged,
Type_ValueRefreshed,
Type_Group,
Type_NodeNew,
Type_NodeAdded,
Type_NodeRemoved,
Type_NodeProtocolInfo,
Type_NodeNaming,
Type_NodeEvent,
Type_PollingDisabled,
Type_PollingEnabled,
Type_SceneEvent,
Type_CreateButton,
Type_DeleteButton,
Type_ButtonOn,
Type_ButtonOff,
Type_DriverReady,
Type_DriverFailed,
Type_DriverReset,
Type_EssentialNodeQueriesComplete,
Type_NodeQueriesComplete,
Type_AwakeNodesQueried,
Type_AllNodesQueriedSomeDead,
Type_AllNodesQueried,
Type_Notification,
Type_DriverRemoved,
Type_ControllerCommand,
Type_NodeReset
};
enum NotificationCode
{
Code_MsgComplete = 0,
Code_Timeout,
Code_NoOperation,
Code_Awake,
Code_Sleep,
Code_Dead,
Code_Alive
};
NotificationType GetType()const{ return m_type; }
uint32 GetHomeId()const{ return m_valueId.GetHomeId(); }
uint8 GetNodeId()const{ return m_valueId.GetNodeId(); }
ValueID const& GetValueID()const{ return m_valueId; }
uint8 GetGroupIdx()const{ assert(Type_Group==m_type); return m_byte; }
uint8 GetEvent()const{ assert((Type_NodeEvent==m_type) || (Type_ControllerCommand == m_type)); return m_event; }
uint8 GetButtonId()const{ assert(Type_CreateButton==m_type || Type_DeleteButton==m_type || Type_ButtonOn==m_type || Type_ButtonOff==m_type); return m_byte; }
uint8 GetSceneId()const{ assert(Type_SceneEvent==m_type); return m_byte; }
uint8 GetNotification()const{ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); return m_byte; }
uint8 GetByte()const{ return m_byte; }
string GetAsString()const;
private:
Notification( NotificationType _type ): m_type( _type ), m_byte(0), m_event(0) {}
~Notification(){}
void SetHomeAndNodeIds( uint32 const _homeId, uint8 const _nodeId ){ m_valueId = ValueID( _homeId, _nodeId ); }
void SetHomeNodeIdAndInstance ( uint32 const _homeId, uint8 const _nodeId, uint32 const _instance ){ m_valueId = ValueID( _homeId, _nodeId, _instance ); }
void SetValueId( ValueID const& _valueId ){ m_valueId = _valueId; }
void SetGroupIdx( uint8 const _groupIdx ){ assert(Type_Group==m_type); m_byte = _groupIdx; }
void SetEvent( uint8 const _event ){ assert(Type_NodeEvent==m_type || Type_ControllerCommand == m_type); m_event = _event; }
void SetSceneId( uint8 const _sceneId ){ assert(Type_SceneEvent==m_type); m_byte = _sceneId; }
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; }
void SetNotification( uint8 const _noteId ){ assert((Type_Notification==m_type) || (Type_ControllerCommand == m_type)); m_byte = _noteId; }
NotificationType m_type;
ValueID m_valueId;
uint8 m_byte;
uint8 m_event;
};
} //namespace OpenZWave
#endif //_Notification_H
OpenZWave::NoOperation
Implements COMMAND_CLASS_NO_OPERATION (0x00), a Z-Wave device command class.
Definition: NoOperation.h:37
OpenZWave
Definition: Bitfield.h:34
OpenZWave::ValueStore
Container that holds all of the values associated with a given node.
Definition: ValueStore.h:43
OpenZWave::Notification::Type_ValueRefreshed
Definition: Notification.h:70
OpenZWave::Notification::Type_PollingDisabled
Definition: Notification.h:78
OPENZWAVE_EXPORT
#define OPENZWAVE_EXPORT
Definition: Defs.h:52
OpenZWave::ManufacturerSpecific
Implements COMMAND_CLASS_MANUFACTURER_SPECIFIC (0x72), a Z-Wave device command class.
Definition: ManufacturerSpecific.h:38
OpenZWave::Notification::Type_NodeProtocolInfo
Definition: Notification.h:75
OpenZWave::Notification::Type_DeleteButton
Definition: Notification.h:82
OpenZWave::WakeUp
Implements COMMAND_CLASS_WAKE_UP (0x84), a Z-Wave device command class.
Definition: WakeUp.h:43
OpenZWave::Manager
The main public interface to OpenZWave.
Definition: Manager.h:109
OpenZWave::Notification::GetValueID
ValueID const & GetValueID() const
Definition: Notification.h:139
OpenZWave::Notification::GetSceneId
uint8 GetSceneId() const
Definition: Notification.h:164
OpenZWave::Notification::GetNodeId
uint8 GetNodeId() const
Definition: Notification.h:133
OpenZWave::Notification::Type_NodeEvent
Definition: Notification.h:77
OpenZWave::Notification::GetHomeId
uint32 GetHomeId() const
Definition: Notification.h:127
OpenZWave::Notification::Code_NoOperation
Definition: Notification.h:109
OpenZWave::Notification::Type_ButtonOff
Definition: Notification.h:84
OpenZWave::Notification::Type_NodeAdded
Definition: Notification.h:73
OpenZWave::Notification::Type_Notification
Definition: Notification.h:93
OpenZWave::Notification::Type_NodeRemoved
Definition: Notification.h:74
OpenZWave::Node
The Node class describes a Z-Wave node object...typically a device on the Z-Wave network.
Definition: Node.h:64
OpenZWave::Notification::NotificationType
NotificationType
Definition: Notification.h:65
Defs.h
OpenZWave::Notification::Type_ValueRemoved
Definition: Notification.h:68
OpenZWave::Notification::Type_ButtonOn
Definition: Notification.h:83
OpenZWave::Notification::Type_AllNodesQueried
Definition: Notification.h:92
ValueID.h
OpenZWave::Notification::Type_AllNodesQueriedSomeDead
Definition: Notification.h:91
OpenZWave::Notification::Type_Group
Definition: Notification.h:71
OpenZWave::Notification::Code_Dead
Definition: Notification.h:112
OpenZWave::Notification::GetType
NotificationType GetType() const
Definition: Notification.h:121
OpenZWave::Notification::Type_SceneEvent
Definition: Notification.h:80
OpenZWave::Driver
The Driver class handles communication between OpenZWave and a device attached via a serial port (typ...
Definition: Driver.h:58
OpenZWave::SceneActivation
Implements COMMAND_CLASS_SCENEACTIVATION (0x2B), a Z-Wave device command class.
Definition: SceneActivation.h:39
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::Notification::GetByte
uint8 GetByte() const
Definition: Notification.h:176
OpenZWave::Group
Manages a group of devices (various nodes associated with each other).
Definition: Group.h:49
OpenZWave::Notification::Type_DriverReset
Definition: Notification.h:87
OpenZWave::Notification::Type_AwakeNodesQueried
Definition: Notification.h:90
OpenZWave::Notification::GetButtonId
uint8 GetButtonId() const
Definition: Notification.h:158
OpenZWave::Notification::Type_NodeNaming
Definition: Notification.h:76
OpenZWave::Notification
Provides a container for data sent via the notification callback handler installed by a call to Manag...
Definition: Notification.h:42
OpenZWave::ValueID
Provides a unique ID for a value reported by a Z-Wave device.
Definition: ValueID.h:53
OpenZWave::Notification::Type_NodeQueriesComplete
Definition: Notification.h:89
OpenZWave::Notification::Type_CreateButton
Definition: Notification.h:81
OpenZWave::Notification::Type_ValueChanged
Definition: Notification.h:69
OpenZWave::Notification::GetGroupIdx
uint8 GetGroupIdx() const
Definition: Notification.h:145
OpenZWave::Notification::GetNotification
uint8 GetNotification() const
Definition: Notification.h:170
OpenZWave::Notification::Type_NodeNew
Definition: Notification.h:72
OpenZWave::Notification::NotificationCode
NotificationCode
Definition: Notification.h:105
OpenZWave::Notification::Code_Timeout
Definition: Notification.h:108
OpenZWave::Notification::GetEvent
uint8 GetEvent() const
Definition: Notification.h:151
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:47
OpenZWave::Notification::Type_EssentialNodeQueriesComplete
Definition: Notification.h:88
OpenZWave::NodeNaming
Implements COMMAND_CLASS_NODE_NAMING (0x77), a Z-Wave device command class.
Definition: NodeNaming.h:37
OpenZWave::Notification::Code_Sleep
Definition: Notification.h:111
OpenZWave::Notification::Type_PollingEnabled
Definition: Notification.h:79
OpenZWave::Notification::Code_Awake
Definition: Notification.h:110
OpenZWave::Notification::Type_DriverRemoved
Definition: Notification.h:94
OpenZWave::Basic
Implements COMMAND_CLASS_BASIC (0x20), a Z-Wave device command class.
Definition: Basic.h:39
OpenZWave::Notification::Type_DriverFailed
Definition: Notification.h:86
OpenZWave::Notification::Type_DriverReady
Definition: Notification.h:85
uint8
unsigned char uint8
Definition: Defs.h:74