12 #ifndef DRV_SocketComponentHelper_HPP 13 #define DRV_SocketComponentHelper_HPP 211 static void readTask(
void* pointer);
234 #endif // DRV_SocketComponentHelper_HPP SocketComponentHelper()
constructs the socket read task
bool m_reopen
Force reopen on disconnect.
static constexpr FwSizeType TASK_DEFAULT
bool m_stop
Stops the task when set to true.
void shutdown()
shutdown the socket communications
SocketIpStatus send(const U8 *const data, const U32 size)
send data to the IP socket from the given buffer
bool isOpened()
check if IP socket has previously been opened
void setAutomaticOpen(bool auto_open)
set socket to automatically open connections when true, or not when false
virtual Fw::Buffer getBuffer()=0
returns a buffer to fill with data
supports a task to read a given socket adaptation
OpenState m_open
Have we successfully opened.
void close()
close the socket communications
virtual void connected()=0
called when the IPv4 system has been connected
virtual IpSocket & getSocketHandler()=0
returns a reference to the socket handler
uint8_t U8
8-bit unsigned integer
FwSizeType ParamType
backwards-compatible parameter type
SocketIpStatus recv(U8 *data, U32 &size)
receive data from the IP socket from the given buffer
virtual ~SocketComponentHelper()
destructor of the socket read task
static void readTask(void *pointer)
a task designed to read from the socket and output incoming data
void stop()
stop the socket read task and close the associated socket.
virtual void readLoop()
receive off the TCP socket
SocketDescriptor m_descriptor
Os::Task::Status join()
joins to the stopping read task to wait for it to close
SocketIpStatus
Status enumeration for socket return values.
SocketIpStatus open()
open the socket for communications
Helper base-class for setting up Berkeley sockets.
virtual void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)=0
sends a buffer to be filled with data
void start(const Fw::StringBase &name, const Os::Task::ParamType priority=Os::Task::TASK_DEFAULT, const Os::Task::ParamType stack=Os::Task::TASK_DEFAULT, const Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT)
start the socket read task to start producing data
bool running()
is the read loop running