changes for updated fsfw
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-11-19 13:22:20 +01:00
parent a2d5f872ad
commit c1be4a1e83
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
8 changed files with 52 additions and 46 deletions

View File

@ -227,7 +227,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
// Lambda for common code
auto createNonEmptyTmpDir = [&]() {
if(not std::filesystem::exists("/tmp/test")) {
result = fsHandler->createDirectory("/tmp/test", &cfg);
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
@ -278,7 +278,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
cfg.useMountPrefix = false;
sif::info << "Creating empty file in /tmp folder" << std::endl;
// Do not delete file, user can check existence in shell
ReturnValue_t result = fsHandler->createDirectory("/tmp/test", &cfg);
ReturnValue_t result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
if(result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory created successfully" << std::endl;
}
@ -291,13 +291,13 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
if(not std::filesystem::exists("/tmp/test")) {
result = fsHandler->createDirectory("/tmp/test", &cfg);
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
}
else {
// Delete any leftover files to regular dir removal works
std::remove("/tmp/test/*");
}
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
result = fsHandler->removeDirectory("/tmp", "test", false, &cfg);
if(result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removed successfully" << std::endl;
}
@ -311,7 +311,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
if(result != HasReturnvaluesIF::RETURN_OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/test", true, &cfg);
result = fsHandler->removeDirectory("/tmp", "test", true, &cfg);
if(result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removed recursively successfully" << std::endl;
}
@ -325,7 +325,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
if(result != HasReturnvaluesIF::RETURN_OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
result = fsHandler->removeDirectory("/tmp", "test", false, &cfg);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removal attempt failed as expected" << std::endl;
}

View File

@ -133,8 +133,9 @@ ReturnValue_t FileSystemHandler::initialize() {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename,
const uint8_t *data, size_t size, uint16_t packetNumber, void *args) {
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath,
const char* filename, const uint8_t* data, size_t size,
uint16_t packetNumber, FileSystemArgsIF* args) {
// A double slash between repo and filename should not be an issue, so add it in any case
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
std::string(filename);
@ -149,8 +150,8 @@ ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename,
const uint8_t *data, size_t size, void *args) {
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath,
const char* filename, const uint8_t* data, size_t size, FileSystemArgsIF* args) {
std::string fullPath;
bool useMountPrefix = true;
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
@ -171,8 +172,8 @@ ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const ch
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const char *filename,
void *args) {
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath,
const char* filename, FileSystemArgsIF* args) {
std::string fullPath;
bool useMountPrefix = true;
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
@ -193,7 +194,8 @@ ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const ch
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, void *args) {
ReturnValue_t FileSystemHandler:: createDirectory(const char* repositoryPath, const char* dirname,
bool createParentDirs, FileSystemArgsIF* args) {
std::string fullPath;
bool useMountPrefix = true;
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
@ -202,6 +204,7 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi
}
fullPath += std::string(repositoryPath);
fullPath += "/" + std::string(dirname);
if(std::filesystem::exists(fullPath)) {
return DIRECTORY_ALREADY_EXISTS;
}
@ -212,8 +215,8 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi
return GENERIC_FILE_ERROR;
}
ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
bool deleteRecurively, void *args) {
ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname,
bool deleteRecurively, FileSystemArgsIF* args) {
std::string fullPath;
bool useMountPrefix = true;
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
@ -222,6 +225,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
}
fullPath += std::string(repositoryPath);
fullPath += "/" + std::string(dirname);
if(not std::filesystem::exists(fullPath)) {
return DIRECTORY_DOES_NOT_EXIST;
}
@ -268,3 +272,9 @@ void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) {
useMountPrefix = cfg->useMountPrefix;
}
}
ReturnValue_t FileSystemHandler::renameFile(const char *repositoryPath, const char *oldFilename,
const char *newFilename, FileSystemArgsIF *args) {
// TODO: Implement
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -17,7 +17,7 @@ class FileSystemHandler: public SystemObject,
public ExecutableObjectIF,
public HasFileSystemIF {
public:
struct FsCommandCfg {
struct FsCommandCfg: public FileSystemArgsIF {
// Can be used to automatically use mount prefix of active SD card.
// Otherwise, the operator has to specify the full path to the mounted SD card as well.
bool useMountPrefix = false;
@ -35,18 +35,20 @@ public:
* @return MessageQueueId_t of the object
*/
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t appendToFile(const char* repositoryPath,
const char* filename, const uint8_t* data, size_t size,
uint16_t packetNumber, void* args = nullptr) override;
uint16_t packetNumber, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t createFile(const char* repositoryPath,
const char* filename, const uint8_t* data = nullptr,
size_t size = 0, void* args = nullptr) override;
size_t size = 0, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t removeFile(const char* repositoryPath,
const char* filename, void* args = nullptr) override;
ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) override;
ReturnValue_t removeDirectory(const char* repositoryPath, bool deleteRecurively = false,
void* args = nullptr) override;
const char* filename, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname,
bool createParentDirs, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname,
bool deleteRecurively = false, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename,
const char* newFilename, FileSystemArgsIF* args = nullptr) override;
private:
CoreController* coreCtrl = nullptr;

2
fsfw

@ -1 +1 @@
Subproject commit 190848d00e32274eb844e0f930669b65ffe7eb4e
Subproject commit 5d719d0aeb2d4e2089f5106a03c0bbf9caee4381

View File

@ -18,10 +18,10 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Unittest/eive-unittest"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="fsfw/build-Unittest/fsfw-tests"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.775472168"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive-obsw"/>
</listAttribute>

View File

@ -11,15 +11,14 @@
#include <cstring>
TestTask::TestTask(object_id_t objectId_):
SystemObject(objectId_), testMode(testModes::A) {
EiveTestTask::EiveTestTask(object_id_t objectId_): TestTask(objectId_), testMode(testModes::A) {
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
}
TestTask::~TestTask() {
EiveTestTask::~EiveTestTask() {
}
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
if(oneShotAction) {
@ -74,7 +73,7 @@ const char hyperion_gps_data[] = ""
"$GNVTG,040.7,T,,M,000.0,N,000.0,K,A*10\r\n"
"$GNZDA,173225.998892,27,02,2021,00,00*75\r\n";
ReturnValue_t TestTask::performOneShotAction() {
ReturnValue_t EiveTestTask::performOneShotAction() {
#if OBSW_ADD_TEST_CODE == 1
//performLwgpsTest();
#endif
@ -82,24 +81,24 @@ ReturnValue_t TestTask::performOneShotAction() {
}
ReturnValue_t TestTask::performPeriodicAction() {
ReturnValue_t EiveTestTask::performPeriodicAction() {
ReturnValue_t result = RETURN_OK;
return result;
}
ReturnValue_t TestTask::performActionA() {
ReturnValue_t EiveTestTask::performActionA() {
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
}
ReturnValue_t TestTask::performActionB() {
ReturnValue_t EiveTestTask::performActionB() {
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
}
void TestTask::performLwgpsTest() {
void EiveTestTask::performLwgpsTest() {
/* Everything here will only be performed once. */
sif::info << "Processing sample GPS output.." << std::endl;

View File

@ -1,13 +1,10 @@
#ifndef TEST_TESTTASK_H_
#define TEST_TESTTASK_H_
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/parameters/HasParametersIF.h>
#include <fsfw/serialize/SerialBufferAdapter.h>
#include <fsfw/serialize/SerializeElement.h>
#include <fsfw/serialize/SerialLinkedListAdapter.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include "fsfw_tests/integration/task/TestTask.h"
#include <cstddef>
@ -18,13 +15,11 @@
* Should not be used for board specific
* tests. Instead, a derived board test class should be used.
*/
class TestTask : public SystemObject,
public ExecutableObjectIF,
public HasReturnvaluesIF {
class EiveTestTask : public TestTask {
public:
TestTask(object_id_t objectId);
virtual ~TestTask();
virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
EiveTestTask(object_id_t objectId);
virtual ~EiveTestTask();
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
protected:
virtual ReturnValue_t performOneShotAction();

2
tmtc

@ -1 +1 @@
Subproject commit 28082dca885e35641fda85be765ff10c16c3ebe8
Subproject commit 9068ebbfc07fe2d58d8c41eed133e758729ca9b6