A private doorbell project to serve an Android app with webcam pictures and microphone recordings when someone presses the button. Information is being spread via MQTT. https://www.taibsu.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
884 B

#include <string>
// 3rd-party
#include <mosquittopp.h>
#include "config.h"
namespace tai
class mqttClient : public mosqpp::mosquittopp
mqttClient(std::shared_ptr<tai::config> config);
bool send(const std::string& message);
bool subscribeTo(const std::string& topic);
bool subscribeToKnownTopic();
std::shared_ptr<tai::config> _conf;
std::string _host;
std::string _id;
std::string _topic;
std::string _token;
std::string _user;
std::string _pass;
int _port;
int _keepalive;
std::thread _mqttLoop;
void on_connect(int rc) override;
void on_disconnect(int rc) override;
void on_publish(int mid) override;
void on_message(const struct mosquitto_message* message) override;
void on_subscribe(int mid, int qos_count, const int* granted_qos) override;
#endif // MQTTCLIENT_H