BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
GWMessageContext.h
1 #pragma once
2 
3 #include <Poco/SharedPtr.h>
4 
5 #include "core/Result.h"
6 #include "gwmessage/GWRequest.h"
7 #include "gwmessage/GWResponse.h"
8 #include "gwmessage/GWResponseWithAck.h"
9 #include "gwmessage/GWSensorDataExport.h"
10 #include "model/GlobalID.h"
11 #include "util/LambdaTimerTask.h"
12 
13 namespace BeeeOn {
14 
19 enum GWMessagePriority {
20  DEFAULT_PRIO = 0,
21  DATA_PRIO = 10,
22  REQUEST_PRIO = 20,
23  RESPONSEWITHACK_PRIO = 30,
24  RESPONSE_PRIO = 40,
25 };
26 
38 public:
39  typedef Poco::SharedPtr<GWMessageContext> Ptr;
40 
41  GWMessageContext(GWMessagePriority priority);
42 
43  virtual ~GWMessageContext();
44 
45  GWMessage::Ptr message();
46  void setMessage(GWMessage::Ptr msg);
47 
48  int priority() const;
49 
50  GlobalID id() const;
51 
52 protected:
53  int m_priority;
54  GWMessage::Ptr m_message;
55 };
56 
64 public:
65  typedef Poco::SharedPtr<GWTimedContext> Ptr;
66 
67  GWTimedContext(GWMessagePriority priority);
68 
69  LambdaTimerTask::Ptr missingResponseTask();
70  void setMissingResponseTask(LambdaTimerTask::Ptr task);
71 
72 private:
73  LambdaTimerTask::Ptr m_missingResponseTask;
74 };
75 
81 public:
82  typedef Poco::SharedPtr<GWRequestContext> Ptr;
83 
85  GWRequestContext(GWRequest::Ptr request, Result::Ptr result);
86 
87  Result::Ptr result();
88  void setResult(Result::Ptr result);
89 private:
90  Result::Ptr m_result;
91 };
92 
97 public:
98  typedef Poco::SharedPtr<GWResponseContext> Ptr;
99 
101  GWResponseContext(GWResponse::Ptr response);
102 };
103 
111 public:
112  typedef Poco::SharedPtr<GWResponseWithAckContext> Ptr;
113 
115 
116  GWResponse::Status status();
117  void setStatus(GWResponse::Status);
118 
119 private:
120  GWResponse::Status m_status;
121 };
122 
127 public:
128  typedef Poco::SharedPtr<GWSensorDataExportContext> Ptr;
129 
131 };
132 
138 public:
139  bool operator()(const GWMessageContext::Ptr a, const GWMessageContext::Ptr b);
140 };
141 
142 }
Definition: GlobalID.h:10
Definition: GWMessageContext.h:137
Definition: GWMessageContext.h:96
Definition: GWMessageContext.h:126
Status
Definition: GWResponse.h:59
Definition: GWMessageContext.h:37
Definition: GWMessageContext.h:63
Definition: GWMessageContext.h:80
Definition: GWMessageContext.h:110