F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SocketReadTask.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title SocketReadTask.hpp
3// \author mstarch
4// \brief hpp file for SocketReadTask 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#ifndef DRV_SOCKETREADTASK_HPP
13#define DRV_SOCKETREADTASK_HPP
14
15#include <Fw/Buffer/Buffer.hpp>
16#include <Drv/Ip/IpSocket.hpp>
17#include <Os/Task.hpp>
18
19namespace Drv {
28 public:
33
37 virtual ~SocketReadTask();
38
52 void startSocketTask(const Fw::StringBase &name,
53 const bool reconnect = true,
56 const NATIVE_UINT_TYPE cpuAffinity = Os::Task::TASK_DEFAULT);
57
68
80
90 void close();
91
101 void shutdown();
102
109 void stopSocketTask();
110
119 Os::Task::TaskStatus joinSocketTask(void** value_ptr);
120
121
122 PROTECTED:
134
145 virtual Fw::Buffer getBuffer() = 0;
146
157 virtual void sendBuffer(Fw::Buffer buffer, SocketIpStatus status) = 0;
158
162 virtual void connected() = 0;
163
169 static void readTask(void* pointer);
170
173 bool m_stop;
174
175};
176};
177#endif // DRV_SOCKETREADTASK_HPP
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
Helper base-class for setting up Berkeley sockets.
Definition IpSocket.hpp:46
supports a task to read a given socket adaptation
virtual void connected()=0
called when the IPv4 system has been connected
void stopSocketTask()
stop the socket read task and close the associated socket.
virtual IpSocket & getSocketHandler()=0
returns a reference to the socket handler
bool m_stop
Stops the task when set to true.
virtual Fw::Buffer getBuffer()=0
returns a buffer to fill with data
void close()
close the socket communications
static void readTask(void *pointer)
a task designed to read from the socket and output incoming data
void shutdown()
shutdown the socket communications
virtual ~SocketReadTask()
destructor of the socket read task
void startSocketTask(const Fw::StringBase &name, const bool reconnect=true, const NATIVE_UINT_TYPE priority=Os::Task::TASK_DEFAULT, const NATIVE_UINT_TYPE stack=Os::Task::TASK_DEFAULT, const NATIVE_UINT_TYPE cpuAffinity=Os::Task::TASK_DEFAULT)
start the socket read task to start producing data
bool m_reconnect
Force reconnection.
SocketIpStatus open()
open the socket for communications
virtual void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)=0
sends a buffer to be filled with data
SocketIpStatus startup()
startup the socket for communications
SocketReadTask()
constructs the socket read task
Os::Task::TaskStatus joinSocketTask(void **value_ptr)
joins to the stopping read task to wait for it to close
forward declaration
Definition Task.hpp:15
static const NATIVE_UINT_TYPE TASK_DEFAULT
Definition Task.hpp:17
TaskStatus
Definition Task.hpp:18
SocketIpStatus
Status enumeration for socket return values.
Definition IpSocket.hpp:23