F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
AMPCSSequence.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title AMPCSSequence.hpp
3 // \author Bocchino
4 // \brief AMPCSSequence interface
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 #ifndef Svc_AMPCSSequence_HPP
14 #define Svc_AMPCSSequence_HPP
15 
17 
18 namespace Svc {
19 
22  class AMPCSSequence :
24  {
25 
26  public:
27 
29  struct SequenceHeader {
30 
31  struct Constants {
32 
33  typedef enum {
35  SIZE = 4
36  } t;
37 
38  };
39 
40  typedef U8 t[Constants::SIZE];
41 
42  };
43 
45  struct Record {
46 
48  struct TimeFlag {
49 
51  typedef enum {
52  ABSOLUTE = 0x00,
53  RELATIVE = 0xFF
54  } t;
55 
57  struct Serial {
58 
59  typedef U8 t;
60 
61  };
62 
63  };
64 
66  struct Time {
67 
69  typedef U32 t;
70 
71  };
72 
74  struct CmdLength {
75 
77  typedef U16 t;
78 
79  };
80 
82  struct Opcode {
83 
85  typedef U16 t;
86 
87  };
88 
89  };
90 
91  public:
92 
95  CmdSequencerComponentImpl& component
96  );
97 
98  public:
99 
102  bool loadFile(
103  const Fw::StringBase& fileName
104  );
105 
108  bool hasMoreRecords() const;
109 
112  void nextRecord(
113  Sequence::Record& record
114  );
115 
119  void reset();
120 
123  void clear();
124 
125  PRIVATE:
126 
129  bool readCRCFile(
130  Fw::CmdStringArg& crcFileName
131  );
132 
135  bool readCRC();
136 
139  bool deserializeCRC();
140 
143  bool getFileSize(
144  const Fw::StringBase& seqFileName
145  );
146 
149  bool readSequenceFile(
150  const Fw::StringBase& seqFileName
151  );
152 
155  bool readOpenSequenceFile();
156 
160  bool readSequenceHeader();
161 
164  bool readRecords();
165 
168  bool validateCRC();
169 
172  Fw::SerializeStatus deserializeRecord(
173  Sequence::Record& record
174  );
175 
178  Fw::SerializeStatus deserializeTimeFlag(
179  Sequence::Record::Descriptor& descriptor
180  );
181 
184  Fw::SerializeStatus deserializeTime(
185  Fw::Time& timeTag
186  );
187 
190  Fw::SerializeStatus deserializeCmdLength(
191  Record::CmdLength::t& cmdLength
192  );
193 
196  Fw::SerializeStatus translateCommand(
197  Fw::ComBuffer& comBuffer,
198  const Record::CmdLength::t cmdLength
199  );
200 
203  bool validateRecords();
204 
205  PRIVATE:
206 
208  SequenceHeader::t m_sequenceHeader;
209 
212 
214  Os::File m_crcFile;
215 
217  Os::File m_sequenceFile;
218 
219  };
220 
221 }
222 
223 #endif
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
Definition: Time.hpp:9
A sequence in AMPCS format.
bool loadFile(const Fw::StringBase &fileName)
bool hasMoreRecords() const
AMPCSSequence(CmdSequencerComponentImpl &component)
Construct an AMPCSSequence.
void nextRecord(Sequence::Record &record)
A sequence with unspecified binary format.
SerializeStatus
forward declaration for string
U16 t
The type of the command length field.
U16 t
The type of an AMPCS command opcode.
The serial representation of a time flag.
U32 t
The type of the time field.
AMPCS sequence record.
@ SIZE
The sequence header size in bytes.
Container for computed and stored CRC values.