OpenZWave Library  1.6.896
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  namespace Internal
38  {
39  namespace CC
40  {
44  class Alarm: public CommandClass, private Timer
45  {
46  public:
47  static CommandClass* Create(uint32 const _homeId, uint8 const _nodeId)
48  {
49  return new Alarm(_homeId, _nodeId);
50  }
51  virtual ~Alarm()
52  {
53  }
54 
57  {
58  return 0x71;
59  }
61  static string const StaticGetCommandClassName()
62  {
63  return "COMMAND_CLASS_NOTIFICATION";
64  }
65 
66  // From CommandClass
67  virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue) override;
68  virtual bool RequestValue(uint32 const _requestFlags, uint16 const _index, uint8 const _instance, Driver::MsgQueue const _queue) override;
70  virtual uint8 const GetCommandClassId() const override
71  {
72  return StaticGetCommandClassId();
73  }
75  virtual string const GetCommandClassName() const override
76  {
78  }
80  virtual bool HandleMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override;
81  virtual uint8 GetMaxVersion() override
82  {
83  return 8;
84  }
85  virtual bool SetValue(Internal::VC::Value const& _value) override;
86 
87  private:
88  Alarm(uint32 const _homeId, uint8 const _nodeId);
89  void SetupEvents(uint32 type, uint32 index, vector<Internal::VC::ValueList::Item> *_items, uint32 const _instance);
90  void ClearAlarm(uint32 type);
91  void ClearEventParams(uint32 const _instance);
92  bool m_v1Params;
93  std::vector<uint32> m_ParamsSet;
94  uint32 m_ClearTimeout;
95  std::map<uint32, uint32> m_TimersToInstances;
96  };
97  } // namespace CommandClass
98  } // namespace Internal
99 
100 } // namespace OpenZWave
101 
102 #endif
static uint8 const StaticGetCommandClassId()
Get command class ID (1 byte) identifying this command class.
Definition: Alarm.h:56
Definition: Bitfield.cpp:30
MsgQueue
Definition: Driver.h:658
unsigned short uint16
Definition: Defs.h:89
Implements COMMAND_CLASS_NOTIFICATION (0x71), a Z-Wave device command class.
Definition: Alarm.h:44
virtual bool SetValue(Internal::VC::Value const &_value) override
Definition: Alarm.cpp:128
Base class for all Z-Wave command classes.
Definition: CommandClass.h:60
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition: Alarm.h:47
virtual string const GetCommandClassName() const override
Get a string containing the name of this command class. (Inherited from CommandClass) ...
Definition: Alarm.h:75
unsigned int uint32
Definition: Defs.h:92
virtual bool RequestValue(uint32 const _requestFlags, uint16 const _index, uint8 const _instance, Driver::MsgQueue const _queue) override
Definition: Alarm.cpp:143
Timer SubClass for automatically registering/unregistering Timer Callbacks if the instance goes out o...
Definition: TimerThread.h:127
virtual ~Alarm()
Definition: Alarm.h:51
virtual uint8 const GetCommandClassId() const override
Get command class ID (1 byte) identifying this command class. (Inherited from CommandClass) ...
Definition: Alarm.h:70
virtual uint8 GetMaxVersion() override
Definition: Alarm.h:81
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1) override
Handle a response to a message associated with this command class. (Inherited from CommandClass) ...
Definition: Alarm.cpp:190
static string const StaticGetCommandClassName()
Get a string containing the name of this command class.
Definition: Alarm.h:61
virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue) override
Definition: Alarm.cpp:84
Base class for values associated with a node.
Definition: Value.h:53
unsigned char uint8
Definition: Defs.h:86