F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
UdpComponentImpl.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title UdpComponentImpl.hpp
3 // \author mstarch
4 // \brief hpp file for UdpComponentImpl 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 UdpComponentImpl_HPP
14 #define UdpComponentImpl_HPP
15 
16 #include <Drv/Ip/IpSocket.hpp>
18 #include <Drv/Ip/UdpSocket.hpp>
20 
21 namespace Drv {
22 
24  public:
25  // ----------------------------------------------------------------------
26  // Construction, initialization, and destruction
27  // ----------------------------------------------------------------------
28 
33  UdpComponentImpl(const char* const compName);
34 
39 
40  // ----------------------------------------------------------------------
41  // Helper methods to start and stop socket
42  // ----------------------------------------------------------------------
43 
59  SocketIpStatus configureSend(const char* hostname,
60  const U16 port,
61  const U32 send_timeout_seconds = SOCKET_SEND_TIMEOUT_SECONDS,
62  const U32 send_timeout_microseconds = SOCKET_SEND_TIMEOUT_MICROSECONDS);
63 
75  SocketIpStatus configureRecv(const char* hostname, const U16 port);
76 
85  U16 getRecvPort();
86 
87 
88 PROTECTED:
89  // ----------------------------------------------------------------------
90  // Implementations for socket read task virtual methods
91  // ----------------------------------------------------------------------
92 
102 
112 
121  void sendBuffer(Fw::Buffer buffer, SocketIpStatus status);
122 
126  void connected();
127 
128  PRIVATE:
129 
130  // ----------------------------------------------------------------------
131  // Handler implementations for user-defined typed input ports
132  // ----------------------------------------------------------------------
133 
149  Drv::SendStatus send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer);
150 
151  Drv::UdpSocket m_socket;
152 };
153 
154 } // end namespace Drv
155 
156 #endif // end UdpComponentImpl
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
@ 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:47
Status returned by the send call.
supports a task to read a given socket adaptation
Auto-generated base for Udp component.
SocketIpStatus configureRecv(const char *hostname, const U16 port)
Configures the Udp receive settings but does not open the connection.
void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)
sends a buffer to be filled with data
Fw::Buffer getBuffer()
returns a buffer to fill with data
IpSocket & getSocketHandler()
returns a reference to the socket handler
void connected()
called when the IPv4 system has been connected
U16 getRecvPort()
get the port being received on
~UdpComponentImpl()
Destroy the component.
UdpComponentImpl(const char *const compName)
construct the TcpClient component.
SocketIpStatus configureSend(const char *hostname, const U16 port, const U32 send_timeout_seconds=SOCKET_SEND_TIMEOUT_SECONDS, const U32 send_timeout_microseconds=SOCKET_SEND_TIMEOUT_MICROSECONDS)
Configures the Udp send settings but does not open the connection.
Helper for setting up Udp using Berkeley sockets as a client.
Definition: UdpSocket.hpp:32
SocketIpStatus
Status enumeration for socket return values.
Definition: IpSocket.hpp:23