OpenZWave Library  1.6.0
Alarm.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Alarm.h
4 //
5 // Implementation of the Z-Wave COMMAND_CLASS_ALARM
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 _Alarm_H
29 #define _Alarm_H
30 
32 #include "TimerThread.h"
33 
34 namespace OpenZWave
35 {
36  class ValueByte;
37 
41  class Alarm: public CommandClass, private Timer
42  {
43  public:
44  static CommandClass* Create( uint32 const _homeId, uint8 const _nodeId ){ return new Alarm( _homeId, _nodeId ); }
45  virtual ~Alarm(){}
46 
48  static uint8 const StaticGetCommandClassId(){ return 0x71; }
50  static string const StaticGetCommandClassName(){ return "COMMAND_CLASS_NOTIFICATION"; }
51 
52  // From CommandClass
53  virtual bool RequestState( uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue );
54  virtual bool RequestValue( uint32 const _requestFlags, uint16 const _index, uint8 const _instance, Driver::MsgQueue const _queue );
56  virtual uint8 const GetCommandClassId()const{ return StaticGetCommandClassId(); }
58  virtual string const GetCommandClassName()const{ return StaticGetCommandClassName(); }
60  virtual bool HandleMsg( uint8 const* _data, uint32 const _length, uint32 const _instance = 1 );
61  virtual uint8 GetMaxVersion(){ return 8; }
62  virtual bool SetValue( Value const& _value );
63 
64 
65  private:
66  Alarm( uint32 const _homeId, uint8 const _nodeId );
67  void SetupEvents(uint32 type, uint32 index, vector<ValueList::Item> *_items, uint32 const _instance);
68  void ClearAlarm(uint32 type);
69  void ClearEventParams(uint32 const _instance);
70  bool m_v1Params;
71  std::vector<uint32> m_ParamsSet;
72  uint32 m_ClearTimeout;
73  std::map<uint32, uint32> m_TimersToInstances;
74 
75 
76  };
77 
78 } // namespace OpenZWave
79 
80 #endif
uint32
unsigned int uint32
Definition: Defs.h:95
OpenZWave::Alarm::StaticGetCommandClassId
static uint8 const StaticGetCommandClassId()
Get command class ID (1 byte) identifying this command class.
Definition: Alarm.h:48
TimerThread.h
OpenZWave::CommandClass
Base class for all Z-Wave command classes.
Definition: CommandClass.h:56
uint8
unsigned char uint8
Definition: Defs.h:89
OpenZWave::Alarm::GetCommandClassName
virtual string const GetCommandClassName() const
Get a string containing the name of this command class. (Inherited from CommandClass)
Definition: Alarm.h:58
OpenZWave::Alarm::SetValue
virtual bool SetValue(Value const &_value)
Definition: Alarm.cpp:149
OpenZWave::Alarm::RequestValue
virtual bool RequestValue(uint32 const _requestFlags, uint16 const _index, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: Alarm.cpp:166
OpenZWave::Alarm::GetMaxVersion
virtual uint8 GetMaxVersion()
Definition: Alarm.h:61
OpenZWave::Value
Base class for values associated with a node.
Definition: Value.h:49
OpenZWave::Alarm::RequestState
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue)
Definition: Alarm.cpp:102
CommandClass.h
OpenZWave::Timer
Timer SubClass for automatically registering/unregistering Timer Callbacks if the instance goes out o...
Definition: TimerThread.h:129
OpenZWave::Alarm
Implements COMMAND_CLASS_NOTIFICATION (0x71), a Z-Wave device command class.
Definition: Alarm.h:42
OpenZWave::Alarm::HandleMsg
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1)
Handle a response to a message associated with this command class. (Inherited from CommandClass)
Definition: Alarm.cpp:216
OpenZWave::Alarm::Create
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: Alarm.h:44
OpenZWave::Alarm::~Alarm
virtual ~Alarm()
Definition: Alarm.h:45
OpenZWave::Alarm::StaticGetCommandClassName
static string const StaticGetCommandClassName()
Get a string containing the name of this command class.
Definition: Alarm.h:50
OpenZWave::Alarm::GetCommandClassId
virtual uint8 const GetCommandClassId() const
Get command class ID (1 byte) identifying this command class. (Inherited from CommandClass)
Definition: Alarm.h:56
OpenZWave::Driver::MsgQueue
MsgQueue
Definition: Driver.h:592
uint16
unsigned short uint16
Definition: Defs.h:92
OpenZWave
Definition: Bitfield.h:35