-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnode_event.cpp
129 lines (109 loc) · 2.37 KB
/
node_event.cpp
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
121
122
123
124
125
126
127
128
129
/*
* Copyright (c) 2012-2023 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.
*
*/
#include "deconz/node_event.h"
namespace deCONZ {
class NodeEventPrivate
{
public:
NodeEventPrivate();
const Node *node;
NodeEvent::Event event;
uint8_t endpoint;
uint16_t profileId;
uint16_t clusterId;
std::vector<uint16_t> attributeIds;
};
NodeEventPrivate::NodeEventPrivate() :
node(0),
event(NodeEvent::NodeAdded),
endpoint(0),
profileId(0),
clusterId(0)
{
}
NodeEvent::NodeEvent() :
d_ptr(new NodeEventPrivate)
{
}
NodeEvent::NodeEvent(NodeEvent::Event event, const Node *node, uint8_t endpoint, uint16_t profileId, uint16_t clusterId) :
d_ptr(new NodeEventPrivate)
{
Q_D(NodeEvent);
d->event = event;
d->node = node;
d->endpoint = endpoint;
d->profileId = profileId;
d->clusterId = clusterId;
}
NodeEvent::NodeEvent(NodeEvent::Event event, const Node *node, const ApsDataIndication &ind) :
d_ptr(new NodeEventPrivate)
{
Q_D(NodeEvent);
d->event = event;
d->node = node;
d->endpoint = ind.srcEndpoint();
d->profileId = ind.profileId();
d->clusterId = ind.clusterId();
}
NodeEvent::NodeEvent(const NodeEvent &other) :
d_ptr(new NodeEventPrivate(*other.d_ptr))
{
}
NodeEvent &NodeEvent::operator= (const NodeEvent &other)
{
// Self assignment?
if (this == &other)
{
return *this;
}
*this->d_ptr = *other.d_ptr;
return *this;
}
NodeEvent::~NodeEvent()
{
delete d_ptr;
d_ptr = 0;
}
const Node *NodeEvent::node() const
{
Q_D(const NodeEvent);
return d->node;
}
NodeEvent::Event NodeEvent::event() const
{
Q_D(const NodeEvent);
return d->event;
}
uint8_t NodeEvent::endpoint() const
{
Q_D(const NodeEvent);
return d->endpoint;
}
uint16_t NodeEvent::profileId() const
{
Q_D(const NodeEvent);
return d->profileId;
}
uint16_t NodeEvent::clusterId() const
{
Q_D(const NodeEvent);
return d->clusterId;
}
const std::vector<uint16_t> &NodeEvent::attributeIds() const
{
Q_D(const NodeEvent);
return d->attributeIds;
}
void NodeEvent::addAttributeId(uint16_t id)
{
Q_D(NodeEvent);
return d->attributeIds.push_back(id);
}
}