Fix MqttPubSub Constructor

* Fix MqttPubSub constructor
* Add MQTT client accessor to MqttConnector
This commit is contained in:
kasedy 2020-05-17 14:02:00 -07:00 committed by GitHub
parent 7d3bbf4240
commit 51dabb705f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,9 @@ class MqttConnector {
}
virtual void onConnect() = 0;
public:
inline AsyncMqttClient* getMqttClient() const { return _mqttClient; }
};
template <class T>
@ -141,8 +144,8 @@ class MqttPubSub : public MqttPub<T>, public MqttSub<T> {
String pubTopic = "",
String subTopic = "") :
MqttConnector<T>(statefulService, mqttClient),
MqttPub<T>(jsonSerializer, statefulService, mqttClient, pubTopic = ""),
MqttSub<T>(jsonDeserializer, statefulService, mqttClient, subTopic = "") {
MqttPub<T>(jsonSerializer, statefulService, mqttClient, pubTopic),
MqttSub<T>(jsonDeserializer, statefulService, mqttClient, subTopic) {
}
public: