lwip_mqtt_api.h 1.2 KB

1234567891011121314151617181920212223242526
  1. #ifndef _LWIP_MQTT_API_H
  2. #define _LWIP_MQTT_API_H
  3. #include "sockets.h"
  4. #include "lwip/apps/mqtt.h"
  5. #include "lwip/apps/mqtt_priv.h"
  6. #define MQTT_STRING_SIZE MQTT_OUTPUT_RINGBUF_SIZE
  7. err_t lwip_mqtt_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port, mqtt_connection_cb_t cb, void *arg,
  8. const struct mqtt_connect_client_info_t *client_info);
  9. err_t lwip_mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t dup, u8_t qos, u8_t retain,
  10. mqtt_request_cb_t cb, void *arg);
  11. err_t lwip_mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub);
  12. void lwip_mqtt_disconnect(mqtt_client_t *client);
  13. void lwip_mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t pub_cb,
  14. mqtt_incoming_data_cb_t data_cb, void *arg);
  15. u8_t lwip_mqtt_client_is_connected(mqtt_client_t *client);
  16. #define lwip_mqtt_client_new() mqtt_client_new()
  17. #define lwip_mqtt_subscribe(client, topic, qos, cb, arg) lwip_mqtt_sub_unsub(client, topic, qos, cb, arg, 1)
  18. #define lwip_mqtt_unsubscribe(client, topic, cb, arg) lwip_mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
  19. #endif