F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TcpClientComponentImpl.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TcpClientComponentImpl.hpp
3 // \author mstarch
4 // \brief hpp file for TcpClientComponentImpl component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2020, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef TcpClientComponentImpl_HPP
14 #define TcpClientComponentImpl_HPP
15 
16 #include <Drv/Ip/IpSocket.hpp>
20 
21 namespace Drv {
22 
24  public:
25  // ----------------------------------------------------------------------
26  // Construction, initialization, and destruction
27  // ----------------------------------------------------------------------
28 
33  TcpClientComponentImpl(const char* const compName);
34 
39 
40  // ----------------------------------------------------------------------
41  // Helper methods to start and stop socket
42  // ----------------------------------------------------------------------
43 
60  SocketIpStatus configure(const char* hostname,
61  const U16 port,
62  const U32 send_timeout_seconds = SOCKET_SEND_TIMEOUT_SECONDS,
63  const U32 send_timeout_microseconds = SOCKET_SEND_TIMEOUT_MICROSECONDS,
64  FwSizeType buffer_size = 1024);
65 
66  PROTECTED:
67  // ----------------------------------------------------------------------
68  // Implementations for socket read task virtual methods
69  // ----------------------------------------------------------------------
70 
80 
90 
99  void sendBuffer(Fw::Buffer buffer, SocketIpStatus status);
100 
104  void connected();
105 
106 
107  PRIVATE:
108 
109  // ----------------------------------------------------------------------
110  // Handler implementations for user-defined typed input ports
111  // ----------------------------------------------------------------------
112 
128  Drv::SendStatus send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer);
129 
130  Drv::TcpClientSocket m_socket;
131 
132  // Member variable to store the buffer size
133  FwSizeType m_allocation_size;
134 };
135 
136 } // end namespace Drv
137 
138 #endif // end TcpClientComponentImpl
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
@ SOCKET_SEND_TIMEOUT_SECONDS
Definition: IpCfg.hpp:17
@ SOCKET_SEND_TIMEOUT_MICROSECONDS
Definition: IpCfg.hpp:18
Helper base-class for setting up Berkeley sockets.
Definition: IpSocket.hpp:55
Status returned by the send call.
supports a task to read a given socket adaptation
Auto-generated base for TcpClient component.
SocketIpStatus configure(const char *hostname, const U16 port, const U32 send_timeout_seconds=SOCKET_SEND_TIMEOUT_SECONDS, const U32 send_timeout_microseconds=SOCKET_SEND_TIMEOUT_MICROSECONDS, FwSizeType buffer_size=1024)
Configures the TcpClient settings but does not open the connection.
TcpClientComponentImpl(const char *const compName)
construct the TcpClient component.
void connected()
called when the IPv4 system has been connected
void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)
sends a buffer to be filled with data
IpSocket & getSocketHandler()
returns a reference to the socket handler
Fw::Buffer getBuffer()
returns a buffer to fill with data
~TcpClientComponentImpl()
Destroy the component.
Helper for setting up Tcp using Berkeley sockets as a client.
SocketIpStatus
Status enumeration for socket return values.
Definition: IpSocket.hpp:29