36 crcFileName +=
".CRC32";
41 const bool status = this->readCRCFile(crcFileName)
42 and this->getFileSize(fileName)
43 and this->readSequenceFile(fileName)
44 and this->validateCRC()
46 and this->validateRecords();
65 result = this->readCRC() and this->deserializeCRC();
66 } else if (status ==
Os::File::DOESNT_EXIST) {
74 this->m_crcFile.
close();
92 static_cast<U32
>(fileSize -
static_cast<FwSignedSizeType>(
sizeof(this->m_sequenceHeader)));
103 bool AMPCSSequence ::
116 result = this->readOpenSequenceFile();
125 this->m_sequenceFile.
close();
130 bool AMPCSSequence ::
134 if (this->m_crc.
m_stored != this->m_crc.m_computed) {
137 this->m_crc.m_computed
144 bool AMPCSSequence ::
148 Sequence::Record record;
153 for ( ; numRecords < loopBound; ++numRecords) {
196 bool AMPCSSequence ::
226 bool AMPCSSequence ::
242 bool AMPCSSequence ::
243 readOpenSequenceFile()
247 bool status = this->readSequenceHeader();
250 this->m_sequenceHeader,
251 sizeof(this->m_sequenceHeader)
253 status = this->readRecords();
263 this->m_crc.
update(buffAddr, buffLen);
269 bool AMPCSSequence ::
273 Os::File& file = this->m_sequenceFile;
279 this->m_sequenceHeader,
291 if (status and readLen !=
sizeof this->m_sequenceHeader) {
294 static_cast<I32
>(readLen)
304 bool AMPCSSequence ::
307 Os::File& file = this->m_sequenceFile;
330 if (readLenUint != size) {
333 static_cast<I32
>(readLen)
344 deserializeRecord(Sequence::Record& record)
350 this->deserializeTimeFlag(record.m_descriptor);
353 status = this->deserializeTime(record.m_timeTag);
356 status = this->deserializeCmdLength(cmdLength);
359 status = this->translateCommand(record.m_command, cmdLength);
367 deserializeTimeFlag(Sequence::Record::Descriptor& descriptor)
373 switch (timeFlagSerial) {
375 descriptor = Sequence::Record::ABSOLUTE;
378 descriptor = Sequence::Record::RELATIVE;
395 timeTag.
set(time, 0);
438 fixedBuffLen ==
sizeof(cmdDescriptor) +
sizeof(zeros),
441 const U32 totalBuffLen = fixedBuffLen + cmdLength;
449 status = buffer.
deserialize(&addr[fixedBuffLen], size,
true);
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
@ TB_DONT_CARE
Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed.
PlatformAssertArgType FwAssertArgType
PlatformSignedSizeType FwSignedSizeType
#define FW_CONTEXT_DONT_CARE
Don't care value for time contexts in sequences.
U32 FwPacketDescriptorType
const char * toChar() const
U8 * getBuffAddr()
gets buffer address for data filling
U8 * getBuffAddr()
gets buffer address for data filling
Serializable::SizeType getBuffCapacity() const
returns capacity, not current size, of buffer
NATIVE_UINT_TYPE SizeType
virtual U8 * getBuffAddr()=0
gets buffer address for data filling
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void resetSer()
reset to beginning of buffer to reuse for serialization
Serializable::SizeType getBuffLength() const
returns current buffer size
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void set(U32 seconds, U32 useconds)
Status read(U8 *buffer, FwSignedSizeType &size)
read data from this file into supplied buffer bounded by size
void close() override
close the file, if not opened then do nothing
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
@ OP_OK
Operation was successful.
@ DOESNT_EXIST
File doesn't exist (for read)
@ OPEN_READ
Open file for reading.
bool loadFile(const Fw::StringBase &fileName)
bool hasMoreRecords() const
AMPCSSequence(CmdSequencerComponentImpl &component)
Construct an AMPCSSequence.
void nextRecord(Sequence::Record &record)
void fileNotFound()
File not found.
void fileSizeError(const U32 size)
File size error.
void fileReadError()
File read error.
void fileCRCFailure(const U32 storedCRC, const U32 computedCRC)
File CRC failure.
void recordInvalid(const U32 recordNumber, const I32 error)
Record invalid.
void fileInvalid(const CmdSequencer_FileReadStage::t stage, const I32 error)
File invalid.
Events m_events
Event reporting.
Header m_header
The sequence header.
Fw::ExternalSerializeBuffer m_buffer
Serialize buffer to hold the binary sequence data.
void setFileName(const Fw::StringBase &fileName)
Set the file name. Also sets the log file name.
CmdSequencerComponentImpl & m_component
The enclosing component.
Fw::CmdStringArg m_fileName
The sequence file name.
SerializeStatus
forward declaration for string
@ FW_DESERIALIZE_FORMAT_ERROR
Deserialization data had incorrect values (unexpected data types)
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ FW_DESERIALIZE_SIZE_MISMATCH
Data was left in the buffer, but not enough to deserialize.
Status getFileSize(const char *path, FwSizeType &size)
@ OP_OK
Operation was successful.
U16 t
The type of the command length field.
U32 t
The type of the time field.
void finalize()
Finalize computed CRC.
void init()
Initialize computed CRC.
void update(const BYTE *buffer, NATIVE_UINT_TYPE bufferSize)
Update computed CRC.