#pragma once
#include "ZZ_Types.h"
#define  MAXBUFFER			10240
#include<qstring.h>
using namespace ZZ_MISCDEF;

typedef struct tagTransportLayerInfomation
{
	//Serial
	int iPortType;
	int iPortNumber;
	int indexBaudRate;
	int iBaudRate;
	int	indexParity, indexBytesize, indexStopBits; //Mode
	bool    Hw;		
	bool	Sw;		
	bool    Dtr, Rts;
	QString FullPortName;
	tagTransportLayerInfomation() {
		iPortType = 0;
		indexParity = 0;
		iPortNumber = 8;
		iBaudRate = 9600;
		indexBytesize = 3;
		indexStopBits = 0;
		FullPortName = "";
	}
	 
	  //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;     //baud
	int mcs;     //microsteps 0:full 1:half 2:4 3:8 4:16 5:32 6:64 7:128 8:256
	float spd;   //velocity
	float acc;   //acceleration
	float dec;   //deceleration
	float cra;   //acc state current
	float crn;   //normal state current
	float crh;   //hold state current
	ZZ_U8 s1f;
	ZZ_U8 s1r;
	ZZ_U8 s2f;
	ZZ_U8 s2r;
	ZZ_U8 zmd;   //zero mode
	ZZ_U8 osv;   //open state sensor value
	ZZ_U8 snr;   //zero sensor
	ZZ_U8 zsp;   //zero safe position
	float zsd;   //zero velocity
	tagControllerParams() {
		bdr = 9600;

		cra = 0.8;
		crh = 0.1;
		crn = 0.8;

		acc = 100000;
		dec = 100000;
		spd = 64000;

		osv = 0;
		snr = 0;
		zmd = 3;
		zsp = 20;
		zsd = 50000;

		mcs = 6;
	}
}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      //����ģʽֹͣ
};

