#ifndef COMMONSTRUCT_H #define COMMONSTRUCT_H //电刺激相关 #define FRAME_HEAD 0xAA #define FRAME_END 0x55 #define FUNCCODE_DIGITAL_GET_INFO 0x81 #define FUNCCODE_DIGITAL_CONTROL 0X82 #define FUNCCODE_DIGITAL_PRECONDITIONING 0x83 #define FUNCCODE_DIGITAL_POWOFF 0x84 #define FUNCCODE_DIGITAL_ERROR 0x8F #define FUNCCODE_ANALOG_SETTING 0x91 #define FUNCCODE_ANALOG_CHANNAL_CONTROL 0x92 #define FUNCCODE_ANALOG_SET_CURRENT 0x93 #define FUNCCODE_ANALOG_DATA_UPLOAD 0x94 #define FUNCCODE_ANALOG_DATA_CHANGE 0x95 #define FUNCCODE_ANALOG_SET_GAIN 0x96 #define FUNCCODE_ANALOG_SET_COLLECT 0x97 #define FUNCCODE_ANALOG_SET_STIMULATE 0x98 #define FUNCCODE_ANALOG_STATE 0x99 #define FUNCCODE_ANALOG_ERROR 0x9F #define FUNCCODE_ANALOG_ERROR 0x9F #include enum PowState { PowCancel=0, PowOff=1, PowOn=2 }; enum CheckFunc { CheckFuncSum, CheckFuncXOR, CheckFuncCRC16 }; enum LightState { LightO1 = 1, LightOff = 2, LightFlicker = 3 }; enum ModeState { ModeOut = 0, ModeIn =1 }; enum ErrorCode { ErrorCheckSum = 0, ErrorFuncCode = 1 }; enum SampleRate { SamplingRate4K=4000, SamplingRate8k=8000 }; enum WorkMode //工作模式 { WorkModeCollect=1, //采集 WorkModeStimulate=2,//刺激 WorkModeTrigge=3 //触发 }; enum ChannelState { ChannelStateClose = 0, ChannelStateOpen = 1, ChannelStatePause = 2, ChannelStateContinue=3 }; enum ChannelWorkState //工作状态 { ChannelWorkFree = 0,//空闲态 ChannelWorkRise = 1,//上坡态 ChannelWorkFall = 2,//下坡态 ChannelWorkHold = 3,//保持态 ChannelWorkBreak = 4//休息态 }; enum DataMode { DataModeRMS = 0, DataModeRaw = 1 }; enum GainMode { GainMode10 = 0, GainMode100 = 1 }; struct DigitalInfo { uint8_t adapterState; uint8_t batteryState; uint8_t reset; uint8_t AChannelA; uint8_t AChannelB; uint8_t AChannelC; uint8_t AChannelD; }; struct SerialLogInfo { int iRevTotalByte; int iGoodFrameCount; int iCheckNGFrameCount; int iRevGoodByte; int iSendFrameCount; int iSendNGFrameCount; }; struct AnalogSetting { WorkMode workmode; //模式 SampleRate samplerate;//采样率 qreal frequency; //频率 int pulseWidth; //脉宽 qreal risingTime; //上升时间 qreal fallingTime; //下降时间 int holdingTime; //保持时间 int breakTime; //休息时间 }; struct AnalogState { ModeState electrodeStateA; ModeState electrodeStateB; ModeState electrodeStateC; ModeState electrodeStateD; ModeState resetState; ChannelWorkState channelWorkStateA; ChannelWorkState channelWorkStateB; ChannelWorkState channelWorkStateC; ChannelWorkState channelWorkStateD; }; struct MyoelectricData { int ch1; int ch2; int ch3; int ch4; }; Q_DECLARE_METATYPE(MyoelectricData) #endif // COMMONSTRUCT_H