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
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 (C) 2009-2018 California Institute of Technology.
7 // ALL RIGHTS RESERVED. United States Government Sponsorship
8 // acknowledged.
9 
10 #include "Fw/Types/Assert.hpp"
12 
13 namespace Svc {
14 
15  CmdSequencerComponentImpl::FileReadStage
17  toComponentEnum(const t fileReadStage)
18  {
19  CmdSequencerComponentImpl::FileReadStage result =
20  static_cast<CmdSequencerComponentImpl::FileReadStage>(0);
21  FW_ASSERT(result >= 0, result);
22  FW_ASSERT(result < CmdSequencerComponentImpl::FileReadStage_MAX, result);
23  switch(fileReadStage) {
24  case READ_HEADER:
25  result = CmdSequencerComponentImpl::SEQ_READ_HEADER;
26  break;
27  case READ_HEADER_SIZE:
28  result = CmdSequencerComponentImpl::SEQ_READ_HEADER_SIZE;
29  break;
30  case DESER_SIZE:
31  result = CmdSequencerComponentImpl::SEQ_DESER_SIZE;
32  break;
33  case DESER_NUM_RECORDS:
34  result = CmdSequencerComponentImpl::SEQ_DESER_NUM_RECORDS;
35  break;
36  case DESER_TIME_BASE:
37  result = CmdSequencerComponentImpl::SEQ_DESER_TIME_BASE;
38  break;
39  case DESER_TIME_CONTEXT:
40  result = CmdSequencerComponentImpl::SEQ_DESER_TIME_CONTEXT;
41  break;
42  case READ_SEQ_CRC:
43  result = CmdSequencerComponentImpl::SEQ_READ_SEQ_CRC;
44  break;
45  case READ_SEQ_DATA:
46  result = CmdSequencerComponentImpl::SEQ_READ_SEQ_DATA;
47  break;
48  case READ_SEQ_DATA_SIZE:
49  result = CmdSequencerComponentImpl::SEQ_READ_SEQ_DATA_SIZE;
50  break;
51  default:
52  FW_ASSERT(0, fileReadStage);
53  break;
54  }
55  return result;
56  }
57 
59  Events(Sequence& sequence) :
60  m_sequence(sequence)
61  {
62 
63  }
64 
66  fileCRCFailure(const U32 storedCRC, const U32 computedCRC)
67  {
68  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
69  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
70  component.log_WARNING_HI_CS_FileCrcFailure(
71  logFileName,
72  storedCRC,
73  computedCRC
74  );
75  component.error();
76  }
77 
79  fileInvalid(const FileReadStage::t stage, const I32 error)
80  {
81  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
82  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
83  component.log_WARNING_HI_CS_FileInvalid(
84  logFileName,
85  FileReadStage::toComponentEnum(stage),
86  error
87  );
88  component.error();
89  }
90 
93  {
94  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
95  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
96  component.log_WARNING_HI_CS_FileNotFound(logFileName);
97  component.error();
98  }
99 
102  {
103  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
104  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
105  component.log_WARNING_HI_CS_FileReadError(logFileName);
106  component.error();
107  }
108 
110  fileSizeError(const U32 size)
111  {
112  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
113  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
114  component.log_WARNING_HI_CS_FileSizeError(
115  logFileName,
116  size
117  );
118  component.error();
119  }
120 
122  recordInvalid(const U32 recordNumber, const I32 error)
123  {
124  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
125  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
126  component.log_WARNING_HI_CS_RecordInvalid(
127  logFileName,
128  recordNumber,
129  error
130  );
131  component.error();
132  }
133 
135  recordMismatch(const U32 numRecords, const U32 extraBytes)
136  {
137  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
138  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
139  component.log_WARNING_HI_CS_RecordMismatch(
140  logFileName,
141  numRecords,
142  extraBytes
143  );
144  // TODO: Should this be an error?
145  }
146 
148  timeBaseMismatch(const U32 currTimeBase, const U32 seqTimeBase)
149  {
150  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
151  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
152  component.log_WARNING_HI_CS_TimeBaseMismatch(
153  logFileName,
154  currTimeBase,
155  seqTimeBase
156  );
157  component.error();
158  }
159 
162  const U32 currTimeContext,
163  const U32 seqTimeContext
164  )
165  {
166  Fw::LogStringArg& logFileName = this->m_sequence.getLogFileName();
167  CmdSequencerComponentImpl& component = this->m_sequence.m_component;
168  component.log_WARNING_HI_CS_TimeContextMismatch(
169  logFileName,
170  currTimeContext,
171  seqTimeContext
172  );
173  component.error();
174  }
175 
176 }
177 
Svc::CmdSequencerComponentImpl::Sequence::Events::timeContextMismatch
void timeContextMismatch(const U32 currTimeContext, const U32 seqTimeContext)
Time context mismatch.
Definition: Events.cpp:161
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_NUM_RECORDS
@ DESER_NUM_RECORDS
Definition: CmdSequencerImpl.hpp:66
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_TIME_CONTEXT
@ DESER_TIME_CONTEXT
Definition: CmdSequencerImpl.hpp:68
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_HEADER_SIZE
@ READ_HEADER_SIZE
Definition: CmdSequencerImpl.hpp:64
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_DATA_SIZE
@ READ_SEQ_DATA_SIZE
Definition: CmdSequencerImpl.hpp:71
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_CRC
@ READ_SEQ_CRC
Definition: CmdSequencerImpl.hpp:69
Fw::LogStringArg
Definition: LogString.hpp:11
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_SEQ_DATA
@ READ_SEQ_DATA
Definition: CmdSequencerImpl.hpp:70
Svc::CmdSequencerComponentImpl::Sequence::Events::Events
Events(Sequence &sequence)
Construct an Events object.
Definition: Events.cpp:59
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_SIZE
@ DESER_SIZE
Definition: CmdSequencerImpl.hpp:65
Svc::CmdSequencerComponentImpl::Sequence::Events::fileInvalid
void fileInvalid(const FileReadStage::t stage, const I32 error)
File invalid.
Definition: Events.cpp:79
Svc::CmdSequencerComponentImpl::Sequence::Events::fileCRCFailure
void fileCRCFailure(const U32 storedCRC, const U32 computedCRC)
File CRC failure.
Definition: Events.cpp:66
Svc::CmdSequencerComponentImpl::Sequence::Events::fileSizeError
void fileSizeError(const U32 size)
File size error.
Definition: Events.cpp:110
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::t
t
Definition: CmdSequencerImpl.hpp:62
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::toComponentEnum
static CmdSequencerComponentImpl::FileReadStage toComponentEnum(const t fileReadStage)
Convert FileReadStage::t to CmdSequencerComponentImpl::FileReadStage.
Definition: Events.cpp:17
Svc::CmdSequencerComponentImpl::Sequence::Events::fileReadError
void fileReadError(void)
File read error.
Definition: Events.cpp:101
Assert.hpp
Svc::CmdSequencerComponentImpl::Sequence::Events::fileNotFound
void fileNotFound(void)
File not found.
Definition: Events.cpp:92
Svc::CmdSequencerComponentImpl::Sequence::Events::timeBaseMismatch
void timeBaseMismatch(const U32 currTimeBase, const U32 seqTimeBase)
Time base mismatch.
Definition: Events.cpp:148
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_HEADER
@ READ_HEADER
Definition: CmdSequencerImpl.hpp:63
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_TIME_BASE
@ DESER_TIME_BASE
Definition: CmdSequencerImpl.hpp:67
Svc::CmdSequencerComponentImpl::Sequence::Events::recordMismatch
void recordMismatch(const U32 numRecords, const U32 extraBytes)
Record mismatch.
Definition: Events.cpp:135
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
Svc
Definition: ActiveRateGroupImplCfg.hpp:18
Svc::CmdSequencerComponentImpl
Definition: CmdSequencerImpl.hpp:21
CmdSequencerImpl.hpp
Svc::CmdSequencerComponentImpl::Sequence::Events::recordInvalid
void recordInvalid(const U32 recordNumber, const I32 error)
Record invalid.
Definition: Events.cpp:122
Svc::CmdSequencerComponentImpl::Sequence
A sequence with unspecified binary format.
Definition: CmdSequencerImpl.hpp:49