chore: housekeeping

This commit is contained in:
2024-11-12 00:55:52 +06:00
parent 5f9c966602
commit 48943ba71f
32 changed files with 715 additions and 854 deletions

View File

@@ -5,7 +5,7 @@
#include <stdbool.h>
#include "ch32v003fun.h"
#include "w5500.h"
#include "network.h"
#define MAX_PAYLOAD_LENGTH 256
@@ -17,6 +17,7 @@ typedef struct {
int qos;
} ch32_mqtt_options_t;
// MQTT state
typedef struct {
Network network;
MQTTClient client;
@@ -28,16 +29,18 @@ typedef struct {
bool discovery_published;
} mqtt_state_t;
// List of connected MQTT nodes
extern char nodes_list[MAX_PAYLOAD_LENGTH];
void mqtt_init(mqtt_state_t* state);
void mqtt_process(mqtt_state_t* state);
// Callback for handling incoming MQTT messages
void message_arrived(MessageData* md);
void publish_value(MQTTClient* client, const char* device_name,
const char* property, uint16_t value);
// Publish a retained message to an MQTT topic
void publish_retained(MQTTClient* client, const char* topic,
const char* payload);
// Publish a QoS 0 message to a MQTT topic
void publish_message(MQTTClient* client, const char* payload,
const char* topic);
#endif
#endif // MQTT_HANDLER_H