14 bool recoverable =
false;
15 this->m_allocatorId = identifier;
16 U8* allocatedMemory =
static_cast<U8*
>(allocator.
allocate(identifier, bytes, recoverable));
18 FW_ASSERT(bytes >= originalBytes, static_cast<FwAssertArgType>(bytes));
19 this->m_sequenceBuffer.
setExtBuffer(allocatedMemory, bytes);
24 this->m_sequenceBuffer.
clear();
27 void FpySequencer::updateCrc(U32& crc,
const U8* buffer,
FwSizeType bufferSize) {
29 for (
FwSizeType index = 0; index < bufferSize; index++) {
30 crc =
static_cast<U32
>(
update_crc_32(crc, static_cast<char>(buffer[index])));
41 this->m_computedCRC = CRC_INITIAL_VALUE;
58 readStatus = this->readHeader();
71 readStatus = this->readBody();
84 readStatus = this->readFooter();
97 if (sequenceFileSize != sequenceFilePosition) {
143 deserStatus = this->m_sequenceBuffer.
deserialize(this->m_sequenceObj.
get_args()[argMappingIdx]);
176 this->m_computedCRC = ~this->m_computedCRC;
190 const FpySequencer_FileReadStage& readStage,
200 if (expectedReadLen > capacity) {
212 if (actualReadLen < expectedReadLen) {
218 FW_ASSERT(expectedReadLen == actualReadLen, static_cast<FwAssertArgType>(expectedReadLen),
219 static_cast<FwAssertArgType>(actualReadLen));
222 this->m_sequenceBuffer.
setBuffLen(static_cast<Fw::Serializable::SizeType>(expectedReadLen));
226 FpySequencer::updateCrc(this->m_computedCRC, this->m_sequenceBuffer.
getBuffAddr(), expectedReadLen);
Serialization/Deserialization operation was successful.
void clear()
clear external buffer
Type_of_args & get_args()
Get member args.
void log_WARNING_HI_InsufficientBufferSpace(U64 bufferSize, const Fw::StringBase &filePath) const
Log event InsufficientBufferSpace.
PlatformSizeType FwSizeType
void log_WARNING_HI_WrongCRC(U32 expected, U32 actual) const
Log event WrongCRC.
virtual void * allocate(const FwEnumStoreType identifier, FwSizeType &size, bool &recoverable)=0
Allocate memory.
const char * toChar() const
Status position(FwSizeType &position_result) override
get file pointer position of the currently open file
Status size(FwSizeType &size_result) override
get size of currently open file
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
void log_WARNING_HI_FileReadError(Svc::FpySequencer_FileReadStage readStage, const Fw::StringBase &filePath, I32 errorCode) const
Log event FileReadError.
SerializeStatus
forward declaration for string
unsigned long update_crc_32(unsigned long crc, char c)
void log_WARNING_HI_ExtraBytesInSequence(U32 remaining) const
Log event ExtraBytesInSequence.
Serializable::SizeType getBuffLength() const
returns current buffer size
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
Svc::Fpy::Header & get_header()
Get member header.
void log_WARNING_HI_EndOfFileError(Svc::FpySequencer_FileReadStage readStage, const Fw::StringBase &filePath) const
Log event EndOfFileError.
Type_of_statements & get_statements()
Get member statements.
SizeType length() const
Get length of string.
void allocateBuffer(FwEnumStoreType identifier, Fw::MemAllocator &allocator, FwSizeType bytes)
uint8_t U8
8-bit unsigned integer
void log_WARNING_HI_TooManySequenceStatements(U16 count, U16 max) const
Log event TooManySequenceStatements.
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
void log_WARNING_HI_FileOpenError(const Fw::StringBase &filePath, I32 errorCode) const
Log event FileOpenError.
void setExtBuffer(U8 *buffPtr, Serializable::SizeType size)
Svc::Fpy::Footer & get_footer()
Get member footer.
Operation was successful.
void log_WARNING_HI_FileReadDeserializeError(Svc::FpySequencer_FileReadStage readStage, const Fw::StringBase &filePath, I32 errorCode, U64 buffLeft, U64 buffLength) const
Log event FileReadDeserializeError.
SerializeStatus deserialize(U8 &val)
void log_WARNING_HI_WrongSchemaVersion(U8 expected, U8 actual) const
Log event WrongSchemaVersion.
RateGroupDivider component implementation.
void log_WARNING_HI_TooManySequenceArgs(U8 count, U8 max) const
Log event TooManySequenceArgs.
Serializable::SizeType getBuffCapacity() const
returns capacity, not current size, of buffer
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
Deallocate memory.
void deallocateBuffer(Fw::MemAllocator &allocator)
bool isOpen() const
determine if the file is open
U8 * getBuffAddr()
gets buffer address for data filling
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data