2021-05-14 19:38:02 +02:00
|
|
|
#include "logger.h"
|
|
|
|
|
#include "module.h"
|
|
|
|
|
#include "pipeline.h"
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include "nlohmann/json.hpp"
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include "processing.h"
|
2021-08-15 16:47:44 +02:00
|
|
|
#include "main_ui.h"
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2021-08-15 16:47:44 +02:00
|
|
|
namespace processing
|
2021-05-14 19:38:02 +02:00
|
|
|
{
|
2021-08-15 16:47:44 +02:00
|
|
|
void process(std::string downlink_pipeline,
|
|
|
|
|
std::string input_level,
|
|
|
|
|
std::string input_file,
|
|
|
|
|
std::string output_level,
|
|
|
|
|
std::string output_file,
|
2021-11-03 20:44:23 +01:00
|
|
|
nlohmann::json parameters)
|
2021-08-15 16:47:44 +02:00
|
|
|
{
|
|
|
|
|
satdumpUiStatus = OFFLINE_PROCESSING;
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2021-08-15 16:47:44 +02:00
|
|
|
logger->info("Starting processing pipeline " + downlink_pipeline + "...");
|
|
|
|
|
logger->debug("Input file (" + input_level + ") : " + input_file);
|
|
|
|
|
logger->debug("Output file (" + output_level + ") : " + output_file);
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2021-08-15 16:47:44 +02:00
|
|
|
if (!std::filesystem::exists(output_file))
|
2022-02-22 19:55:11 +01:00
|
|
|
std::filesystem::create_directories(output_file);
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2022-02-22 19:55:11 +01:00
|
|
|
// Get pipeline
|
|
|
|
|
std::optional<Pipeline> pipeline = getPipelineFromName(downlink_pipeline);
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2022-02-22 19:55:11 +01:00
|
|
|
if (pipeline.has_value())
|
|
|
|
|
pipeline.value().run(input_file, output_file, parameters, input_level, true, uiCallList, uiCallListMutex);
|
2021-08-15 16:47:44 +02:00
|
|
|
else
|
|
|
|
|
logger->critical("Pipeline " + downlink_pipeline + " does not exist!");
|
2021-05-14 19:38:02 +02:00
|
|
|
|
2021-08-15 16:47:44 +02:00
|
|
|
logger->info("Done! Goodbye");
|
|
|
|
|
satdumpUiStatus = MAIN_MENU;
|
|
|
|
|
}
|
2021-05-14 19:38:02 +02:00
|
|
|
}
|