#pragma once
#include "ZZ_Types.h"
#define  MAXBUFFER			10240

using namespace ZZ_MISCDEF;

typedef struct tagTransportLayerInfomation
{
	//Serial
	int iPortType = 0;
	int iPortNumber;
	int iIndexBaudRate;
	int iBaudRate = 9600;
	int	indexParity = 0, indexBytesize = 3, indexStopBits = 0; //Mode
	bool    Hw;		
	bool	Sw;		
	bool    Dtr, Rts;
	QString qstrFullPortName = "";
	  //Bit
	  //Stop
	  //MODEM CONTROL setting
	  //MODEM LINE STATUS

	//TCP UDP

}PortInfo;

typedef struct tagMotorStatusInfo
{
	float fVelocity;
	int   iPosition;
	ZZ_U32  uiFlags;
}MSInfo;

typedef struct tagControllerParams
{
	int bdr    = 9600;     //baud
	int mcs    = 6;     //microsteps 0:full 1:half 2:4 3:8 4:16 5:32 6:64 7:128 8:256
	float spd  = 64000;   //velocity
	float acc  = 100000;   //acceleration
	float dec  = 100000;   //deceleration
	float cra  = (float)0.8;   //acc state current
	float crn  = (float)0.8;   //normal state current
	float crh  = (float)0.8;   //hold state current
	ZZ_U8 s1f;
	ZZ_U8 s1r;
	ZZ_U8 s2f;
	ZZ_U8 s2r;
	ZZ_U8 zmd  = 3;   //zero mode
	ZZ_U8 osv  = 0;   //open state sensor value
	ZZ_U8 snr  = 0;   //zero sensor
	ZZ_U8 zsp  = 200;   //zero safe position
	float zsd  = 50000;   //zero velocity
}ControllerParams;

typedef union
{
	ZZ_U8    byteValue[4];
	short   i16Value[2];
	ZZ_U16  u16Value[2];
	int     i32Value;
	float   fValue;
	ZZ_U32    u32Value;
}unValue;

enum emVSMDTriggerEvent
{
	NoAction =0,        //无动作（只有状态位 S1 变化通知）
	ResetZeroPosition,  //重新设置原点位置
	DecSpdStop,         //减速停止
	DecSpdStopRZP,      //减速停止，并在停止后重新设置原点位置
	Stop,               //立刻停止
	StopRZP,            //立刻停止，并在停止后重新设置原点位置
	RunningPosDirect,   //正向连续运转（正速度）
	RunningNegDirect,   //反向连续运转（负速度）
	OfflineModeOn,      //离线模式启动
	OfflineModeOff      //离线模式停止
};

