2026-02-24 20:57:59 +04:00
|
|
|
#include "logos_manager.h"
|
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
void logos_core_set_plugins_dir(const char* plugins_dir);
|
|
|
|
|
void logos_core_start();
|
|
|
|
|
void logos_core_cleanup();
|
|
|
|
|
char** logos_core_get_loaded_plugins();
|
|
|
|
|
int logos_core_load_plugin(const char* plugin_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logos::Logos(const QString& pluginsDir)
|
|
|
|
|
: m_pluginsDir(pluginsDir)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
Logos::~Logos()
|
|
|
|
|
{
|
|
|
|
|
if (m_initialized) {
|
|
|
|
|
cleanup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Logos::init()
|
|
|
|
|
{
|
|
|
|
|
std::cout << "Setting plugins directory to: " << m_pluginsDir.toStdString() << std::endl;
|
|
|
|
|
logos_core_set_plugins_dir(m_pluginsDir.toUtf8().constData());
|
|
|
|
|
|
|
|
|
|
logos_core_start();
|
|
|
|
|
std::cout << "Logos Core started successfully!" << std::endl;
|
|
|
|
|
|
2026-02-24 21:02:48 +04:00
|
|
|
// capability_module is loaded automatically by logos_core_start()
|
2026-02-24 20:57:59 +04:00
|
|
|
if (!logos_core_load_plugin("storage_module")) {
|
|
|
|
|
std::cerr << "Failed to load storage_module plugin" << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
std::cout << "Successfully loaded storage_module plugin" << std::endl;
|
|
|
|
|
|
2026-02-26 10:39:27 -03:00
|
|
|
m_api = new LogosAPI("cli");
|
|
|
|
|
m_modules = new LogosModules(m_api);
|
2026-02-24 20:57:59 +04:00
|
|
|
m_initialized = true;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Logos::cleanup()
|
|
|
|
|
{
|
|
|
|
|
if (!m_initialized) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Logos: cleanup...";
|
|
|
|
|
|
2026-02-26 10:39:27 -03:00
|
|
|
delete m_modules;
|
|
|
|
|
delete m_api;
|
2026-02-24 20:57:59 +04:00
|
|
|
logos_core_cleanup();
|
|
|
|
|
|
|
|
|
|
m_initialized = false;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-26 10:39:27 -03:00
|
|
|
LogosModules* Logos::modules()
|
2026-02-24 20:57:59 +04:00
|
|
|
{
|
2026-02-26 10:39:27 -03:00
|
|
|
return m_modules;
|
2026-02-24 20:57:59 +04:00
|
|
|
}
|