remote.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : remote.h
  5. * @brief : Header for remote.c file.
  6. * This file contains the common defines of the application.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2024 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __REMOTE_H
  22. #define __REMOTE_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32l4xx_hal.h"
  28. #include "uType.h"
  29. /* Private includes ----------------------------------------------------------*/
  30. /* USER CODE BEGIN Includes */
  31. /* USER CODE END Includes */
  32. /* Exported types ------------------------------------------------------------*/
  33. /* USER CODE BEGIN ET */
  34. #include <string.h> //memset
  35. #include <stdio.h> //printf
  36. #include <stdbool.h> // bool
  37. /* USER CODE END ET */
  38. /* Exported constants --------------------------------------------------------*/
  39. /* USER CODE BEGIN EC */
  40. /* USER CODE END EC */
  41. /* Exported macro ------------------------------------------------------------*/
  42. /* USER CODE BEGIN EM */
  43. /* USER CODE END EM */
  44. /* Exported functions prototypes ---------------------------------------------*/
  45. /* USER CODE BEGIN EFP */
  46. /* 消息体属性 */
  47. struct body_attributy{
  48. uint8_t res;
  49. uint8_t length;
  50. };
  51. typedef struct _Msg_Header{
  52. uint16_t id;
  53. struct body_attributy attr;
  54. uint8_t phone_number[6];
  55. uint16_t sequence;
  56. }Msg_Header;
  57. typedef struct _Register_Body{
  58. uint16_t province;
  59. uint16_t city;
  60. uint8_t manufacturer[5];
  61. uint8_t terminalNo[20];
  62. uint8_t terminalId[7];
  63. uint8_t license_color;
  64. uint8_t license[9];
  65. }Register_Body;
  66. /* USER CODE END EFP */
  67. /* Private defines -----------------------------------------------------------*/
  68. /* USER CODE BEGIN Private defines */
  69. uint8_t Calculate_Checksum(uint8_t* data, uint16_t length);
  70. void my_memmove(char* dest, const char* src, size_t count);
  71. uint16_t escape_7E(char* data, uint16_t data_len );
  72. uint8_t Send_Register(void);
  73. uint8_t Send_Heartbeat(void);
  74. uint8_t Send_General_response(void);
  75. uint8_t Send_sensorline(void);
  76. uint8_t Send_systemlevel(void);
  77. uint8_t Send_Sensordata(Remote_msg* msg);
  78. uint8_t Send_Pressure_CO_H2_Data(SensorDataBuffer* sensor_data);
  79. uint8_t Send_Temperature_Data(SensorDataBuffer* sensor_data);
  80. /* USER CODE END Private defines */
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __REMOTE_H */