simplify FS interface further
This commit is contained in:
parent
c21185e1cb
commit
d838259243
@ -164,8 +164,6 @@ ReturnValue_t cfdp::DestHandler::handleFileDataPdu(const cfdp::PacketInfo& info)
|
||||
}
|
||||
size_t fileSegmentLen = 0;
|
||||
const uint8_t* fileData = fdInfo.getFileData(&fileSegmentLen);
|
||||
FileOpParams fileOpParams(transactionParams.destName.data(), fileSegmentLen);
|
||||
fileOpParams.offset = fdInfo.getOffset().value();
|
||||
if (destParams.cfg.indicCfg.fileSegmentRecvIndicRequired) {
|
||||
FileSegmentRecvdParams segParams;
|
||||
segParams.offset = fdInfo.getOffset().value();
|
||||
@ -177,7 +175,8 @@ ReturnValue_t cfdp::DestHandler::handleFileDataPdu(const cfdp::PacketInfo& info)
|
||||
segParams.segmentMetadata = {segMetadata, segmentMetadatLen};
|
||||
destParams.user.fileSegmentRecvdIndication(segParams);
|
||||
}
|
||||
result = destParams.user.vfs.writeToFile(fileOpParams, fileData);
|
||||
result = destParams.user.vfs.writeToFile(transactionParams.destName.data(),
|
||||
fdInfo.getOffset().value(), fileData, fileSegmentLen);
|
||||
if (result != returnvalue::OK) {
|
||||
// TODO: Proper Error handling
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -451,26 +450,26 @@ ReturnValue_t cfdp::DestHandler::checksumVerification() {
|
||||
std::array<uint8_t, 1024> buf{};
|
||||
etl::crc32 crcCalc;
|
||||
uint64_t currentOffset = 0;
|
||||
FileOpParams params(transactionParams.destName.data(), transactionParams.fileSize.value());
|
||||
while (currentOffset < transactionParams.fileSize.value()) {
|
||||
uint64_t readLen;
|
||||
uint64_t lenToRead;
|
||||
if (currentOffset + buf.size() > transactionParams.fileSize.value()) {
|
||||
readLen = transactionParams.fileSize.value() - currentOffset;
|
||||
lenToRead = transactionParams.fileSize.value() - currentOffset;
|
||||
} else {
|
||||
readLen = buf.size();
|
||||
lenToRead = buf.size();
|
||||
}
|
||||
if (readLen > 0) {
|
||||
params.offset = currentOffset;
|
||||
params.size = readLen;
|
||||
auto result = destParams.user.vfs.readFromFile(params, buf.data(), buf.size());
|
||||
if (lenToRead > 0) {
|
||||
size_t readLen = 0;
|
||||
auto result =
|
||||
destParams.user.vfs.readFromFile(transactionParams.destName.data(), currentOffset,
|
||||
lenToRead, buf.data(), readLen, buf.size());
|
||||
if (result != OK) {
|
||||
// TODO: I think this is a case for a filestore rejection, but it might sense to print
|
||||
// a warning or trigger an event because this should generally not happen
|
||||
return FAILED;
|
||||
}
|
||||
crcCalc.add(buf.begin(), buf.begin() + readLen);
|
||||
crcCalc.add(buf.begin(), buf.begin() + lenToRead);
|
||||
}
|
||||
currentOffset += readLen;
|
||||
currentOffset += lenToRead;
|
||||
}
|
||||
|
||||
uint32_t value = crcCalc.value();
|
||||
|
@ -123,25 +123,25 @@ ReturnValue_t cfdp::SourceHandler::checksumGeneration() {
|
||||
std::array<uint8_t, 1024> buf{};
|
||||
etl::crc32 crcCalc;
|
||||
uint64_t currentOffset = 0;
|
||||
FileOpParams params(transactionParams.sourceName.data(), transactionParams.fileSize.value());
|
||||
while (currentOffset < transactionParams.fileSize.value()) {
|
||||
uint64_t readLen;
|
||||
uint64_t lenToRead;
|
||||
if (currentOffset + buf.size() > transactionParams.fileSize.value()) {
|
||||
readLen = transactionParams.fileSize.value() - currentOffset;
|
||||
lenToRead = transactionParams.fileSize.value() - currentOffset;
|
||||
} else {
|
||||
readLen = buf.size();
|
||||
lenToRead = buf.size();
|
||||
}
|
||||
if (readLen > 0) {
|
||||
params.offset = currentOffset;
|
||||
params.size = readLen;
|
||||
auto result = sourceParams.user.vfs.readFromFile(params, buf.data(), buf.size());
|
||||
if (lenToRead > 0) {
|
||||
size_t readLen = 0;
|
||||
auto result =
|
||||
sourceParams.user.vfs.readFromFile(transactionParams.sourceName.data(), currentOffset,
|
||||
lenToRead, buf.data(), readLen, buf.size());
|
||||
if (result != OK) {
|
||||
addError(result);
|
||||
return FAILED;
|
||||
}
|
||||
crcCalc.add(buf.begin(), buf.begin() + readLen);
|
||||
crcCalc.add(buf.begin(), buf.begin() + lenToRead);
|
||||
}
|
||||
currentOffset += readLen;
|
||||
currentOffset += lenToRead;
|
||||
}
|
||||
|
||||
transactionParams.crc = crcCalc.value();
|
||||
@ -240,7 +240,7 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendMetadataPdu() {
|
||||
|
||||
ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu(bool& noFileDataPdu) {
|
||||
cfdp::Fss offset(transactionParams.progress);
|
||||
uint64_t readLen;
|
||||
uint64_t lenToRead;
|
||||
uint64_t fileSize = transactionParams.fileSize.value();
|
||||
noFileDataPdu = false;
|
||||
if (fileSize == 0) {
|
||||
@ -250,29 +250,31 @@ ReturnValue_t cfdp::SourceHandler::prepareAndSendNextFileDataPdu(bool& noFileDat
|
||||
return OK;
|
||||
}
|
||||
if (fileSize < transactionParams.remoteCfg.maxFileSegmentLen) {
|
||||
readLen = transactionParams.fileSize.value();
|
||||
lenToRead = transactionParams.fileSize.value();
|
||||
} else {
|
||||
if (transactionParams.progress + transactionParams.remoteCfg.maxFileSegmentLen > fileSize) {
|
||||
readLen = fileSize - transactionParams.progress;
|
||||
lenToRead = fileSize - transactionParams.progress;
|
||||
} else {
|
||||
readLen = transactionParams.remoteCfg.maxFileSegmentLen;
|
||||
lenToRead = transactionParams.remoteCfg.maxFileSegmentLen;
|
||||
}
|
||||
}
|
||||
FileOpParams fileParams(transactionParams.sourceName.data(), readLen);
|
||||
FileOpParams fileParams(transactionParams.sourceName.data(), lenToRead);
|
||||
fileParams.offset = transactionParams.progress;
|
||||
ReturnValue_t result =
|
||||
sourceParams.user.vfs.readFromFile(fileParams, fileBuf.data(), fileBuf.size());
|
||||
size_t readLen = 0;
|
||||
ReturnValue_t result = sourceParams.user.vfs.readFromFile(
|
||||
transactionParams.sourceName.data(), transactionParams.progress, lenToRead, fileBuf.data(),
|
||||
readLen, fileBuf.size());
|
||||
if (result != returnvalue::OK) {
|
||||
addError(result);
|
||||
return result;
|
||||
}
|
||||
auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), readLen);
|
||||
auto fileDataInfo = FileDataInfo(offset, fileBuf.data(), lenToRead);
|
||||
auto fileDataPdu = FileDataCreator(transactionParams.pduConf, fileDataInfo);
|
||||
result = sendGenericPdu(fileDataPdu);
|
||||
if (result != OK) {
|
||||
return result;
|
||||
}
|
||||
transactionParams.progress += readLen;
|
||||
transactionParams.progress += lenToRead;
|
||||
if (transactionParams.progress >= fileSize) {
|
||||
// Advance FSM after all file data PDUs were sent.
|
||||
step = TransactionStep::SENDING_EOF;
|
||||
|
@ -70,10 +70,10 @@ class Jgm3Model {
|
||||
W[n][m] = W[n][m] - (((n + m - 1) / (double)(n - m)) *
|
||||
(pow(Earth::MEAN_RADIUS, 2) / pow(r, 2)) * W[n - 2][m]);
|
||||
} // End of if(n!=(m+1))
|
||||
} // End of if(n==m){
|
||||
} // End of if(n==0 and m==0)
|
||||
} // End of for(uint8_t n=0;n<(DEGREE+1);n++)
|
||||
} // End of for(uint8_t m=0;m<(ORDER+1);m++)
|
||||
} // End of if(n==m){
|
||||
} // End of if(n==0 and m==0)
|
||||
} // End of for(uint8_t n=0;n<(DEGREE+1);n++)
|
||||
} // End of for(uint8_t m=0;m<(ORDER+1);m++)
|
||||
|
||||
// overwrite accel if not properly initialized
|
||||
accel[0] = 0;
|
||||
@ -106,7 +106,7 @@ class Jgm3Model {
|
||||
accel[1] += partAccel[1];
|
||||
accel[2] += partAccel[2];
|
||||
} // End of for(uint8_t n=0;n<DEGREE;n++)
|
||||
} // End of uint8_t m=0;m<ORDER;m++
|
||||
} // End of uint8_t m=0;m<ORDER;m++
|
||||
}
|
||||
|
||||
void initializeNavOrbit(const double position[3], const double velocity[3], timeval timeUTC) {
|
||||
|
@ -17,8 +17,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, uint32_t
|
||||
if (hkOwner == nullptr) {
|
||||
// Configuration error.
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
|
||||
<< "invalid!" << std::endl;
|
||||
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner " << "invalid!" << std::endl;
|
||||
#else
|
||||
sif::printError(
|
||||
"LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
|
||||
@ -187,8 +186,8 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t **buffer, size
|
||||
SerializeAdapter::serialize(¤tPoolId, buffer, size, maxSize, streamEndianness);
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: "
|
||||
<< "Serialization error!" << std::endl;
|
||||
sif::warning << "LocalPoolDataSetBase::serializeLocalPoolIds: " << "Serialization error!"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printWarning(
|
||||
"LocalPoolDataSetBase::serializeLocalPoolIds: "
|
||||
|
@ -17,8 +17,8 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkO
|
||||
}
|
||||
if (hkOwner == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
|
||||
<< "owner is a invalid!" << std::endl;
|
||||
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool " << "owner is a invalid!"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(EventMessage* ev
|
||||
if (owner == nullptr) {
|
||||
// Configuration error.
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "DeviceHandlerFailureIsolation::"
|
||||
<< "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl;
|
||||
sif::error << "DeviceHandlerFailureIsolation::" << "isFdirInActionOrAreWeFaulty: Owner not set!"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -62,8 +62,7 @@ ReturnValue_t FailureIsolationBase::initialize() {
|
||||
ObjectManager::instance()->get<ConfirmsFailuresIF>(faultTreeParent);
|
||||
if (parentIF == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FailureIsolationBase::intialize: Parent object "
|
||||
<< "invalid" << std::endl;
|
||||
sif::error << "FailureIsolationBase::intialize: Parent object " << "invalid" << std::endl;
|
||||
sif::error << "Make sure it implements ConfirmsFailuresIF" << std::endl;
|
||||
#else
|
||||
sif::printError("FailureIsolationBase::intialize: Parent object invalid\n");
|
||||
|
@ -102,7 +102,8 @@ class HasFileSystemIF {
|
||||
* @param fileOpInfo General information: File name, size to write, offset, additional arguments
|
||||
* @param data The data to write to the file
|
||||
*/
|
||||
virtual ReturnValue_t writeToFile(FileOpParams params, const uint8_t* data) = 0;
|
||||
virtual ReturnValue_t writeToFile(const char* path, size_t offset, const uint8_t* data,
|
||||
size_t size) = 0;
|
||||
|
||||
/**
|
||||
* @brief Generic function to read from a file. This variant takes a pointer to a buffer and
|
||||
@ -115,19 +116,8 @@ class HasFileSystemIF {
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t** buffer, size_t& readSize,
|
||||
size_t maxSize) = 0;
|
||||
/**
|
||||
* Variant of the @readFromFile which does not perform pointer arithmetic.
|
||||
* @param fileOpInfo General information: File name, size to write, offset, additional arguments
|
||||
* @param buf
|
||||
* @param maxSize
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t* buf, size_t maxSize) {
|
||||
size_t dummy = 0;
|
||||
return readFromFile(fileOpInfo, &buf, dummy, maxSize);
|
||||
}
|
||||
virtual ReturnValue_t readFromFile(const char* path, size_t offset, size_t size, uint8_t* buffer,
|
||||
size_t& readSize, size_t maxSize) = 0;
|
||||
|
||||
/**
|
||||
* @brief Generic function to create a new file.
|
||||
|
@ -321,8 +321,8 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
// Possible configuration error, too much data or/and data coming in too fast,
|
||||
// requiring larger buffers
|
||||
sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached "
|
||||
<< "fill count" << std::endl;
|
||||
sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " << "fill count"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printWarning(
|
||||
"TcpTmTcServer::handleServerOperation: Ring buffer reached "
|
||||
|
@ -49,8 +49,8 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
|
||||
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &tcDataLen,
|
||||
SerializeIF::Endianness::BIG) != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: "
|
||||
<< "Invalid data." << std::endl;
|
||||
sif::error << "Service20ParameterManagement::checkAndAcquireTargetID: " << "Invalid data."
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printError(
|
||||
"Service20ParameterManagement::"
|
||||
|
@ -196,8 +196,8 @@ ReturnValue_t Service3Housekeeping::handleReply(const CommandMessage* reply,
|
||||
|
||||
default:
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "Service3Housekeeping::handleReply: Invalid reply with "
|
||||
<< "reply command " << command << std::endl;
|
||||
sif::warning << "Service3Housekeeping::handleReply: Invalid reply with " << "reply command "
|
||||
<< command << std::endl;
|
||||
#else
|
||||
sif::printWarning(
|
||||
"Service3Housekeeping::handleReply: Invalid reply with "
|
||||
|
@ -12,8 +12,7 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
|
||||
spillsToHigherPools(spillsToHigherPools) {
|
||||
if (NUMBER_OF_SUBPOOLS == 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool::LocalPool: Passed pool configuration is "
|
||||
<< " invalid!" << std::endl;
|
||||
sif::error << "LocalPool::LocalPool: Passed pool configuration is " << " invalid!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
max_subpools_t index = 0;
|
||||
|
@ -38,10 +38,9 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
|
||||
if (!existsModeTable(iter->getTableId())) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
using namespace std;
|
||||
sif::warning << "Subsystem::checkSequence: "
|
||||
<< "Object " << setfill('0') << hex << "0x" << setw(8) << getObjectId()
|
||||
<< setw(0) << ": Mode table for mode ID "
|
||||
<< "0x" << setw(8) << iter->getTableId() << " does not exist" << dec << endl;
|
||||
sif::warning << "Subsystem::checkSequence: " << "Object " << setfill('0') << hex << "0x"
|
||||
<< setw(8) << getObjectId() << setw(0) << ": Mode table for mode ID " << "0x"
|
||||
<< setw(8) << iter->getTableId() << " does not exist" << dec << endl;
|
||||
#endif
|
||||
return TABLE_DOES_NOT_EXIST;
|
||||
} else {
|
||||
|
@ -34,7 +34,7 @@ class ExecutableObjectIF {
|
||||
* a reference to the executing task
|
||||
* @param task_ Pointer to the taskIF of this task
|
||||
*/
|
||||
virtual void setTaskIF(PeriodicTaskIF* task_){};
|
||||
virtual void setTaskIF(PeriodicTaskIF* task_) {};
|
||||
|
||||
/**
|
||||
* This function should be called after the object was assigned to a
|
||||
|
@ -101,8 +101,7 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
|
||||
if (result != returnvalue::OK) {
|
||||
// Continue for now but print error output.
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FixedSlotSequence::checkSequence:"
|
||||
<< " Custom check failed!" << std::endl;
|
||||
sif::error << "FixedSlotSequence::checkSequence:" << " Custom check failed!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +27,5 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
||||
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
||||
static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
||||
|
||||
}; // namespace tmtcdistrib
|
||||
}; // namespace tmtcdistrib
|
||||
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
||||
|
@ -34,8 +34,7 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored(unsigned int maxNumberOfPa
|
||||
} else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TmTcBridge::setMaxNumberOfPacketsStored: Number of "
|
||||
<< "packets stored exceeds limits. "
|
||||
<< "Keeping default value." << std::endl;
|
||||
<< "packets stored exceeds limits. " << "Keeping default value." << std::endl;
|
||||
#endif
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
@ -79,15 +78,13 @@ ReturnValue_t TmTcBridge::performOperation(uint8_t operationCode) {
|
||||
result = handleTc();
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "TmTcBridge::performOperation: "
|
||||
<< "Error handling TCs" << std::endl;
|
||||
sif::debug << "TmTcBridge::performOperation: " << "Error handling TCs" << std::endl;
|
||||
#endif
|
||||
}
|
||||
result = handleTm();
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "TmTcBridge::performOperation: "
|
||||
<< "Error handling TMs" << std::endl;
|
||||
sif::debug << "TmTcBridge::performOperation: " << "Error handling TMs" << std::endl;
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
|
@ -10,11 +10,12 @@ using namespace std;
|
||||
|
||||
HostFilesystem::HostFilesystem() = default;
|
||||
|
||||
ReturnValue_t HostFilesystem::writeToFile(FileOpParams params, const uint8_t *data) {
|
||||
if (params.path() == nullptr) {
|
||||
ReturnValue_t HostFilesystem::writeToFile(const char *path_, size_t offset, const uint8_t *data,
|
||||
size_t size) {
|
||||
if (path_ == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
path path(params.path());
|
||||
path path(path_);
|
||||
std::error_code e;
|
||||
if (not exists(path, e)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
@ -25,17 +26,17 @@ ReturnValue_t HostFilesystem::writeToFile(FileOpParams params, const uint8_t *da
|
||||
if (file.fail()) {
|
||||
return HasFileSystemIF::GENERIC_FILE_ERROR;
|
||||
}
|
||||
file.seekp(static_cast<unsigned int>(params.offset));
|
||||
file.write(reinterpret_cast<const char *>(data), static_cast<unsigned int>(params.size));
|
||||
file.seekp(static_cast<unsigned int>(offset));
|
||||
file.write(reinterpret_cast<const char *>(data), static_cast<unsigned int>(size));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t HostFilesystem::readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) {
|
||||
if (params.path() == nullptr) {
|
||||
ReturnValue_t HostFilesystem::readFromFile(const char *path_, size_t offset, size_t size,
|
||||
uint8_t *buffer, size_t &readSize, size_t maxSize) {
|
||||
if (path_ == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
path path(params.path());
|
||||
path path(path_);
|
||||
std::error_code e;
|
||||
if (not exists(path, e)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
@ -44,8 +45,8 @@ ReturnValue_t HostFilesystem::readFromFile(FileOpParams params, uint8_t **buffer
|
||||
if (file.fail()) {
|
||||
return HasFileSystemIF::GENERIC_FILE_ERROR;
|
||||
}
|
||||
auto sizeToRead = static_cast<unsigned int>(params.size);
|
||||
file.seekg(static_cast<unsigned int>(params.offset));
|
||||
auto sizeToRead = static_cast<unsigned int>(size);
|
||||
file.seekg(static_cast<unsigned int>(offset));
|
||||
if (readSize + sizeToRead > maxSize) {
|
||||
return SerializeIF::BUFFER_TOO_SHORT;
|
||||
}
|
||||
|
@ -16,9 +16,10 @@ class HostFilesystem : public HasFileSystemIF {
|
||||
ReturnValue_t isDirectory(const char *path, bool &isDirectory) override;
|
||||
bool fileExists(const char *path, FileSystemArgsIF *args) override;
|
||||
ReturnValue_t truncateFile(const char *path, FileSystemArgsIF *args) override;
|
||||
ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;
|
||||
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) override;
|
||||
ReturnValue_t writeToFile(const char *path, size_t offset, const uint8_t *data,
|
||||
size_t size) override;
|
||||
ReturnValue_t readFromFile(const char *path, size_t offset, size_t size, uint8_t *buffer,
|
||||
size_t &readSize, size_t maxSize) override;
|
||||
ReturnValue_t createFile(const char *path, const uint8_t *data, size_t size) override;
|
||||
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
|
||||
ReturnValue_t createDirectory(const char *path, bool createParentDirs,
|
||||
|
@ -418,8 +418,8 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck,
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO "
|
||||
"definition with ID "
|
||||
<< gpioIdToCheck << " detected. "
|
||||
<< "Duplicate will be removed from map to add" << std::endl;
|
||||
<< gpioIdToCheck << " detected. " << "Duplicate will be removed from map to add"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printWarning(
|
||||
"LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition "
|
||||
|
@ -49,8 +49,7 @@ ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) {
|
||||
if (not statusPair.second) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "I2cComIF::initializeInterface: Failed to insert device with address "
|
||||
<< i2cAddress << "to I2C device "
|
||||
<< "map" << std::endl;
|
||||
<< i2cAddress << "to I2C device " << "map" << std::endl;
|
||||
#endif
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
@ -91,8 +90,8 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
||||
auto i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress);
|
||||
if (i2cDeviceMapIter == i2cDeviceMap.end()) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not "
|
||||
<< "registered in i2cDeviceMap" << std::endl;
|
||||
sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " << "registered in i2cDeviceMap"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
@ -197,9 +197,8 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie* spiCookie, const
|
||||
if (result == MutexIF::MUTEX_TIMEOUT) {
|
||||
sif::error << "SpiComIF::sendMessage: Lock timeout" << std::endl;
|
||||
} else {
|
||||
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code "
|
||||
<< "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec
|
||||
<< std::endl;
|
||||
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex
|
||||
<< std::setfill('0') << std::setw(4) << result << std::dec << std::endl;
|
||||
}
|
||||
#else
|
||||
sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result);
|
||||
@ -307,9 +306,8 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code "
|
||||
<< "0x" << std::hex << std::setfill('0') << std::setw(4) << result << std::dec
|
||||
<< std::endl;
|
||||
sif::error << "SpiComIF::sendMessage: Failed to lock mutex with code " << "0x" << std::hex
|
||||
<< std::setfill('0') << std::setw(4) << result << std::dec << std::endl;
|
||||
#else
|
||||
sif::printError("SpiComIF::sendMessage: Failed to lock mutex with code %d\n", result);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user