#ifndef _PROTOOLS_H
#define _PROTOOLS_H
#include "user.h"
enum SIGNAL_STATE
{
  PC_OPEN           = 0,  //锁倒下
  PC_CLOSE          = 1,
  //PC_OPEN_2         = 16,
  //PC_CLOSE_2        = 17,
  //  CARD_OPEN         = 2,
  CARD_CLOSE        = 3,  //锁立起来
  PC_REQ            = 4,
  CRC_ERR           = 5,
  ERR               = 6,
  LOW_BAT_OPEN      = 7,
  NOSNL_CLOSE       = 8,
  //REQ_CARD          = 9,
  ADDED_LOCKID      = 10,
  ADDED_WL_LOCK     = 11,
  ADDED_WL_CARD     = 12,
  ADDED_WL_PC       = 13,
  OPT_CONF          = 14,
  //  SET_AUTH          = 15,
  //       CARD_ACTION       = 16,//智能卡动作命令。
  GET_OPT_PA        = 17,
  GET_ADDED_WL_PC   = 18,
  GET_ADDED_WL_LOCK = 19,
  //GET_MAG_DATA      = 20,
  SET_MAG_GAIN      = 21,
  //   GET_MAG_GAIN      = 22,
  PC_OPEN_FAULT     = 23,
  PC_CLOSE_FAULT    = 24,
  ALL_OPEN          = 25,
  ALL_CLOSE         = 26,

  REMOTE_ENABLE     = 27,
  REMOTE_DISABLE    = 28,
  GET_REMOTE_STATE  = 29,
  SET_CURRENT_PARA  = 30,
  GET_CURRENT_PARA  = 31,
  SET_WL_PARA,
  GET_WL_PARA,
  ALARM,
  HAVE_CAR,
  /*20180224增加 */
  MAGCARON,
  SET_LED_0,
  SET_LED_1,
  SET_BEEP_0,
  SET_BEEP_1,
  SET_LED_BEEP_0,
  SET_LED_BEEP_1,
  SET_CAR_NO_STATE,
  SET_CAR_YES_STATE,
  SET_PHO_PARA,
  GET_PHO_PARA,
  PC_OPEN_REPORT,
  PC_CLOSE_REPROT,
  BOOT,
  TEST_REC,
  HARDWARE_VERSION_QUERY,
  SOFTWARE_VERSION_QUERY,
  BatLowValueRead,
  BatLowValueWrite
};
struct WIRELESS_STR
{
		uint8_t WireId[3];
		uint8_t FrameHead;
		uint8_t CmdLength;
		uint8_t LockId[2];
		uint8_t Data[20];
		uint8_t CheckSum;
		uint8_t FrameTail;
};
struct CAR_DATA_STR
{
		uint8_t DataFlag;
		uint8_t hmcX[2];
		uint8_t hmcY[2];
		uint8_t pr[2];
		uint8_t AlarmFlag;
		uint8_t Voltage;
		uint8_t CmdSource;
		uint8_t LockState;
		uint8_t CarState;
		uint8_t ForKingView;
		uint8_t current_para[4];
		uint8_t WlPara[6];
		uint8_t Opa[4];
		uint8_t LockID[2];
		uint8_t WLADD_LOCK[3];
		uint8_t WLADD_CARD[3];
		uint8_t WLADD_PC[3];//车位锁保存的网关信息
		uint8_t WL_PARA[6];
		uint8_t tmp_thr_pho[10];
		uint8_t Other[10];
};
void CmdDeal(void);
void SendData(u8 SINGAL);
extern struct CAR_DATA_STR CarRecDataStr;
extern uint8_t CycleDetectionTime;
void CycleDetection(void);
#endif
