16#include <deconz/aps.h>
17#include <deconz/binding_table.h>
18#include <deconz/zdp_descriptors.h>
28 const Address &address()
const {
return m_address; }
29 quint8 lqi()
const {
return m_lqi; }
36inline uint SR_HashUuid(
const QString &uuid)
44 enum Constants { MaxHops = 9 };
45 enum State { StateIdle, StateWorking, StateSleep };
47 SourceRoute(
const QString &uuid,
const int order,
const std::vector<Address> &hops) :
52 m_srHash = qHash(uuid);
58 for (
size_t i = 0; i < MaxHops && i < m_hops.size(); i++)
60 if (m_hopLqi[i] != other.m_hopLqi[i])
66 return m_srHash == other.uuidHash() &&
67 m_txOk == other.txOk() &&
68 m_errors == other.errors() &&
69 m_hops == other.
hops() &&
75 return !(*
this == other);
78 bool isValid()
const {
return m_srHash != 0 && !m_hops.empty(); }
79 bool isOperational()
const;
80 const QString &uuid()
const {
return m_uuid; }
81 uint uuidHash()
const {
return m_srHash; }
83 const std::vector<Address> &
hops()
const {
return m_hops; }
85 int order()
const {
return m_order; }
89 size_t errors()
const {
return m_errors; }
90 void incrementErrors();
91 size_t txOk()
const {
return m_txOk; }
93 State state()
const {
return m_state; }
94 void setState(State state) { m_state = state; }
95 bool needSave()
const {
return m_needSave; }
96 void saved() { m_needSave =
false; }
98 quint8 m_hopLqi[MaxHops] = { };
101 bool m_needSave =
false;
102 State m_state = StateIdle;
108 std::vector<Address> m_hops;
134 bool isCoordinator()
const;
136 bool isRouter()
const;
138 bool isEndDevice()
const;
140 bool isZombie()
const;
142 void setIsZombie(
bool isZombie);
144 const QString &userDescriptor()
const;
148 void setUserDescriptor(
const QString &userDescriptor);
150 QString deviceTypeString();
152 const std::vector<uint8_t> &endpoints()
const;
154 void setActiveEndpoints(
const std::vector<uint8_t> &ep);
167 std::vector<SimpleDescriptor> &simpleDescriptors();
169 const std::vector<SimpleDescriptor> &simpleDescriptors()
const;
191 const MacCapabilities &macCapabilities()
const;
195 void setMacCapabilities(MacCapabilities cap);
199 virtual const std::vector<NodeNeighbor> &
neighbors()
const = 0;
201 const std::vector<SourceRoute> &sourceRoutes()
const;
209 int addSourceRoute(
const SourceRoute &sourceRoute);
216 bool updateSourceRoute(
const SourceRoute &sourceRoute);
221 int removeSourceRoute(uint srHash);
225 void pushEdScan(
int ed);
226 int edScanValue()
const;
227 bool needRedraw()
const;
228 void setNeedRedraw(
bool redraw);
232 Q_DECLARE_PRIVATE(
Node)
Convenience class to work with network, extended and group addresses.
Definition aps.h:111
Definition binding_table.h:82
Represents a ZigBee node descriptor.
Definition zdp_descriptors.h:109
Definition node_private.h:17
Represents a ZigBee node with all its descriptors and clusters.
Definition node.h:119
virtual const std::vector< NodeNeighbor > & neighbors() const =0
Returns all neighbors of the node.
virtual CommonState state() const =0
Returns the current node state.
virtual const BindingTable & bindingTable() const =0
Returns the binding table of a node.
Represents a ZigBee power descriptor.
Definition zdp_descriptors.h:212
Represents a ZigBee simple descriptor.
Definition zdp_descriptors.h:254
const std::vector< Address > & hops() const
The last hop in the list is the destination node.
Definition node.h:83
int order() const
A lower order means a higher priority for the source route.
Definition node.h:85
The deCONZ namespace.
Definition aps.cpp:19
State
The state of a device or node.
Definition types.h:376
CommonState
Common states for various purposes.
Definition types.h:400
Declaration of the most common deCONZ library types.