F´ Flight Software - C/C++ Documentation
NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
g
h
i
m
r
s
t
v
w
Variables
Typedefs
Enumerations
Enumerator
a
b
f
h
i
n
o
p
s
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
b
d
e
f
g
h
i
l
m
n
p
q
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
l
m
n
o
p
q
r
s
t
w
Related Functions
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
Functions
f
i
m
s
u
Variables
Typedefs
Enumerations
Enumerator
c
d
f
m
p
r
s
t
Macros
a
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
UdpReceiverComponentImpl.hpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title UdpReceiverImpl.hpp
3
// \author tcanham
4
// \brief hpp file for UdpReceiver component implementation class
5
//
6
// \copyright
7
// Copyright 2009-2015, by the California Institute of Technology.
8
// ALL RIGHTS RESERVED. United States Government Sponsorship
9
// acknowledged.
10
//
11
// ======================================================================
12
13
#ifndef UdpReceiver_HPP
14
#define UdpReceiver_HPP
15
16
#include "Svc/UdpReceiver/UdpReceiverComponentAc.hpp"
17
#include "
UdpReceiverComponentImplCfg.hpp
"
18
19
namespace
Svc
{
20
21
class
UdpReceiverComponentImpl
:
22
public
UdpReceiverComponentBase
23
{
24
25
public
:
26
27
// ----------------------------------------------------------------------
28
// Construction, initialization, and destruction
29
// ----------------------------------------------------------------------
30
33
UdpReceiverComponentImpl
(
34
const
char
*
const
compName
35
);
36
39
void
init
(
40
const
NATIVE_INT_TYPE
instance = 0
41
);
42
45
~UdpReceiverComponentImpl
(
void
);
46
48
void
open
(
49
const
char
* port
50
);
51
53
void
startThread
(
54
NATIVE_UINT_TYPE
priority,
55
NATIVE_UINT_TYPE
stackSize,
56
NATIVE_UINT_TYPE
affinity
57
);
58
59
60
PRIVATE:
61
62
// ----------------------------------------------------------------------
63
// Handler implementations for user-defined typed input ports
64
// ----------------------------------------------------------------------
65
68
void
Sched_handler(
69
const
NATIVE_INT_TYPE
portNum,
70
NATIVE_UINT_TYPE
context
71
);
72
73
static
void
workerTask(
void
* ptr);
74
void
doRecv(
void
);
75
Os::Task
m_socketTask;
76
77
NATIVE_INT_TYPE
m_fd;
78
79
class
UdpSerialBuffer :
80
public
Fw::SerializeBufferBase
81
{
82
83
public
:
84
85
#ifdef BUILD_UT
86
void
operator=(
const
UdpSerialBuffer& other);
87
UdpSerialBuffer(
const
Fw::SerializeBufferBase
& other);
88
UdpSerialBuffer(
const
UdpSerialBuffer& other);
89
UdpSerialBuffer();
90
#endif
91
92
NATIVE_UINT_TYPE
getBuffCapacity(
void
)
const
{
93
return
sizeof
(m_buff);
94
}
95
96
// Get the max number of bytes that can be serialized
97
NATIVE_UINT_TYPE
getBuffSerLeft(
void
)
const
{
98
99
const
NATIVE_UINT_TYPE
size = getBuffCapacity();
100
const
NATIVE_UINT_TYPE
loc = getBuffLength();
101
102
if
(loc >= (size-1) ) {
103
return
0;
104
}
105
else
{
106
return
(size - loc - 1);
107
}
108
}
109
110
U8
* getBuffAddr(
void
) {
111
return
m_buff;
112
}
113
114
const
U8
* getBuffAddr(
void
)
const
{
115
return
m_buff;
116
}
117
118
private
:
119
// Should be the max of all the input ports serialized sizes...
120
U8
m_buff[
UDP_RECEIVER_MSG_SIZE
];
121
122
} m_recvBuff;
123
124
UdpSerialBuffer m_portBuff;
125
126
U32 m_packetsReceived;
127
U32 m_bytesReceived;
128
U32 m_packetsDropped;
129
U32 m_decodeErrors;
130
131
bool
m_firstSeq;
132
U8
m_currSeq;
133
134
135
};
136
137
}
// end namespace Svc
138
139
#endif
Fw::SerializeBufferBase
Definition:
Serializable.hpp:43
Svc::UdpReceiverComponentImpl
Definition:
UdpReceiverComponentImpl.hpp:21
Svc::UDP_RECEIVER_MSG_SIZE
const static NATIVE_UINT_TYPE UDP_RECEIVER_MSG_SIZE
Definition:
UdpReceiverComponentImplCfg.hpp:12
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.hpp:76
Svc::UdpReceiverComponentImpl::init
void init(const NATIVE_INT_TYPE instance=0)
Definition:
UdpReceiverComponentImpl.cpp:50
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition:
BasicTypes.hpp:30
Svc::UdpReceiverComponentImpl::~UdpReceiverComponentImpl
~UdpReceiverComponentImpl(void)
Definition:
UdpReceiverComponentImpl.cpp:58
Svc::UdpReceiverComponentImpl::open
void open(const char *port)
Open the connection.
Definition:
UdpReceiverComponentImpl.cpp:65
Svc::UdpReceiverComponentImpl::startThread
void startThread(NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE affinity)
start worker thread
Definition:
UdpReceiverComponentImpl.cpp:96
Svc::UdpReceiverComponentImpl::UdpReceiverComponentImpl
UdpReceiverComponentImpl(const char *const compName)
Definition:
UdpReceiverComponentImpl.cpp:35
Os::Task
forward declaration
Definition:
Task.hpp:15
Svc
Definition:
ActiveRateGroupImplCfg.hpp:18
UdpReceiverComponentImplCfg.hpp
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition:
BasicTypes.hpp:29
Svc
UdpReceiver
UdpReceiverComponentImpl.hpp
Generated by
1.8.17