F´ Flight Software - C/C++ Documentation  NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
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 
18  CmdSequencerComponentImpl::FileReadStage
20  toComponentEnum(const t fileReadStage)
21  {
22  CmdSequencerComponentImpl::FileReadStage result =
23  static_cast<CmdSequencerComponentImpl::FileReadStage>(0);
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:
31  result = CmdSequencerComponentImpl::SEQ_READ_HEADER_SIZE;
32  break;
33  case DESER_SIZE:
34  result = CmdSequencerComponentImpl::SEQ_DESER_SIZE;
35  break;
36  case DESER_NUM_RECORDS:
37  result = CmdSequencerComponentImpl::SEQ_DESER_NUM_RECORDS;
38  break;
39  case DESER_TIME_BASE:
40  result = CmdSequencerComponentImpl::SEQ_DESER_TIME_BASE;
41  break;
42  case DESER_TIME_CONTEXT:
43  result = CmdSequencerComponentImpl::SEQ_DESER_TIME_CONTEXT;
44  break;
45  case READ_SEQ_CRC:
46  result = CmdSequencerComponentImpl::SEQ_READ_SEQ_CRC;
47  break;
48  case READ_SEQ_DATA:
49  result = CmdSequencerComponentImpl::SEQ_READ_SEQ_DATA;
50  break;
51  case READ_SEQ_DATA_SIZE:
52  result = CmdSequencerComponentImpl::SEQ_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;
73  component.log_WARNING_HI_CS_FileCrcFailure(
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;
86  component.log_WARNING_HI_CS_FileInvalid(
87  logFileName,
88  FileReadStage::toComponentEnum(stage),
89  error
90  );
91  component.error();
92  }
93 
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 
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;
117  component.log_WARNING_HI_CS_FileSizeError(
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;
129  component.log_WARNING_HI_CS_RecordInvalid(
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;
142  component.log_WARNING_HI_CS_RecordMismatch(
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;
155  component.log_WARNING_HI_CS_TimeBaseMismatch(
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;
171  component.log_WARNING_HI_CS_TimeContextMismatch(
172  logFileName,
173  currTimeContext,
174  seqTimeContext
175  );
176  component.error();
177  }
178 
179 }
180 
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::DESER_NUM_RECORDS
@ DESER_NUM_RECORDS
Definition: CmdSequencerImpl.hpp:69
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::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::CmdSequencerComponentImpl::Sequence::Events::fileNotFound
void fileNotFound(void)
File not found.
Definition: Events.cpp:95
Svc::CmdSequencerComponentImpl::Sequence::Events::FileReadStage::READ_HEADER
@ READ_HEADER
Definition: CmdSequencerImpl.hpp:66
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
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
FwTimeBaseStoreType
#define FwTimeBaseStoreType
Storage conversion for time base in scripts/ground interface.
Definition: FpConfig.hpp:332
Svc
Definition: ActiveRateGroupImplCfg.hpp:18
Svc::CmdSequencerComponentImpl
Definition: CmdSequencerImpl.hpp:24
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