start mqtt client (based on paho.mqtt.c), basically works

This commit is contained in:
2026-03-13 23:56:55 +03:00
parent 767bb2b382
commit feb86b15f8
114 changed files with 37878 additions and 6 deletions

View File

@@ -0,0 +1,68 @@
//! \~\file pimqtttypes.h
//! \~\ingroup MQTT
//! \~\brief
//! \~english
//! \~russian
/*
PIP - Platform Independent Primitives
MQTT common types
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef pimqtttypes_h
#define pimqtttypes_h
#include "pip_export.h"
#include "pistring.h"
//! \~english Namespace with shared MQTT data types.
//! \~russian Пространство имен с общими MQTT-типами данных.
namespace PIMQTT {
//! \~english MQTT QoS type.
//! \~russian MQTT тип QoS.
enum class QoS {
Level0 = 0 /** \~english Fire and forget - the message may not be delivered. */,
Level1 = 1 /** \~english At least once - the message will be delivered, but may be delivered more than once in some circumstances. */,
Level2 = 2 /** \~english Once and one only - the message will be delivered exactly once. */,
};
enum class Error {
Unknown = 0 /** */,
UnacceptableProtocolVersion = 1 /** */,
IdentifierRejected = 2 /** */,
ServerUnavailable = 3 /** */,
BadUsernameOrPassword = 4 /** */,
NotAuthorized = 5 /** */,
};
struct PIP_EXPORT Message {
bool isValid() const { return topic.isNotEmpty(); }
PIString topic;
PIByteArray payload;
PIMap<int, PIString> properties; // for v5
QoS qos = QoS::Level0;
int msg_id = 0;
bool is_duplicate = false;
};
}; // namespace PIMQTT
#endif