 |
F´ Flight Software - C/C++ Documentation
NASA-v2.1.0
A framework for building embedded system applications to NASA flight quality standards.
|
Go to the documentation of this file.
18 #define MAXIMUM_SIZE 0x7FFFFFFF
67 if ((not self->getSocketHandler().isOpened()) and (not self->m_stop) and
69 Fw::Logger::logMsg(
"[WARNING] Failed to open port with status %d and errno %d\n", status, errno);
74 if (self->getSocketHandler().isOpened() and (not self->m_stop)) {
78 I32 size =
static_cast<I32
>(buffer.
getSize());
80 status =
self->getSocketHandler().recv(data, size);
82 Fw::Logger::logMsg(
"[WARNING] Failed to recv from port with status %d and errno %d\n", status, errno);
83 self->getSocketHandler().close();
89 self->sendBuffer(buffer, status);
93 while (not self->m_stop &&
95 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.
void startSocketTask(const Fw::StringBase &name, const bool reconnect=true, const NATIVE_INT_TYPE priority=-1, const NATIVE_INT_TYPE stack=-1, const NATIVE_INT_TYPE cpuAffinity=-1)
start the socket read task to start producing data
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
virtual void connected()=0
called when the IPv4 system has been connected
@ SOCKET_RETRY_INTERVAL_MS
TaskStatus start(const Fw::StringBase &name, taskRoutine routine, void *arg, NATIVE_UINT_TYPE priority=TASK_DEFAULT, NATIVE_UINT_TYPE stackSize=TASK_DEFAULT, NATIVE_UINT_TYPE cpuAffinity=TASK_DEFAULT, NATIVE_UINT_TYPE identifier=TASK_DEFAULT)
start the 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)
static TaskStatus delay(NATIVE_UINT_TYPE msecs)
delay 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.