Files
ch32v203-eth-node/include/w5500.h
2024-11-09 03:34:43 +06:00

46 lines
1.0 KiB
C

#ifndef W5500_H
#define W5500_H
#include <MQTT/MQTTClient.h>
#include <stdint.h>
// Definitions for socket indexes
#define DHCP_SOCKET 0
#define DNS_SOCKET 1
#define TCP_SOCKET 2
// Options structure for client identification
typedef struct {
char* clientid;
char* username;
char* password;
int qos;
} ch32_mqtt_options_t;
extern volatile int ip_assigned;
void handle_ip_assigned(void);
// Initializes the W5500 chip
void configure_network(void);
// void configure_dhcp(void);
void dhcp_init(void);
void dhcp_process(void);
// resolves a domain name
void resolve_domain_name(const char* domain_name);
// init and connect the MQTT client
int setup_mqtt_client(Network* network, ch32_mqtt_options_t* opts,
MQTTClient* client);
int subscribe_to_topic(MQTTClient* client, const char* topic, enum QoS qos,
messageHandler message_callback);
// publish a message to a topic
void publish_message(MQTTClient* client, const char* payload,
const char* topic);
#endif // W5500_H