#include "dds_manager.hpp"
#include <QDebug>

DDSManager::DDSManager(QObject *parent)
    : QObject(parent)
    , publisher_(std::make_unique<HelloWorldPublisher>())
{
}

DDSManager::~DDSManager() = default;

bool DDSManager::init()
{
    return publisher_->init();
}

void DDSManager::publishOnce()
{
    if (publisher_->publish())
    {
        emit messagePublished(
            QString::fromStdString(publisher_->getCurrentMessage()),
            publisher_->getCurrentIndex()
        );
    }
} 
