|
LOM2M
0.8.0
|
#include "mqttBinding.h"#include "JsonMapper.h"#include "RequestPrimitive.h"#include "gateway.h"#include "keys.h"#include "lom2m.h"#include "tools.h"#include <LittleFS.h>#include <NTPClient.h>#include <WiFiUdp.h>Functions | |
| bool | sendBadRequestMqtt (MqttTopic *mqttTopic) |
| bool | mqtt_setup (WiFiClientSecure *espClient) |
| void | mqtt_reconnect (WiFiClientSecure *espClient, PubSubClient *client, bool loop) |
| void | mqtt_callback (char *topic, byte *payload, unsigned int length) |
| bool | mqtt_send_response (PubSubClient &client, ResponsePrimitive &resp, MqttTopic &mqttTopic) |
| bool | mqtt_send_request (PubSubClient &client, RequestPrimitive &req, String &mqttTopic) |
| void | sendResponse (ResponsePrimitive &response) |
Variables | |
| PubSubClient * | MQTT_CLIENT = nullptr |
| WiFiClientSecure * | ESP_CLIENT = nullptr |
| String | message |
| MqttTopic | mqttTopic |
| void mqtt_callback | ( | char * | topic, |
| byte * | payload, | ||
| unsigned int | length | ||
| ) |
Callback to use when a new MQTT message is received
| topic | - the topic of the received message |
| payload | - of the message |
| lenght | - of the message |
This is used for MQTT setup and subscription
| void mqtt_reconnect | ( | WiFiClientSecure * | espClient, |
| PubSubClient * | client, | ||
| bool | loop = true |
||
| ) |
Reconnect to the MQTT broker
| client | - PubSubClient (mqtt) used to publish and subscribe to topics on the broker |
| espClient | used for the TCP connection |
| loop | - enables to try only once to reconnect or to loop until it is connected Default is keep looping until connected. Used when connection is lost and will lock the process into reconnection phase until it succeeds (if loop set to true or not set at all) |
| bool mqtt_send_request | ( | PubSubClient & | client, |
| RequestPrimitive & | req, | ||
| String & | mqttTopic | ||
| ) |
| bool mqtt_send_response | ( | PubSubClient & | client, |
| ResponsePrimitive & | resp, | ||
| MqttTopic & | mqttTopic | ||
| ) |
Send a response over MQTTS
| client | - MQTT client to use |
| resp | - response primitive to serialize and to send over mqtt |
| topic | - mqtt topic structure containing elements to build the topic to publish to |
| bool mqtt_setup | ( | WiFiClientSecure * | espClient | ) |
Perform all the setup for MQTTS binding
| espClient | used for secure connection establishment |
| bool sendBadRequestMqtt | ( | MqttTopic * | mqttTopic | ) |
| void sendResponse | ( | ResponsePrimitive & | response | ) |
| WiFiClientSecure* ESP_CLIENT = nullptr |
| String message |
| PubSubClient* MQTT_CLIENT = nullptr |
| MqttTopic mqttTopic |