Skip to content

Commit

Permalink
Changed topic
Browse files Browse the repository at this point in the history
  • Loading branch information
fpersson committed Jul 14, 2020
1 parent 6978b1d commit d76ba91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion MqttClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace TempSensor {
class MqttClient : public Mqtt, public FObserver::Observer {
public:
MqttClient(MqttSettings &settings) : Mqtt(settings), mPendingData(""){;}
MqttClient(MqttSettings &settings) : Mqtt(settings), mPendingData(""), mTopic(settings.topic){;}

void onConnected() override;

Expand All @@ -32,6 +32,7 @@ namespace TempSensor {
void notify(const std::string& data) override;
private:
std::string mPendingData;
std::string mTopic;
};
}

Expand Down
2 changes: 1 addition & 1 deletion mqtt/Mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace TempSensor{

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Mqtt::Mqtt(TempSensor::MqttSettings &settings) : isConnected(false), mTopic(settings.topic), mSettings(settings){
Mqtt::Mqtt(TempSensor::MqttSettings &settings) : isConnected(false), mSettings(settings){
mosquitto_lib_init();
mosq = mosquitto_new(nullptr, true, this);

Expand Down
3 changes: 1 addition & 2 deletions mqtt/Mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ namespace TempSensor{
void subscribe(const std::string &topic, int qos);

/**
* @todo make pure virtual
* @brief called on error message
* @param errmsg
*/
Expand Down Expand Up @@ -97,7 +96,7 @@ namespace TempSensor{
std::atomic<bool> mRunning{};
protected:
bool isConnected;
std::string mTopic;
//std::string mTopic;
};
}//namespace

Expand Down

0 comments on commit d76ba91

Please sign in to comment.