src/MQTTHandler.h
branchv_0
changeset 1 cb9577442d3b
parent 0 7ef5ce9477c8
child 2 1a0fbd17db13
--- a/src/MQTTHandler.h	Fri May 06 21:54:32 2022 +0200
+++ b/src/MQTTHandler.h	Fri May 06 23:06:44 2022 +0200
@@ -24,12 +24,13 @@
 #include <locale>
 #include <codecvt>
 
+#include <mosquittopp.h>
+
 #include <relpipe/common/type/typedefs.h>
 #include <relpipe/reader/TypeId.h>
 #include <relpipe/reader/handlers/RelationalReaderStringHandler.h>
 #include <relpipe/reader/handlers/AttributeMetadata.h>
 
-#include "MQTT.h"
 #include "Configuration.h"
 #include "Hex.h"
 
@@ -41,7 +42,6 @@
 private:
 	std::wstring_convert<codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
 	Configuration configuration;
-	shared_ptr<MQTT> mq;
 
 	struct CurrentRelation {
 		relpipe::common::type::StringX name;
@@ -53,8 +53,13 @@
 public:
 
 	MQTTHandler(Configuration configuration) : configuration(configuration) {
-		// TODO: do not throw exception from the constructor: MQTT::open()
-		mq.reset(MQTT::open(convertor.to_bytes(configuration.queue), configuration.unlinkOnClose));
+
+		{
+			// TODO: remove
+			int major, minor, patch;
+			mosqpp::lib_version(&major, &minor, &patch);
+			std::cerr << "mosquitto version: " << major << "." << minor << "." << patch << std::endl;
+		}
 	}
 
 	void startRelation(relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) override {
@@ -72,7 +77,7 @@
 		currentRelation.attributeIndex++;
 		if (currentRelation.attributeIndex == currentRelation.attributes.size()) {
 			currentRelation.attributeIndex = 0;
-			mq->send(currentRelation.currentValue);
+			// FIXME: send the message
 		}
 
 	}