Files
fsfw/unittests/CatchFactory.cpp
T

65 lines
2.3 KiB
C++
Raw Normal View History

2021-04-13 00:19:09 +02:00
#include "CatchFactory.h"
2021-08-16 10:49:07 +02:00
2021-01-13 11:53:34 +01:00
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
2020-12-14 21:14:38 +01:00
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
2021-08-16 10:49:07 +02:00
#include <fsfw/internalerror/InternalErrorReporter.h>
2020-12-14 21:14:38 +01:00
#include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw/storagemanager/PoolManager.h>
2021-01-13 11:53:34 +01:00
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
2021-08-16 10:49:07 +02:00
2022-02-02 10:29:30 +01:00
#include "mocks/HkReceiverMock.h"
#include "tests/TestsConfig.h"
2021-08-16 10:49:07 +02:00
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
2020-12-14 21:14:38 +01:00
/**
* @brief Produces system objects.
* @details
* Build tasks by using SystemObject Interface (Interface).
* Header files of all tasks must be included
* Please note that an object has to implement the system object interface
* if the interface validity is checked or retrieved later by using the
* get<TargetInterface>(object_id) function from the ObjectManagerIF.
*
* Framework objects are created first.
*
* @ingroup init
*/
2021-08-16 10:49:07 +02:00
void Factory::produceFrameworkObjects(void* args) {
2022-02-02 10:29:30 +01:00
setStaticFrameworkObjectIds();
new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE);
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
{
PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}};
new PoolManager(objects::TM_STORE, poolCfg);
}
{
PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}};
new PoolManager(objects::IPC_STORE, poolCfg);
}
2020-12-14 21:14:38 +01:00
}
// TODO: Our tests, and the code base in general should really not depend on some arbitrary function
// like this. Instead, this should be more like a general struct containing all important
// object IDs which are then explicitely passed in the object constructor
2020-12-14 21:14:38 +01:00
void Factory::setStaticFrameworkObjectIds() {
2022-07-26 18:46:28 +02:00
PusServiceBase::PACKET_DESTINATION = objects::NO_OBJECT;
2021-01-13 11:53:34 +01:00
2022-02-02 10:29:30 +01:00
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
2021-01-13 11:53:34 +01:00
2022-02-02 10:29:30 +01:00
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
2022-06-05 12:52:55 +02:00
DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
2021-01-13 11:53:34 +01:00
LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
2022-02-02 10:29:30 +01:00
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
2020-12-14 21:14:38 +01:00
}
2021-08-16 10:49:07 +02:00
#endif