ensaht/mqtt.h
A.M. Rowsell c937638cad wifi: squash commit of wifi implementation
Squashed commit of the following:

commit 7684f6a159896d44ec7dc865aeb382ed674f5764
Author: A.M. Rowsell <amr@frzn.dev>
Date:   Wed Jun 24 02:53:46 2026 -0400

    wireless: these files also need to be present to build, oops.

commit 3b5760f4ffa6e0162fad54552a7274d3209334d8
Author: A.M. Rowsell <amr@frzn.dev>
Date:   Tue Jun 23 10:57:55 2026 -0400

    wifi: working setup with MQTT, plus averaging of readings
2026-06-24 02:55:09 -04:00

31 lines
1.1 KiB
C

#ifndef ENSAHT_MQTT_H
#define ENSAHT_MQTT_H
#include "lwip/apps/mqtt.h"
typedef struct {
mqtt_client_t *client;
ip_addr_t server_addr;
const char *hostname;
u16_t port;
struct mqtt_connect_client_info_t client_info;
mqtt_connection_cb_t connect_cb;
void *connect_arg;
} ensaht_mqtt_t;
void ensaht_mqtt_init(ensaht_mqtt_t *mqtt);
err_t ensaht_mqtt_connect(ensaht_mqtt_t *mqtt, const char *hostname, u16_t port,
const struct mqtt_connect_client_info_t *client_info,
mqtt_connection_cb_t cb, void *arg);
void ensaht_mqtt_disconnect(ensaht_mqtt_t *mqtt);
err_t ensaht_mqtt_publish(mqtt_client_t *client, const char *topic,
const void *payload, u16_t payload_length,
mqtt_request_cb_t cb, void *arg);
err_t ensaht_mqtt_publish_client(ensaht_mqtt_t *mqtt, const char *topic,
const void *payload, u16_t payload_length,
mqtt_request_cb_t cb, void *arg);
err_t ensaht_mqtt_pingreq(mqtt_client_t *client);
err_t ensaht_mqtt_pingreq_client(ensaht_mqtt_t *mqtt);
#endif