17#ifndef _MQTTPublisher_H_
18#define _MQTTPublisher_H_
20#include <unordered_map>
23#include <mosquittopp.h>
24#include "UObject_SK.h"
25#include "SMInterface.h"
26#include "SharedMemory.h"
27#include "extensions/Extensions.h"
110 protected mosqpp::mosquittopp,
115 const std::string& prefix =
"mqtt" );
119 static std::shared_ptr<MQTTPublisher>
init_mqttpublisher(
int argc,
const char*
const* argv,
121 const std::string& prefix =
"mqtt" );
124 static void help_print(
int argc,
const char*
const* argv );
126 virtual void on_connect(
int rc)
override;
127 virtual void on_message(
const struct mosquitto_message* message)
override;
128 virtual void on_subscribe(
int mid,
int qos_count,
const int* granted_qos)
override;
133 virtual void askSensors( UniversalIO::UIOCommand cmd )
override;
138 std::shared_ptr<SMInterface> shm;
146 sid(
id), pubname(name) {}
149 typedef std::unordered_map<uniset::ObjectId, MQTTInfo> MQTTMap;
153 RangeInfo(
long min,
long max,
const std::string& t ): rmin(min), rmax(max), text(t) {}
158 bool check(
long val )
const;
170 std::list<RangeInfo> rlist;
172 void check( mosqpp::mosquittopp* serv,
long value, std::shared_ptr<DebugStream>& log,
const std::string& myname );
174 std::string replace(
RangeInfo* ri,
long value );
177 typedef std::unordered_map<uniset::ObjectId, MQTTTextInfo> MQTTTextMap;
180 MQTTTextMap textpublist;
186 bool connectOK = {
false };
187 std::string host = {
"localhost" };
189 int keepalive = { 60 };
Definition UObject_SK.h:30
Definition MQTTPublisher.h:112
static std::shared_ptr< MQTTPublisher > init_mqttpublisher(int argc, const char *const *argv, uniset::ObjectId shmID, const std::shared_ptr< SharedMemory > &ic=nullptr, const std::string &prefix="mqtt")
Definition MQTTPublisher.cc:218
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition MQTTPublisher.cc:142
static void help_print(int argc, const char *const *argv)
Definition MQTTPublisher.cc:164
Definition MessageType.h:127
Definition MessageType.h:171
Definition Calibration.h:27
long ObjectId
Definition UniSetTypes_i.idl:30
Definition MQTTPublisher.h:141
Definition MQTTPublisher.h:162
Definition MQTTPublisher.h:152