BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
ZWaveNetwork.h
1 #pragma once
2 
3 #include <set>
4 #include <string>
5 #include <vector>
6 
7 #include <Poco/SharedPtr.h>
8 #include <Poco/Timespan.h>
9 
10 #include "zwave/ZWaveNode.h"
11 
12 namespace BeeeOn {
13 
23 class ZWaveNetwork {
24 public:
25  typedef Poco::SharedPtr<ZWaveNetwork> Ptr;
26 
31  class PollEvent {
32  public:
33  enum Type {
40 
47 
53 
59 
65 
70 
75 
80 
85 
90  };
91 
92  PollEvent();
93  ~PollEvent();
94 
95  static PollEvent createNewNode(const ZWaveNode &node);
96  static PollEvent createUpdateNode(const ZWaveNode &node);
97  static PollEvent createRemoveNode(const ZWaveNode &node);
98  static PollEvent createValue(const ZWaveNode::Value &value);
99  static PollEvent createInclusionStart();
100  static PollEvent createInclusionDone();
101  static PollEvent createRemoveNodeStart();
102  static PollEvent createRemoveNodeDone();
103  static PollEvent createReady();
104 
105  bool isNone() const
106  {
107  return type() == EVENT_NONE;
108  }
109 
110  Type type() const;
111  const ZWaveNode &node() const;
112  const ZWaveNode::Value &value() const;
113 
114  std::string toString() const;
115 
116  protected:
117  PollEvent(Type type);
118  PollEvent(Type type, const ZWaveNode &node);
119  PollEvent(const ZWaveNode::Value &value);
120 
121  private:
122  Type m_type;
123  Poco::SharedPtr<ZWaveNode> m_node;
124  Poco::SharedPtr<ZWaveNode::Value> m_value;
125  };
126 
127  virtual ~ZWaveNetwork();
128 
135  virtual PollEvent pollEvent(
136  const Poco::Timespan &timeout) = 0;
137 
143  virtual void startInclusion() = 0;
144 
148  virtual void cancelInclusion() = 0;
149 
155  virtual void startRemoveNode() = 0;
156 
160  virtual void cancelRemoveNode() = 0;
161 
165  virtual void interrupt() = 0;
166 
174  virtual void postValue(const ZWaveNode::Value&) = 0;
175 
176 };
177 
178 }
Z-Wave inclusion process has stopped.
Definition: ZWaveNetwork.h:74
virtual void postValue(const ZWaveNode::Value &)=0
Post the given value into the Z-Wave network. There is no implicit feedback about the result status...
virtual PollEvent pollEvent(const Poco::Timespan &timeout)=0
Poll for new events in the ZWaveNetwork.
Value coming from the Z-Wave network. It holds some data (usually sensor data) and metadata to identi...
Definition: ZWaveNode.h:102
A new Z-Wave node has been detected. There might be incomplete information about it. Use method PollEvent::node() to access it.
Definition: ZWaveNetwork.h:46
Z-Wave node removal process has stopped.
Definition: ZWaveNetwork.h:84
A Z-Wave node has been removed from the Z-Wave network. Use method PollEvent::node() to access it...
Definition: ZWaveNetwork.h:58
Representation of events reported by the ZWaveNetwork implementation via the call pollEvent()...
Definition: ZWaveNetwork.h:31
ZWaveNetwork is an interface to a real Z-Wave network.
Definition: ZWaveNetwork.h:23
virtual void cancelRemoveNode()=0
Cancel remove node if it is running.
Z-Wave node removal process has started.
Definition: ZWaveNetwork.h:79
A Z-Wave node&#39;s information has been updated. Use method PollEvent::node() to access it...
Definition: ZWaveNetwork.h:52
Received data from a Z-Wave node. Use method PollEvent::value() to access it.
Definition: ZWaveNetwork.h:64
virtual void startInclusion()=0
Starts the Z-Wave network node inclusion process.
Type
Definition: ZWaveNetwork.h:33
virtual void cancelInclusion()=0
Cancel inclusion if it is running.
All available Z-Wave nodes have been queried.
Definition: ZWaveNetwork.h:89
ZWaveNode represents information from the Z-Wave network about a particular node. Each Z-Wave node is...
Definition: ZWaveNode.h:22
virtual void interrupt()=0
Interrupt any blocking calls currently in progress.
Z-Wave inclusion process has started.
Definition: ZWaveNetwork.h:69
virtual void startRemoveNode()=0
Start node removal process in the Z-Wave network.
Dummy, nothing happens. It might come when interrupted for some reason (termination). It can be just a spurious wakeup.
Definition: ZWaveNetwork.h:39