#ifndef  _SOFT_TERRAIN_H_
#define  _SOFT_TERRAIN_H_
#include "stdint.h"
#include "stdbool.h"
#include "common.h"
#include "soft_obstacle.h"

#pragma pack(1)
typedef struct 
{
  //获取心跳属性
  Connect_check Link;

  //获取雷达高度数据
  short height;
  uint8_t crc;
  
  //获取灵敏度
  char send_fcu_sensi_count;
  char get_radar_sensi_count;
  bool get_radar_sensi_flag; //标志位
  bool fcu_set_sensi_flag;
  short fcu_set_sensi;      //灵敏度
  short get_radar_sensi;
  char set_radar_sensi_count;
  bool set_radar_sensi_ack;

  //获取版本信息
  bool get_radar_ver_flag;
  bool get_radar_sn_flag;
  char version[10];
  int soft_verison;
  int hard_version;

  bool get_radar_blind_flag;
  bool get_radar_power_flag;
  bool get_radar_rawSwitch_flag;
  //SN号
  char sn[20];
}uavr_terrain;
#pragma pack()

#pragma pack(1)
struct dm_byte1
{
  uint8_t tail:1;
  uint8_t head:1;
  uint8_t i:6;
};
#pragma pack()

union dm_byte
{
  uint8_t frame_flag;
  struct dm_byte1 flag;
};

#pragma pack(1)
typedef struct 
{
  int soft_verison;
  char version[10];
  char sn[20];

  bool get_radar_ver_flag;
  bool get_radar_sn_flag;
}moocib_part_radar_msg;
#pragma pack()
#pragma pack(1)
typedef struct 
{
  uint8_t target_num;
  uint16_t power_level;
  uint16_t crc;
  uint16_t warn;
  union dm_byte byte7;
  uint8_t buf[150];
}DM_RADAR;
#pragma pack()
#pragma pack(1)
typedef struct 
{
  uint8_t target_num;
  uint16_t time_delay;
  uint16_t crc;
  uint16_t err_num;
  union dm_byte byte7;

  uint8_t RawData[25 * 2];
}DM_4dTRADAR;
#pragma pack()
#pragma pack(1)
typedef struct 
{
  uint8_t target_num;
  uint16_t time_delay;
  uint16_t err_num;

  uint8_t RawData[25 * 2];
}DM_4dTRADAR_tofmu;
#pragma pack()
#pragma pack(1)
typedef struct 
{
  uint8_t target_num;
  uint16_t time_delay;
  uint16_t crc;
  uint16_t warn;
  union dm_byte byte7;

  uint8_t RawData[256 * 5];
}DM_4dFRADAR;
#pragma pack()
typedef struct 
{
  char version[11];
  int soft_verison;
  char sn[20];

  bool get_radar_ver_flag;

}DM_4D_REDARVER;
extern DM_4D_REDARVER DM_4DB_info;
extern bool DM4Dmsg_send_fmu;
extern DM_4dTRADAR DM_T4d;
extern DM_4dTRADAR DM_BT4d;
extern bool F4DB_send_flag;
extern uint8_t DM4dt_recv_flag;
extern uint8_t DM4dbt_recv_flag;
extern uavr_terrain uavr56_info;
extern uavr_terrain mimo_ter_info; 
extern moocib_part_radar_msg Mocib_radar_part;
extern DM_RADAR DM_T_info,FMU_DM_info;
extern Connect_check DM_status;
extern Connect_check DM_4dstatus;
extern uint8_t DM_recv_flag;
extern DM_4dFRADAR DM_B4d;
extern uavr_obs DM_f_info;
extern int16_t F_4DRadar[3][3];
extern int16_t B_4DRadar[3][3];
extern DM_4dTRADAR_tofmu D4T_tofmu;
extern DM_4dTRADAR_tofmu D4BT_tofmu;
extern bool F4DT_send_flag;
extern uavr_terrain DM_ter_info;
void can_recv_mocib_terrain(uint8_t *data);
void can_recv_enzhao_terrain(uint32_t CanID, uint8_t data[], uint8_t len);
void can_recv_mocib_T_terrain(uint32_t CanID, uint8_t data[], uint8_t len);
void DM_Fobs_recieved_hookfuction(uint32_t cellCanID,uint8_t data[], uint8_t len);
void DM_terrain_recieved_hookfuction(uint32_t cellCanID,uint8_t data[], uint8_t len);
void DM_Bobs_recieved_hookfuction(uint32_t cellCanID,uint8_t data[], uint8_t len);
#endif 