F´ Flight Software - C/C++ Documentation
NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
j
l
m
o
p
r
s
t
u
v
w
Variables
b
c
f
g
k
l
m
o
p
r
s
t
u
w
z
Typedefs
a
b
c
d
e
f
g
h
i
l
n
o
p
r
s
t
u
v
w
Enumerations
Enumerator
a
b
f
h
i
k
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
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
a
b
c
e
f
i
m
r
s
t
w
Enumerations
b
c
d
f
g
h
m
o
q
r
s
t
u
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Related Symbols
:
a
b
c
d
f
g
h
l
p
q
r
s
t
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Functions
f
g
i
m
p
r
s
t
u
Variables
_
b
c
f
g
i
l
p
r
s
w
Typedefs
a
b
c
e
f
i
n
p
s
t
u
Enumerations
Enumerator
a
b
c
f
g
h
p
r
s
t
Macros
_
a
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
►
F´ Flight Software - C/C++ Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
BufferLogger.hpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title BufferLogger.hpp
3
// \author bocchino, dinkel, mereweth
4
// \brief Svc Buffer Logger interface
5
//
6
// \copyright
7
// Copyright (C) 2015-2017 California Institute of Technology.
8
// ALL RIGHTS RESERVED. United States Government Sponsorship
9
// acknowledged.
10
//
11
// ======================================================================
12
13
#ifndef Svc_BufferLogger_HPP
14
#define Svc_BufferLogger_HPP
15
16
#include "
Svc/BufferLogger/BufferLoggerComponentAc.hpp
"
17
#include "
Os/File.hpp
"
18
#include "
Fw/Types/String.hpp
"
19
#include "
Fw/Types/Assert.hpp
"
20
#include "
Os/Mutex.hpp
"
21
#include "
Utils/Hash/Hash.hpp
"
22
23
namespace
Svc
{
24
25
class
BufferLogger
:
26
public
BufferLoggerComponentBase
27
{
28
29
PRIVATE:
30
31
// ----------------------------------------------------------------------
32
// Types
33
// ----------------------------------------------------------------------
34
36
class
File {
37
38
public
:
39
41
struct
Mode
{
42
typedef
enum
{
43
CLOSED
= 0,
44
OPEN
= 1
45
}
t
;
42
typedef
enum
{
…
};
46
};
41
struct
Mode
{
…
};
47
48
public
:
49
51
File(
52
BufferLogger
& bufferLogger
53
);
54
56
~File();
57
58
public
:
59
61
void
init
(
62
const
char
*
const
prefix,
63
const
char
*
const
suffix,
64
const
U32 maxSize,
65
const
U8
sizeOfSize
66
);
67
69
void
setBaseName(
70
const
Fw::StringBase
& baseName
71
);
72
74
void
logBuffer(
75
const
U8
*
const
data,
76
const
U32 size
77
);
78
80
void
closeAndEmitEvent();
81
83
bool
flush();
84
85
PRIVATE:
86
88
void
open();
89
92
bool
writeBuffer(
93
const
U8
*
const
data,
94
const
U32 size
95
);
96
99
bool
writeSize(
100
const
U32 size
101
);
102
105
bool
writeBytes(
106
const
void
*
const
data,
107
const
U32 length
108
);
109
111
void
writeHashFile();
112
114
void
close();
115
116
PRIVATE:
117
119
BufferLogger
& bufferLogger;
120
122
Fw::String
prefix;
123
125
Fw::String
suffix;
126
128
Fw::String
baseName;
129
131
NATIVE_UINT_TYPE
fileCounter;
132
134
U32 maxSize;
135
137
U8
sizeOfSize;
138
140
Fw::String
name;
141
142
// The current mode
143
Mode::t
mode;
144
146
Os::File
osFile;
147
149
U32 bytesWritten;
150
151
};
// class File
152
153
public
:
154
155
// ----------------------------------------------------------------------
156
// Construction, initialization, and destruction
157
// ----------------------------------------------------------------------
158
160
BufferLogger
(
161
const
char
*
const
compName
162
);
163
165
void
init
(
166
const
NATIVE_INT_TYPE
queueDepth,
167
const
NATIVE_INT_TYPE
instance
168
);
169
170
// ----------------------------------------------------------------------
171
// Public methods
172
// ----------------------------------------------------------------------
173
175
void
initLog
(
176
const
char
*
const
logFilePrefix,
177
const
char
*
const
logFileSuffix,
178
const
U32 maxFileSize,
179
const
U8
sizeOfSize
180
);
181
182
PRIVATE:
183
184
// ----------------------------------------------------------------------
185
// Handler implementations for user-defined typed input ports
186
// ----------------------------------------------------------------------
187
190
void
bufferSendIn_handler(
191
const
NATIVE_INT_TYPE
portNum,
192
Fw::Buffer
& fwBuffer
193
);
194
197
void
comIn_handler(
198
const
NATIVE_INT_TYPE
portNum,
199
Fw::ComBuffer
&data,
200
U32 context
201
);
202
205
void
pingIn_handler(
206
const
NATIVE_INT_TYPE
portNum,
207
U32 key
208
);
209
212
void
schedIn_handler(
213
const
NATIVE_INT_TYPE
portNum,
214
NATIVE_UINT_TYPE
context
215
);
216
217
PRIVATE:
218
219
// ----------------------------------------------------------------------
220
// Command handler implementations
221
// ----------------------------------------------------------------------
222
225
void
BL_OpenFile_cmdHandler(
226
const
FwOpcodeType
opCode,
227
const
U32 cmdSeq,
228
const
Fw::CmdStringArg
& file
229
);
230
233
void
BL_CloseFile_cmdHandler(
234
const
FwOpcodeType
opCode,
235
const
U32 cmdSeq
236
);
237
240
void
BL_SetLogging_cmdHandler(
241
const
FwOpcodeType
opCode,
242
const
U32 cmdSeq,
243
BufferLogger_LogState
state
244
);
245
248
void
BL_FlushFile_cmdHandler(
249
const
FwOpcodeType
opCode,
250
const
U32 cmdSeq
251
);
252
253
PRIVATE:
254
255
// ----------------------------------------------------------------------
256
// Private instance variables
257
// ----------------------------------------------------------------------
258
260
BufferLogger_LogState
m_state;
261
263
File m_file;
264
265
};
25
class
BufferLogger
: {
…
};
266
267
}
268
269
#endif
Assert.hpp
NATIVE_INT_TYPE
PlatformIntType NATIVE_INT_TYPE
Definition
BasicTypes.h:51
U8
uint8_t U8
8-bit unsigned integer
Definition
BasicTypes.h:26
NATIVE_UINT_TYPE
PlatformUIntType NATIVE_UINT_TYPE
Definition
BasicTypes.h:52
BufferLoggerComponentAc.hpp
File.hpp
FwOpcodeType
U32 FwOpcodeType
Definition
FpConfig.h:56
Hash.hpp
Mutex.hpp
String.hpp
Fw::Buffer
Definition
Buffer.hpp:43
Fw::CmdStringArg
Definition
CmdString.hpp:10
Fw::ComBuffer
Definition
ComBuffer.hpp:20
Fw::ObjBase::init
void init()
Object initializer.
Definition
ObjBase.cpp:27
Fw::StringBase
Definition
StringType.hpp:23
Fw::String
Definition
String.hpp:10
Os::File
Definition
File.hpp:10
Svc::BufferLogger_LogState
Definition
BufferLogger_LogStateEnumAc.hpp:18
Svc::BufferLoggerComponentBase
Auto-generated base for BufferLogger component.
Definition
BufferLoggerComponentAc.hpp:38
Svc::BufferLogger
Definition
BufferLogger.hpp:27
Svc::BufferLogger::initLog
void initLog(const char *const logFilePrefix, const char *const logFileSuffix, const U32 maxFileSize, const U8 sizeOfSize)
Set up log file parameters.
Definition
BufferLogger.cpp:46
Svc::BufferLogger::BufferLogger
BufferLogger(const char *const compName)
Create a BufferLogger object.
Definition
BufferLogger.cpp:23
Svc
Definition
ActiveRateGroupCfg.hpp:18
Svc::BufferLogger::File::Mode
The file mode.
Definition
BufferLogger.hpp:41
Svc::BufferLogger::File::Mode::t
t
Definition
BufferLogger.hpp:42
Svc::BufferLogger::File::Mode::CLOSED
@ CLOSED
Definition
BufferLogger.hpp:43
Svc::BufferLogger::File::Mode::OPEN
@ OPEN
Definition
BufferLogger.hpp:44
Svc
BufferLogger
BufferLogger.hpp
Generated by
1.10.0