summaryrefslogtreecommitdiff
path: root/mqtt.h
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2022-12-26 08:33:32 +0100
committerMikhail Burakov <mburakov@mailbox.org>2022-12-26 08:33:32 +0100
commit56df239a929cc050f7c22ccf9010c657e65c4b9a (patch)
tree5c1be36eb4bbf8993c5387e37e6b48c2cfd8acab /mqtt.h
parent16c0e4a3c8de3c96d29fd495c1aded36d8935759 (diff)
Add new mqtt implementation to toolbox
Diffstat (limited to 'mqtt.h')
-rw-r--r--mqtt.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/mqtt.h b/mqtt.h
new file mode 100644
index 0000000..6740ffc
--- /dev/null
+++ b/mqtt.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 Mikhail Burakov. This file is part of toolbox.
+ *
+ * toolbox is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * toolbox 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with toolbox. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef TOOLBOX_MQTT_H_
+#define TOOLBOX_MQTT_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+bool MqttConnect(int mqtt, uint16_t keepalive);
+bool MqttSubscribe(int mqtt, uint16_t message_id, const char* topic,
+ uint16_t topic_size);
+bool MqttPublish(int mqtt, const char* topic, uint16_t topic_size,
+ const void* payload, size_t payload_size);
+bool MqttPing(int mqtt);
+bool MqttDisconnect(int mqtt);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // TOOLBOX_MQTT_H_