Files
MQTT/include/MQTT.h
T
2020-06-12 11:31:09 +02:00

37 lines
598 B
C++

#ifndef MQTT_H
#define MQTT_H
#include "Message.h"
#include <functional>
#include <memory>
#include <string>
namespace MQTT {
class MQTTImpl;
class MQTT
{
public:
MQTT(const std::string& hostname, int port);
~MQTT();
public:
typedef std::function<void(const Message&)> CallbackMethod;
public:
bool Send(const Message& 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