#ifndef _ZH_PROTOCOL_H
#define _ZH_PROTOCOL_H
#include "Mini58Series.h"
#define BUF_COUNT 2
#define FRAME_LEN 10

enum ops_type_e
{
		NET_ADDR = 0,
		SWITCH,
		MODE,
		TEMPERATURE,
		WIND_SPEED,
		WIND_DIRECTION,
		ROOM_TEMP,
		MALFUNCTION,
		STATE,
		CRC,
		POLL_CHECK,
		DELAY_TIME
};

enum sw_state_e
{
    SW_OFF = 0,
    SW_ON  = 1
};

enum mode_e
{
    HEATINF            = 1,
    REFRIGERATION      = 2,
    SUPPLY_AIR         = 4,
    XERANSIS           = 8 
};

enum wind_speed
{
    AUTOMATIC          = 0,
    LOW_SPEED          = 1,
    INTERMEDIATE_SPEED = 2,
    HIGH_SPEED         = 3
};

enum wind_direction_e
{
    NO_WIND_DIRECTION  = 0,
    ANGLE_30           = 1,
    ANGLE_45           = 2,
    ANGLE_60           = 4,
    SWING              = 7
};

struct ZH_protocol_t 
{
		uint8_t send_times;
		uint8_t buf_handle_flag[BUF_COUNT];
		uint8_t send_buf[FRAME_LEN];
		uint8_t receive_buf[BUF_COUNT][FRAME_LEN];
		uint8_t poll_check_receive[FRAME_LEN];
	
		enum ops_type_e ops_type;
	
		void (*uart_init)(void (*send_uart)(uint8_t *buf, uint8_t len));
		void (*send)(enum ops_type_e type, uint8_t state);
		void (*receive)(uint8_t re_data);
		void (*send_all)(uint8_t On_OFF, uint8_t temperature, uint8_t windspeed,uint8_t mode,uint8_t wind_direct);
};

extern struct ZH_protocol_t *ZH_protocol_i;

#endif
