2021-06-08 13:36:08 +02:00
|
|
|
#include <bsp_hosted/core/InitMission.h>
|
|
|
|
#include <bsp_hosted/core/ObjectFactory.h>
|
|
|
|
#include <fsfw/objectmanager/ObjectManager.h>
|
2022-05-05 20:55:48 +02:00
|
|
|
#include <fsfw/platform.h>
|
2021-06-08 13:36:08 +02:00
|
|
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
|
|
|
#include <fsfw/tasks/TaskFactory.h>
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
#include "example/test/MutexExample.h"
|
|
|
|
#include "example/utility/utility.h"
|
|
|
|
|
2021-06-08 17:38:04 +02:00
|
|
|
#ifdef PLATFORM_WIN
|
2021-06-08 13:36:08 +02:00
|
|
|
static const char* COMPILE_PRINTOUT = "Windows";
|
2021-06-08 17:38:04 +02:00
|
|
|
#elif defined(PLATFORM_UNIX)
|
2021-06-08 13:36:08 +02:00
|
|
|
static const char* COMPILE_PRINTOUT = "Linux";
|
|
|
|
#else
|
|
|
|
static const char* COMPILE_PRINTOUT = "unknown OS";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
|
|
ServiceInterfaceStream sif::debug("DEBUG", false);
|
|
|
|
ServiceInterfaceStream sif::info("INFO", false);
|
|
|
|
ServiceInterfaceStream sif::warning("WARNING", false);
|
|
|
|
ServiceInterfaceStream sif::error("ERROR", false, true, true);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int main() {
|
2022-05-05 20:55:48 +02:00
|
|
|
utility::commonInitPrint("Hosted", COMPILE_PRINTOUT);
|
2021-06-08 13:36:08 +02:00
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::info << "Producing system objects.." << std::endl;
|
2021-06-08 13:36:08 +02:00
|
|
|
#else
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::printInfo("Producing system objects..\n");
|
2021-06-08 13:36:08 +02:00
|
|
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
ObjectManager* objManager = ObjectManager::instance();
|
|
|
|
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
2021-06-08 13:36:08 +02:00
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::info << "Objects created successfully.." << std::endl;
|
|
|
|
sif::info << "Initializing objects.." << std::endl;
|
2021-06-08 13:36:08 +02:00
|
|
|
#else
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::printInfo("Objects created successfully..\n");
|
2021-06-08 13:36:08 +02:00
|
|
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
objManager->initialize();
|
2021-06-08 13:36:08 +02:00
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::info << "Creating tasks.." << std::endl;
|
2021-06-08 13:36:08 +02:00
|
|
|
#else
|
2022-05-05 20:55:48 +02:00
|
|
|
sif::printInfo("Creating tasks..\n");
|
2021-06-08 13:36:08 +02:00
|
|
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
InitMission::createTasks();
|
2021-06-08 13:36:08 +02:00
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
MutexExample::example();
|
|
|
|
// PusPacketCreator::createPusPacketAndPrint();
|
2021-06-08 13:36:08 +02:00
|
|
|
|
2022-05-05 20:55:48 +02:00
|
|
|
/* Permanent loop. */
|
|
|
|
for (;;) {
|
|
|
|
/* Sleep main thread, not needed anymore. */
|
|
|
|
TaskFactory::delayTask(5000);
|
|
|
|
}
|
|
|
|
return 0;
|
2021-06-08 13:36:08 +02:00
|
|
|
}
|