BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
GWSListener.h
1 #pragma once
2 
3 #include <string>
4 
5 #include <Poco/SharedPtr.h>
6 #include <Poco/Net/SocketAddress.h>
7 
8 #include "gwmessage/GWAck.h"
9 #include "gwmessage/GWRequest.h"
10 #include "gwmessage/GWResponse.h"
11 
12 namespace BeeeOn {
13 
19 class GWSListener {
20 public:
21  typedef Poco::SharedPtr<GWSListener> Ptr;
22 
23  struct Address {
24  const std::string host;
25  const int port;
26 
27  std::string toString() const;
28  };
29 
30  virtual ~GWSListener();
31 
36  virtual void onConnected(const Address &address);
37 
42  virtual void onDisconnected(const Address &address);
43 
47  virtual void onRequest(const GWRequest::Ptr request);
48 
52  virtual void onResponse(const GWResponse::Ptr response);
53 
57  virtual void onAck(const GWAck::Ptr ack);
58 
63  virtual void onOther(const GWMessage::Ptr other);
64 
70  virtual void onTrySend(const GWMessage::Ptr message);
71 
78  virtual void onSent(const GWMessage::Ptr message);
79 };
80 
81 }
virtual void onRequest(const GWRequest::Ptr request)
When a request is received, this event is fired.
Definition: GWSListener.cpp:24
virtual void onTrySend(const GWMessage::Ptr message)
Fire when a message is about to be sent to the server. After the send is successful (no network failu...
Definition: GWSListener.cpp:40
virtual void onConnected(const Address &address)
Fired when the connection to the remote server is successfully created and it is possible to exchange...
Definition: GWSListener.cpp:16
virtual void onDisconnected(const Address &address)
Fired when the connection to the remote server is considered broken or when it is disconnected on a r...
Definition: GWSListener.cpp:20
Definition: GWSListener.h:23
virtual void onAck(const GWAck::Ptr ack)
When an ack is received, this event is fired.
Definition: GWSListener.cpp:32
virtual void onSent(const GWMessage::Ptr message)
Fire when a message is being sent to the server. There might be a delay between putting a messing int...
Definition: GWSListener.cpp:44
virtual void onOther(const GWMessage::Ptr other)
When a message other then request, response or ack is received, this event is fired.
Definition: GWSListener.cpp:36
virtual void onResponse(const GWResponse::Ptr response)
When a response is received, this event is fired.
Definition: GWSListener.cpp:28
GWSListener provides an interface for delivering of events and messages related to communication with...
Definition: GWSListener.h:19