F´ Flight Software - C/C++ Documentation  NASA-v1.5.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
Events.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Events.cpp
3 // \author Bocchino
4 // \brief Implementation for CmdSequencerComponentImpl::Sequence::Events
5 //
6 // \copyright
7 // Copyright (C) 2009-2018 California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #include "Fw/Types/Assert.hpp"
15 
16 namespace Svc {
17 
20  toComponentEnum(const t fileReadStage)
21  {
24  FW_ASSERT(result >= 0, result);
25  FW_ASSERT(result < CmdSequencerComponentImpl::FileReadStage_MAX, result);
26  switch(fileReadStage) {
27  case READ_HEADER:
28  result = CmdSequencerComponentImpl::SEQ_READ_HEADER;
29  break;
30  case READ_HEADER_SIZE:
32  break;
33  case DESER_SIZE:
35  break;
36  case DESER_NUM_RECORDS:
38  break;
39  case DESER_TIME_BASE:
41  break;
42  case DESER_TIME_CONTEXT:
44  break;
45  case READ_SEQ_CRC:
47  break;
48  case READ_SEQ_DATA:
50  break;
51  case READ_SEQ_DATA_SIZE:
53  break;
54  default:
55  FW_ASSERT(0, fileReadStage);
56  break;
57  }
58  return result;
59  }
60 
62  Events(Sequence& sequence) :
63  m_sequence(sequence)
64  {
65 
66  }
67 
69  fileCRCFailure(const U32 storedCRC, const U32 computedCRC)
70  {
71  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
72  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
74  logFileName,
75  storedCRC,
76  computedCRC
77  );
78  component.error();
79  }
80 
82  fileInvalid(const FileReadStage::t stage, const I32 error)
83  {
84  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
85  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
87  logFileName,
88  FileReadStage::toComponentEnum(stage),
89  error
90  );
91  component.error();
92  }
93 
95  fileNotFound(void)
96  {
97  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
98  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
99  component.log_WARNING_HI_CS_FileNotFound(logFileName);
100  component.error();
101  }
102 
104  fileReadError(void)
105  {
106  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
107  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
108  component.log_WARNING_HI_CS_FileReadError(logFileName);
109  component.error();
110  }
111 
113  fileSizeError(const U32 size)
114  {
115  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
116  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
118  logFileName,
119  size
120  );
121  component.error();
122  }
123 
125  recordInvalid(const U32 recordNumber, const I32 error)
126  {
127  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
128  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
130  logFileName,
131  recordNumber,
132  error
133  );
134  component.error();
135  }
136 
138  recordMismatch(const U32 numRecords, const U32 extraBytes)
139  {
140  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
141  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
143  logFileName,
144  numRecords,
145  extraBytes
146  );
147  // TODO: Should this be an error?
148  }
149 
151  timeBaseMismatch(const FwTimeBaseStoreType currTimeBase, const FwTimeBaseStoreType seqTimeBase)
152  {
153  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
154  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
156  logFileName,
157  currTimeBase,
158  seqTimeBase
159  );
160  component.error();
161  }
162 
165  const FwTimeContextStoreType currTimeContext,
166  const FwTimeContextStoreType seqTimeContext
167  )
168  {
169  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
170  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
172  logFileName,
173  currTimeContext,
174  seqTimeContext
175  );
176  component.error();
177  }
178 
179 }
180 
Svc::CmdSequencerComponentBase::SEQ_READ_SEQ_DATA
PROTECTED SEQ_READ_SEQ_DATA
Definition: CmdSequencerComponentAc.hpp:898
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_FileSizeError
void log_WARNING_HI_CS_FileSizeError(Fw::LogStringArg &fileName, U32 size)
Definition: CmdSequencerComponentAc.cpp:2269
Svc::CmdSequencerComponentBase::SEQ_READ_SEQ_DATA_SIZE
PROTECTED SEQ_READ_SEQ_DATA_SIZE
Definition: CmdSequencerComponentAc.hpp:899
Svc::CmdSequencerComponentBase::FileReadStage
PROTECTED FileReadStage_MAX FileReadStage
Definition: CmdSequencerComponentAc.hpp:901
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_NUM_RECORDS
@ DESER_NUM_RECORDS
Definition: CmdSequencerImpl.hpp:69
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_RecordInvalid
void log_WARNING_HI_CS_RecordInvalid(Fw::LogStringArg &fileName, U32 recordNumber, I32 error)
Definition: CmdSequencerComponentAc.cpp:2145
Svc::CmdSequencerComponentBase::SEQ_DESER_SIZE
PROTECTED SEQ_DESER_SIZE
Definition: CmdSequencerComponentAc.hpp:893
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_TIME_CONTEXT
@ DESER_TIME_CONTEXT
Definition: CmdSequencerImpl.hpp:71
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_HEADER_SIZE
@ READ_HEADER_SIZE
Definition: CmdSequencerImpl.hpp:67
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_DATA_SIZE
@ READ_SEQ_DATA_SIZE
Definition: CmdSequencerImpl.hpp:74
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_CRC
@ READ_SEQ_CRC
Definition: CmdSequencerImpl.hpp:72
Fw::LogStringArg
Definition: LogString.hpp:11
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_DATA
@ READ_SEQ_DATA
Definition: CmdSequencerImpl.hpp:73
Svc::CmdSequencerComponentBase::SEQ_READ_HEADER_SIZE
PROTECTED SEQ_READ_HEADER_SIZE
Definition: CmdSequencerComponentAc.hpp:892
Svc::CmdSequencerComponentImpl::Sequence::Events::Events
Events(Sequence &sequence)
Construct an Events object.
Definition: Events.cpp:62
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_SIZE
@ DESER_SIZE
Definition: CmdSequencerImpl.hpp:68
Svc::CmdSequencerComponentImpl::Sequence::Events::fileInvalid
void fileInvalid(const FileReadStage::t stage, const I32 error)
File invalid.
Definition: Events.cpp:82
Svc::CmdSequencerComponentImpl::Sequence::Events::fileCRCFailure
void fileCRCFailure(const U32 storedCRC, const U32 computedCRC)
File CRC failure.
Definition: Events.cpp:69
Svc::CmdSequencerComponentImpl::Sequence::Events::fileSizeError
void fileSizeError(const U32 size)
File size error.
Definition: Events.cpp:113
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::t
t
Definition: CmdSequencerImpl.hpp:65
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::toComponentEnum
static CmdSequencerComponentImpl::FileReadStage toComponentEnum(const t fileReadStage)
Convert FileReadStage::t to CmdSequencerComponentImpl::FileReadStage.
Definition: Events.cpp:20
Svc::CmdSequencerComponentImpl::Sequence::Events::fileReadError
void fileReadError(void)
File read error.
Definition: Events.cpp:104
FwTimeContextStoreType
#define FwTimeContextStoreType
Storage conversion for time context in scripts/ground interface.
Definition: FpConfig.hpp:336
Assert.hpp
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_FileReadError
void log_WARNING_HI_CS_FileReadError(Fw::LogStringArg &fileName)
Definition: CmdSequencerComponentAc.cpp:1933
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_FileInvalid
void log_WARNING_HI_CS_FileInvalid(Fw::LogStringArg &fileName, FileReadStage stage, I32 error)
Definition: CmdSequencerComponentAc.cpp:2021
Svc::CmdSequencerComponentImpl::Sequence::Events::fileNotFound
void fileNotFound(void)
File not found.
Definition: Events.cpp:95
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_FileCrcFailure
void log_WARNING_HI_CS_FileCrcFailure(Fw::LogStringArg &fileName, U32 storedCRC, U32 computedCRC)
Definition: CmdSequencerComponentAc.cpp:2463
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_HEADER
@ READ_HEADER
Definition: CmdSequencerImpl.hpp:66
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_TimeContextMismatch
void log_WARNING_HI_CS_TimeContextMismatch(Fw::LogStringArg &fileName, U8 currTimeBase, U8 seqTimeBase)
Definition: CmdSequencerComponentAc.cpp:3268
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_TIME_BASE
@ DESER_TIME_BASE
Definition: CmdSequencerImpl.hpp:70
Svc::CmdSequencerComponentImpl::Sequence::Events::timeContextMismatch
void timeContextMismatch(const FwTimeContextStoreType currTimeContext, const FwTimeContextStoreType seqTimeContext)
Time context mismatch.
Definition: Events.cpp:164
Svc::CmdSequencerComponentImpl::Sequence::Events::recordMismatch
void recordMismatch(const U32 numRecords, const U32 extraBytes)
Record mismatch.
Definition: Events.cpp:138
Svc::CmdSequencerComponentImpl::Sequence::Events::timeBaseMismatch
void timeBaseMismatch(const FwTimeBaseStoreType currTimeBase, const FwTimeBaseStoreType seqTimeBase)
Time base mismatch.
Definition: Events.cpp:151
Svc::CmdSequencerComponentBase::SEQ_DESER_TIME_CONTEXT
PROTECTED SEQ_DESER_TIME_CONTEXT
Definition: CmdSequencerComponentAc.hpp:896
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
Svc::CmdSequencerComponentBase::SEQ_DESER_TIME_BASE
PROTECTED SEQ_DESER_TIME_BASE
Definition: CmdSequencerComponentAc.hpp:895
Svc::CmdSequencerComponentBase::SEQ_READ_SEQ_CRC
PROTECTED SEQ_READ_SEQ_CRC
Definition: CmdSequencerComponentAc.hpp:897
Svc::CmdSequencerComponentImpl::error
void error(void)
Record an error.
Definition: CmdSequencerImpl.cpp:217
FwTimeBaseStoreType
#define FwTimeBaseStoreType
Storage conversion for time base in scripts/ground interface.
Definition: FpConfig.hpp:332
Svc
Definition: ActiveLoggerComponentAc.cpp:22
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_TimeBaseMismatch
void log_WARNING_HI_CS_TimeBaseMismatch(Fw::LogStringArg &fileName, U16 time_base, U16 seq_time_base)
Definition: CmdSequencerComponentAc.cpp:3144
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_RecordMismatch
void log_WARNING_HI_CS_RecordMismatch(Fw::LogStringArg &fileName, U32 header_records, U32 extra_bytes)
Definition: CmdSequencerComponentAc.cpp:3020
Svc::CmdSequencerComponentImpl::m_sequence
Sequence * m_sequence
The abstract sequence.
Definition: CmdSequencerImpl.hpp:745
Svc::CmdSequencerComponentImpl::Sequence::getLogFileName
Fw::LogStringArg & getLogFileName(void)
Definition: Sequence.cpp:130
Svc::CmdSequencerComponentBase::SEQ_DESER_NUM_RECORDS
PROTECTED SEQ_DESER_NUM_RECORDS
Definition: CmdSequencerComponentAc.hpp:894
Svc::CmdSequencerComponentImpl
Definition: CmdSequencerImpl.hpp:26
CmdSequencerImpl.hpp
Svc::CmdSequencerComponentImpl::Sequence::Events::recordInvalid
void recordInvalid(const U32 recordNumber, const I32 error)
Record invalid.
Definition: Events.cpp:125
Svc::CmdSequencerComponentImpl::Sequence
A sequence with unspecified binary format.
Definition: CmdSequencerImpl.hpp:52
Svc::CmdSequencerComponentBase::log_WARNING_HI_CS_FileNotFound
void log_WARNING_HI_CS_FileNotFound(Fw::LogStringArg &fileName)
Definition: CmdSequencerComponentAc.cpp:2375