HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
apps/transport.h
Go to the documentation of this file.
1 // =============================================================================
15 // =============================================================================
16 
17 #ifndef HF_APP_TRANSPORT_H
18 #define HF_APP_TRANSPORT_H
19 
20 #include <forward_list>
21 
22 #include "uv.h"
23 
24 #include "hanfun.h"
25 
26 // =============================================================================
27 // API
28 // =============================================================================
29 
30 namespace HF
31 {
36  namespace Application
37  {
42  {
43  protected:
44 
45  uv_tcp_t socket;
46 
47  public:
48 
49  virtual ~Transport() {}
50 
51  void initialize();
52 
53  void destroy();
54  };
55 
60  {
61  protected:
62 
64 
65  uv_stream_s *stream;
66 
67  public:
68 
75  Link(Transport *_tsp, uv_stream_s *stream):
76  HF::Transport::AbstractLink(), tsp(_tsp), stream(stream)
77  {
78  stream->data = this;
79  }
80 
81  virtual ~Link()
82  {}
83 
84  void send(HF::Common::ByteArray &array);
85 
86  Transport *transport() const
87  {
88  return tsp;
89  }
90  };
91 
92  } // namespace Application
93 
96 } // namespace HF
97 
98 #endif /* HF_TRANSPORT_H */
This is the top level include file for the HAN-FUN library.
Transport Layer implementation over TCP/IP using libuv.
Parent class for transport layer implementations on a HAN-FUN Concentrator device.
Definition: devices.h:929
void destroy()
Free the system resources associated with this transport layer.
Definition: transport.cpp:576
uv_tcp_t socket
libuv tcp/ip socket.
This class represents a byte array.
void send(HF::Common::ByteArray &array)
Send the data in the given ByteArray using the link to the remote end-point.
Definition: transport.cpp:588
void initialize()
Initialize the associated transport layer.
Definition: transport.cpp:474
Top-level namespace for the HAN-FUN library.
Definition: attributes.h:22