20 m_computed(INITIAL_COMPUTED_VALUE),
29 this->m_computed = INITIAL_COMPUTED_VALUE;
37 this->m_computed =
update_crc_32(this->m_computed, buffer[index]);
44 this->m_computed = ~this->m_computed;
54 bool CmdSequencerComponentImpl::FPrimeSequence ::
58 if (this->m_crc.m_stored != this->m_crc.m_computed) {
59 this->m_events.fileCRCFailure(
61 this->m_crc.m_computed
75 this->setFileName(fileName);
77 const bool status = this->readFile()
78 and this->validateCRC()
79 and this->m_header.validateTime(this->m_component)
80 and this->validateRecords();
89 return this->m_buffer.getBuffLeft() > 0;
102 this->m_buffer.resetDeser();
108 this->m_buffer.resetSer();
111 bool CmdSequencerComponentImpl::FPrimeSequence ::
118 this->m_fileName.toChar(),
123 result = this->readOpenFile();
125 this->m_events.fileNotFound();
128 this->m_events.fileReadError();
132 this->m_sequenceFile.close();
137 bool CmdSequencerComponentImpl::FPrimeSequence ::
140 U8 *
const buffAddr = this->m_buffer.getBuffAddr();
142 bool status = this->readHeader();
145 status = this->deserializeHeader()
146 and this->readRecordsAndCRC()
147 and this->extractCRC();
151 this->m_crc.update(buffAddr, buffLen);
152 this->m_crc.finalize();
157 bool CmdSequencerComponentImpl::FPrimeSequence ::
161 Os::File& file = this->m_sequenceFile;
180 this->m_events.fileInvalid(
181 Events::FileReadStage::READ_HEADER,
188 this->m_events.fileInvalid(
189 Events::FileReadStage::READ_HEADER_SIZE,
207 bool CmdSequencerComponentImpl::FPrimeSequence ::
208 deserializeHeader(
void)
211 Header& header = this->m_header;
216 this->m_events.fileInvalid(
217 Events::FileReadStage::DESER_SIZE,
223 this->m_events.fileSizeError(header.m_fileSize);
227 serializeStatus = buffer.
deserialize(header.m_numRecords);
229 this->m_events.fileInvalid(
230 Events::FileReadStage::DESER_NUM_RECORDS,
239 this->m_events.fileInvalid(
240 Events::FileReadStage::DESER_TIME_BASE,
245 header.m_timeBase =
static_cast<TimeBase>(tbase);
247 serializeStatus = buffer.
deserialize(header.m_timeContext);
249 this->m_events.fileInvalid(
250 Events::FileReadStage::DESER_TIME_CONTEXT,
258 bool CmdSequencerComponentImpl::FPrimeSequence ::
259 readRecordsAndCRC(
void)
261 Os::File& file = this->m_sequenceFile;
272 this->m_events.fileInvalid(
273 Events::FileReadStage::READ_SEQ_DATA,
280 this->m_events.fileInvalid(
281 Events::FileReadStage::READ_SEQ_DATA_SIZE,
293 bool CmdSequencerComponentImpl::FPrimeSequence ::
297 U32& crc = this->m_crc.m_stored;
301 const U32 crcSize =
sizeof(crc);
303 if (buffSize < crcSize) {
304 this->m_events.fileInvalid(
305 Events::FileReadStage::READ_SEQ_CRC,
310 FW_ASSERT(buffSize >= crcSize, buffSize, crcSize);
317 status = crcBuff.deserialize(crc);
326 deserializeRecord(Record& record)
331 this->deserializeDescriptor(record.m_descriptor);
335 record.m_descriptor == Record::END_OF_SEQUENCE
341 status = this->deserializeTimeTag(record.m_timeTag);
344 status = this->deserializeRecordSize(recordSize);
347 status = this->copyCommand(record.m_command, recordSize);
354 deserializeDescriptor(Record::Descriptor& descriptor)
368 descriptor =
static_cast<Record::Descriptor
>(descEntry);
374 deserializeTimeTag(
Fw::Time& timeTag)
377 U32 seconds, useconds;
383 timeTag.
set(seconds,useconds);
389 deserializeRecordSize(U32& recordSize)
419 bool CmdSequencerComponentImpl::FPrimeSequence ::
420 validateRecords(
void)
423 const U32 numRecords = this->m_header.m_numRecords;
424 Sequence::Record record;
427 for (
NATIVE_UINT_TYPE recordNumber = 0; recordNumber < numRecords; recordNumber++) {
430 this->m_events.recordInvalid(recordNumber, status);
436 if (buffLeftSize > 0) {
437 this->m_events.recordMismatch(numRecords, buffLeftSize);