Files
MQTT/include/MQTT.h
T
2025-01-16 14:57:27 +01:00

39 lines
657 B
C++

#ifndef MQTT_H
#define MQTT_H
#include "MQTTMessage.h"
#include <functional>
#include <memory>
#include <string>
namespace MQTT {
class MQTTImpl;
class MQTT
{
public:
MQTT(const std::string& hostname, int port, int threads = 3);
~MQTT();
MQTT(const MQTT&) = delete;
public:
typedef std::function<void(const MQTTMessage&)> CallbackMethod;
public:
bool Send(const MQTTMessage& message);
bool Subscribe(const std::string& topic);
void Unsubscribe(const std::string& topic);
size_t Connect(CallbackMethod function);
void Disconnect(size_t connection);
private:
std::unique_ptr<MQTTImpl> m_pMQTTImpl;
};
} // namespace MQTT
#endif // MQTT_H