mqtt_api.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-06-03 RV the first version
  9. */
  10. #ifndef APPLICATIONS_FIREMQTT_PORT_MQTT_USR_API_H_
  11. #define APPLICATIONS_FIREMQTT_PORT_MQTT_USR_API_H_
  12. #include <rtthread.h>
  13. #include <core_mqtt.h>
  14. #include <transport_interface.h>
  15. #include <sys/socket.h>
  16. #include <netdb.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include "port.h"
  20. #include <sys/select.h> // 添加select相关定义
  21. #include <unistd.h> // 添加close等系统调用定义
  22. #include "port.h"
  23. #include <rtdbg.h>
  24. #include "config.h"
  25. #ifdef RT_USING_ULOG
  26. #define MQTT_PRINT(fmt, ...) LOG_D(fmt, ##__VA_ARGS__)
  27. #else
  28. #define MQTT_PRINT(fmt, ...) ((void)0)
  29. #endif
  30. #define MIN(a, b) ((a) < (b) ? (a) : (b))
  31. MQTTStatus_t mqttInit(NetworkContext_t *networkContext, MQTTEventCallback_t userCallback);
  32. MQTTStatus_t mqttConnect(NetworkContext_t *networkContext);
  33. MQTTStatus_t mqttSubscribe(MQTTSubscribeInfo_t *subscribeInfo);
  34. MQTTStatus_t mqttPublish(MQTTPublishInfo_t *publishInfo);
  35. void mqttClientTask(void *parameter);
  36. #endif /* APPLICATIONS_FIREMQTT_PORT_MQTT_USR_API_H_ */