
#ifndef __COMMUNITION_MINI_H
#define __COMMUNITION_MINI_H




typedef  enum 
{
    PC_CMD_HANDSHAKE = 0x01,
    PC_CMD_SETWIFI,
	PC_CMD_QRCODE,
	PC_CMD_REPORT_RESULT,
	PC_CMD_DATA_UPLOAD,
	PC_CMD_REPORT_REEOR = 0x06,
	PC_CMD_DATASCOPE,
	PC_CMD_SETSN,
	PC_CMD_INFO,
	PC_CMD_SNANDCARD,
	PC_CMD_SETIP = 0x0B,
	PC_CMD_SETRUNTEMP = 0x10,
	PC_CMD_UPDATESTATE = 0x11,
	PC_CMD_ASKSTATE = 0x12,
	PC_CMD_SETSTATE = 0x13,/*设置强制改变模块状态*/
	UINON_CMD_TEMP_ADJ = 0x40, /*校准参数*/
	UINON_CMD_TEMP_PID = 0x41, /*PID参数*/
	UINON_CMD_TEMP_ADJ_GET = 0x42, /*校准参数*/
	UINON_CMD_TEMP_PID_GET = 0x43, /*PID参数*/
	UINON_CMD_TEMP_START = 0x44, /*开始加热*/
	UINON_CMD_TEMP_STOP = 0x45, /*停止加热*/
	UINON_CMD_MOTORMOVE = 0x48,
	UINON_CMD_MOTORTRETURN = 0x49,
	UINON_CMD_MOTORSTOP = 0x4a,
	UINON_CMD_MOTORGETPRAM = 0x4b,
	UINON_CMD_TEMP_DEBUG = 0x50,
	UINON_CMD_THEROM_GOAL = 0x51,
	UINON_CMD_THEROM_CHECK = 0x52,
	UINON_CMD_THEROM_OFFSET = 0x53,
	UINON_CMD_THEROM_PID = 0x54,
	UINON_CMD_THEROM_OVERHEAT = 0x55,
	UINON_CMD_THEROM_OVERCOOL = 0x56,
	UINON_CMD_THEROM_GET = 0x58,
}pc_cmd_type;
typedef struct _sysinf
{
	unsigned char SN[8];
	unsigned char amplifState;
	unsigned char lysisState;
  unsigned char updateSt;
}stateinfDef;

typedef struct 
{
    unsigned short head;
    unsigned char seq;
    unsigned char cmd;
    unsigned short len;
    char *data;
    unsigned char checksum;
    unsigned char tail;
}CmdMessage, *pCmdMessage;

struct PCActionPack
{
    pc_cmd_type cmd;
    int (*action)(unsigned char cmd, unsigned char *parg);
    int (*response)(CmdMessage *pMsg, unsigned char result);
    int datalen;
};
/* host量配置参数 */
typedef struct _pidParm {
    float kp; /* 预留参数2 */
    float ki; /* 预留参数1 */
    float kd; /* 预留参数3 */
} pidParm;
/* host量配置参数 */
typedef struct _MotorParm {
    float time; /* 预留参数2 */
    float speed; /* 预留参数1 */
    float swingtime; /* 预留参数3 */
} MotorParm;
/* host量配置参数 */
typedef struct _tempAdjCouple {
    float raw;    /*原始值*/
    float offset; /*预留参数2 */
} tempAdjCouple;

typedef struct _tempAdjParm {
    unsigned int section; /* 段数 */
    tempAdjCouple *offsetlist; /*  */
} tempAdjParm;

typedef struct _miniConfigPram {    
	unsigned int partID;
    union {
        pidParm pid;
        tempAdjParm adj;
        MotorParm minf;
    }Pram;
} miniConfigPram;



void query_pc_cmd(CmdMessage *pMsg);
unsigned int check_to_pc_busy(void);
unsigned short data_send_to_pc(pc_cmd_type cmd, char *data, unsigned short len);
#endif
