/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : remote.h
  * @brief          : Header for remote.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __REMOTE_H
#define __REMOTE_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_hal.h"
#include "uType.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
#include <string.h> //memset
#include <stdio.h>	//printf
#include <stdbool.h> // bool

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/


/* USER CODE BEGIN EFP */
/* 消息体属性 */
struct body_attributy{
	uint8_t      res;
	uint8_t      length;
};

typedef struct _Msg_Header{
	uint16_t id;
	struct body_attributy attr;
	uint8_t phone_number[6];
	uint16_t sequence;
}Msg_Header;

typedef struct _Register_Body{
	uint16_t province;
	uint16_t city;
	uint8_t  manufacturer[5];
	uint8_t  terminalNo[20];
	uint8_t  terminalId[7];
	uint8_t  license_color;
	uint8_t  license[9];
}Register_Body;



/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */
uint8_t Calculate_Checksum(uint8_t* data, uint16_t length);
void my_memmove(char* dest, const char* src, size_t count);
uint16_t escape_7E(char* data, uint16_t data_len );
uint8_t Send_Register(void);
uint8_t Send_Heartbeat(void);
uint8_t Send_General_response(void);
uint8_t Send_sensorline(void);
uint8_t Send_systemlevel(void);
uint8_t Send_Sensordata(Remote_msg* msg);
uint8_t Send_Pressure_CO_H2_Data(SensorDataBuffer* sensor_data);
uint8_t Send_Temperature_Data(SensorDataBuffer* sensor_data);

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __REMOTE_H */
