F´ Flight Software - C/C++ Documentation  NASA-v2.1.0
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 
19 namespace Drv {
28  public:
33 
37  virtual ~SocketReadTask();
38 
52  void startSocketTask(const Fw::StringBase &name,
53  const bool reconnect = true,
54  const NATIVE_INT_TYPE priority = -1,
55  const NATIVE_INT_TYPE stack = -1,
56  const NATIVE_INT_TYPE cpuAffinity = -1);
57 
69 
78  void close();
79 
86  void stopSocketTask(void);
87 
96  Os::Task::TaskStatus joinSocketTask(void** value_ptr);
97 
98 
99  PROTECTED:
110  virtual IpSocket& getSocketHandler() = 0;
111 
122  virtual Fw::Buffer getBuffer() = 0;
123 
134  virtual void sendBuffer(Fw::Buffer buffer, SocketIpStatus status) = 0;
135 
139  virtual void connected() = 0;
140 
146  static void readTask(void* pointer);
147 
149  bool m_reconnect;
150  bool m_stop;
151 
152 };
153 };
154 #endif // DRV_SOCKETREADTASK_HPP
Drv::SocketReadTask::stopSocketTask
void stopSocketTask(void)
stop the socket read task and close the associated socket.
Definition: SocketReadTask.cpp:56
Drv::SocketReadTask::startSocketTask
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
Definition: SocketReadTask.cpp:26
Drv::SocketReadTask::SocketReadTask
SocketReadTask()
constructs the socket read task
Definition: SocketReadTask.cpp:22
Fw::StringBase
Definition: StringType.hpp:23
Drv::IpSocket
Helper base-class for setting up Berkley sockets.
Definition: IpSocket.hpp:45
Drv::SocketReadTask::m_reconnect
bool m_reconnect
Force reconnection.
Definition: SocketReadTask.hpp:149
Buffer.hpp
Drv
Definition: BlockDriverImpl.cpp:5
Task.hpp
Drv::SocketReadTask::open
SocketIpStatus open()
open the socket for communications
Definition: SocketReadTask.cpp:39
Drv::SocketReadTask::m_stop
bool m_stop
Stops the task when set to true.
Definition: SocketReadTask.hpp:150
Fw::Buffer
Definition: Buffer.hpp:43
Drv::SocketReadTask::close
void close()
close the socket communications
Definition: SocketReadTask.cpp:48
Drv::SocketReadTask::m_task
Os::Task m_task
Definition: SocketReadTask.hpp:148
Drv::SocketReadTask::getSocketHandler
virtual IpSocket & getSocketHandler()=0
returns a reference to the socket handler
Os::Task::TaskStatus
TaskStatus
Definition: Task.hpp:19
Drv::SocketReadTask
supports a task to read a given socket adaptation
Definition: SocketReadTask.hpp:27
Drv::SocketReadTask::connected
virtual void connected()=0
called when the IPv4 system has been connected
Os::Task
forward declaration
Definition: Task.hpp:16
Drv::SocketIpStatus
SocketIpStatus
Status enumeration for socket return values.
Definition: IpSocket.hpp:23
Drv::SocketReadTask::~SocketReadTask
virtual ~SocketReadTask()
destructor of the socket read task
Definition: SocketReadTask.cpp:24
Drv::SocketReadTask::readTask
static void readTask(void *pointer)
a task designed to read from the socket and output incoming data
Definition: SocketReadTask.cpp:61
Drv::SocketReadTask::sendBuffer
virtual void sendBuffer(Fw::Buffer buffer, SocketIpStatus status)=0
sends a buffer to be filled with data
Drv::SocketReadTask::joinSocketTask
Os::Task::TaskStatus joinSocketTask(void **value_ptr)
joins to the stopping read task to wait for it to close
Definition: SocketReadTask.cpp:52
IpSocket.hpp
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
Drv::SocketReadTask::getBuffer
virtual Fw::Buffer getBuffer()=0
returns a buffer to fill with data