OpenZWave Library 1.7.0
Loading...
Searching...
No Matches
Supervision.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// Supervision.h
4//
5// Implementation of the Z-Wave COMMAND_CLASS_SUPERVISION
6//
7// Copyright (c) 2020 Mark Ruys <mark@paracas.nl>
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 _Supervision_H
29#define _Supervision_H
30
31#include <deque>
32
34
35namespace OpenZWave
36{
37 namespace Internal
38 {
39 namespace CC
40 {
45 {
46 public:
64
65 static CommandClass* Create(uint32 const _homeId, uint8 const _nodeId)
66 {
67 return new Supervision(_homeId, _nodeId);
68 }
69 virtual ~Supervision()
70 {
71 }
72
74 {
75 return 0x6c;
76 }
77 static string const StaticGetCommandClassName()
78 {
79 return "COMMAND_CLASS_SUPERVISION";
80 }
81
82 uint8 CreateSupervisionSession(uint8 _command_class_id, uint8 _index);
83 static uint8 const StaticNoSessionId()
84 {
85 return 0xff; // As sessions are only 5 bits, this value will never match
86 }
87 uint32 GetSupervisionIndex(uint8 _session_id);
88 static uint32 const StaticNoIndex()
89 {
90 return 0xffff; // As indices are max 16 bits, this value will never match
91 }
92
93 // From CommandClass
94 virtual uint8 const GetCommandClassId() const override
95 {
97 }
98 virtual string const GetCommandClassName() const override
99 {
101 }
102 virtual bool HandleIncomingMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override;
103 virtual bool HandleMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override;
104
105 private:
106 Supervision(uint32 const _homeId, uint8 const _nodeId) :
107 CommandClass(_homeId, _nodeId),
108 m_last_session_id{StaticNoSessionId()}
109 {
110 }
111
112 struct s_Session {
113 uint8 session_id;
114 uint8 command_class_id;
115 uint8 index;
116 };
117 std::deque<s_Session> m_sessions;
118 uint8 m_last_session_id;
119
120 void HandleSupervisionReport(uint8 const* _data, uint32 const _length, uint32 const _instance);
121 };
122 } // namespace CC
123 } // namespace Internal
124} // namespace OpenZWave
125
126#endif
127
unsigned int uint32
Definition Defs.h:91
unsigned char uint8
Definition Defs.h:85
Base class for all Z-Wave command classes.
Definition CommandClass.h:61
Implements COMMAND_CLASS_SUPERVISION (0x6c), a Z-Wave device command class.
Definition Supervision.h:45
static string const StaticGetCommandClassName()
Definition Supervision.h:77
SupervisionCmd
Definition Supervision.h:48
@ SupervisionCmd_Report
Definition Supervision.h:50
@ SupervisionCmd_Get
Definition Supervision.h:49
SupervisionStatus
Definition Supervision.h:58
@ SupervisionStatus_Working
Definition Supervision.h:60
@ SupervisionStatus_Fail
Definition Supervision.h:61
@ SupervisionStatus_Success
Definition Supervision.h:62
@ SupervisionStatus_NoSupport
Definition Supervision.h:59
uint8 CreateSupervisionSession(uint8 _command_class_id, uint8 _index)
Definition Supervision.cpp:44
SupervisionMoreStatusUpdates
Definition Supervision.h:53
@ SupervisionMoreStatusUpdates_MoreReports
Definition Supervision.h:55
@ SupervisionMoreStatusUpdates_LastReport
Definition Supervision.h:54
static CommandClass * Create(uint32 const _homeId, uint8 const _nodeId)
Definition Supervision.h:65
virtual ~Supervision()
Definition Supervision.h:69
virtual uint8 const GetCommandClassId() const override
Definition Supervision.h:94
virtual bool HandleIncomingMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1) override
Definition Supervision.cpp:138
uint32 GetSupervisionIndex(uint8 _session_id)
Definition Supervision.cpp:64
static uint8 const StaticGetCommandClassId()
Definition Supervision.h:73
static uint8 const StaticNoSessionId()
Definition Supervision.h:83
virtual bool HandleMsg(uint8 const *_data, uint32 const _length, uint32 const _instance=1) override
Definition Supervision.cpp:147
static uint32 const StaticNoIndex()
Definition Supervision.h:88
virtual string const GetCommandClassName() const override
Definition Supervision.h:98
Definition Bitfield.cpp:31