applied formatting
Some checks failed
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
2022-01-17 15:58:27 +01:00
parent 975b3cd294
commit 77c45c0de9
206 changed files with 28883 additions and 30263 deletions

View File

@ -1,26 +1,24 @@
#ifndef BSP_Q7S_CORE_NVMPARAMS_PARAMETERDEFINITIONS_H_
#define BSP_Q7S_CORE_NVMPARAMS_PARAMETERDEFINITIONS_H_
#include "mission/memory/NVMParameterBase.h"
#include <filesystem>
#include <nlohmann/json.hpp>
#include <filesystem>
#include "mission/memory/NVMParameterBase.h"
class DummyParameter: public NVMParameterBase {
public:
static constexpr char DUMMY_KEY_PARAM_1[] = "dummy1";
static constexpr char DUMMY_KEY_PARAM_2[] = "dummy2";
class DummyParameter : public NVMParameterBase {
public:
static constexpr char DUMMY_KEY_PARAM_1[] = "dummy1";
static constexpr char DUMMY_KEY_PARAM_2[] = "dummy2";
DummyParameter(std::string mountPrefix, std::string jsonFileName):
NVMParameterBase(mountPrefix + "/conf/" + jsonFileName),
mountPrefix(mountPrefix) {
insertValue(DUMMY_KEY_PARAM_1, 1);
insertValue(DUMMY_KEY_PARAM_2, "blablub");
}
DummyParameter(std::string mountPrefix, std::string jsonFileName)
: NVMParameterBase(mountPrefix + "/conf/" + jsonFileName), mountPrefix(mountPrefix) {
insertValue(DUMMY_KEY_PARAM_1, 1);
insertValue(DUMMY_KEY_PARAM_2, "blablub");
}
private:
std::string mountPrefix;
private:
std::string mountPrefix;
};
#endif /* BSP_Q7S_CORE_NVMPARAMS_PARAMETERDEFINITIONS_H_ */

View File

@ -1,29 +1,29 @@
#include <test/testtasks/PusTcInjector.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tmtcpacket/pus/TcPacketBase.h>
#include <fsfw/tmtcpacket/pus/TcPacketStored.h>
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
#include <fsfw/tmtcservices/TmTcMessage.h>
#include <fsfw/tmtcpacket/pus/TcPacketBase.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/tmtcpacket/pus/TcPacketStored.h>
#include <test/testtasks/PusTcInjector.h>
PusTcInjector::PusTcInjector(object_id_t objectId, object_id_t destination,
object_id_t tcStore, uint16_t defaultApid): SystemObject(objectId),
defaultApid(defaultApid), destination(destination), tcStoreId(tcStore) {
}
PusTcInjector::PusTcInjector(object_id_t objectId, object_id_t destination, object_id_t tcStore,
uint16_t defaultApid)
: SystemObject(objectId),
defaultApid(defaultApid),
destination(destination),
tcStoreId(tcStore) {}
PusTcInjector::~PusTcInjector() {
}
PusTcInjector::~PusTcInjector() {}
//ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// uint8_t subservice,const uint8_t* appData, size_t appDataLen) {
// return injectPusTelecommand(service, subservice, defaultApid, appData,
// appDataLen);
//}
// }
// TODO: ACK flags
//ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// ReturnValue_t PusTcInjector::injectPusTelecommand(uint8_t service,
// uint8_t subservice,uint16_t apid, const uint8_t* appData,
// size_t appDataLen) {
// // Prepare TC packet. Store into TC store immediately.
@ -44,24 +44,22 @@ PusTcInjector::~PusTcInjector() {
//}
ReturnValue_t PusTcInjector::initialize() {
// Prepare message queue which is used to send telecommands.
injectionQueue = QueueFactory::instance()->
createMessageQueue(INJECTION_QUEUE_DEPTH);
AcceptsTelecommandsIF* targetQueue = ObjectManager::instance()->
get<AcceptsTelecommandsIF>(destination);
if(targetQueue == nullptr) {
sif::error << "PusTcInjector: CCSDS distributor not initialized yet!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
else {
injectionQueue->setDefaultDestination(targetQueue->getRequestQueue());
}
// Prepare message queue which is used to send telecommands.
injectionQueue = QueueFactory::instance()->createMessageQueue(INJECTION_QUEUE_DEPTH);
AcceptsTelecommandsIF* targetQueue =
ObjectManager::instance()->get<AcceptsTelecommandsIF>(destination);
if (targetQueue == nullptr) {
sif::error << "PusTcInjector: CCSDS distributor not initialized yet!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
} else {
injectionQueue->setDefaultDestination(targetQueue->getRequestQueue());
}
// Prepare store used to store TC messages
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
if(tcStore == nullptr) {
sif::error << "PusTcInjector: TC Store not initialized!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
// Prepare store used to store TC messages
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
if (tcStore == nullptr) {
sif::error << "PusTcInjector: TC Store not initialized!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -3,70 +3,71 @@
#include <fsfw/ipc/MessageQueueIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include <array>
class PusTcInjector: public SystemObject {
public:
static constexpr uint8_t INJECTION_QUEUE_DEPTH = 10;
const uint16_t defaultApid;
class PusTcInjector : public SystemObject {
public:
static constexpr uint8_t INJECTION_QUEUE_DEPTH = 10;
const uint16_t defaultApid;
/**
* Initialize a software telecommand injector by supplying object IDs to
* various helper objects which must exist before calling initialiez()
* @param objectId ID of PUS telecommand injector
* @param destination ID of destination, which has to implement
* AcceptsTelecommandIF.
* @param tcStore ID of telecommand store, which has to implement
* StorageManagerIF.
* @param defaultApid Default APID which will be used if an injection
* without an APID is requested.
*/
PusTcInjector(object_id_t objectId, object_id_t destination,
object_id_t tcStore, uint16_t defaultApid);
/**
* This has to be called before using the PusTcInjector.
* Call Not necessary when using a factory and the object manager.
* @return -@c RETURN_OK for successfull init
* -@c ObjectManagerIF::CHILD_INIT_FAILED otherwise
*/
ReturnValue_t initialize() override;
/**
* Initialize a software telecommand injector by supplying object IDs to
* various helper objects which must exist before calling initialiez()
* @param objectId ID of PUS telecommand injector
* @param destination ID of destination, which has to implement
* AcceptsTelecommandIF.
* @param tcStore ID of telecommand store, which has to implement
* StorageManagerIF.
* @param defaultApid Default APID which will be used if an injection
* without an APID is requested.
*/
PusTcInjector(object_id_t objectId, object_id_t destination, object_id_t tcStore,
uint16_t defaultApid);
/**
* This has to be called before using the PusTcInjector.
* Call Not necessary when using a factory and the object manager.
* @return -@c RETURN_OK for successfull init
* -@c ObjectManagerIF::CHILD_INIT_FAILED otherwise
*/
ReturnValue_t initialize() override;
virtual~ PusTcInjector();
virtual ~PusTcInjector();
/**
* Can be used to inject a telecommand by supplying service, subservice
* and optional application data and its length.
* Default APID will be used.
* @param service PUS service type
* @param subservice PUS subservice type
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
//ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// const uint8_t* appData = nullptr, size_t appDataLen = 0);
/**
* Can be used to inject a telecommand by supplying service, subservice
* and optional application data and its length.
* Default APID will be used.
* @param service PUS service type
* @param subservice PUS subservice type
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
// ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// const uint8_t* appData = nullptr, size_t appDataLen = 0);
/**
* Provides the same functionality while also setting a user defined APID.
* @param service PUS service type
* @param subservice PUS subservice type
* @param apid Custom APID to,
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
//ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// uint16_t apid, const uint8_t* appData = nullptr,
// size_t appDataLen = 0);
private:
MessageQueueIF* injectionQueue = nullptr;
StorageManagerIF *tcStore = nullptr;
/**
* Provides the same functionality while also setting a user defined APID.
* @param service PUS service type
* @param subservice PUS subservice type
* @param apid Custom APID to,
* @param appData Pointer to application data
* @param appDataLen Length of application data
* @return
*/
// ReturnValue_t injectPusTelecommand(uint8_t service, uint8_t subservice,
// uint16_t apid, const uint8_t* appData = nullptr,
// size_t appDataLen = 0);
private:
MessageQueueIF* injectionQueue = nullptr;
StorageManagerIF* tcStore = nullptr;
/* Cached for initialize function */
object_id_t destination = 0;
object_id_t tcStoreId = 0;
/* Cached for initialize function */
object_id_t destination = 0;
object_id_t tcStoreId = 0;
uint16_t sequenceCount = 0;
uint16_t sequenceCount = 0;
};
#endif /* TEST_TESTTASKS_PUSTCINJECTOR_H_ */

View File

@ -1,45 +1,43 @@
#include "TestTask.h"
#include "OBSWConfig.h"
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <array>
#include <cstring>
#include "OBSWConfig.h"
EiveTestTask::EiveTestTask(object_id_t objectId_): TestTask(objectId_), testMode(testModes::A) {
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
EiveTestTask::EiveTestTask(object_id_t objectId_) : TestTask(objectId_), testMode(testModes::A) {
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
}
EiveTestTask::~EiveTestTask() {
}
EiveTestTask::~EiveTestTask() {}
ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) {
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = RETURN_OK;
if(oneShotAction) {
/* Add code here which should only be run once */
performOneShotAction();
oneShotAction = false;
}
if (oneShotAction) {
/* Add code here which should only be run once */
performOneShotAction();
oneShotAction = false;
}
/* Add code here which should only be run once per performOperation */
performPeriodicAction();
/* Add code here which should only be run once per performOperation */
performPeriodicAction();
/* Add code here which should only be run on alternating cycles. */
if(testMode == testModes::A) {
performActionA();
testMode = testModes::B;
}
else if(testMode == testModes::B) {
performActionB();
testMode = testModes::A;
}
return result;
/* Add code here which should only be run on alternating cycles. */
if (testMode == testModes::A) {
performActionA();
testMode = testModes::B;
} else if (testMode == testModes::B) {
performActionB();
testMode = testModes::A;
}
return result;
}
#include <etl/vector.h>
@ -48,70 +46,70 @@ ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) {
/**
* @brief Dummy data from GPS receiver. Will be replaced witgh hyperion data later.
*/
const char
gps_rx_data[] = ""
"$GPRMC,183729,A,3907.356,N,12102.482,W,000.0,360.0,080301,015.5,E*6F\r\n"
"$GPRMB,A,,,,,,,,,,,,V*71\r\n"
"$GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,,*75\r\n"
"$GPGSA,A,3,02,,,07,,09,24,26,,,,,1.6,1.6,1.0*3D\r\n"
"$GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,35*71\r\n"
"$GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43*77\r\n"
"$PGRME,22.0,M,52.9,M,51.0,M*14\r\n"
"$GPGLL,3907.360,N,12102.481,W,183730,A*33\r\n"
"$PGRMZ,2062,f,3*2D\r\n"
"$PGRMM,WGS84*06\r\n"
"$GPBOD,,T,,M,,*47\r\n"
"$GPRTE,1,1,c,0*07\r\n"
"$GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E*67\r\n"
"$GPRMB,A,,,,,,,,,,,,V*71\r\n";
const char gps_rx_data[] =
""
"$GPRMC,183729,A,3907.356,N,12102.482,W,000.0,360.0,080301,015.5,E*6F\r\n"
"$GPRMB,A,,,,,,,,,,,,V*71\r\n"
"$GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,,*75\r\n"
"$GPGSA,A,3,02,,,07,,09,24,26,,,,,1.6,1.6,1.0*3D\r\n"
"$GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,35*71\r\n"
"$GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43*77\r\n"
"$PGRME,22.0,M,52.9,M,51.0,M*14\r\n"
"$GPGLL,3907.360,N,12102.481,W,183730,A*33\r\n"
"$PGRMZ,2062,f,3*2D\r\n"
"$PGRMM,WGS84*06\r\n"
"$GPBOD,,T,,M,,*47\r\n"
"$GPRTE,1,1,c,0*07\r\n"
"$GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E*67\r\n"
"$GPRMB,A,,,,,,,,,,,,V*71\r\n";
const char hyperion_gps_data[] = ""
"$GNGGA,173225.998892,4908.5596,N,00906.2765,E,1,05,2.1,215.0,M,48.2,M,,0000*74\r\n"
"$GNGLL,4908.5596,N,00906.2765,E,173225.998892,A,A*7F\r\n"
"$GPGSA,A,3,18,16,26,31,20,,,,,,,,3.2,2.1,2.4*3C\r\n"
"$GNRMC,173225.998892,A,4908.5596,N,00906.2765,E,000.0,040.7,270221,,,A*4F\r\n"
"$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";
const char hyperion_gps_data[] =
""
"$GNGGA,173225.998892,4908.5596,N,00906.2765,E,1,05,2.1,215.0,M,48.2,M,,0000*74\r\n"
"$GNGLL,4908.5596,N,00906.2765,E,173225.998892,A,A*7F\r\n"
"$GPGSA,A,3,18,16,26,31,20,,,,,,,,3.2,2.1,2.4*3C\r\n"
"$GNRMC,173225.998892,A,4908.5596,N,00906.2765,E,000.0,040.7,270221,,,A*4F\r\n"
"$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 EiveTestTask::performOneShotAction() {
#if OBSW_ADD_TEST_CODE == 1
//performLwgpsTest();
// performLwgpsTest();
#endif
return HasReturnvaluesIF::RETURN_OK;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t EiveTestTask::performPeriodicAction() {
ReturnValue_t result = RETURN_OK;
return result;
ReturnValue_t result = RETURN_OK;
return result;
}
ReturnValue_t EiveTestTask::performActionA() {
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
}
ReturnValue_t EiveTestTask::performActionB() {
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
ReturnValue_t result = RETURN_OK;
/* Add periodically executed code here */
return result;
}
void EiveTestTask::performLwgpsTest() {
/* Everything here will only be performed once. */
sif::info << "Processing sample GPS output.." << std::endl;
/* Everything here will only be performed once. */
sif::info << "Processing sample GPS output.." << std::endl;
lwgps_t gpsStruct;
sif::info << "Size of GPS struct: " << sizeof(gpsStruct) << std::endl;
lwgps_init(&gpsStruct);
lwgps_t gpsStruct;
sif::info << "Size of GPS struct: " << sizeof(gpsStruct) << std::endl;
lwgps_init(&gpsStruct);
/* Process all input data */
lwgps_process(&gpsStruct, hyperion_gps_data, strlen(hyperion_gps_data));
/* Process all input data */
lwgps_process(&gpsStruct, hyperion_gps_data, strlen(hyperion_gps_data));
/* Print messages */
printf("Valid status: %d\n", gpsStruct.is_valid);
printf("Latitude: %f degrees\n", gpsStruct.latitude);
printf("Longitude: %f degrees\n", gpsStruct.longitude);
printf("Altitude: %f meters\n", gpsStruct.altitude);
/* Print messages */
printf("Valid status: %d\n", gpsStruct.is_valid);
printf("Latitude: %f degrees\n", gpsStruct.latitude);
printf("Longitude: %f degrees\n", gpsStruct.longitude);
printf("Altitude: %f meters\n", gpsStruct.altitude);
}

View File

@ -2,12 +2,12 @@
#define TEST_TESTTASK_H_
#include <fsfw/serialize/SerialBufferAdapter.h>
#include <fsfw/serialize/SerializeElement.h>
#include <fsfw/serialize/SerialLinkedListAdapter.h>
#include "fsfw_tests/integration/task/TestTask.h"
#include <fsfw/serialize/SerializeElement.h>
#include <cstddef>
#include "fsfw_tests/integration/task/TestTask.h"
/**
* @brief Test class for general C++ testing.
@ -16,38 +16,35 @@
* tests. Instead, a derived board test class should be used.
*/
class EiveTestTask : public TestTask {
public:
EiveTestTask(object_id_t objectId);
virtual ~EiveTestTask();
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
public:
EiveTestTask(object_id_t objectId);
virtual ~EiveTestTask();
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
protected:
virtual ReturnValue_t performOneShotAction();
virtual ReturnValue_t performPeriodicAction();
virtual ReturnValue_t performActionA();
virtual ReturnValue_t performActionB();
protected:
virtual ReturnValue_t performOneShotAction();
virtual ReturnValue_t performPeriodicAction();
virtual ReturnValue_t performActionA();
virtual ReturnValue_t performActionB();
enum testModes: uint8_t {
A,
B
};
enum testModes : uint8_t { A, B };
testModes testMode;
testModes testMode;
bool testFlag = false;
uint8_t counter { 1 };
uint8_t counterTrigger { 3 };
bool testFlag = false;
uint8_t counter{1};
uint8_t counterTrigger{3};
void performPusInjectorTest();
void examplePacketTest();
private:
// Actually, to be really thread-safe, a mutex should be used as well
// Let's keep it simple for now.
bool oneShotAction = true;
StorageManagerIF* IPCStore;
void performPusInjectorTest();
void examplePacketTest();
void performLwgpsTest();
private:
// Actually, to be really thread-safe, a mutex should be used as well
// Let's keep it simple for now.
bool oneShotAction = true;
StorageManagerIF* IPCStore;
void performLwgpsTest();
};
#endif /* TESTTASK_H_ */