 |
F´ Flight Software - C/C++ Documentation
NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
|
Go to the documentation of this file.
18 #define MAXIMUM_SIZE 0x7FFFFFFF
62 if ((not self->getSocketHandler().isOpened()) and (not self->m_stop) and
63 ((status = self->getSocketHandler().open()) !=
SOCK_SUCCESS)) {
64 Fw::Logger::logMsg(
"[WARNING] Failed to open port with status %d and errno %d\n", status, errno);
69 if (self->getSocketHandler().isOpened() and (not self->m_stop)) {
73 I32 size =
static_cast<I32
>(buffer.
getSize());
75 status =
self->getSocketHandler().recv(data, size);
77 Fw::Logger::logMsg(
"[WARNING] Failed to recv from port with status %d and errno %d\n", status, errno);
78 self->getSocketHandler().close();
84 self->sendBuffer(buffer, status);
88 while (not self->m_stop &&
90 self->getSocketHandler().close();
void stopSocketTask(void)
stop the socket read task and close the associated socket.
SocketIpStatus open(void)
open the IP socket for communications
@ SOCK_SUCCESS
Socket operation successful.
@ SOCK_INTERRUPTED_TRY_AGAIN
Interrupted status for retries.
SocketReadTask()
constructs the socket read task
uint8_t U8
8-bit unsigned integer
bool m_reconnect
Force reconnection.
SocketIpStatus open()
open the socket for communications
bool m_stop
Stops the task when set to true.
void close()
close the socket communications
virtual IpSocket & getSocketHandler()=0
returns a reference to the socket handler
@ TASK_OK
message sent/received okay
supports a task to read a given socket adaptation
bool isStarted(void)
check to see if task is started
void startSocketTask(const Fw::StringBase &name, const NATIVE_INT_TYPE priority, const NATIVE_INT_TYPE stack, const bool reconnect=true, const NATIVE_INT_TYPE cpuAffinity=-1)
start the socket read task to start producing data
@ SOCKET_RETRY_INTERVAL_MS
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)
static TaskStatus delay(NATIVE_UINT_TYPE msecs)
delay the task
TaskStatus start(const Fw::StringBase &name, NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, taskRoutine routine, void *arg, NATIVE_INT_TYPE cpuAffinity=-1)
start the task
SocketIpStatus
Status enumeration for socket return values.
virtual ~SocketReadTask()
destructor of the socket read task
static void readTask(void *pointer)
a task designed to read from the socket and output incoming data
Os::Task::TaskStatus joinSocketTask(void **value_ptr)
joins to the stopping read task to wait for it to close
int NATIVE_INT_TYPE
native integer type declaration
void close(void)
closes the socket
TaskStatus join(void **value_ptr)
Wait for task to finish.