Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:21:06

0001 #ifndef __MQTTCONNECTION_H__
0002 #define __MQTTCONNECTION_H__
0003 
0004 #include <string>
0005 #include <mosquitto.h>
0006 
0007 
0008 class MQTTConnection {
0009 
0010  public:
0011 
0012   MQTTConnection ( const std::string hostname, const std::string topic, const int port=1883);
0013   virtual ~MQTTConnection();
0014 
0015   virtual int Status() const { return _status;};
0016   virtual std::string GetHostName() const { return _hostname;};
0017   virtual int GetPort() const { return _port;};
0018   
0019   virtual int send(const std::string message); 
0020 
0021  protected:
0022 
0023   int OpenConnection();
0024   int CloseConnection();
0025 
0026   std::string _hostname;
0027   std::string _topic;
0028   int _status;
0029   int _port;
0030 
0031   struct mosquitto *mosq;
0032 
0033 };
0034 
0035 #endif