-
Notifications
You must be signed in to change notification settings - Fork 505
/
bindings.h
120 lines (106 loc) · 3.02 KB
/
bindings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* Copyright (c) 2016-2020 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
*/
#ifndef BINDINGS_H
#define BINDINGS_H
#include <QElapsedTimer>
#include <deconz.h>
/*! \class Binding
Represents a ZigBee ZDO Binding.
*/
class Binding
{
public:
enum Constans
{
GroupAddressMode = 0x01,
ExtendedAddressMode = 0x03
};
Binding();
bool operator==(const Binding &rhs) const;
bool operator!=(const Binding &rhs) const;
/*! The source IEEE address. */
quint64 srcAddress;
/*! The source endpoint. */
quint8 srcEndpoint;
/*! The cluster on the source device that is bound to the destination device. */
quint16 clusterId;
/*! The addressing mode for the destination address.
0x01 = 16-bit group address (no endpoint)
0x03 = 64-bit extended address + endpoint
*/
quint8 dstAddrMode;
union
{
quint16 group; //!< The destination group address (if dstAddrMode = 0x01).
quint64 ext; //!< The destination extended address (if dstAddrMode = 0x03).
} dstAddress;
/*! Destination endpoint (if dstAddrMode = 0x03). */
quint8 dstEndpoint;
bool readFromStream(QDataStream &stream);
bool writeToStream(QDataStream &stream) const;
};
/*! \class BindingTableReader
Helper class to query full binding table of a node.
*/
class BindingTableReader
{
public:
enum Constants
{
MaxConfirmTime = 10 * 60 * 1000, // 10 min
MaxResponseTime = 10 * 1000, // 10 sec
MaxEndDeviceResponseTime = 60 * 60 * 1000 // 60 min
};
BindingTableReader() :
state(StateIdle),
index(0),
isEndDevice(false)
{
}
enum State {
StateIdle,
StateWaitConfirm,
StateWaitResponse,
StateFinished
};
State state; //!< State of query
quint8 index; //!< Current read index
bool isEndDevice; //!< True if node is an end-device
QElapsedTimer time; //!< State timeout reference
deCONZ::ApsDataRequest apsReq; //!< The APS request to match APS confirm.id
};
class ConfigureReportingRequest
{
public:
ConfigureReportingRequest() :
direction(0x00),
reportableChange8bit(0xFF),
reportableChange16bit(0xFFFF),
reportableChange24bit(0xFFFFFF),
reportableChange48bit(0xFFFFFFFF), // there's no quint48
manufacturerCode(0)
{
}
quint8 zclSeqNum;
quint8 direction;
quint8 dataType;
quint16 attributeId;
quint16 minInterval;
quint16 maxInterval;
quint8 reportableChange8bit;
quint16 reportableChange16bit;
quint32 reportableChange24bit; // there's no quint24
quint32 reportableChange48bit; // there's no quint48
quint16 manufacturerCode;
};
#if DECONZ_LIB_VERSION >= 0x010F00
deCONZ::Binding convertToCoreBinding(const Binding &bnd);
#endif
#endif // BINDINGS_H