access.h 866 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <sys/cdefs.h>
  2. //
  3. // Created by 李建 on 2023/12/6.
  4. //
  5. #ifndef TEST_ACCESS_H
  6. #define TEST_ACCESS_H
  7. #include "gateway_defs.h"
  8. #include "freertos/FreeRTOS.h"
  9. #include "freertos/task.h"
  10. #include <cJSON.h>
  11. #define MQTT_CONNECTED BIT0
  12. #define MQTT_DISCONNECTED BIT1
  13. typedef struct
  14. {
  15. TaskHandle_t taskHandle;
  16. int32_t event_id;
  17. uint8_t return_code;
  18. } MQTT_t;
  19. typedef struct
  20. {
  21. char *topic; // 发布的主题
  22. cJSON *data; // 上报的data字段
  23. } publish_message_t;
  24. // device access the mqtt server
  25. _Noreturn void device_access_task(void *pv);
  26. /**
  27. * 设备上报状态
  28. */
  29. void sparrow_publish_status(publish_message_t message);
  30. /**
  31. * 设备上报事件
  32. */
  33. void sparrow_publish_event(publish_message_t message);
  34. /**
  35. * 设备上报指令响应
  36. */
  37. void sparrow_publish_command(publish_message_t message);
  38. #endif // TEST_ACCESS_H