18 #define MAXIMUM_SIZE 0x7FFFFFFF
76 if ((not self->getSocketHandler().isStarted()) and (not self->m_stop) and
79 "[WARNING] Failed to open port with status %d and errno %d\n",
87 if ((not self->getSocketHandler().isOpened()) and (not self->m_stop) and
90 "[WARNING] Failed to open port with status %d and errno %d\n",
98 if (self->getSocketHandler().isStarted() and
self->getSocketHandler().isOpened() and (not self->m_stop)) {
103 status =
self->getSocketHandler().recv(data, size);
105 Fw::Logger::logMsg(
"[WARNING] Failed to recv from port with status %d and errno %d\n",
108 self->getSocketHandler().close();
114 self->sendBuffer(buffer, status);
118 while (not self->m_stop &&
120 self->getSocketHandler().shutdown();
PlatformPointerCastType POINTER_CAST
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
static const Fw::Time SOCKET_RETRY_INTERVAL
void close()
closes the socket
virtual void shutdown()
shutdown the socket
SocketIpStatus open()
open the IP socket for communications
virtual SocketIpStatus startup()
startup the socket, a no-op on unless this is server
supports a task to read a given socket adaptation
virtual void connected()=0
called when the IPv4 system has been connected
bool m_stop
Stops the task when set to true.
void close()
close the socket communications
static void readTask(void *pointer)
a task designed to read from the socket and output incoming data
virtual IpSocket & getSocketHandler()=0
returns a reference to the socket handler
void shutdown()
shutdown the socket communications
virtual ~SocketReadTask()
destructor of the socket read task
void stop()
stop the socket read task and close the associated socket.
bool m_reconnect
Force reconnection.
Os::Task::Status join()
joins to the stopping read task to wait for it to close
SocketIpStatus open()
open the socket for communications
void start(const Fw::StringBase &name, const bool reconnect=true, 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
SocketIpStatus startup()
startup the socket for communications
SocketReadTask()
constructs the socket read task
static void logMsg(const char *fmt, POINTER_CAST a0=0, POINTER_CAST a1=0, POINTER_CAST a2=0, POINTER_CAST a3=0, POINTER_CAST a4=0, POINTER_CAST a5=0, POINTER_CAST a6=0, POINTER_CAST a7=0, POINTER_CAST a8=0, POINTER_CAST a9=0)
State getState()
get the task's state
FwSizeType ParamType
backwards-compatible parameter type
Status start(const Arguments &arguments) override
start the task
Status join() override
block until the task has ended
@ OP_OK
message sent/received okay
static Status delay(Fw::Time interval)
delay the current task
SocketIpStatus
Status enumeration for socket return values.
@ SOCK_SUCCESS
Socket operation successful.
@ SOCK_INTERRUPTED_TRY_AGAIN
Interrupted status for retries.