#pragma once #include #include #include #include #include "connectors/IConnector.h" #include "external/tgbot-cpp/include/tgbot/tgbot.h" #include "connectors/Types.h" #include "core/inc/ThreadSafeQueue.h" namespace MBFT { class TgbotCppConnector : public IConnector { private: std::unique_ptr bot; MBFT::ThreadSafeQueue> sendQ; MBFT::ThreadSafeQueue> recvQ; std::thread inbound_thread; std::thread outbound_thread; void inbound_message_callback(TgBot::Message::Ptr message); static void inbound_message_thread(TgBot::Bot& bot); static void outbound_message_thread(TgBot::Bot& bot, MBFT::ThreadSafeQueue>& q); public: TgbotCppConnector(void); virtual std::shared_ptr receive(void) override; virtual void send(std::shared_ptr& msg) override; }; }