protocol_GB.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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-12-15 RuoFeng the first version
  9. */
  10. #ifndef APPLICATIONS_PROTOCOL_GB_H_
  11. #define APPLICATIONS_PROTOCOL_GB_H_
  12. /*********************↓ define ↓************************/
  13. /*********************↑ define ↑************************/
  14. /**
  15. *
  16. *
  17. *
  18. *
  19. * */
  20. /*********************↓ include ↓************************/
  21. // #include <main.h>
  22. #include <rtthread.h>
  23. #include "cJSON.h"
  24. /*********************↑ include ↑************************/
  25. /**
  26. *
  27. *
  28. *
  29. *
  30. * */
  31. /*********************↓ extern ↓************************/
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /*********************↑ extern ↑************************/
  36. /**
  37. *
  38. *
  39. *
  40. *
  41. * */
  42. /********************↓ declaration ↓***********************/
  43. /**
  44. * @brief 生成OB帧(观测数据)
  45. * @return cJSON对象,需要调用者释放
  46. */
  47. cJSON* generate_ob_frame(char issupp);
  48. /**
  49. * @brief 生成ME帧(元数据)
  50. * @param firmware 固件版本
  51. * @return cJSON对象,需要调用者释放
  52. */
  53. cJSON* generate_me_frame(void);
  54. /**
  55. * @brief 生成ST帧(状态数据)
  56. * @return cJSON对象,需要调用者释放
  57. */
  58. cJSON* generate_st_frame(void);
  59. /**
  60. * @brief 更新传感器状态和质控码
  61. */
  62. void update_sensor_status(void);
  63. /**
  64. * @brief 获取当前协议版本
  65. * @return 协议版本字符串
  66. */
  67. const char* get_protocol_version(void);
  68. /**
  69. * @brief 获取设备类型编码
  70. * @return 设备类型编码字符串
  71. */
  72. const char* get_device_type(void);
  73. /**
  74. * @brief 获取数据字典标识
  75. * @return 数据字典标识字符串
  76. */
  77. const char* get_data_dict(void);
  78. /********************↑ declaration ↑***********************/
  79. /**
  80. *
  81. *
  82. *
  83. *
  84. * */
  85. /*********************↓ global variables ↓************************/
  86. #ifndef FALSE
  87. #define FALSE 0
  88. #endif
  89. #ifndef TRUE
  90. #define TRUE 1
  91. #endif
  92. /*********************↑ global variables ↑************************/
  93. /**
  94. *
  95. *
  96. *
  97. *
  98. * */
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102. #endif /* APPLICATIONS_PROTOCOL_GB_H_ */