//
// Created by zx on 2023/11/24.
//

#include "communication_manager.h"

Error_manager CommunicationManager::Init(const CommunicationManagerConfig &config) {

    if (config.grpc_enable()) {
        m_grpc_server = new StreamRpcServer;
        m_grpc_server->Listenning(config.grpc_server_ip(), 9876);
    }

    if (config.rabbitmq_enable()) {
        std::string file_path = ETC_PATH PROJECT_NAME + config.rabbitmq_config_file();
        RabbitmqCommunicationTof3D::get_instance_pointer()->rabbitmq_init_from_protobuf(file_path);
    }

    if (config.mqtt_enable()) {
        std::string file_path = ETC_PATH PROJECT_NAME + config.mqtt_config_file();
        Tof3DMqttAsyncClient::iter()->init(file_path);
    }
    return {};
}
