satdump/src-core/init.cpp

76 lines
2.2 KiB
C++
Raw Normal View History

2022-05-12 15:24:25 -07:00
#define SATDUMP_DLL_EXPORT 1
2021-03-22 18:53:09 +01:00
#include "init.h"
#include "logger.h"
#include "core/module.h"
#include "core/pipeline.h"
2021-05-04 12:23:22 +02:00
#include <filesystem>
//#include "tle.h"
#include "core/plugin.h"
#include "satdump_vars.h"
#include "core/config.h"
2021-08-02 23:33:10 +02:00
2022-04-21 16:10:00 +02:00
#include "common/tracking/tle.h"
2022-05-20 20:19:14 +02:00
#include "products/products.h"
2022-04-21 16:10:00 +02:00
2022-08-30 12:01:12 +02:00
#include "core/opencl.h"
2022-03-10 19:56:37 +01:00
namespace satdump
2021-03-22 18:53:09 +01:00
{
2022-05-12 15:24:25 -07:00
SATDUMP_DLL std::string user_path;
2022-05-07 17:06:56 +02:00
2022-03-10 19:56:37 +01:00
void initSatdump()
{
logger->info(" _____ __ ____ ");
logger->info(" / ___/____ _/ /_/ __ \\__ ______ ___ ____ ");
logger->info(" \\__ \\/ __ `/ __/ / / / / / / __ `__ \\/ __ \\");
logger->info(" ___/ / /_/ / /_/ /_/ / /_/ / / / / / / /_/ /");
logger->info("/____/\\__,_/\\__/_____/\\__,_/_/ /_/ /_/ .___/ ");
logger->info(" /_/ ");
logger->info("Starting SatDump v" + (std::string)SATDUMP_VERSION);
logger->info("");
2022-03-30 15:41:23 +02:00
#ifdef _WIN32
2022-05-07 17:06:56 +02:00
user_path = ".";
2022-05-13 21:35:51 +02:00
#elif __ANDROID__
user_path = ".";
2022-03-30 15:41:23 +02:00
#else
2022-05-07 17:06:56 +02:00
user_path = std::string(getenv("HOME")) + "/.config/satdump";
2022-03-30 15:41:23 +02:00
#endif
if (std::filesystem::exists("satdump_cfg.json"))
config::loadConfig("satdump_cfg.json", user_path);
else
config::loadConfig(satdump::RESPATH + "satdump_cfg.json", user_path);
2022-03-10 19:56:37 +01:00
loadPlugins();
registerModules();
// Load pipelines
if (std::filesystem::exists("pipelines") && std::filesystem::is_directory("pipelines"))
loadPipelines("pipelines");
else
loadPipelines(satdump::RESPATH + "pipelines");
2022-03-10 19:56:37 +01:00
// List them
logger->debug("Registered pipelines :");
for (Pipeline &pipeline : pipelines)
logger->debug(" - " + pipeline.name);
2022-08-30 12:01:12 +02:00
#ifdef USE_OPENCL
// OpenCL
opencl::initOpenCL();
#endif
2022-03-10 19:56:37 +01:00
// TLEs
2022-04-21 16:10:00 +02:00
if (config::main_cfg["satdump_general"]["update_tles_startup"]["value"].get<bool>())
updateTLEFile(user_path + "/satdump_tles.txt");
loadTLEFileIntoRegistry(user_path + "/satdump_tles.txt");
2022-03-10 19:56:37 +01:00
2022-05-20 20:19:14 +02:00
// Products
registerProducts();
2022-03-10 19:56:37 +01:00
// Let plugins know we started
eventBus->fire_event<SatDumpStartedEvent>({});
}
}