diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.cpp index 70e77ba..1c34034 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.cpp @@ -13,6 +13,7 @@ CKeyence_Laser::CKeyence_Laser() m_StoredDataNumber=0; m_NeedStorageDataNumber=0; m_StorageCycle=LKIF_STORAGECYCLE_100; + m_ProgramNO=1; } CKeyence_Laser::~CKeyence_Laser() @@ -38,6 +39,14 @@ void CKeyence_Laser::KeyenceLaserInit(void) m_pDataStorageGetStatus=(pLKIF_DataStorageGetStatus)GetProcAddress(m_hLkif,"LKIF_DataStorageGetStatus"); m_pSetDataStorage=(pLKIF_SetDataStorage)GetProcAddress(m_hLkif,"LKIF_SetDataStorage"); m_pSetProgramNo=(pLKIF_SETPROGRAMNO)GetProcAddress(m_hLkif,"LKIF_SetProgramNo"); + m_pSetScaling=(pLKIF_SetScaling)GetProcAddress(m_hLkif,"LKIF_SetScaling"); + m_pGetScaling=(pLKIF_GetScaling)GetProcAddress(m_hLkif,"LKIF_GetScaling"); + m_pSetDisplayUnit=(pLKIF_SetDisplayUnit)GetProcAddress(m_hLkif,"LKIF_SetDisplayUnit"); + m_pGetDisplayUnit=(pLKIF_GetDisplayUnit)GetProcAddress(m_hLkif,"LKIF_GetDisplayUnit"); + m_pSetPanel=(pLKIF_SetPanel)GetProcAddress(m_hLkif,"LKIF_SetPanel"); + m_pSetMeasureMode=(pLKIF_SetMeasureMode)GetProcAddress(m_hLkif,"LKIF_SetMeasureMode"); + m_pSetCalcMethod=(pLKIF_SetCalcMethod)GetProcAddress(m_hLkif,"LKIF_SetCalcMethod"); + m_pSetMutualInterferencePrevention=(pLKIF_SetMutualInterferencePrevention)GetProcAddress(m_hLkif,"LKIF_SetMutualInterferencePrevention"); } else { @@ -250,5 +259,74 @@ BOOL CKeyence_Laser::SetProgramNO(int ProNO) { BOOL bStatus(FALSE); bStatus=m_pSetProgramNo(ProNO); + m_ProgramNO=ProNO; return bStatus; }; + +//============================================== +BOOL CKeyence_Laser::SetOutValueScaling(double _CalibVal) +{ + BOOL bStatus(FALSE); + double DisplayUnit(0.0001); + bStatus=m_pSetDisplayUnit(0,LKIF_DISPLAYUNIT_00_0001MM); + bStatus=m_pSetDisplayUnit(1,LKIF_DISPLAYUNIT_00_0001MM); + int InputValue1(0),OutputValue1(0),InputValue2(10000),OutputValue2(10000); + bStatus=m_pSetScaling(0,0,InputValue1,OutputValue1,InputValue2,OutputValue2); + bStatus=m_pSetScaling(1,1,InputValue1,OutputValue1,InputValue2,OutputValue2); + Sleep(20); + float OutValue1(0.0),OutValue2(0.0); + Get_KeyenceLaserData(&OutValue1,&OutValue2); + InputValue2=static_cast((static_cast(OutValue1))/DisplayUnit); + OutputValue2=static_cast((_CalibVal)/DisplayUnit); + bStatus=m_pSetScaling(0,0,InputValue1,OutputValue1,InputValue2,OutputValue2); + + InputValue2=static_cast((static_cast(OutValue2))/DisplayUnit); + bStatus=m_pSetScaling(1,1,InputValue1,OutputValue1,InputValue2,OutputValue2); + return bStatus; +}; + +//============================================== +BOOL CKeyence_Laser::GetOutValueScaling(double* _CalibratedScale) +{ + BOOL bStatus(FALSE); + double DisplayUnit(0.0001); + bStatus=m_pSetDisplayUnit(0,LKIF_DISPLAYUNIT_00_0001MM); + bStatus=m_pSetDisplayUnit(1,LKIF_DISPLAYUNIT_00_0001MM); + int InputValue1(0),OutputValue1(0),InputValue2(0),OutputValue2(0); + bStatus=m_pGetScaling(0,0,&InputValue1,&OutputValue1,&InputValue2,&OutputValue2); + _CalibratedScale[0]=static_cast(InputValue1)*DisplayUnit; + _CalibratedScale[1]=static_cast(OutputValue1)*DisplayUnit; + _CalibratedScale[2]=static_cast(InputValue2)*DisplayUnit; + _CalibratedScale[3]=static_cast(OutputValue2)*DisplayUnit; + Sleep(20); + bStatus=m_pGetScaling(1,1,&InputValue1,&OutputValue1,&InputValue2,&OutputValue2); + _CalibratedScale[4]=static_cast(InputValue1)*DisplayUnit; + _CalibratedScale[5]=static_cast(OutputValue1)*DisplayUnit; + _CalibratedScale[6]=static_cast(InputValue2)*DisplayUnit; + _CalibratedScale[7]=static_cast(OutputValue2)*DisplayUnit; + return bStatus; +}; +//============================================== +BOOL CKeyence_Laser::SetProgram(char _MeasureMode) +{ + BOOL bStatus(FALSE); + switch(_MeasureMode) + { + case 1: + { + bStatus=m_pSetPanel(2); + bStatus=m_pSetMeasureMode(0,LKIF_MEASUREMODE_TRAN_2); + bStatus=m_pSetMeasureMode(1,LKIF_MEASUREMODE_TRAN_2); + + bStatus=m_pSetCalcMethod(0,LKIF_CALCMETHOD_HEAD_HEADA_TRANSPARENT,LKIF_CALCTARGET_PEAK_1_2); + bStatus=m_pSetCalcMethod(1,LKIF_CALCMETHOD_HEAD_HEADB_TRANSPARENT,LKIF_CALCTARGET_PEAK_1_2); + + bStatus=m_pSetMutualInterferencePrevention(TRUE); + + break; + } + default: + break; + } + return bStatus; +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.h b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.h index 77c4cb0..7926526 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/Keyence_Laser.h @@ -26,6 +26,21 @@ typedef BOOL (WINAPI* pLKIF_DataStorageGetStatus)(IN int OutNo,OUT BOOL *IsStora typedef BOOL (WINAPI* pLKIF_SetDataStorage)(IN LKIF_TARGETOUT TargetOut,IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle); // Program Change typedef BOOL (WINAPI* pLKIF_SETPROGRAMNO)(IN int ProgramNo); +// Program Change +typedef BOOL (WINAPI* pLKIF_SETPROGRAMNO)(IN int ProgramNo); +// Set Scaling +typedef BOOL (WINAPI* pLKIF_SetScaling)(IN int OutNo,IN int HeadNo,IN int InputValue1,IN int OutputValue1,IN int InputValue2,IN int OutputValue2); +typedef BOOL (WINAPI* pLKIF_GetScaling)(IN int OutNo,IN int HeadNo,OUT int *InputValue1,OUT int *OutputValue1,OUT int *InputValue2,OUT int *OutputValue2); + +typedef BOOL (WINAPI* pLKIF_SetDisplayUnit)(IN int OutNo,IN LKIF_DISPLAYUNIT DisplayUnit); +typedef BOOL (WINAPI* pLKIF_GetDisplayUnit)(IN int OutNo,OUT LKIF_DISPLAYUNIT *DisplayUnit); +typedef BOOL (WINAPI* pLKIF_SetPanel)(IN int OutNo); +// Set Measurement Mode +typedef BOOL (WINAPI* pLKIF_SetMeasureMode)(IN int HeadNo,IN LKIF_MEASUREMODE MeasureMode); +typedef BOOL (WINAPI* pLKIF_SetCalcMethod)(IN int OutNo,IN LKIF_CALCMETHOD CalcMethod,LKIF_CALCTARGET CalcTarget); +typedef BOOL (WINAPI* pLKIF_SetMutualInterferencePrevention)(IN BOOL IsOn); + + //====================================================================================== class CKeyence_Laser { @@ -34,6 +49,7 @@ protected: int m_NeedStorageDataNumber; LKIF_STORAGECYCLE m_StorageCycle; HMODULE m_hLkif; + int m_ProgramNO; public: CKeyence_Laser(); @@ -48,6 +64,15 @@ public: pLKIF_DataStorageGetStatus m_pDataStorageGetStatus; pLKIF_SetDataStorage m_pSetDataStorage; pLKIF_SETPROGRAMNO m_pSetProgramNo; + pLKIF_SetScaling m_pSetScaling; + pLKIF_GetScaling m_pGetScaling; + pLKIF_SetDisplayUnit m_pSetDisplayUnit; + pLKIF_GetDisplayUnit m_pGetDisplayUnit; + pLKIF_SetPanel m_pSetPanel; + pLKIF_SetMeasureMode m_pSetMeasureMode; + pLKIF_SetCalcMethod m_pSetCalcMethod; + pLKIF_SetMutualInterferencePrevention m_pSetMutualInterferencePrevention; + int m_StoredDataNumber; BOOL m_bIsStorage; void KeyenceLaserInit(void); @@ -58,7 +83,9 @@ public: BOOL GetStoredData(float *GetStorageData,int *GetStorageNumber); BOOL PauseScanAndGetData(float *GetStorageData,int *GetStorageNumber); BOOL SetProgramNO(int ProNO); - + BOOL SetOutValueScaling(double _CalibVal); + BOOL SetProgram(char _MeasureMode); + BOOL GetOutValueScaling(double* _CalibratedScale); }; #endif diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Keyence/LkIF.xx.h b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/LkIF.xx.h new file mode 100644 index 0000000..b60f925 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Keyence/LkIF.xx.h @@ -0,0 +1,330 @@ +#ifndef LKIF_INCLUDED +#define LKIF_INCLUDED + +#ifdef I_AM_LKIF +#define EXP __declspec(dllexport) +#else +#define EXP __declspec(dllimport) +#endif + +extern "C" +{ +// Measurement value structures +typedef enum { + LKIF_FLOATRESULT_VALID, // valid data + LKIF_FLOATRESULT_RANGEOVER_P, // over range at positive (+) side + LKIF_FLOATRESULT_RANGEOVER_N, // over range at negative (-) side + LKIF_FLOATRESULT_WAITING, // comparator result +} LKIF_FLOATRESULT; + +typedef struct { + LKIF_FLOATRESULT FloatResult; // valid or invalid data + float Value; // measurement value during LKIF_FLOATRESULT_VALID. + // Any other times will return an invalid value +} LKIF_FLOATVALUE; +/////////////////////////////////////////////// +// Measurement Control Command +// +// Measurement Value Output +EXP BOOL WINAPI LKIF_GetCalcData(OUT LKIF_FLOATVALUE *CalcData1,OUT LKIF_FLOATVALUE *CalcData2); +// Timing ON/OFF +EXP BOOL WINAPI LKIF_SetTiming(IN int OutNo,IN BOOL IsOn); +// Auto-zero ON/OFF +EXP BOOL WINAPI LKIF_SetZero(IN int OutNo,IN BOOL IsOn); +// Reset +EXP BOOL WINAPI LKIF_SetReset(IN int OutNo); +// Panel Lock +EXP BOOL WINAPI LKIF_SetPanelLock(IN BOOL IsLock); +// Program Change +EXP BOOL WINAPI LKIF_SetProgramNo(IN int ProgramNo); +// Program Check +EXP BOOL WINAPI LKIF_GetProgramNo(OUT int *ProgramNo); +// Statistical Results Output +typedef struct { + LKIF_FLOATVALUE ToleUpper; // tolerance upper limit + LKIF_FLOATVALUE ToleLower; // tolerance lower limit + LKIF_FLOATVALUE AverageValue; // average value + LKIF_FLOATVALUE MaxValue; // maximum value + LKIF_FLOATVALUE MinValue; // minimum value + LKIF_FLOATVALUE DifValue; // maximum value - minimum value + LKIF_FLOATVALUE SdValue; // standard deviation + LONG DataCnt; // number of all data + LONG HighDataCnt; // number of tolerance High data + LONG GoDataCnt; // number of tolerance Go data + LONG LowDataCnt; // number of tolerance Low data +} LKIF_FIGUREDATA; +EXP BOOL WINAPI LKIF_GetFigureData(IN int OutNo,OUT LKIF_FIGUREDATA *FigureData); +// Clearing Statistics +EXP BOOL WINAPI LKIF_ClearFigureData(void); +// Starting the Data Storage +EXP BOOL WINAPI LKIF_DataStorageStart(void); +// Stopping the Data Storage +EXP BOOL WINAPI LKIF_DataStorageStop(void); +// Initializing the Data Storage +EXP BOOL WINAPI LKIF_DataStorageInit(void); +// Outputting the Data Storage +EXP BOOL WINAPI LKIF_DataStorageGetData(IN int OutNo,IN int NumOutBuffer,OUT LKIF_FLOATVALUE *OutBuffer,OUT int *NumReceived); +// Data Storage Accumulation Status Output +EXP BOOL WINAPI LKIF_DataStorageGetStatus(IN int OutNo,OUT BOOL *IsStorage,OUT int *NumStorageData); +// Receive Light Waveform +EXP BOOL WINAPI LKIF_GetLight(IN int HeadNo,IN int PeekNo,OUT int *MeasurePosition,OUT int *NumReaded,OUT BYTE *Value); + +/////////////////////////////////////////////// +// Change Parameter Command +// +// Display Panel Switch +EXP BOOL WINAPI LKIF_SetPanel(IN int OutNo); +// Set Tolerance +EXP BOOL WINAPI LKIF_SetTolerance(IN int OutNo,IN int UpperLimit,IN int LowerLimit,IN int Hysteresis); +// Set ABLE +typedef enum { + LKIF_ABLEMODE_AUTO, // automatic + LKIF_ABLEMODE_MANUAL, // manual +} LKIF_ABLEMODE; +EXP BOOL WINAPI LKIF_SetAbleMode(IN int HeadNo,IN LKIF_ABLEMODE AbleMode); +// Set ABLE Control Range +EXP BOOL WINAPI LKIF_SetAbleMinMax(IN int HeadNo,IN int Min,IN int Max); +// Set Measurement Mode +typedef enum { + LKIF_MEASUREMODE_NORMAL, // normal + LKIF_MEASUREMODE_HALF_T, // translucent object + LKIF_MEASUREMDOE_TRAN_1, // transparent object + LKIF_MEASUREMODE_TRAN_2, // transparent object 2 + LKIF_MEASUREMODE_MRS, // multireflective object +} LKIF_MEASUREMODE; +EXP BOOL WINAPI LKIF_SetMeasureMode(IN int HeadNo,IN LKIF_MEASUREMODE MeasureMode); +// Set Number of Times of Alarm Processing +EXP BOOL WINAPI LKIF_SetNumAlarm(IN int HeadNo,IN int NumAlarm); +// Set Alarm Level +EXP BOOL WINAPI LKIF_SetAlarmLevel(IN int HeadNo,IN int AlarmLevel); +// Starting the ABLE Calibration +EXP BOOL WINAPI LKIF_AbleStart(IN int HeadNo); +// Finishing the ABLE Calibration +EXP BOOL WINAPI LKIF_AbleStop(void); +// Stopping the ABLE Calibration +EXP BOOL WINAPI LKIF_AbleCancel(void); +// Set Mounting Mode +typedef enum { + LKIF_REFLECTIONMODE_DIFFUSION, // diffuse reflection + LKIF_REFLECTIONMODE_MIRROR, // specular reflection +} LKIF_REFLECTIONMODE; +EXP BOOL WINAPI LKIF_SetReflectionMode(IN int HeadNo,IN LKIF_REFLECTIONMODE ReflectionMode); +// Set Calculation Method +typedef enum { + LKIF_CALCMETHOD_HEADA, // head A + LKIF_CALCMETHOD_HEADB, // head B + LKIF_CALCMETHOD_HEAD_HEADA_PLUS_HEADB, // head A+head B + LKIF_CALCMETHOD_HEAD_HEADA_MINUS_HEADB, // head A-head B + LKIF_CALCMETHOD_HEAD_HEADA_TRANSPARENT, // head A transparent object + LKIF_CALCMETHOD_HEAD_HEADB_TRANSPARENT, // head B transparent object +} LKIF_CALCMETHOD; +// Measurement target +typedef enum { + LKIF_CALCTARGET_PEAK_1, // peak 1 + LKIF_CALCTARGET_PEAK_2, // peak 2 + LKIF_CALCTARGET_PEAK_3, // peak 3 + LKIF_CALCTARGET_PEAK_4, // peak 4 + LKIF_CALCTARGET_PEAK_1_2, // peak 1-peak 2 + LKIF_CALCTARGET_PEAK_1_3, // peak 1-peak 3 + LKIF_CALCTARGET_PEAK_1_4, // peak 1-peak 4 + LKIF_CALCTARGET_PEAK_2_3, // peak 2-peak 3 + LKIF_CALCTARGET_PEAK_2_4, // peak 2-peak 4 + LKIF_CALCTARGET_PEAK_3_4, // peak 3-peak 4 +} LKIF_CALCTARGET; +EXP BOOL WINAPI LKIF_SetCalcMethod(IN int OutNo,IN LKIF_CALCMETHOD CalcMethod,LKIF_CALCTARGET CalcTarget); +// Set Scaling +EXP BOOL WINAPI LKIF_SetScaling(IN int OutNo,IN int HeadNo,IN int InputValue1,IN int OutputValue1,IN int InputValue2,IN int OutputValue2); +// Set Filter Mode +typedef enum { + LKIF_FILTERMODE_MOVING_AVERAGE, // moving average + LKIF_FILTERMODE_LOWPASS, // low pass filter + LKIF_FILTERMODE_HIGHPASS, // high pass filter +} LKIF_FILTERMODE; +EXP BOOL WINAPI LKIF_SetFilterMode(IN int OutNo,OUT LKIF_FILTERMODE FilterMode); +// Set Number of Times for Averaging +typedef enum { + LKIF_AVERAGE_1, // 1 time + LKIF_AVERAGE_4, // + LKIF_AVERAGE_16, // + LKIF_AVERAGE_64, // + LKIF_AVERAGE_256, // + LKIF_AVERAGE_1024, // + LKIF_AVERAGE_4096, // + LKIF_AVERAGE_16384, // + LKIF_AVERAGE_65536, // + LKIF_AVERAGE_262144, // 262144 times +} LKIF_AVERAGE; +EXP BOOL WINAPI LKIF_SetAverage(IN int OutNo,IN LKIF_AVERAGE Average); +// Set Cutoff Frequency +typedef enum { + LKIF_CUTOFFFREQUENCY_1000, // 1000Hz + LKIF_CUTOFFFREQUENCY_300, // 300Hz + LKIF_CUTOFFFREQUENCY_100, // 100Hz + LKIF_CUTOFFFREQUENCY_30, // 30Hz + LKIF_CUTOFFFREQUENCY_10, // 10Hz + LKIF_CUTOFFFREQUENCY_3, // 3Hz + LKIF_CUTOFFFREQUENCY_1, // 1Hz + LKIF_CUTOFFFREQUENCY_0_3, // 0.3Hz + LKIF_CUTOFFFREQUENCY_0_1, // 0.1Hz +} LKIF_CUTOFFFREQUENCY; +EXP BOOL WINAPI LKIF_SetCutOffFrequency(IN int OutNo,IN LKIF_CUTOFFFREQUENCY CutOffFrequency); +// Set Trigger Mode +typedef enum { + LKIF_TRIGGERMODE_EXT1, // external trigger 1 + LKIF_TRIGGERMODE_EXT2, // external trigger 2 +} LKIF_TRIGGERMODE; +EXP BOOL WINAPI LKIF_SetTriggerMode(IN int OutNo,IN LKIF_TRIGGERMODE TriggerMode); +// Set Offset +EXP BOOL WINAPI LKIF_SetOffset(IN int OutNo,IN int Offset); +// Set Analog Output Scaling +EXP BOOL WINAPI LKIF_SetAnalogScaling(IN int OutNo,IN int InputValue1,IN int OutputVoltage1,IN int InputValue2,IN int OutputVoltage2); +// Set Calculation Mode +typedef enum { + LKIF_CALCMODE_NORMAL, // normal + LKIF_CALCMODE_PEAKHOLD, // peak hold + LKIF_CALCMODE_BOTTOMHOLD, // bottom hold + LKIF_CALCMODE_PEAKTOPEAKHOLD, // peak-to-peak hold + LKIF_CALCMODE_SAMPLEHOLD, // sample hold + LKIF_CALCMODE_AVERAGEHOLD, // average hold +} LKIF_CALCMODE; +EXP BOOL WINAPI LKIF_SetCalcMode(IN int OutNo,IN LKIF_CALCMODE CalcMode); +// Set Minimum Display Unit +typedef enum { + LKIF_DISPLAYUNIT_0000_01MM, // 0.01mm + LKIF_DISPLAYUNIT_000_001MM, // 0.001mm + LKIF_DISPLAYUNIT_00_0001MM, // 0.0001mm + LKIF_DISPLAYUNIT_0_00001MM, // 0.00001mm + LKIF_DISPLAYUNIT_00000_1UM, // 0.1um + LKIF_DISPLAYUNIT_0000_01UM, // 0.01um +} LKIF_DISPLAYUNIT; +EXP BOOL WINAPI LKIF_SetDisplayUnit(IN int OutNo,IN LKIF_DISPLAYUNIT DisplayUnit); +// Set Analog-Through +EXP BOOL WINAPI LKIF_SetAnalogThrough(IN int OutNo,IN BOOL IsOn); +// Set Data Storage +typedef enum { + LKIF_TARGETOUT_NONE, // no target OUT + LKIF_TARGETOUT_OUT1, // OUT1 + LKIF_TARGETOUT_OUT2, // OUT2 + LKIF_TARGETOUT_BOTH, // OUT1 and OUT2 +} LKIF_TARGETOUT; +typedef enum { + LKIF_STORAGECYCLE_1, // sampling rate x 1 + LKIF_STORAGECYCLE_2, // sampling rate x 2 + LKIF_STORAGECYCLE_5, // sampling rate x 5 + LKIF_STORAGECYCLE_10, // sampling rate x 10 + LKIF_STORAGECYCLE_20, // sampling rate x 20 + LKIF_STORAGECYCLE_50, // sampling rate x 50 + LKIF_STORAGECYCLE_100, // sampling rate x 100 + LKIF_STORAGECYCLE_200, // sampling rate x 200 + LKIF_STORAGECYCLE_500, // sampling rate x 500 + LKIF_STORAGECYCLE_1000, // sampling rate x 1000 +} LKIF_STORAGECYCLE; +EXP BOOL WINAPI LKIF_SetDataStorage(IN LKIF_TARGETOUT TargetOut,IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle); +// Set Sampling Rate +typedef enum { + LKIF_SAMPLINGCYCLE_20USEC, // 20us + LKIF_SAMPLINGCYCLE_50USEC, // 50us + LKIF_SAMPLINGCYCLE_100USEC, // 100us + LKIF_SAMPLINGCYCLE_200USEC, // 200us + LKIF_SAMPLINGCYCLE_500USEC, // 500us + LKIF_SAMPLINGCYCLE_1MSEC, // 1ms +} LKIF_SAMPLINGCYCLE; +EXP BOOL WINAPI LKIF_SetSamplingCycle(IN LKIF_SAMPLINGCYCLE SamplingCycle); +// Set Mutual Interference Prevention +EXP BOOL WINAPI LKIF_SetMutualInterferencePrevention(IN BOOL IsOn); +// Set Timing Synchronization +typedef enum { + LKIF_SYNCHRONIZATION_ASYNCHRONOUS, // asynchronous + LKIF_SYNCHRONIZATION_SYNCHRONIZED, // synchronous +} LKIF_SYNCHRONIZATION; +EXP BOOL WINAPI LKIF_SetTimingSynchronization(IN LKIF_SYNCHRONIZATION Synchronization); +// Set Comparator Output Format +typedef enum { + LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_NORMAL, // normal + LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_HOLD, // hold + LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_OFF_DELAY, // off-delay +} LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT; +EXP BOOL WINAPI LKIF_SetToleranceComparatorOutputFormat(IN LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT ToleranceComparatorOutputFormat); +// Set Strobe Time +typedef enum { + LKIF_STOROBETIME_2MS, // 2ms + LKIF_STOROBETIME_5MS, // 5ms + LKIF_STOROBETIME_10MS, // 10ms + LKIF_STOROBETIME_20MS, // 20ms +} LKIF_STOROBETIME; +EXP BOOL WINAPI LKIF_SetStorobeTime(IN LKIF_STOROBETIME StorobeTime); +/////////////////////////////////////////////// +// Check Parameter Command +// +// Display Panel Check +EXP BOOL WINAPI LKIF_GetPanel(OUT int *OutNo); +// Get Tolerance +EXP BOOL WINAPI LKIF_GetTolerance(IN int OutNo,OUT int *UpperLimit,OUT int *LowerLimit,OUT int *Hysteresis); +// Get ABLE +EXP BOOL WINAPI LKIF_GetAbleMode(IN int HeadNo,OUT LKIF_ABLEMODE *AbleMode); +// ABLE Control Range +EXP BOOL WINAPI LKIF_GetAbleMinMax(IN int HeadNo,OUT int *Min,OUT int *Max); +// Get Measurement Mode +EXP BOOL WINAPI LKIF_GetMeasureMode(IN int HeadNo,OUT LKIF_MEASUREMODE *MeasureMode); +// Get Number of Times of Alarm Processing +EXP BOOL WINAPI LKIF_GetNumAlarm(IN int HeadNo,OUT int *NumAlarm); +// Get Alarm Level +EXP BOOL WINAPI LKIF_GetAlarmLevel(IN int HeadNo,OUT int *AlarmLevel); +// Get Mounting Mode +EXP BOOL WINAPI LKIF_GetReflectionMode(IN int HeadNo,OUT LKIF_REFLECTIONMODE *ReflectionMode); +// Get Calculation Method +EXP BOOL WINAPI LKIF_GetCalcMethod(IN int OutNo,OUT LKIF_CALCMETHOD *CalcMethod,LKIF_CALCTARGET *CalcTarget); +// Get Scaling +EXP BOOL WINAPI LKIF_GetScaling(IN int OutNo,IN int HeadNo,OUT int *InputValue1,OUT int *OutputValue1,OUT int *InputValue2,OUT int *OutputValue2); +// Get Filter Mode +EXP BOOL WINAPI LKIF_GetFilterMode(IN int OutNo,OUT LKIF_FILTERMODE *FilterMode); +// Get Number of Times for Averaging +EXP BOOL WINAPI LKIF_GetAverage(IN int OutNo,OUT LKIF_AVERAGE *Average); +// Get Cutoff Frequency +EXP BOOL WINAPI LKIF_GetCutOffFrequency(IN int OutNo,OUT LKIF_CUTOFFFREQUENCY *CutOffFrequency); +// Get Trigger Mode +EXP BOOL WINAPI LKIF_GetTriggerMode(IN int OutNo,OUT LKIF_TRIGGERMODE *TriggerMode); +// Get Offset +EXP BOOL WINAPI LKIF_GetOffset(IN int OutNo,IN int *Offset); +// Get Analog Output Scaling +EXP BOOL WINAPI LKIF_GetAnalogScaling(IN int OutNo,OUT int *InputValue1,OUT int *OutputVoltage1,OUT int *InputValue2,OUT int *OutputVoltage2); +// Get Calculation Mode +EXP BOOL WINAPI LKIF_GetCalcMode(IN int OutNo,OUT LKIF_CALCMODE *CalcMode); +// Get Minimum Display Unit +EXP BOOL WINAPI LKIF_GetDisplayUnit(IN int OutNo,OUT LKIF_DISPLAYUNIT *DisplayUnit); +// Analog-Through +EXP BOOL WINAPI LKIF_GetAnalogThrough(IN int OutNo,OUT BOOL *IsOn); +// Get Data Storage +EXP BOOL WINAPI LKIF_GetDataStorage(IN LKIF_TARGETOUT *TargetOut,OUT int *NumStorage,OUT LKIF_STORAGECYCLE *StorageCycle); +// Get Sampling Rate +EXP BOOL WINAPI LKIF_GetSamplingCycle(OUT LKIF_SAMPLINGCYCLE *SamplingCycle); +// Get Mutual Interference Prevention +EXP BOOL WINAPI LKIF_GetMutualInterferencePrevention(OUT BOOL *IsOn); +// Get Timing Synchronization +EXP BOOL WINAPI LKIF_GetTimingSynchronization(OUT LKIF_SYNCHRONIZATION *Synchronization); +// Get Comparator Output Format +EXP BOOL WINAPI LKIF_GetToleranceComparatorOutputFormat(OUT LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT *ToleranceComparatorOutputFormat); +// Get Strobe Time +EXP BOOL WINAPI LKIF_GetStorobeTime(OUT LKIF_STOROBETIME *StorobeTime); +/////////////////////////////////////////////// +// Mode Change Command +// +// Mode Switch +typedef enum { + LKIF_MODE_NORMAL, // normal mode + LKIF_MODE_COMMUNICATION, // setting mode +} LKIF_MODE; +EXP BOOL WINAPI LKIF_SetMode(IN LKIF_MODE Mode); +/////////////////////////////////////////////// +// USB Setting Command +// +#define USBPORTNO_MIN 1 +#define USBPORTNO_MAX 13 +// Enumerate Port Number Function (array of 13 ports) +EXP BOOL WINAPI LKIF_EnumPortNo(BOOL IsValidPortNo[USBPORTNO_MAX]); +// Set Port Number Function (1 to 13) +EXP BOOL WINAPI LKIF_SetPortNo(int PortNo); + +} // extern "C" + +#endif // LKIF_INCLUDED \ No newline at end of file diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CMDDefines.H b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CMDDefines.H new file mode 100644 index 0000000..9fe3d6d --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CMDDefines.H @@ -0,0 +1,9 @@ +#pragma once +enum EEntityType +{ + etUnknow = 0, + + etPoint = 1, + +}; + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.CPP b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.CPP new file mode 100644 index 0000000..6963bf2 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.CPP @@ -0,0 +1,729 @@ +#include "stdafx.h" +#include +# include "CPoint3.h" + + +#define ABS(x) ((x)>=0?(x):-(x)) +#define NORM2_EPSILON 1e-64 +#define NORM1_EPSILON 1e-32 + +#define CPOINT3_CPP + +CPoint3::CPoint3(void): CObject () +{ + //cout << _T( "creating object " ) << this << _T( " with default constructor\n" ); + x = y = z = 0.0; +} + +CPoint3::~CPoint3(void) +{ + //cout << _T( "Deleting object " ) << this << _T( "\n" ); +} + +CPoint3::CPoint3(const double* t): CObject () +{ + //cout << _T( "creating object " ) << this << _T( " with double * constructor using data " ); + //cout << t[0] << _T( ", " ) << t[1] << _T( ", " ) << t[2] << _T( "\n" ); + if (t) + { + x = t[0]; + y = t[1]; + z = t[2]; + } + else + { + x = y = z = 0; + } +} + +CPoint3::CPoint3(const double xx, const double yy, const double zz): CObject () +{ + //cout << _T( "creating object " ) << this << _T( " with 3 double constructor using data " ); + //cout << xx <<_T( ", " ) << yy << _T( ", " ) << zz << _T( "\n" ); + x = xx; + y = yy; + z = zz; +} + +CPoint3::CPoint3(const CPoint3 & t): CObject () +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + //cout << _T( "creating object " ) << this << _T( " with copy constructor \n" ); + x = t.x; + y = t.y; + z = t.z; +} + +CPoint3::CPoint3(const float* pts): CObject () +{ + x = (double) pts[0]; + y = (double) pts[1]; + z = (double) pts[2]; +} + +CPoint3::operator const double *(void) const +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + //cout << _T( "operator double * on " ) << this << _T( " yeilds " ) << m_data << _T( "\n" ); + return & (x); +} + +CPoint3::operator double *(void) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + //cout << _T( "operator double * on " ) << this << _T( " yeilds " ) << m_data << _T( "\n" ); + return & (x); +} + +CPoint3 operator+(const CPoint3 &t, const CPoint3 &u) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); + ASSERT(u.IsValid()); +#endif + + //cout << _T( "calling operator+ on objects " ) << &t << _T( " and " ) << &u; + //cout << _T( " and returning " ) << &result << _T( "\n" ); + return CPoint3((t.x + u.x), (t.y + u.y), (t.z + u.z)); +} + +CPoint3 CPoint3::operator-(void) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + return CPoint3(-x,-y,-z); +} + +CPoint3 operator-(const CPoint3 &t, const CPoint3 &u) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); + ASSERT(u.IsValid()); +#endif + + //cout << _T( "calling operator- on objects " ) << &t << _T( " and " ) << &u; + //cout << _T( " and returning " ) << &result << _T( "\n" ); + return CPoint3((t.x - u.x), (t.y - u.y), (t.z - u.z)); +} + +CPoint3 & CPoint3::operator+=(const CPoint3 &t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator+= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x += t.x; + y += t.y; + z += t.z; + return *this; +} + +CPoint3 & CPoint3::operator+=(const double* t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + + //cout << _T( "calling operator+= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x += t[0]; + y += t[1]; + z += t[2]; + return *this; +} + +CPoint3 & CPoint3::operator+=(double t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + + x += t; + y += t; + z += t; + return *this; +} + +CPoint3 & CPoint3::operator-=(const CPoint3 &t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator-= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x -= t.x; + y -= t.y; + z -= t.z; + return *this; +} + +CPoint3 & CPoint3::operator*=(const CPoint3 &t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator*= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x *= t.x; + y *= t.y; + z *= t.z; + return *this; +} + +CPoint3 & CPoint3::operator-=(const double* t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + + //cout << _T( "calling operator-= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x -= t[0]; + y -= t[1]; + z -= t[2]; + return *this; +} + +CPoint3 & CPoint3::operator-=(double t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); +#endif + + x -= t; + y -= t; + z -= t; + return *this; +} + +CPoint3 & CPoint3::operator=(const CPoint3 & t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x = t.x; + y = t.y; + z = t.z; + return *this; +} + +CPoint3 & CPoint3::operator=(const float* t) +{ + //cout << _T( "calling operator= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + if (t) + { + x = (double) t[0]; + y = (double) t[1]; + z = (double) t[2]; + } + else + { + x = 0.0; + y = 0.0; + z = 0.0; + } + return *this; +} + +CPoint3 & CPoint3::operator=(const double* t) +{ + //cout << _T( "calling operator= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + if (t) + { + x = t[0]; + y = t[1]; + z = t[2]; + } + else + { + x = 0.0; + y = 0.0; + z = 0.0; + } + return *this; +} + +CPoint3 & CPoint3::operator=(const double t) +{ + x = t; + y = t; + z = t; + return *this; +} + +bool CPoint3::operator==(const CPoint3 &t) const +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator== on object " ) << this << _T( " and on object " ) << &t; + if ((x == t.x) && + (y == t.y) && + (z == t.z)) + { + //cout << _T( " and returning TRUE" ) << _T( "\n" ); + return true; + } + else + { + //cout << _T( " and returning FALSE" ) << _T( "\n" ); + return false; + } +} + +bool CPoint3::operator!=(const CPoint3 &t) const +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator!= on object " ) << this << _T( " and on object " ) << &t; + if ((x == t.x) && + (y == t.y) && + (z == t.z)) + { + //cout << _T( " and returning FALSE\n" ); + return false; + } + else + { + //cout << _T( " and returning TRUE\n" ); + return true; + } +} + + +void CPoint3::display(void) +{ + //cout << _T( "CPoint3 " ) << this << _T( " = " ) << x << _T( ", " ) << y << _T( ", " ) << z << _T( "\n" ); +} + +CPoint3 operator* (const CPoint3 &t, double mult) // scalar multiply +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator* on object " ) << t << _T( " and double " ) << mult << _T( "\n" ); + return CPoint3(t.x *mult, t.y *mult, t.z *mult); +} + +CPoint3 operator* (double mult, const CPoint3 &t) // scalar multiply +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator* on double " ) << mult << _T( " and object " ) << t << _T( "\n" ); + return CPoint3(t.x *mult, t.y *mult, t.z *mult); +} + +CPoint3 operator+(const CPoint3 &t, double mult) // add t pointwise +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + return CPoint3(t.x + mult, t.y + mult, t.z + mult); +} + +CPoint3 operator+(double mult, const CPoint3 &t) // add t pointwise +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + return CPoint3(t.x + mult, t.y + mult, t.z + mult); +} + +CPoint3 operator-(const CPoint3 &t, double mult) // subtract t pointwise +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + return CPoint3(t.x - mult, t.y - mult, t.z - mult); +} + +CPoint3 operator-(double mult, const CPoint3 &t) // subtract t pointwise +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + return CPoint3(mult - t.x, mult - t.y, mult - t.z); +} + +double operator* (const CPoint3 &t, const CPoint3 &u) // dot product +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); + ASSERT(u.IsValid()); +#endif + + //cout << _T( "calling operator* on object " ) << t << _T( " and object " ) << u << _T( "\n" ); + return t.x *u.x + + t.y *u.y + + t.z *u.z; +} + +CPoint3 & CPoint3::operator*=(double mult) // scalar multiply +{ + //cout << _T( "calling operator*= on object " ) << *this << _T( " and double " ) << mult << _T( "\n" ); + x *= mult; + y *= mult; + z *= mult; + return *this; +} + +CPoint3 operator/(const CPoint3 &t, double divisor) // scalar divide +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator/ on object " ) << t << _T( " and double " ) << divisor << _T( "\n" ); + CPoint3 result(0.0, 0.0, 0.0); + if (divisor != 0.0) + { + result.x = t.x / divisor; + result.y = t.y / divisor; + result.z = t.z / divisor; + } + return result; +} + +CPoint3 & CPoint3::operator/=(const CPoint3 &t) +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(t.IsValid()); +#endif + + //cout << _T( "calling operator*= on object " ) << &t; + //cout << _T( " and returning " ) << this << _T( "\n" ); + x /= t.x; + y /= t.y; + z /= t.z; + return *this; +} + +CPoint3 & CPoint3::operator/=(double divisor) // scalar divide and assignment +{ + //cout << _T( "calling operator/= on object " ) << *this << _T( " and double " ) << divisor << _T( "\n" ); + if (divisor != 0.0) + { + x /= divisor; + y /= divisor; + z /= divisor; + } + else + { + x = y = z = 0.0; + } + return *this; +} + +void CPoint3::Serialize(CArchive & archive) +{ + CObject::Serialize(archive); + + if (archive.IsStoring()) + { + archive << (double) x; + archive << (double) y; + archive << (double) z; + } + else + { + archive >> (double&) x; + archive >> (double&) y; + archive >> (double&) z; + } +} + +double CPoint3::norm(void) const // return the norm of this object +{ + return sqrt(x *x + y *y + z *z); +} +double CPoint3::normalize() +{ + double Norm = norm(); + if (Norm > 0.0) + { + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (int i = 0; i < 3; i++) + { + m_data[i] /= Norm; + } + } + else + { + z = 1.0; + } + return (Norm); +} + +/* PR272573 only normalize when the original vector is not approximatly normalized. +1. return the unit original vector, [1 - norm2(vector)] < NORM2_EPSILON +2. return the new normalized vector, ABS[norm2(vector) - 1] > NORM2_EPSILON*/ +double CPoint3::Normalize(double dbEpsilon) +{ + double dbNorm = 0; + dbNorm = norm2(); + if (dbNorm < 1.0) + { + if( ABS(dbNorm - 1.0) < NORM2_EPSILON ) // unit vector + { + dbNorm = 1.0; + return dbNorm; + } + } + dbNorm = sqrt(dbNorm); + if (dbEpsilon < 0) + dbEpsilon = NORM1_EPSILON; + else if (dbEpsilon > NORM1_EPSILON) + dbEpsilon = NORM1_EPSILON; + if (dbNorm > dbEpsilon) // normalize to unit vector + { + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (int i = 0; i < 3; i++) + { + m_data[i] /= dbNorm; + } + } + else + { + z = 1.0; + } + return (dbNorm); +} +CPoint3 CPoint3::crossOnly(const CPoint3 &u) const +{ + return CPoint3((y*u[2] - z*u[1]), (z*u[0] - x*u[2]), (x*u[1] - y*u[0])); +} + +CPoint3 CPoint3::cross(const CPoint3 &u) const // cross product +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(u.IsValid()); +#endif + + CPoint3 result(0.0, 0.0, 0.0); + + result[0] = y *u[2] - z *u[1]; + result[1] = z *u[0] - x *u[2]; + result[2] = x *u[1] - y *u[0]; + result.normalize(); + return (result); +} + +// Anis - The above cross always return a non (0, 0, 0) result which is not always interesting +CPoint3 CPoint3::cross2(const CPoint3 &u) const // cross product +{ +#ifdef CPOINT3_DEBUG_CHECKS + ASSERT(IsValid()); + ASSERT(u.IsValid()); +#endif + + CPoint3 result; + + result[0] = y *u[2] - z *u[1]; + result[1] = z *u[0] - x *u[2]; + result[2] = x *u[1] - y *u[0]; + + double Norm = result.norm(); + + if (Norm > 0.0) + { + for (int i = 0; i < 3; i++) + result[i] /= Norm; + } + return (result); +} + +// Anis +double CPoint3::norm2(void) const // return the squared norm of this object +{ + return (x *x + y *y + z *z); +} + +double CPoint3::maxabs(int* Index) const +{ + double cVal = -1.0; + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (int i = 0; i < 3; i++) + { + if (fabs(m_data[i]) > cVal) + { + if (Index) + { + *Index = i; + } + cVal = fabs(m_data[i]); + } + } + return (cVal); +} + +double CPoint3::minabs(int* Index) const +{ + double cVal = 0.0; + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (int i = 0; i < 3; i++) + { + if (fabs(m_data[i]) < cVal || i == 0) + { + if (Index) + { + *Index = i; + } + cVal = fabs(m_data[i]); + } + } + return (cVal); +} + +void CPoint3::setXYZ(double _x, double _y, double _z) +{ + x = _x; + y = _y; + z = _z; +} + +//computes the angle between two vectors (they *MUST* first be normalized) +double CPoint3::angleBetween(const CPoint3 &inPoint) +{ + double diffNorm, sumNorm; + sumNorm = (*this + inPoint).norm(); + diffNorm = (*this - inPoint).norm(); + return 2.0*atan2(diffNorm,sumNorm); +} + +//makes a vector orthogonal to this. +CPoint3 CPoint3::constructOrthogonalVector(void) +{ + double thisLength, maxAbsValue; + CPoint3 returnVector, unitVector; + int maxAbsIndex; + + maxAbsValue = maxabs(&maxAbsIndex); + thisLength = norm(); + if(thisLength == 0.0) + { + returnVector[0] = 1.0; + return returnVector; + } + + //try to construct a vector sufficiently different from this. + returnVector[maxAbsIndex] = 0.0; + returnVector[(maxAbsIndex + 1) % 3] = maxAbsValue; + returnVector[(maxAbsIndex + 2) % 3] = 0; + unitVector = *this; + unitVector.normalize(); + + //now we should have sufficient difference between returnPoint and this + //to do a gram-schmidt orthogonal construction + returnVector = returnVector - (returnVector*unitVector)*unitVector; + returnVector.normalize(); + return returnVector; +} + +void operator>>(CArchive &InArch, CPoint3 & InPnt) +{ + InPnt.Serialize(InArch); +} + +void operator<<(CArchive &InArch, CPoint3 & InPnt) +{ + InPnt.Serialize(InArch); +} + +BOOL CPoint3::toVARIANT(VARIANT *pv) +{ + BOOL retval = FALSE; + SAFEARRAY *tmp; + SAFEARRAYBOUND a[1]; + long i; + + pv->vt = VT_ARRAY | VT_R8; + + a[0].lLbound = 0; + a[0].cElements = 3; + + tmp = SafeArrayCreate(VT_R8, 1, a); + if (tmp) + { + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (i = 0; i < 3; i++) + SafeArrayPutElement(tmp, &i, &m_data[i]); + + pv->parray = tmp; + retval = TRUE; + } + + return retval; +} + +BOOL CPoint3::fromVARIANT(VARIANT pv) +{ + BOOL retval = FALSE; + SAFEARRAY *tmp; + long num; + long i; + + if(pv.vt && (pv.vt & VT_ARRAY) && (pv.vt & VT_R8) && pv.parray) + { + tmp = pv.parray; + num = tmp->rgsabound->cElements; + if(num == 3) + { + double m_data[3]={0.0}; + m_data[0]=x; + m_data[1]=y; + m_data[2]=z; + for (i = 0; i < num; i++) + SafeArrayGetElement(tmp, &i, &m_data[i]); + retval = TRUE; + } + } + return retval; +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.H b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.H new file mode 100644 index 0000000..b4a50f5 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CPOINT3.H @@ -0,0 +1,110 @@ +#pragma once +#ifndef CPOINT3_H +#define CPOINT3_H + + + +#include +#include "afxdisp.h" + +//#define CPOINT3_DEBUG_CHECKS + +#ifdef CPOINT3_DEBUG_CHECKS +#include +#endif + + +//#pragma warning (disable:4270) // we don't care about non-const initializers, as we do use them +class CPoint3: public CObject +{ +public: + CPoint3(void); + // default object + + CPoint3(const CPoint3& t); + // copy constructors + + CPoint3(const double* t); + // Conversion from array + + CPoint3(const double x, const double y, const double z); + + CPoint3(const float* pts); + // Conversoin from array of floats + + ~CPoint3(void); + + operator const double *(void) const; // subscript operator and + operator double *(void); // subscript operator and + + // conversion to array/pointer + friend CPoint3 operator* (const CPoint3 &t, double mult); // scalar multiply + friend CPoint3 operator* (double mult, const CPoint3 &t); // scalar multiply + friend CPoint3 operator+(const CPoint3 &t, double offset); // add offset pointwise + friend CPoint3 operator+(double offset, const CPoint3 &t); // add offset pointwise + friend CPoint3 operator-(const CPoint3 &t, double offset); // subtract offset pointwise + friend CPoint3 operator-(double offset, const CPoint3 &t); // subtract offset pointwise + CPoint3& operator*=(double mult); // scalar multiply and assignment + CPoint3& operator*=(const CPoint3 &t); // point wise multiplication and assignment + friend CPoint3 operator/(const CPoint3 &, double divisor); // scalar divide + CPoint3& operator/=(const CPoint3 &t); // point wise divide and assignment + CPoint3& operator/=(double divisor); // scalar divide and assignment + friend double operator* (const CPoint3 &t, const CPoint3 &u); // dot product + friend CPoint3 operator+(const CPoint3 &t, const CPoint3 &u); // pointwise addition + CPoint3& operator+=(const CPoint3 &t); // pointwise addition and assignment + CPoint3& operator+=(const double* t); + CPoint3& operator+=(double offset); // add offset pointwise + friend CPoint3 operator-(const CPoint3 &t, const CPoint3 &u); // pointwise subtraction + CPoint3 operator-(void); // additive inverse + CPoint3& operator-=(const CPoint3 &t); // pointwise subtraction and assignment + friend void operator << (CArchive &InArch , CPoint3 & InPnt); // write a CPoint3 + friend void operator >>(CArchive &InArch , CPoint3 & InPnt); // read a CPoin3 + CPoint3& operator-=(const double* t); + CPoint3& operator-=(double offset); // subtract offset pointwise. + CPoint3& operator=(const CPoint3& t); // assignment Needed a const operator for use + // with CArray - TJ + CPoint3& operator=(const double* t); // assignment + CPoint3& operator=(const double t); // assignment + CPoint3& operator=(const float* t); + bool operator==(const CPoint3 &t) const; // test for equality + bool operator!=(const CPoint3 &t) const; // test for inequality + void display(void); // debugging function + void Serialize(CArchive & archive); // the ubiquitous function for IO + double norm(void) const; // return the norm of this object + double norm2(void) const; // return the squared norm of this object + double normalize(void); // normalize and return old norm. + double Normalize(double dbEpsilon); + CPoint3 crossOnly(const CPoint3 &u) const; // cross, but do not normalize. + CPoint3 cross(const CPoint3 &u) const; // cross product m_data x v normalized. + CPoint3 cross2(const CPoint3 &u) const; // cross product m_data x v normalized and can be (0, 0, 0) + double maxabs(int* Index = NULL) const; // return the value of the largest absulute + double minabs(int* Index = NULL) const; // return the value of the smallest absulute + void setXYZ(double x, double y, double z); + double angleBetween(const CPoint3 &inPoint); + CPoint3 constructOrthogonalVector(void); + // value coordinate + friend double distance(const CPoint3 &t, const CPoint3 &u) + { + return ((t - u).norm()); + } + +#ifdef CPOINT3_DEBUG_CHECKS + bool IsValid(void) const + { + if(this) + return (_finite(m_data[0]) && _finite(m_data[1]) && _finite(m_data[2])); + return false; + } +#endif + + BOOL toVARIANT(VARIANT *pv); + BOOL fromVARIANT(VARIANT pv); + double x; + double y; + double z; + +}; + +#endif + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.H b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.H new file mode 100644 index 0000000..4880f92 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.H @@ -0,0 +1,42 @@ +#pragma once +#include +#include "CPOINT3.H" +#include "CMDDefines.h" + + +class CSO7_CMD +{ +public: + CSO7_CMD(); + CSO7_CMD(const CSO7_CMD& _CMD); + ~CSO7_CMD() {} + + CSO7_CMD& operator=(const CSO7_CMD& _CMD); + + virtual CSO7_CMD* Copy() { return NULL; } + virtual void Init(); + virtual int get_id() = 0; + virtual int get_type() = 0; + + + virtual void SaveCmd(CString _filename,int _savetype=0) = 0; + + virtual void ReadCmd(CString _filename,int _savetype=0) = 0; + + virtual void GetPoint(int type_of_point, + int theo_or_meas, + int coord_sys, + CSO7_CMD * align, + CPoint3 &out, + int workpl = 0) = 0; + + virtual void PutPoint(int type_of_point, + int theo_or_meas, + int coord_sys, + CSO7_CMD * align, + CPoint3 &in_point, + int workpl = 0) =0; +public: + int m_ID; + +}; \ No newline at end of file diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.cpp b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.cpp new file mode 100644 index 0000000..4646715 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/CSO7_CMD.cpp @@ -0,0 +1,26 @@ +#include "stdafx.h" +#include "CSO7_CMD.h" + +//======================== +CSO7_CMD::CSO7_CMD() +{ + Init(); +} +//======================== +CSO7_CMD::CSO7_CMD(const CSO7_CMD& _CMD) +{ + m_ID=_CMD.m_ID; + +} +//======================== +CSO7_CMD& CSO7_CMD::operator=(const CSO7_CMD& _CMD) +{ + m_ID=_CMD.m_ID; + return *this; +} +//======================== +void CSO7_CMD::Init() +{ + m_ID=0; +} + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.cpp b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.cpp new file mode 100644 index 0000000..971222d --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.cpp @@ -0,0 +1,102 @@ +#include "StdAfx.h" + +#include "CSO7_CMD.h" +#include "So7_CNC_Point.h" + +//===================================== +CSo7_CNC_Point::CSo7_CNC_Point(void) +{ + Init(); +} + +//===================================== +CSo7_CNC_Point::~CSo7_CNC_Point(void) +{ + +} + +CSo7_CNC_Point::CSo7_CNC_Point(const CSo7_CNC_Point& _CNC_Point) + : CSO7_CMD(_CNC_Point) +{ + m_ID = _CNC_Point.m_ID; + m_Pos = _CNC_Point.m_Pos; + +} +//=================================================== +CSo7_CNC_Point::CSo7_CNC_Point(const CPoint3& _pos) +{ + Init(); + m_Pos=_pos; +} + +//=================================================== +CSo7_CNC_Point& CSo7_CNC_Point::operator = (const CSo7_CNC_Point& _CNC_Point) +{ + if (this == &_CNC_Point) + return *this; + + CSO7_CMD::operator = (_CNC_Point); + m_Pos=_CNC_Point.m_Pos; + m_ID=_CNC_Point.m_ID; + + return *this; +} + +//=================================================== +CSO7_CMD* CSo7_CNC_Point::Copy() +{ + CSo7_CNC_Point* _CNC_Point = new CSo7_CNC_Point(m_Pos); + return _CNC_Point; +} + +//===================================== +void CSo7_CNC_Point::Init() +{ + m_ID=0; +} +//==================================== +int CSo7_CNC_Point::get_id() +{ + return m_ID; +} + +//==================================== +int CSo7_CNC_Point::get_type() +{ + return etPoint; +} + +//==================================== +void CSo7_CNC_Point::GetPoint(int type_of_point,int theo_or_meas,int coord_sys,CSO7_CMD * align,CPoint3 &out,int workpl) +{ + UNREFERENCED_PARAMETER(type_of_point); + UNREFERENCED_PARAMETER(theo_or_meas); + UNREFERENCED_PARAMETER(coord_sys); + UNREFERENCED_PARAMETER(align); + UNREFERENCED_PARAMETER(workpl); + out=m_Pos; +} + +//==================================== +void CSo7_CNC_Point::PutPoint(int type_of_point,int theo_or_meas,int coord_sys,CSO7_CMD * align,CPoint3 &in_point,int workpl) +{ + UNREFERENCED_PARAMETER(type_of_point); + UNREFERENCED_PARAMETER(theo_or_meas); + UNREFERENCED_PARAMETER(coord_sys); + UNREFERENCED_PARAMETER(align); + UNREFERENCED_PARAMETER(workpl); + m_Pos=in_point; + +} +//=================================================== +void CSo7_CNC_Point::SaveCmd(CString _filename,int _savetype) +{ + UNREFERENCED_PARAMETER(_filename); + UNREFERENCED_PARAMETER(_savetype); +} +//=================================================== +void CSo7_CNC_Point::ReadCmd(CString _filename,int _savetype) +{ + UNREFERENCED_PARAMETER(_filename); + UNREFERENCED_PARAMETER(_savetype); +} \ No newline at end of file diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.h b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.h new file mode 100644 index 0000000..b9662c3 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Point.h @@ -0,0 +1,35 @@ +#pragma once +class CSo7_CNC_Point:public CSO7_CMD +{ +public: + CSo7_CNC_Point(void); + ~CSo7_CNC_Point(void); + CSo7_CNC_Point(const CSo7_CNC_Point& _CNC_Point); + CSo7_CNC_Point(const CPoint3& _pos); + CSo7_CNC_Point& operator=(const CSo7_CNC_Point& _CNC_Point); + +protected: + void Init(); +public: + CPoint3 m_Pos; + CSO7_CMD* Copy(); + int get_id(); + int get_type(); + void SaveCmd(CString _filename,int _savetype=0); + void ReadCmd(CString _filename,int _savetype=0); + + void GetPoint(int type_of_point, + int theo_or_meas, + int coord_sys, + CSO7_CMD * align, + CPoint3 &out, + int workpl = 0); + + void PutPoint(int type_of_point, + int theo_or_meas, + int coord_sys, + CSO7_CMD * align, + CPoint3 &in_point, + int workpl = 0); +}; + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.cpp b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.cpp new file mode 100644 index 0000000..bcb80a8 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.cpp @@ -0,0 +1,100 @@ +#include "StdAfx.h" + +#include "CSO7_CMD.h" +#include "So7_CNC_Program.h" + +//===================================== +CSo7_CNC_Program::CSo7_CNC_Program(void) +{ + _pCurrCncStep = nullptr; + m_NewProgram=TRUE; + m_CncProgName = _T("Untitled"); + m_ActivatedCNCListItem=0; + m_Program_Number=0; +} + +//===================================== +CSo7_CNC_Program::~CSo7_CNC_Program(void) +{ + +} + +//================================================================================================ +void CSo7_CNC_Program::AddCncStep(CSO7_CMD* pProgStep) +{ + m_Program_Number=m_CNC_element.size(); + pProgStep->m_ID=m_Program_Number++; + m_CNC_element.push_back(pProgStep); + _pCurrCncStep = pProgStep; + return; +}; + +//================================================================================================ +void CSo7_CNC_Program::RemoveContent() +{ + ; +} +//================================================================================================ +// Add and +int CSo7_CNC_Program::InitNew() +{ + SYSTEMTIME st; + GetSystemTime(&st); + RemoveAll(); + TCHAR date[24]; + //swprintf(date, 24, _T("%02d/%02d/%04d %02d:%02d:%02d"), st.wDay, (int)st.wMonth, (int)st.wYear, (int)st.wHour, (int)st.wMinute, (int)st.wSecond); + m_CncProgName = _T("Untitled"); + m_NewProgram=TRUE; + m_Operator = _T("Operator"); + m_Owner = _T("SevenOcean"); + m_CreateDate = (LPCSTR) date; // get toay's date + m_CncProgTitle = _T("O-Ring Part for China Space Agency"); + m_Division=_T("Inspection"); + m_PartNumber=_T("PT-12345678"); + m_PartFamily=_T("O-Ring"); + return 0; // means OK +}; + +//================================================================================================ +void CSo7_CNC_Program::RemoveAll() +{ + m_CNC_element.clear(); + m_Program_Number=0; +}; + +//================================================================================================ +BOOL CSo7_CNC_Program::IsEmpty() +{ + if (m_Program_Number>0) + { + return FALSE; + } + return TRUE; +}; + +//================================================================================================ +void CSo7_CNC_Program::Load(CString _csProgFile) +{ + UNREFERENCED_PARAMETER(_csProgFile); +}; + +//================================================================================================ +void CSo7_CNC_Program::Save() +{ + +}; + +//================================================================================================ +void CSo7_CNC_Program::Close() +{ + if (m_isModified) + { + Save(); + }; +}; + +//================================================================================================ +void CSo7_CNC_Program::Initialize(void) +{ + InitNew(); +}; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.h b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.h new file mode 100644 index 0000000..48357a2 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/SevenOcean/Program/So7_CNC_Program.h @@ -0,0 +1,37 @@ +#pragma once +class CSo7_CNC_Program +{ +public: + CSo7_CNC_Program(void); + ~CSo7_CNC_Program(void); + void Initialize(); + void Load(CString _csProgName); + void Save(); + void Close(); + void AddCncStep(CSO7_CMD* pProgStep); + void RemoveContent(); + int InitNew(); + void RemoveAll(); + BOOL IsEmpty(); + std::vector m_CNC_element; + CSO7_CMD* _pCurrCncStep; + int m_Program_Number; + CString m_CncProgName; + CString m_CncProgFileName; + BOOL m_NewProgram; + CString m_Title; + CString m_Operator; + CString m_Owner; + CString m_CreateDate; + CString m_CncProgTitle; + CString m_ModifiedDate; + CString m_Division; + CString m_PartNumber; + CString m_PartFamily; + CString _cmdXmlTag; + int m_Unit; // 0 - mm, 1 - inches + int m_Status; // 0 not loaded. + bool m_isModified; + int m_ActivatedCNCListItem; +}; + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log index 08be437..3252e47 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log @@ -1531,3 +1531,401 @@ Construct Cso7_Proto. Destruct Cso7_Proto. Construct Cso7_Proto. Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp index d875b05..4b6f776 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.cpp @@ -89,6 +89,7 @@ BEGIN_MESSAGE_MAP(CKeyence_UtilDlg, CDialog) ON_EN_KILLFOCUS(IDC_EDIT_TEST_LK_G_INTERVAL, &CKeyence_UtilDlg::OnEnKillfocusEditTestLkGInterval) ON_BN_CLICKED(IDC_BUTTON_TEST_KEYENCE_CLEAR_LOG, &CKeyence_UtilDlg::OnBnClickedButtonTestKeyenceClearLog) ON_BN_CLICKED(IDC_BUTTON_KEYENCE_LASER_CALIBRATE_VALUE, &CKeyence_UtilDlg::OnBnClickedButtonKeyenceLaserCalibrateValue) + ON_BN_CLICKED(IDC_BUTTON_KEYENCE_LASER_CALIBRATE_VALUE0, &CKeyence_UtilDlg::OnBnClickedButtonKeyenceLaserCalibrateValue0) END_MESSAGE_MAP() #pragma region GUI @@ -332,6 +333,19 @@ BOOL CKeyence_UtilDlg::ExportReportCSV(const CString &FilePathName) // CKeyence_UtilDlg 消息处理程序 #pragma region LK_G_LASER //=========================================================== +void CKeyence_UtilDlg::OnBnClickedButtonKeyenceLaserCalibrateValue0() +{ + double dCaliVal[10]={0.0}; + m_pKeyence_Laser->GetOutValueScaling(dCaliVal); + UpdateData(TRUE); + USES_CONVERSION; + CString csTmp; + (GetDlgItem(IDC_EDIT_KEYENCE_LASER_CALIBRATE_VALUE0))->GetWindowText(csTmp); + const char* cTempValue=T2A(csTmp); + double Calibrateval=static_cast(atof(cTempValue)); + m_pKeyence_Laser->SetOutValueScaling(Calibrateval); +} +//=========================================================== void CKeyence_UtilDlg::OnBnClickedButtonInitKeyenceLaser() { if (((CButton*)(GetDlgItem(IDC_CHECK_CONTINUE_READ_LASER_VALUE)))->GetCheck()) @@ -510,6 +524,11 @@ void CKeyence_UtilDlg::OnBnClickedButtonKeyenceLaserCalibrateValue() void CKeyence_UtilDlg::OnBnClickedCheckTestKeyenceLkGProgram0() { m_LK_G_ProNOState[0]=((CButton *)GetDlgItem(IDC_CHECK_TEST_KEYENCE_LK_G_PROGRAM0))->GetCheck(); + if (m_LK_G_ProNOState[0]) + { + m_pKeyence_Laser->SetProgramNO(1); + m_pKeyence_Laser->SetProgram(1); + } GetDlgItem(IDC_EDIT_TEST_KEYENCE_SETFOCUS)->SetFocus(); } void CKeyence_UtilDlg::OnBnClickedCheckTestKeyenceLkGProgram1() @@ -798,3 +817,6 @@ void CKeyence_UtilDlg::OnBnClickedButtonGetScanDataKeyenceLkHlaser() + + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h index e79ec79..6bb7bc4 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Keyence_UtilDlg.h @@ -73,4 +73,5 @@ public: afx_msg void OnEnKillfocusEditTestLkGInterval(); afx_msg void OnBnClickedButtonTestKeyenceClearLog(); afx_msg void OnBnClickedButtonKeyenceLaserCalibrateValue(); + afx_msg void OnBnClickedButtonKeyenceLaserCalibrateValue0(); }; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Mv_Util.rc b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Mv_Util.rc index 060de3b..8d258c0 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Mv_Util.rc +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Mv_Util.rc @@ -73,21 +73,21 @@ BEGIN EDITTEXT IDC_EDIT_X_SCALE_COEFFICIENT,46,284,54,12,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_Y_SCALE_COEFFICIENT,109,284,54,12,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_Z_SCALE_COEFFICIENT,172,284,54,12,ES_CENTER | ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_SET_VER_NO,325,279,45,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SET_VER_NO,325,317,45,14,ES_AUTOHSCROLL GROUPBOX "USB Control",IDC_STATIC,15,12,89,115 GROUPBOX "Config",IDC_STATIC,13,129,55,83 GROUPBOX "Get_Data",IDC_STATIC,114,13,98,115 - PUSHBUTTON "当前探头:激光",IDC_BUTTON_PROBE_ONOFF,273,369,48,20,BS_MULTILINE | NOT WS_VISIBLE - PUSHBUTTON "当前状态:夹具开",IDC_BUTTON_FIXTURE_ONOFF,273,369,48,20,BS_MULTILINE | NOT WS_VISIBLE - PUSHBUTTON "当前状态:夹具上",IDC_BUTTON_FIXTURE_UPDOWN,273,369,48,20,BS_MULTILINE | NOT WS_VISIBLE - GROUPBOX "Ver NO.",IDC_STATIC,252,265,145,37 - LTEXT "Set Ver NO.",IDC_STATIC,273,282,39,8 - GROUPBOX "Common Cmd",IDC_STATIC,253,307,144,54 - CONTROL "X",IDC_RADIO_SELECT_X,"Button",BS_AUTORADIOBUTTON,274,316,20,10 - CONTROL "Y",IDC_RADIO_SELECT_Y,"Button",BS_AUTORADIOBUTTON,317,316,20,10 - CONTROL "Z",IDC_RADIO_SELECT_Z,"Button",BS_AUTORADIOBUTTON,360,316,20,10 - PUSHBUTTON "Set Section",IDC_BUTTON_SET_SECTION,271,336,46,21,BS_MULTILINE - PUSHBUTTON "Correction Scale",IDC_BUTTON_CORRECTION_SCALE,327,336,46,21,BS_MULTILINE + PUSHBUTTON "当前探头:激光",IDC_BUTTON_PROBE_ONOFF,7,459,48,20,BS_MULTILINE | NOT WS_VISIBLE + PUSHBUTTON "当前状态:夹具开",IDC_BUTTON_FIXTURE_ONOFF,7,459,48,20,BS_MULTILINE | NOT WS_VISIBLE + PUSHBUTTON "当前状态:夹具上",IDC_BUTTON_FIXTURE_UPDOWN,7,459,48,20,BS_MULTILINE | NOT WS_VISIBLE + GROUPBOX "Ver NO.",IDC_STATIC,252,303,145,37 + LTEXT "Set Ver NO.",IDC_STATIC,273,320,39,8 + GROUPBOX "Common Cmd",IDC_STATIC,253,345,144,54 + CONTROL "X",IDC_RADIO_SELECT_X,"Button",BS_AUTORADIOBUTTON,274,354,20,10 + CONTROL "Y",IDC_RADIO_SELECT_Y,"Button",BS_AUTORADIOBUTTON,317,354,20,10 + CONTROL "Z",IDC_RADIO_SELECT_Z,"Button",BS_AUTORADIOBUTTON,360,354,20,10 + PUSHBUTTON "Set Section",IDC_BUTTON_SET_SECTION,271,374,46,21,BS_MULTILINE + PUSHBUTTON "Correction Scale",IDC_BUTTON_CORRECTION_SCALE,327,374,46,21,BS_MULTILINE GROUPBOX "Light Control",IDC_STATIC,226,14,85,113 LTEXT "Top",IDC_STATIC,236,28,18,11 LTEXT "Bottom",IDC_STATIC,234,43,22,11 @@ -143,9 +143,11 @@ BEGIN CONTROL "",IDC_MFCBUTTON_STATUS_IN_PORT4,"MfcButton",WS_TABSTOP,353,72,21,14 CONTROL "",IDC_MFCBUTTON_STATUS_IN_PORT5,"MfcButton",WS_TABSTOP,353,88,21,14 CONTROL "",IDC_MFCBUTTON_STATUS_IN_PORT6,"MfcButton",WS_TABSTOP,353,104,21,14 - EDITTEXT IDC_EDIT_SO7_READ_IO_STATUS_ADDRESS,347,371,40,14,ES_AUTOHSCROLL | NOT WS_VISIBLE - LTEXT "Addr",IDC_STATIC,327,372,16,8,NOT WS_VISIBLE + EDITTEXT IDC_EDIT_SO7_READ_IO_STATUS_ADDRESS,87,465,40,14,ES_AUTOHSCROLL | NOT WS_VISIBLE + LTEXT "Addr",IDC_STATIC,67,462,16,8,NOT WS_VISIBLE PUSHBUTTON "Test Z Signal",IDC_BUTTON_SO7_TEST_Z_SIGNAL,169,235,61,14 + PUSHBUTTON "CNC Program",IDC_BUTTON_SO7_CNC_PROGRAM,281,274,52,19 + GROUPBOX "CNC",IDC_STATIC,252,265,143,34 END IDD_S07_UTIL_SEND_PARAMETER DIALOGEX 0, 0, 753, 481 @@ -488,8 +490,8 @@ BEGIN EDITTEXT IDC_EDIT_REPETEST_TIMES,124,248,57,12,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_REPETEST_INTERVAL,124,272,45,12,ES_RIGHT | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_REPETEST_ERRORRANGE,124,296,45,12,ES_RIGHT | ES_AUTOHSCROLL - PUSHBUTTON "Begin",IDC_BUTTON_BEGIN_REPE_TEST,194,234,56,13 - PUSHBUTTON "Save...",IDC_BUTTON_SAVE_REPETEST,194,269,56,13 + PUSHBUTTON "Begin",IDC_BUTTON_BEGIN_REPE_TEST,194,249,56,13 + PUSHBUTTON "Save...",IDC_BUTTON_SAVE_REPETEST,194,276,56,13 GROUPBOX "System",IDC_STATIC,19,9,64,46 CONTROL "inch",IDC_RADIO_INCH,"Button",BS_AUTORADIOBUTTON | WS_GROUP,33,20,29,10 CONTROL "mm",IDC_RADIO_MM,"Button",BS_AUTORADIOBUTTON,33,30,27,10 @@ -531,6 +533,7 @@ BEGIN LTEXT "um",IDC_STATIC_DEADBAND_UNITS,172,298,19,8 CONTROL "VolComp",IDC_CHECK_REPETEST_VOLCOMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,283,43,10 CONTROL "V",IDC_CHECK_REPETESTV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,267,20,10 + CONTROL "Output Time",IDC_CHECK_SO7_MOTION_OUTPUT_TIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,198,225,55,10 END IDD_SO7_UTIL_IMAGE_DLL DIALOGEX 0, 0, 377, 184 @@ -740,6 +743,48 @@ BEGIN CONTROL "4",IDC_RADIO_SV4000E_CHANNEL4,"Button",BS_AUTORADIOBUTTON,451,213,20,10 END +IDD_SO7_UTIL_PROGRAM DIALOGEX 0, 0, 590, 386 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + PUSHBUTTON "Exit",IDCANCEL,533,365,50,14 + GROUPBOX "Motion",IDC_STATIC,163,11,253,130 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT,"MfcButton",WS_TABSTOP,295,56,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT,"MfcButton",WS_TABSTOP,369,56,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD,"MfcButton",WS_TABSTOP,332,26,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD,"MfcButton",WS_TABSTOP,332,86,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_Z_UP,"MfcButton",WS_TABSTOP,295,26,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN,"MfcButton",WS_TABSTOP,295,86,37,31 + CONTROL "3",IDC_MFCBUTTON_SPEEDGEAR,"MfcButton",WS_TABSTOP,332,56,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_PLUS_SPEED,"MfcButton",WS_TABSTOP,369,26,37,31 + CONTROL "",IDC_MFCBUTTON_SO7_PROGRAM_MINUS_SPEED,"MfcButton",WS_TABSTOP,369,86,37,31 + CONTROL "",IDC_LIST_REPORT_OUTPUT,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,17,151,557,117 + GROUPBOX "Readout",IDC_STATIC,420,11,157,130 + GROUPBOX "Motion Type",IDC_STATIC,169,32,52,82 + CONTROL "Move",IDC_RADIO_SO7_PROGRAM_MOVE,"Button",BS_AUTORADIOBUTTON,174,54,33,10 + CONTROL "MoveTo",IIDC_RADIO_SO7_PROGRAM_MOVE_TO,"Button",BS_AUTORADIOBUTTON,174,84,41,10 + EDITTEXT IDC_EDIT_SO7_PROGRAM_X_MOVETO,241,37,40,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SO7_PROGRAM_Y_MOVETO,241,63,40,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SO7_PROGRAM_Z_MOVETO,241,89,40,14,ES_AUTOHSCROLL + LTEXT "X",IDC_STATIC,230,39,8,8 + LTEXT "Y",IDC_STATIC,230,65,8,8 + LTEXT "Z",IDC_STATIC,230,92,8,8 + PUSHBUTTON "X",IDC_BUTTON_PROGRAM_SET_ZERO_X,427,41,27,21 + PUSHBUTTON "Y",IDC_BUTTON_PROGRAM_SET_ZERO_Y,427,64,27,21 + PUSHBUTTON "Z",IDC_BUTTON_PROGRAM_SET_ZERO_Z,427,87,27,21 + GROUPBOX "CNC Program",IDC_STATIC,15,14,140,130 + PUSHBUTTON "Add CNC Point",IDC_BUTTON_SO7_PROGRAM_ADD_CNC_PROGRAM,90,29,54,28 + PUSHBUTTON "Run",IDC_BUTTON_SO7_PROGRAM_RUN_CNC,87,65,60,32 + EDITTEXT IDC_EDIT_SO7_PROGRAM_MSG_OUTPUT,17,276,554,77,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT_READOUT_X,459,42,113,22,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_EDIT_READOUT_Z,459,85,113,22,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + EDITTEXT IDC_EDIT_READOUT_Y,459,63,113,22,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "New",IDC_BUTTON_SO7_PROGRAM_NEW_CNC,25,29,54,28 + PUSHBUTTON "Save as...",IDC_BUTTON_SO7_PROGRAM_SAVE_CNC_FILE,25,105,54,28 + PUSHBUTTON "Open",IDC_BUTTON_SO7_PROGRAM_OPEN_CNC,25,67,54,28 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -855,6 +900,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 312 END + + IDD_SO7_UTIL_PROGRAM, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 583 + TOPMARGIN, 7 + BOTTOMMARGIN, 379 + END END #endif // APSTUDIO_INVOKED @@ -1015,6 +1068,267 @@ BEGIN 0 END +IDD_SO7_UTIL_PROGRAM DLGINIT +BEGIN + IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT, 0x37c, 464, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3438, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f58, 0x454c, 0x5446, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, +0x6f54, 0x3e70, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, 0x3e70, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, +0x3e74, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, + IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT, 0x37c, 465, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3738, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f58, 0x4952, 0x4847, +0x3c54, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, +0x546e, 0x706f, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x546e, 0x706f, 0x3c3e, 0x464d, +0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x526e, 0x6769, +0x7468, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, +0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x526e, 0x6769, 0x7468, "\076" + IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD, 0x37c, 469, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3138, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f59, 0x5246, 0x4e4f, +0x5754, 0x5241, 0x3c44, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, +0x616d, 0x6567, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x4f65, 0x546e, 0x706f, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, +0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x546e, 0x706f, +0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, +0x526e, 0x6769, 0x7468, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x526e, 0x6769, 0x7468, +"\076" + IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD, 0x37c, 468, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3038, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f59, 0x4142, 0x4b43, +0x4157, 0x4452, 0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, +0x6567, 0x6e4f, 0x6f54, 0x3e70, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, 0x3e70, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, +0x6952, 0x6867, 0x3e74, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, + + IDC_MFCBUTTON_SO7_PROGRAM_Z_UP, 0x37c, 462, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3338, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f5a, 0x5055, 0x2f3c, +0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x3e65, 0x4d3c, +0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, +0x3e70, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, 0x3e70, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, +0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, +0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, + IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN, 0x37c, 464, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3238, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x5f5a, 0x4f44, 0x4e57, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, +0x6f54, 0x3e70, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, 0x3e70, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, +0x3e74, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, + IDC_MFCBUTTON_SPEEDGEAR, 0x37c, 369, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3c38, 0x4d2f, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x495f, 0x616d, 0x6567, 0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x546e, 0x706f, 0x463e, +0x4c41, 0x4553, 0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x4f65, 0x546e, 0x706f, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, +0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x526e, 0x6769, 0x7468, 0x463e, 0x4c41, +0x4553, 0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, +0x4f65, 0x526e, 0x6769, 0x7468, "\076" + IDC_MFCBUTTON_SO7_PROGRAM_PLUS_SPEED, 0x37c, 468, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3737, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x4c50, 0x5355, 0x535f, +0x4550, 0x4445, 0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, +0x6567, 0x6e4f, 0x6f54, 0x3e70, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6f54, 0x3e70, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, +0x6952, 0x6867, 0x3e74, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x6e4f, 0x6952, 0x6867, 0x3e74, + + IDC_MFCBUTTON_SO7_PROGRAM_MINUS_SPEED, 0x37c, 469, 0 +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x535f, 0x7974, 0x656c, 0x343e, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7453, 0x6c79, 0x3e65, +0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x415f, 0x7475, 0x736f, 0x7a69, +0x3e65, 0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, +0x415f, 0x7475, 0x736f, 0x7a69, 0x3e65, 0x4d3c, 0x4346, 0x7542, 0x7474, +0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, +0x543e, 0x5552, 0x3c45, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x465f, +0x6c75, 0x546c, 0x7865, 0x5474, 0x6f6f, 0x3e6c, 0x4d3c, 0x4346, 0x7542, +0x7474, 0x6e6f, 0x435f, 0x7275, 0x6f73, 0x5472, 0x7079, 0x3e65, 0x3131, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x7543, 0x7372, 0x726f, +0x7954, 0x6570, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x5465, 0x7079, 0x3e65, 0x3031, 0x2f3c, 0x464d, 0x4243, 0x7475, +0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x5465, 0x7079, 0x3e65, 0x4d3c, 0x4346, +0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, 0x4449, 0x313e, 0x3637, +0x2f3c, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4965, +0x3e44, 0x4d3c, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, 0x616d, 0x6567, +0x493e, 0x4244, 0x425f, 0x5449, 0x414d, 0x5f50, 0x494d, 0x554e, 0x5f53, +0x5053, 0x4545, 0x3c44, 0x4d2f, 0x4346, 0x7542, 0x7474, 0x6e6f, 0x495f, +0x616d, 0x6567, 0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, +0x6761, 0x4f65, 0x546e, 0x706f, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, +0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x546e, 0x706f, +0x3c3e, 0x464d, 0x4243, 0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, +0x526e, 0x6769, 0x7468, 0x463e, 0x4c41, 0x4553, 0x2f3c, 0x464d, 0x4243, +0x7475, 0x6f74, 0x5f6e, 0x6d49, 0x6761, 0x4f65, 0x526e, 0x6769, 0x7468, +"\076" + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP_MINUS_SPEED BITMAP "res\\bmp\\minus.bmp" +IDB_BITMAP_PLUS_SPEED BITMAP "res\\bmp\\plus.bmp" +IDB_BITMAP_Y_BACKWARD BITMAP "res\\bmp\\Y_Backward.bmp" +IDB_BITMAP_Y_FRONTWARD BITMAP "res\\bmp\\Y_Frontward.bmp" +IDB_BITMAP_Z_DOWN BITMAP "res\\bmp\\Z_DOWN.bmp" +IDB_BITMAP_Z_UP BITMAP "res\\bmp\\Z_UP.bmp" +IDB_BITMAP_X_LEFT BITMAP "res\\bmp\\X_LEFT.BMP" +IDB_BITMAP_X_RIGHT BITMAP "res\\bmp\\X_RIGHT.bmp" #endif // Chinese (Simplified, PRC) resources ///////////////////////////////////////////////////////////////////////////// @@ -1693,6 +2007,8 @@ BEGIN PUSHBUTTON "Get Data",IDC_BUTTON_GET_SCAN_DATA_KEYENCE_LK_HLASER,7,295,8,14,NOT WS_VISIBLE GROUPBOX "LKIF2.DLL",IDC_STATIC,7,284,13,28,NOT WS_VISIBLE EDITTEXT IDC_EDIT_TEST_KEYENCE_SETFOCUS,7,328,40,14,ES_AUTOHSCROLL | NOT WS_VISIBLE + EDITTEXT IDC_EDIT_KEYENCE_LASER_CALIBRATE_VALUE0,93,41,40,14,ES_AUTOHSCROLL + PUSHBUTTON "Calibrate",IDC_BUTTON_KEYENCE_LASER_CALIBRATE_VALUE0,139,40,50,14 END diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.cpp new file mode 100644 index 0000000..1c6526f --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.cpp @@ -0,0 +1,61 @@ +#include "stdafx.h" + +#include "MyListCtrl.h" +//======================================================= +COLORREF CMyListCtrl::OnGetCellTextColor(int nRow, int nColum) +{ + if (!m_bColor) + { + return CMFCListCtrl::OnGetCellTextColor(nRow, nColum); + } + + return(nRow % 2) == 0 ? RGB(128, 37, 0) : RGB(0, 0, 0); +} +//======================================================= +COLORREF CMyListCtrl::OnGetCellBkColor(int nRow, int nColum) +{ + if (!m_bColor) + { + return CMFCListCtrl::OnGetCellBkColor(nRow, nColum); + } + + if (m_bMarkSortedColumn && nColum == m_iSortedColumn) + { + return(nRow % 2) == 0 ? RGB(233, 221, 229) : RGB(176, 218, 234); + } + + return(nRow % 2) == 0 ? RGB(255, 255, 255) : RGB(211, 223, 238) ; +} +//======================================================= +HFONT CMyListCtrl::OnGetCellFont(int nRow, int nColum, DWORD /*dwData* = 0*/) +{ + if (!m_bModifyFont) + { + return NULL; + } + + if (nColum == 2 &&(nRow >= 4 && nRow <= 8)) + { + return afxGlobalData.fontDefaultGUIBold; + } + + return NULL; +} +//======================================================= +int CMyListCtrl::OnCompareItems(LPARAM lParam1, LPARAM lParam2, int iColumn) +{ + CString strItem1 = GetItemText((int)(lParam1 < lParam2 ? lParam1 : lParam2), iColumn); + CString strItem2 = GetItemText((int)(lParam1 < lParam2 ? lParam2 : lParam1), iColumn); + + if (iColumn == 0) + { + int nItem1 = _ttoi(strItem1); + int nItem2 = _ttoi(strItem2); + return(nItem1 < nItem2 ? -1 : 1); + } + else + { + int iSort = _tcsicmp(strItem1, strItem2); + return(iSort); + } +} \ No newline at end of file diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.h new file mode 100644 index 0000000..37a514c --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyListCtrl.h @@ -0,0 +1,14 @@ +#pragma once + +class CMyListCtrl : public CMFCListCtrl +{ + virtual COLORREF OnGetCellTextColor(int nRow, int nColum); + virtual COLORREF OnGetCellBkColor(int nRow, int nColum); + virtual HFONT OnGetCellFont(int nRow, int nColum, DWORD dwData = 0); + + virtual int OnCompareItems(LPARAM lParam1, LPARAM lParam2, int iColumn); + +public: + BOOL m_bColor; + BOOL m_bModifyFont; +}; \ No newline at end of file diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.cpp new file mode 100644 index 0000000..8a7d8be --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.cpp @@ -0,0 +1,215 @@ +// ProcessButton.cpp : 实现文件 +// + +#include "stdafx.h" +#include "resource.h" +#include "afxwin.h" +#include "..\..\..\SevenOcean\SO7_Proto.h" + +#include "MyMFCButton.h" + +extern CSO7_Proto* m_pSO7_Proto; + +// CMyMFCButton + +IMPLEMENT_DYNAMIC(CMyMFCButton, CMFCButton) + + CMyMFCButton::CMyMFCButton() +{ + +} + +CMyMFCButton::~CMyMFCButton() +{ +} + + +BEGIN_MESSAGE_MAP(CMyMFCButton, CMFCButton) + ON_WM_LBUTTONDOWN() + ON_WM_LBUTTONUP() + ON_WM_LBUTTONDBLCLK() +END_MESSAGE_MAP() + + +// CMyMFCButton 消息处理程序 + + +//==================================== +void CMyMFCButton::OnLButtonDown(UINT nFlags, CPoint point) +{ + if ( point.x>0 ) + { + if (nFlags == MK_LBUTTON) + { + int iCtrlID; + iCtrlID=GetDlgCtrlID(); + + switch (iCtrlID) + { + //====================================================================================== + case IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT: + { + if (m_pSO7_Proto->g_machine.x._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.x._pos_fixed._long_*=-1; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=0; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_X(-m_pSO7_Proto->g_machine.x._Move_Speed_Gear); + } + break; + } + case IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT: + { + if (m_pSO7_Proto->g_machine.x._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=0; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_X(m_pSO7_Proto->g_machine.x._Move_Speed_Gear); + } + break; + } + case IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD: + { + if (m_pSO7_Proto->g_machine.y._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.x._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=0; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Y(m_pSO7_Proto->g_machine.y._Move_Speed_Gear); + } + break; + } + case IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD: + { + if (m_pSO7_Proto->g_machine.y._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.y._pos_fixed._long_*=-1; + m_pSO7_Proto->g_machine.x._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=0; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Y(-m_pSO7_Proto->g_machine.y._Move_Speed_Gear); + } + break; + } + case IDC_MFCBUTTON_SO7_PROGRAM_Z_UP: + { + if (m_pSO7_Proto->g_machine.z._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.x._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=0; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Z(m_pSO7_Proto->g_machine.z._Move_Speed_Gear); + } + break; + } + case IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN: + { + if (m_pSO7_Proto->g_machine.z._Move_Speed_Gear==0) + { + long lMoveTOX=m_pSO7_Proto->g_machine.x._pos_fixed._long_; + long lMoveTOY=m_pSO7_Proto->g_machine.y._pos_fixed._long_; + long lMoveTOZ=m_pSO7_Proto->g_machine.z._pos_fixed._long_; + m_pSO7_Proto->g_machine.x._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=0; + m_pSO7_Proto->g_machine.z._pos_fixed._long_*=-1; + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->g_machine.x._pos_fixed._long_=lMoveTOX; + m_pSO7_Proto->g_machine.y._pos_fixed._long_=lMoveTOY; + m_pSO7_Proto->g_machine.z._pos_fixed._long_=lMoveTOZ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Z(-m_pSO7_Proto->g_machine.z._Move_Speed_Gear); + } + break; + } + default: + break; + + } + } + } +} + +//==================================== +void CMyMFCButton::OnLButtonUp(UINT /*nFlags*/, CPoint/* point*/) +{ + int iCtrlID; + iCtrlID=GetDlgCtrlID(); + switch (iCtrlID) + { + case IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT: + case IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT: + case IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD: + case IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD: + case IDC_MFCBUTTON_SO7_PROGRAM_Z_UP: + case IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN: + { + if (m_pSO7_Proto->g_machine.x._Move_Speed_Gear==0) + { + ; + } + else + { + m_pSO7_Proto->_send_cmd_SO7_CMD_STOP_MOVE_XYZ(); + } + break; + } + default: + break; + + } +} + +void CMyMFCButton::OnLButtonDblClk(UINT nFlags, CPoint point) +{ + OnLButtonUp(nFlags, point); +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.h new file mode 100644 index 0000000..76cf040 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyMFCButton.h @@ -0,0 +1,23 @@ + +#pragma once + + +// CMyMFCButton + +class CMyMFCButton : public CMFCButton +{ + DECLARE_DYNAMIC(CMyMFCButton) + +public: + CMyMFCButton(); + virtual ~CMyMFCButton(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + +protected: + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); +}; + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.cpp new file mode 100644 index 0000000..9a11c44 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.cpp @@ -0,0 +1,90 @@ +// MyStatic.cpp : implementation file +// + +#include "stdafx.h" +#include "resource.h" +#include "MyStatic.h" + + +// CMyStatic + +IMPLEMENT_DYNAMIC(CMyStatic, CStatic) + +CMyStatic::CMyStatic() +{ + +} + +CMyStatic::~CMyStatic() +{ +} + + +BEGIN_MESSAGE_MAP(CMyStatic, CStatic) + ON_WM_CTLCOLOR() +END_MESSAGE_MAP() + + +HBRUSH CMyStatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) +{ + HBRUSH hbr=CStatic::OnCtlColor(pDC,pWnd,nCtlColor); + + static HBRUSH Hbr_Red = ::CreateSolidBrush(RGB(255,0,0)); + static HBRUSH Hbr_Green = ::CreateSolidBrush(RGB(0,255,0)); + + + + // TODO: Change any attributes of the DC here + + STATIC_BKCOLOR static_BkColor = NULL_COLOR; + HBRUSH rHbrush = hbr; + + switch (pWnd->GetDlgCtrlID()) + { + case IDC_STATIC_READOUT_X: + { + static_BkColor = RED_COLOR; + break; + } + case IDC_STATIC_READOUT_Y: + { + static_BkColor = GREEN_COLOR; + break; + } + case IDC_STATIC_READOUT_Z: + { + static_BkColor = RED_COLOR; + break; + } + default: + { + static_BkColor = NULL_COLOR; + break; + } + } + switch (static_BkColor) + { + case RED_COLOR: + pDC->SetTextColor(RGB(255,255,255)); + pDC->SetBkColor(RGB(255,0,0)); + rHbrush = (HBRUSH)Hbr_Red; + break; + case GREEN_COLOR: + pDC->SetTextColor(RGB(255,255,255)); + pDC->SetBkColor(RGB(0,255,0)); + rHbrush = (HBRUSH)Hbr_Green; + break; + case NULL_COLOR: + rHbrush = hbr; + break; + default: + rHbrush = hbr; + } + + return rHbrush; +} + + +// CMyStatic message handlers + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.h new file mode 100644 index 0000000..d93c8a6 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/MyStatic.h @@ -0,0 +1,25 @@ +#pragma once + +enum STATIC_BKCOLOR +{ + NULL_COLOR, + RED_COLOR, + GREEN_COLOR, +}; + +// CMyStatic + +class CMyStatic : public CStatic +{ + DECLARE_DYNAMIC(CMyStatic) + +public: + CMyStatic(); + virtual ~CMyStatic(); + +protected: + DECLARE_MESSAGE_MAP() + afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); +}; + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.cpp index e65992b..4e7b780 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.cpp @@ -28,7 +28,7 @@ IMPLEMENT_DYNAMIC(CSO7_Move_Location, CDialog) CSO7_Move_Location::CSO7_Move_Location(CWnd* pParent /*=NULL*/) : CDialog(CSO7_Move_Location::IDD, pParent) { - + m_bOutputTime=FALSE; } CSO7_Move_Location::~CSO7_Move_Location() @@ -70,6 +70,7 @@ BEGIN_MESSAGE_MAP(CSO7_Move_Location, CDialog) ON_BN_CLICKED(IDC_CHECK_REPETEST_ABSOLUTE, &CSO7_Move_Location::OnBnClickedCheckRepetestAbsolute) ON_BN_CLICKED(IDC_RADIO_SCALE, &CSO7_Move_Location::OnBnClickedRadioScale) ON_BN_CLICKED(IDC_RADIO_MM, &CSO7_Move_Location::OnBnClickedRadioMm) + ON_BN_CLICKED(IDC_CHECK_SO7_MOTION_OUTPUT_TIME, &CSO7_Move_Location::OnBnClickedCheckSo7MotionOutputTime) END_MESSAGE_MAP() @@ -622,6 +623,7 @@ void CSO7_Move_Location::OnBnClickedButtonBeginRepeTest() OnBnClickedButtonZeroSet(); iCnt=0; m_OutMessage=_T(""); + m_OutputTime=_T(""); GetDlgItem(IDC_EDIT_REPRETEST)->SetWindowText(m_OutMessage); m_dRepeTest_Record_Dis[0]=0; m_dRepeTest_Record_Dis[1]=0; @@ -635,6 +637,7 @@ void CSO7_Move_Location::OnBnClickedButtonBeginRepeTest() m_bRepeTestAxisV= ((CButton *)GetDlgItem(IDC_CHECK_REPETESTV))->GetCheck(); m_bRepeTestAbsolute=((CButton *)GetDlgItem(IDC_CHECK_REPETEST_ABSOLUTE))->GetCheck(); m_pSO7_Proto->g_machine.InterruptFlag[0]=0; + m_StartTime=clock(); if(((CButton *)GetDlgItem(IDC_CHECK_REPETEST_VOLCOMP))->GetCheck()) { bRepeTestDone=true; @@ -730,7 +733,13 @@ BOOL CSO7_Move_Location::RepeTestVolComp() m_OutMessageY+=csTemp; csTemp.Format(_T(" To: %-3.4f VolComp : %-3.4f\r\n"),m_dRepeTest_Dis+m_pSO7_Proto->g_machine.z._d_cur_pos_,dToZ); m_OutMessageZ+=csTemp; - + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } if (m_bRepeTestAxisX) { m_pSO7_Proto->g_machine.x._pos_fixed._long_=m_pSO7_Proto->MMtoScale((dToX-m_pSO7_Proto->g_machine.x._d_cur_pos_),m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); @@ -778,7 +787,13 @@ BOOL CSO7_Move_Location::RepeTestVolComp() m_OutMessageY+=csTemp; csTemp.Format(_T("g_machine.z._d_cur_pos_,dFromZ); m_OutMessageZ+=csTemp; - + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("[Time] > %2.2fs "),m_duration/1000.0); + m_OutputTime+=csTemp; + } dToX=m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dRepeTest_Dis; dToY=m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dRepeTest_Dis; dToZ=m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dRepeTest_Dis; @@ -825,6 +840,8 @@ BOOL CSO7_Move_Location::RepeTestVolComp() bRepeTestDone=false; iCnt++; + m_StartTime=clock(); + } } @@ -856,6 +873,7 @@ BOOL CSO7_Move_Location::RepeTestmmRel() { if(bRepeTestDone) { + if (iCnt%2 == 0) { RecordDis[0]=m_dRepeTest_Record_Dis[0]; @@ -896,7 +914,15 @@ BOOL CSO7_Move_Location::RepeTestmmRel() m_OutMessageY+=csTemp; csTemp.Format(_T(" <% 3.4f\r\n"),RecordToDis[2]-m_dRepeTest_Record_Dis[2]); m_OutMessageZ+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } } + m_StartTime=clock(); if (m_bRepeTestAxisX) { @@ -960,7 +986,8 @@ BOOL CSO7_Move_Location::RepeTestmmRel() } } } - + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageX; m_OutMessage+=m_OutMessageY; m_OutMessage+=m_OutMessageZ; @@ -1093,6 +1120,15 @@ BOOL CSO7_Move_Location::RepeTestmmRel() csTemp.Format(_T("Dis: >% 3.4f"),m_dRepeTest_Record_Dis[2]-RecordDis[2]); m_OutMessageZ+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("[Time] > %2.2fs "),m_duration/1000.0); + m_OutputTime+=csTemp; + } + m_StartTime=clock(); + if (m_bRepeTestAxisX) { if (m_bRepeTestAxisY) @@ -1160,7 +1196,7 @@ BOOL CSO7_Move_Location::RepeTestmmRel() } bRepeTestDone=false; - iCnt++; + iCnt++; } } @@ -1173,6 +1209,13 @@ BOOL CSO7_Move_Location::RepeTestmmRel() m_OutMessageY+=csTemp; csTemp.Format(_T(" <% 3.4f\r\n"),RecordToDis[2]-m_dRepeTest_Record_Dis[2]); m_OutMessageZ+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } if (m_bRepeTestAxisX) { if (m_bRepeTestAxisY) @@ -1227,7 +1270,8 @@ BOOL CSO7_Move_Location::RepeTestmmRel() } } } - + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageX; m_OutMessage+=m_OutMessageY; m_OutMessage+=m_OutMessageZ; @@ -1261,7 +1305,7 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() if(iCnt(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } } + m_StartTime=clock(); if (m_bRepeTestAxisX) { @@ -1385,7 +1437,9 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() } } - m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ); + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageX; m_OutMessage+=m_OutMessageY; m_OutMessage+=m_OutMessageZ; @@ -1517,7 +1571,16 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() csTemp.Format(_T("Dis: >% 3.4f"),m_dRepeTest_Record_Dis[1]-RecordDis[1]); m_OutMessageY+=csTemp; csTemp.Format(_T("Dis: >% 3.4f"),m_dRepeTest_Record_Dis[2]-RecordDis[2]); - m_OutMessageZ+=csTemp; + m_OutMessageZ+=csTemp; + + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("[Time] > %2.2fs "),m_duration/1000.0); + m_OutputTime+=csTemp; + } + m_StartTime=clock(); //============================================================ //控制回来的距离 @@ -1600,7 +1663,7 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() } bRepeTestDone=false; - iCnt++; + iCnt++; } } @@ -1613,6 +1676,13 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() m_OutMessageY+=csTemp; csTemp.Format(_T(" <% 3.4f\r\n"),RecordToDis[2]-m_dRepeTest_Record_Dis[2]); m_OutMessageZ+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } if (m_bRepeTestAxisX) { if (m_bRepeTestAxisY) @@ -1667,7 +1737,8 @@ BOOL CSO7_Move_Location::RepeTestmmAbs() } } } - + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageX; m_OutMessage+=m_OutMessageY; m_OutMessage+=m_OutMessageZ; @@ -1695,7 +1766,7 @@ BOOL CSO7_Move_Location::RepeTestpulse() if(bRepeTestDone) { if (iCnt%2 == 0) - { + { lRecordDis[0]=m_lRepeTest_Record_Dis[0]; lRecordDis[1]=m_lRepeTest_Record_Dis[1]; lRecordDis[2]=m_lRepeTest_Record_Dis[2]; @@ -1706,7 +1777,13 @@ BOOL CSO7_Move_Location::RepeTestpulse() m_OutMessageY+=csTemp; csTemp.Format(_T("[%2d] Z: From: % 6ld "),iCnt/2+1,m_lRepeTest_Record_Dis[2]); m_OutMessageZ+=csTemp; - + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } if (m_bRepeTestAxisX) { if (m_bRepeTestAxisY) @@ -1774,6 +1851,13 @@ BOOL CSO7_Move_Location::RepeTestpulse() csTemp.Format(_T("Dis: % 6ld \r\n"),m_lRepeTest_Record_Dis[2]-lRecordDis[2]); m_OutMessageZ+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("[Time] > %2.2fs "),m_duration/1000.0); + m_OutputTime+=csTemp; + } if (m_bRepeTestAxisX) { if (m_bRepeTestAxisY) @@ -1835,7 +1919,9 @@ BOOL CSO7_Move_Location::RepeTestpulse() m_OutMessageZ=_T(""); } } - } + } + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageX; m_OutMessage+=m_OutMessageY; m_OutMessage+=m_OutMessageZ; @@ -1847,7 +1933,8 @@ BOOL CSO7_Move_Location::RepeTestpulse() } bRepeTestDone=false; - iCnt++; + iCnt++; + m_StartTime=clock(); } } @@ -1903,11 +1990,20 @@ BOOL CSO7_Move_Location::RepeTestZoom() { csTemp.Format(_T(" <% 6ld\r\n"),RecordToDisV-m_lRepeTest_Record_Dis[3]); m_OutMessageV+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("< %2.2fs\r\n"),m_duration/1000.0); + m_OutputTime+=csTemp; + } } m_pSO7_Proto->g_machine.zm._pos_fixed._long_=m_lRepeTest_Dis; m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_TO_POS_ZM(); + m_OutMessage+=m_OutputTime; + m_OutputTime=_T(""); m_OutMessage+=m_OutMessageV; m_OutMessageV=_T(""); @@ -1953,6 +2049,13 @@ BOOL CSO7_Move_Location::RepeTestZoom() csTemp.Format(_T("Dis: >% 6ld"),m_lRepeTest_Record_Dis[3]-RecordFromDisV); m_OutMessageV+=csTemp; + if (m_bOutputTime) + { + m_FinishTime=clock(); + m_duration=static_cast(m_FinishTime-m_StartTime); + csTemp.Format(_T("[Time] > %2.2fs "),m_duration/1000.0); + m_OutputTime+=csTemp; + } //============================================================ //控制回来的距离 m_pSO7_Proto->g_machine.zm._pos_fixed._long_=0-m_lRepeTest_Dis; @@ -1961,6 +2064,7 @@ BOOL CSO7_Move_Location::RepeTestZoom() } bRepeTestDone=false; iCnt++; + m_StartTime=clock(); } } else @@ -2254,3 +2358,16 @@ void CSO7_Move_Location::OutputWithScroll(const CString &strText,CEdit &edtOutpu edtOutput.SetRedraw(TRUE); } + +//===================================================================================== +void CSO7_Move_Location::OnBnClickedCheckSo7MotionOutputTime() +{ + if (((CButton *)GetDlgItem(IDC_CHECK_SO7_MOTION_OUTPUT_TIME))->GetCheck()) + { + m_bOutputTime=TRUE; + } + else + { + m_bOutputTime=FALSE; + } +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.h index 1e18a25..774d15e 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Move_Location.h @@ -69,7 +69,10 @@ public: BOOL RepeTestpulse(); BOOL RepeTestVolComp(); BOOL RepeTestZoom(); - + BOOL m_bOutputTime; + clock_t m_StartTime, m_FinishTime; + double m_duration; + CString m_OutputTime; void OutputWithScroll(const CString &strNewText,CEdit &edtOutput); afx_msg void OnBnClickedCancel(); afx_msg void OnBnClickedOkStart(); @@ -88,4 +91,5 @@ public: afx_msg void OnBnClickedCheckRepetestAbsolute(); afx_msg void OnBnClickedRadioScale(); afx_msg void OnBnClickedRadioMm(); + afx_msg void OnBnClickedCheckSo7MotionOutputTime(); }; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.cpp index 1ffe3e8..2d5945e 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.cpp @@ -12,6 +12,9 @@ #include "SO7_Move_Location.h" #include "Setup_so7config.h" #include "SO7_VolComp.h" +#include "MyListCtrl.h" +#include "MyMFCButton.h" +#include "So7_Util_Program.h" #include "SO7_UtilDlg.h" // CSO7_UtilDlg 对话框 @@ -129,6 +132,7 @@ BEGIN_MESSAGE_MAP(CSO7_UtilDlg, CDialog) ON_BN_CLICKED(IDC_RADIO_SPEED_GEAR5, &CSO7_UtilDlg::OnBnClickedRadioSpeedGear5) ON_EN_KILLFOCUS(IDC_EDIT_SO7_READ_IO_STATUS_ADDRESS, &CSO7_UtilDlg::OnEnKillfocusEditSo7ReadIoStatusAddress) ON_BN_CLICKED(IDC_BUTTON_SO7_TEST_Z_SIGNAL, &CSO7_UtilDlg::OnBnClickedButtonSo7TestZSignal) + ON_BN_CLICKED(IDC_BUTTON_SO7_CNC_PROGRAM, &CSO7_UtilDlg::OnBnClickedButtonSo7CncProgram) END_MESSAGE_MAP() @@ -209,7 +213,8 @@ BOOL CSO7_UtilDlg::OnInitDialog() GetDlgItem(IDC_EDIT_SET_VER_NO)->EnableWindow(false); GetDlgItem(IDC_BUTTON_SET_SECTION)->EnableWindow(false); GetDlgItem(IDC_BUTTON_CORRECTION_SCALE)->EnableWindow(false); - + GetDlgItem(IDC_BUTTON_SO7_CNC_PROGRAM)->EnableWindow(false); + ((CButton *)GetDlgItem(IDC_RADIO_SPEED_GEAR1))->SetCheck(false); ((CButton *)GetDlgItem(IDC_RADIO_SPEED_GEAR2))->SetCheck(false); @@ -367,6 +372,8 @@ void CSO7_UtilDlg::OnBnClickedButtonStartSo7machine() GetDlgItem(IDC_EDIT_SET_VER_NO)->EnableWindow(true); GetDlgItem(IDC_BUTTON_SET_SECTION)->EnableWindow(true); GetDlgItem(IDC_BUTTON_CORRECTION_SCALE)->EnableWindow(true); + GetDlgItem(IDC_BUTTON_SO7_CNC_PROGRAM)->EnableWindow(true); + SetTimer(1, 150, 0); GetDlgItem(IDC_EDIT_UPDATE_FREQ)->SetWindowText(_T("150")); @@ -433,6 +440,7 @@ void CSO7_UtilDlg::OnBnClickedButtonStopSo7machine() GetDlgItem(IDC_EDIT_SET_VER_NO)->EnableWindow(false); GetDlgItem(IDC_BUTTON_SET_SECTION)->EnableWindow(false); GetDlgItem(IDC_BUTTON_CORRECTION_SCALE)->EnableWindow(false); + GetDlgItem(IDC_BUTTON_SO7_CNC_PROGRAM)->EnableWindow(false); KillTimer(1); m_pSO7_Proto->_shutdown_machine(); @@ -1276,4 +1284,14 @@ void CSO7_UtilDlg::OutputWithScroll(const CString &strNewText,CEdit &edtOutput) edtOutput.LineScroll(iLine, 0); edtOutput.SetSel(iCount, iCount); edtOutput.SetRedraw(TRUE); -} \ No newline at end of file +} + +void CSO7_UtilDlg::OnBnClickedButtonSo7CncProgram() +{ + KillTimer(1); + CSo7_Util_Program* pSo7_Util_Program=new CSo7_Util_Program; + pSo7_Util_Program->DoModal(); + delete pSo7_Util_Program; + pSo7_Util_Program=NULL; + SetTimer(1,150,NULL); +} diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.h index a610849..407d797 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_UtilDlg.h @@ -112,4 +112,5 @@ public: afx_msg void OnBnClickedRadioSpeedGear5(); afx_msg void OnEnKillfocusEditSo7ReadIoStatusAddress(); afx_msg void OnBnClickedButtonSo7TestZSignal(); + afx_msg void OnBnClickedButtonSo7CncProgram(); }; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.cpp new file mode 100644 index 0000000..3abb4c4 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.cpp @@ -0,0 +1,515 @@ +// So7_Util_Program.cpp : implementation file +// + +#include "stdafx.h" +#include "resource.h" +#include "..\..\..\SevenOcean\SO7_Proto.h" +#include "MyListCtrl.h" +#include "MyMFCButton.h" +#include "..\..\..\SevenOcean\Program\CSO7_CMD.H" +#include "..\..\..\SevenOcean\Program\So7_CNC_Point.h" +#include "..\..\..\SevenOcean\Program\So7_CNC_Program.h" +#include "So7_Util_Program.h" +#include "afxdialogex.h" + +#define GLOBAL_UNIT _T(" mm") +#define THREAD_RUNNING_STATE 0 +#define THREAD_PAUSED 1 +#define THREAD_EXIT -1 + +HANDLE CSo7_Util_Program::m_Thread_Id=NULL; +HANDLE CSo7_Util_Program::m_Thread_Mutex=NULL; +HANDLE CSo7_Util_Program::m_hTriggerEvent=NULL; +int CSo7_Util_Program::m_Thread_State=THREAD_PAUSED; +BOOL CSo7_Util_Program::m_bThread_Status=FALSE; + +extern CSO7_Proto* m_pSO7_Proto; +CSo7_CNC_Program* m_pSo7_CNC_Program=NULL; +// CSo7_Util_Program dialog + +IMPLEMENT_DYNAMIC(CSo7_Util_Program, CDialog) + +CSo7_Util_Program::CSo7_Util_Program(CWnd* pParent /*=NULL*/) + : CDialog(CSo7_Util_Program::IDD, pParent) +{ + +} + +CSo7_Util_Program::~CSo7_Util_Program() +{ +} + +void CSo7_Util_Program::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + + DDX_Text(pDX, IDC_EDIT_READOUT_X, m_csXPos); + DDX_Text(pDX, IDC_EDIT_READOUT_Y, m_csYPos); + DDX_Text(pDX, IDC_EDIT_READOUT_Z, m_csZPos); + + DDX_Control(pDX, IDC_LIST_REPORT_OUTPUT, m_RptListCtrl); + + DDX_Control(pDX, IDC_EDIT_SO7_PROGRAM_MSG_OUTPUT, m_edMSG); + + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT, m_Button_MoveX_Left); + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT, m_Button_MoveX_Right); + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD, m_Button_MoveY_Front); + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD, m_Button_MoveY_Back); + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_Z_UP, m_Button_MoveZ_Up); + DDX_Control(pDX, IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN, m_Button_MoveZ_Down); + +} + + +BEGIN_MESSAGE_MAP(CSo7_Util_Program, CDialog) + ON_WM_TIMER() + ON_WM_CTLCOLOR() + ON_BN_CLICKED(IDCANCEL, &CSo7_Util_Program::OnBnClickedCancel) + ON_BN_CLICKED(IDC_MFCBUTTON_SO7_PROGRAM_PLUS_SPEED, &CSo7_Util_Program::OnBnClickedMfcbuttonSo7ProgramPlusSpeed) + ON_BN_CLICKED(IDC_MFCBUTTON_SO7_PROGRAM_MINUS_SPEED, &CSo7_Util_Program::OnBnClickedMfcbuttonSo7ProgramMinusSpeed) + ON_BN_CLICKED(IDC_BUTTON_PROGRAM_SET_ZERO_X, &CSo7_Util_Program::OnBnClickedButtonProgramSetZeroX) + ON_BN_CLICKED(IDC_BUTTON_PROGRAM_SET_ZERO_Y, &CSo7_Util_Program::OnBnClickedButtonProgramSetZeroY) + ON_BN_CLICKED(IDC_BUTTON_PROGRAM_SET_ZERO_Z, &CSo7_Util_Program::OnBnClickedButtonProgramSetZeroZ) + ON_BN_CLICKED(IDC_BUTTON_SO7_PROGRAM_ADD_CNC_PROGRAM, &CSo7_Util_Program::OnBnClickedButtonSo7ProgramAddCncProgram) + ON_BN_CLICKED(IDC_BUTTON_SO7_PROGRAM_NEW_CNC, &CSo7_Util_Program::OnBnClickedButtonSo7ProgramNewCnc) + ON_BN_CLICKED(IDC_BUTTON_SO7_PROGRAM_OPEN_CNC, &CSo7_Util_Program::OnBnClickedButtonSo7ProgramOpenCnc) + ON_BN_CLICKED(IDC_BUTTON_SO7_PROGRAM_SAVE_CNC_FILE, &CSo7_Util_Program::OnBnClickedButtonSo7ProgramSaveCncFile) + ON_BN_CLICKED(IDC_BUTTON_SO7_PROGRAM_RUN_CNC, &CSo7_Util_Program::OnBnClickedButtonSo7ProgramRunCnc) + ON_EN_KILLFOCUS(IDC_EDIT_SO7_PROGRAM_X_MOVETO, &CSo7_Util_Program::OnEnKillfocusEditSo7ProgramXMoveto) + ON_EN_KILLFOCUS(IDC_EDIT_SO7_PROGRAM_Z_MOVETO, &CSo7_Util_Program::OnEnKillfocusEditSo7ProgramZMoveto) + ON_EN_KILLFOCUS(IDC_EDIT_SO7_PROGRAM_Y_MOVETO, &CSo7_Util_Program::OnEnKillfocusEditSo7ProgramYMoveto) + ON_BN_CLICKED(IDC_RADIO_SO7_PROGRAM_MOVE, &CSo7_Util_Program::OnBnClickedRadioSo7ProgramMove) + ON_BN_CLICKED(IIDC_RADIO_SO7_PROGRAM_MOVE_TO, &CSo7_Util_Program::OnBnClickedRadioSo7ProgramMoveTo) +END_MESSAGE_MAP() + + +// CSo7_Util_Program message handlers +//================================================================================================ +BOOL CSo7_Util_Program::OnInitDialog() +{ + CDialog::OnInitDialog(); + + + m_bSetZeroX=FALSE; + m_bSetZeroY=FALSE; + m_bSetZeroZ=FALSE; + m_IsRuningCNC=FALSE; + if (!m_pSO7_Proto->so7_motion_is_homed()) + { + AfxMessageBox(_T("Homing now!")); + m_pSO7_Proto->so7_motion_Dcc_Home(); + } + { + m_Thread_State = THREAD_RUNNING_STATE; + m_hTriggerEvent = CreateEvent(NULL,FALSE,NULL,NULL); + m_Thread_Id = CreateThread((LPSECURITY_ATTRIBUTES)NULL,0,(LPTHREAD_START_ROUTINE)m_Thread,(LPVOID)this,0,NULL); + m_Thread_Mutex = CreateMutex(NULL,FALSE,NULL); + } + m_pSO7_Proto->g_machine.x._pos_fixed._long_=m_pSO7_Proto->MMtoScale(10.0,m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); + m_pSO7_Proto->g_machine.y._pos_fixed._long_=m_pSO7_Proto->MMtoScale(10.0,m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); + m_pSO7_Proto->g_machine.z._pos_fixed._long_=m_pSO7_Proto->MMtoScale(10.0,m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); + + m_pSO7_Proto->g_machine.x._dSet_Zero_Pos = 0.0 ; + m_pSO7_Proto->g_machine.y._dSet_Zero_Pos = 0.0 ; + m_pSO7_Proto->g_machine.z._dSet_Zero_Pos = 0.0 ; + m_pSO7_Proto->g_machine.x._Move_Speed_Gear=3; + m_pSO7_Proto->g_machine.y._Move_Speed_Gear=3; + m_pSO7_Proto->g_machine.z._Move_Speed_Gear=3; + + ((CButton *)GetDlgItem(IDC_RADIO_SO7_PROGRAM_MOVE))->SetCheck(1); + ((CButton *)GetDlgItem(IIDC_RADIO_SO7_PROGRAM_MOVE_TO))->SetCheck(0); + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_X_MOVETO))->SetWindowTextW(_T("10")); + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_Y_MOVETO))->SetWindowTextW(_T("10")); + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_Z_MOVETO))->SetWindowTextW(_T("10")); + + m_Readout_Font.CreatePointFont(180,_T("Arial")) ; + + ((GetDlgItem(IDC_EDIT_READOUT_X)))->SetFont(&m_Readout_Font); + ((GetDlgItem(IDC_EDIT_READOUT_Y)))->SetFont(&m_Readout_Font); + ((GetDlgItem(IDC_EDIT_READOUT_Z)))->SetFont(&m_Readout_Font); + + m_BTNFont.CreatePointFont(300,_T("Arial")) ; + ((CMFCButton*)(GetDlgItem(IDC_MFCBUTTON_SPEEDGEAR)))->SetFont(&m_BTNFont); + ((CMFCButton*)(GetDlgItem(IDC_MFCBUTTON_SPEEDGEAR)))->SetTextColor(RGB(128,255,255)); + + { + m_RptListCtrl.InsertColumn(0, _T("NO."), LVCFMT_LEFT, 60); + m_RptListCtrl.InsertColumn(1, _T("Time"), LVCFMT_LEFT, 60+120); + m_RptListCtrl.InsertColumn(2, _T("PosX"), LVCFMT_LEFT, 60+120*2); + m_RptListCtrl.InsertColumn(3, _T("PosY"), LVCFMT_LEFT, 60+120*3); + m_RptListCtrl.InsertColumn(4, _T("PosZ"), LVCFMT_LEFT, 60+120*4); + + for (int i = 1; i < 1000; i++) + { + CString str; + str.Format(_T("%d"), i); + m_RptListCtrl.InsertItem(i, str); + m_RptListCtrl.SetItemData(i, i); + } + + m_RptListCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); + } + m_csXPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.x._d_cur_pos_-m_pSO7_Proto->g_machine.x._dSet_Zero_Pos)); + m_csXPos+=GLOBAL_UNIT; + m_csYPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.y._d_cur_pos_-m_pSO7_Proto->g_machine.y._dSet_Zero_Pos)); + m_csYPos+=GLOBAL_UNIT; + m_csZPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.z._d_cur_pos_-m_pSO7_Proto->g_machine.z._dSet_Zero_Pos)); + m_csZPos+=GLOBAL_UNIT; + SetTimer(1,150,NULL); + + if (!m_pSo7_CNC_Program) + { + m_pSo7_CNC_Program=new CSo7_CNC_Program(); + } + UpdateData(FALSE); + return TRUE; // return TRUE unless you set the focus to a control +} +//================================================================================================ +void CSo7_Util_Program::OnBnClickedCancel() +{ + KillTimer(1); + + m_Thread_State = THREAD_EXIT; + SetEvent(m_hTriggerEvent); + if(m_Thread_Id) + { + DWORD dwCode = STILL_ACTIVE; + while(dwCode == STILL_ACTIVE) + { + GetExitCodeThread(m_Thread_Id,&dwCode); + Sleep(1); + } + } + + SetEvent(m_hTriggerEvent); + CloseHandle(m_hTriggerEvent); + m_Thread_State = THREAD_EXIT; + ReleaseMutex(m_Thread_Mutex); + CloseHandle(m_Thread_Mutex); + + if (m_pSo7_CNC_Program) + { + delete m_pSo7_CNC_Program; + m_pSo7_CNC_Program=nullptr; + } + CDialog::OnCancel(); +} +//=================================================== +void CSo7_Util_Program::OnBnClickedMfcbuttonSo7ProgramPlusSpeed() +{ + if (m_pSO7_Proto->g_machine.x._Move_Speed_Gear<4) + { + m_pSO7_Proto->g_machine.x._Move_Speed_Gear++; + m_pSO7_Proto->g_machine.y._Move_Speed_Gear++; + m_pSO7_Proto->g_machine.z._Move_Speed_Gear++; + CString BTNText; + BTNText.Format(_T("%d"),m_pSO7_Proto->g_machine.x._Move_Speed_Gear); + ((CMFCButton*)(GetDlgItem(IDC_MFCBUTTON_SPEEDGEAR)))->SetWindowTextW(BTNText); + + } +} +//=================================================== +void CSo7_Util_Program::OnBnClickedMfcbuttonSo7ProgramMinusSpeed() +{ + if (m_pSO7_Proto->g_machine.x._Move_Speed_Gear>1) + { + m_pSO7_Proto->g_machine.x._Move_Speed_Gear--; + m_pSO7_Proto->g_machine.y._Move_Speed_Gear--; + m_pSO7_Proto->g_machine.z._Move_Speed_Gear--; + CString BTNText; + BTNText.Format(_T("%d"),m_pSO7_Proto->g_machine.x._Move_Speed_Gear); + ((CMFCButton*)(GetDlgItem(IDC_MFCBUTTON_SPEEDGEAR)))->SetWindowTextW(BTNText); + } +} + +//=================================================== +void CSo7_Util_Program::OnBnClickedRadioSo7ProgramMove() +{ + UpdateData(TRUE); + USES_CONVERSION; + CString csSpeedGear; + (GetDlgItem(IDC_MFCBUTTON_SPEEDGEAR))->GetWindowText(csSpeedGear); + const char* cSpeedGear=T2A(csSpeedGear); + m_pSO7_Proto->g_machine.x._Move_Speed_Gear =static_cast(atoi(cSpeedGear)); + m_pSO7_Proto->g_machine.y._Move_Speed_Gear =static_cast(atoi(cSpeedGear)); + m_pSO7_Proto->g_machine.z._Move_Speed_Gear =static_cast(atoi(cSpeedGear)); +} + +//=================================================== +void CSo7_Util_Program::OnBnClickedRadioSo7ProgramMoveTo() +{ + m_pSO7_Proto->g_machine.x._Move_Speed_Gear=0; + m_pSO7_Proto->g_machine.y._Move_Speed_Gear=0; + m_pSO7_Proto->g_machine.z._Move_Speed_Gear=0; +} + +//=================================================== +void CSo7_Util_Program::OnEnKillfocusEditSo7ProgramXMoveto() +{ + UpdateData(TRUE); + USES_CONVERSION; + double dMove_to_x(0.0); + CString csMoveTo; + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_X_MOVETO))->GetWindowText(csMoveTo); + const char* cMoveTo=T2A(csMoveTo); + dMove_to_x = atof(cMoveTo); + + m_pSO7_Proto->g_machine.x._pos_fixed._long_=m_pSO7_Proto->MMtoScale(fabs(dMove_to_x),m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); +} + +//=================================================== +void CSo7_Util_Program::OnEnKillfocusEditSo7ProgramYMoveto() +{ + UpdateData(TRUE); + USES_CONVERSION; + double dMove_to_y(0.0); + CString csMoveTo; + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_Y_MOVETO))->GetWindowText(csMoveTo); + const char* cMoveTo=T2A(csMoveTo); + dMove_to_y = atof(cMoveTo); + + m_pSO7_Proto->g_machine.y._pos_fixed._long_=m_pSO7_Proto->MMtoScale(fabs(dMove_to_y),m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); +} +//=================================================== +void CSo7_Util_Program::OnEnKillfocusEditSo7ProgramZMoveto() +{ + UpdateData(TRUE); + USES_CONVERSION; + double dMove_to_z(0.0); + CString csMoveTo; + (GetDlgItem(IDC_EDIT_SO7_PROGRAM_Z_MOVETO))->GetWindowText(csMoveTo); + const char* cMoveTo=T2A(csMoveTo); + dMove_to_z = atof(cMoveTo); + + m_pSO7_Proto->g_machine.z._pos_fixed._long_=m_pSO7_Proto->MMtoScale(fabs(dMove_to_z),m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); +} + +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonProgramSetZeroX() +{ + if (m_bSetZeroX) + { + m_pSO7_Proto->g_machine.x._dSet_Zero_Pos = 0.0 ; + m_bSetZeroX=FALSE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_X)))->SetWindowTextW(_T("X")); + } + else + { + m_pSO7_Proto->g_machine.x._dSet_Zero_Pos = m_pSO7_Proto->g_machine.x._d_cur_pos_ ; + m_bSetZeroX=TRUE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_X)))->SetWindowTextW(_T("X'")); + } +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonProgramSetZeroY() +{ + if (m_bSetZeroY) + { + m_pSO7_Proto->g_machine.y._dSet_Zero_Pos = 0.0 ; + m_bSetZeroY=FALSE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_Y)))->SetWindowTextW(_T("Y")); + } + else + { + m_pSO7_Proto->g_machine.y._dSet_Zero_Pos = m_pSO7_Proto->g_machine.y._d_cur_pos_ ; + m_bSetZeroY=TRUE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_Y)))->SetWindowTextW(_T("Y'")); + } +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonProgramSetZeroZ() +{ + if (m_bSetZeroZ) + { + m_pSO7_Proto->g_machine.z._dSet_Zero_Pos = 0.0 ; + m_bSetZeroZ=FALSE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_Z)))->SetWindowTextW(_T("Z")); + } + else + { + m_pSO7_Proto->g_machine.z._dSet_Zero_Pos = m_pSO7_Proto->g_machine.z._d_cur_pos_ ; + m_bSetZeroZ=TRUE; + ((CButton*)(GetDlgItem(IDC_BUTTON_PROGRAM_SET_ZERO_Z)))->SetWindowTextW(_T("Z'")); + } +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonSo7ProgramAddCncProgram() +{ + CPoint3 m_pnt; + m_pnt.x= m_pSO7_Proto->g_machine.x._d_cur_pos_; + m_pnt.y=m_pSO7_Proto->g_machine.y._d_cur_pos_; + m_pnt.z=m_pSO7_Proto->g_machine.z._d_cur_pos_; + CSo7_CNC_Point *pCncPnt =new CSo7_CNC_Point(m_pnt); + m_pSo7_CNC_Program->AddCncStep(pCncPnt); + m_OutMessage.Format(_T("[Pro No%d]X:%3.4f,Y:%3.4f,Z:%3.4f"),m_pSo7_CNC_Program->m_Program_Number, m_pnt.x, m_pnt.y, m_pnt.z); + OutputWithScroll(m_OutMessage,m_edMSG); +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonSo7ProgramNewCnc() +{ +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonSo7ProgramOpenCnc() +{ +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonSo7ProgramSaveCncFile() +{ +} +//=================================================== +void CSo7_Util_Program::OnBnClickedButtonSo7ProgramRunCnc() +{ + if (m_IsRuningCNC) + { + m_IsRuningCNC=FALSE; + ((CButton*)(GetDlgItem(IDC_BUTTON_SO7_PROGRAM_RUN_CNC)))->SetWindowTextW(_T("Run")); + } + else + { + Sleep(50); + m_IsRuningCNC=TRUE; + ((CButton*)(GetDlgItem(IDC_BUTTON_SO7_PROGRAM_RUN_CNC)))->SetWindowTextW(_T("Stop")); + m_RuningCNCIndex=0; + m_Thread_State=THREAD_RUNNING_STATE; + SetEvent(m_hTriggerEvent); + } +} +//=================================================== +BOOL CSo7_Util_Program::RunCNC() +{ + WaitForSingleObject(m_Thread_Mutex, INFINITE); + + while (m_IsRuningCNC &&(m_RuningCNCIndexm_Program_Number)) + { + CPoint3 m_pnt; + m_pSo7_CNC_Program->m_CNC_element.at(m_RuningCNCIndex)->GetPoint(0,0,0,NULL,m_pnt); + m_pSO7_Proto->so7_motion_set_position_xyz(m_pnt.x,m_pnt.y,m_pnt.z,true); + m_RuningCNCIndex++; + } + m_IsRuningCNC=FALSE; + ((CButton*)(GetDlgItem(IDC_BUTTON_SO7_PROGRAM_RUN_CNC)))->SetWindowTextW(_T("Run")); + SetTimer(1,150,NULL); + ReleaseMutex(m_Thread_Mutex); + + return TRUE; + +} +//================================================================================================ +void CSo7_Util_Program::OnTimer(UINT_PTR nIDEvent) +{ + switch(nIDEvent) + { + case 1: + { + if (m_pSO7_Proto) + { + if (m_pSO7_Proto->g_machine.s_status._machine_running) + { + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_AXIS_XYZ(); + + m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); + m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); + m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); + + m_csXPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.x._d_cur_pos_-m_pSO7_Proto->g_machine.x._dSet_Zero_Pos)); + m_csXPos+=GLOBAL_UNIT; + m_csYPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.y._d_cur_pos_-m_pSO7_Proto->g_machine.y._dSet_Zero_Pos)); + m_csYPos+=GLOBAL_UNIT; + m_csZPos.Format(_T("%8.4lf"), (m_pSO7_Proto->g_machine.z._d_cur_pos_-m_pSO7_Proto->g_machine.z._dSet_Zero_Pos)); + m_csZPos+=GLOBAL_UNIT; + + UpdateData(FALSE); + } + } + break; + } + case 2: + { + break; + } + } + CDialog::OnTimer(nIDEvent); +} + +//============================================== +unsigned __stdcall CSo7_Util_Program::m_Thread(LPVOID pThis) +{ + CSo7_Util_Program* _This = (CSo7_Util_Program*)pThis; + for(;;) + { + if(m_Thread_State == THREAD_EXIT) + ExitThread(0); + WaitForSingleObject(m_hTriggerEvent,INFINITE); + + switch(m_Thread_State) + { + case THREAD_RUNNING_STATE: + { + _This->RunCNC(); + break; + } + case THREAD_PAUSED: + { + break; + } + case THREAD_EXIT: + { + ExitThread(0); + break; + } + } + }; + m_Thread_State=THREAD_EXIT; + ExitThread(0); + +} +//================================================================================================ +HBRUSH CSo7_Util_Program::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) +{ + HBRUSH hbr=CDialog::OnCtlColor(pDC,pWnd,nCtlColor); + + HBRUSH rHbrush = hbr; + + switch (pWnd->GetDlgCtrlID()) + { + case IDC_EDIT_READOUT_X: + case IDC_EDIT_READOUT_Y: + case IDC_EDIT_READOUT_Z: + { + pDC->SetTextColor(RGB(0,255,0)); + pDC->SetBkMode(TRANSPARENT); + pDC->SetBkColor(RGB(0,0,0)); + rHbrush = (HBRUSH)::GetStockObject(BLACK_BRUSH); + break; + } + default: + { + rHbrush = hbr; + break; + } + } + return rHbrush; +} +//===================================================================================== +//Print message on edit control +void CSo7_Util_Program::OutputWithScroll(const CString &strNewText,CEdit &edtOutput) +{ + CString strOutput; + edtOutput.GetWindowText(strOutput); + strOutput += strNewText; + if ("\r\n" != strOutput.Right(2)) + { + strOutput += "\r\n"; + } + + int iCount = strOutput.GetLength(); + + edtOutput.SetRedraw(FALSE); + edtOutput.SetWindowText(strOutput); + int iLine = edtOutput.GetLineCount(); + edtOutput.LineScroll(iLine, 0); + edtOutput.SetSel(iCount, iCount); + edtOutput.SetRedraw(TRUE); +} + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.h new file mode 100644 index 0000000..fe5f4fb --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Util_Program.h @@ -0,0 +1,76 @@ +#pragma once + +enum STATIC_BKCOLOR +{ + NULL_COLOR, + RED_COLOR, + GREEN_COLOR, + BLACK_COLOR +}; +// CSo7_Util_Program dialog + +class CSo7_Util_Program : public CDialog +{ + friend class CMyListCtrl; + DECLARE_DYNAMIC(CSo7_Util_Program) + +public: + CSo7_Util_Program(CWnd* pParent = NULL); // standard constructor + virtual ~CSo7_Util_Program(); + +// Dialog Data + enum { IDD = IDD_SO7_UTIL_PROGRAM }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnInitDialog(); + afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); + afx_msg void OnTimer(UINT_PTR nIDEvent); + DECLARE_MESSAGE_MAP() +protected: + CMyMFCButton m_Button_MoveX_Left; + CMyMFCButton m_Button_MoveX_Right; + CMyMFCButton m_Button_MoveY_Front; + CMyMFCButton m_Button_MoveY_Back; + CMyMFCButton m_Button_MoveZ_Up; + CMyMFCButton m_Button_MoveZ_Down; + CEdit m_edMSG; + CMyListCtrl m_RptListCtrl; + CString m_OutMessage; + CString m_csXPos; + CString m_csYPos; + CString m_csZPos; + CFont m_BTNFont; + CFont m_Readout_Font; + BOOL m_bSetZeroX; + BOOL m_bSetZeroY; + BOOL m_bSetZeroZ; + BOOL m_IsRuningCNC; + int m_RuningCNCIndex; + void OutputWithScroll(const CString &strNewText,CEdit &edtOutput); + BOOL RunCNC(void); +protected: + static unsigned __stdcall m_Thread(LPVOID pThis) ; + static HANDLE m_Thread_Id; + static HANDLE m_Thread_Mutex; + static HANDLE m_hTriggerEvent; + static int m_Thread_State; + static BOOL m_bThread_Status; +public: + afx_msg void OnBnClickedCancel(); + afx_msg void OnBnClickedMfcbuttonSo7ProgramPlusSpeed(); + afx_msg void OnBnClickedMfcbuttonSo7ProgramMinusSpeed(); + afx_msg void OnBnClickedButtonProgramSetZeroX(); + afx_msg void OnBnClickedButtonProgramSetZeroY(); + afx_msg void OnBnClickedButtonProgramSetZeroZ(); + afx_msg void OnBnClickedButtonSo7ProgramAddCncProgram(); + afx_msg void OnBnClickedButtonSo7ProgramNewCnc(); + afx_msg void OnBnClickedButtonSo7ProgramOpenCnc(); + afx_msg void OnBnClickedButtonSo7ProgramSaveCncFile(); + afx_msg void OnBnClickedButtonSo7ProgramRunCnc(); + afx_msg void OnEnKillfocusEditSo7ProgramXMoveto(); + afx_msg void OnEnKillfocusEditSo7ProgramZMoveto(); + afx_msg void OnEnKillfocusEditSo7ProgramYMoveto(); + afx_msg void OnBnClickedRadioSo7ProgramMove(); + afx_msg void OnBnClickedRadioSo7ProgramMoveTo(); +}; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj index 45fabb9..8f0bdd5 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj @@ -310,6 +310,10 @@ + + + + @@ -331,6 +335,8 @@ + + @@ -340,6 +346,7 @@ + @@ -371,6 +378,11 @@ + + + + + @@ -392,6 +404,8 @@ + + @@ -402,6 +416,7 @@ + @@ -415,6 +430,14 @@ + + + + + + + + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj.filters b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj.filters index 394f5b4..9c69579 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj.filters +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Usb_Util.vcxproj.filters @@ -139,6 +139,27 @@ Sources Files + + Sources Files + + + Sources Files + + + Sources Files + + + Sources Files + + + Sources Files + + + Sources Files + + + Sources Files + @@ -309,30 +330,78 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + - - Resource Files - Resource Files - - Resource Files + + Resource Files\ICO - Resource Files + Resource Files\ICO + + + Resource Files\ICO - Resource Files - - - Resource Files + Resource Files\ICO - Resource Files + Resource Files\ICO + + + Resource Files\ICO + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP + + + Resource Files\BMP @@ -345,6 +414,12 @@ {7ce29a12-8b0d-4df6-966f-c952d8c6a5da} + + {461ccbe2-c0cc-47f4-90a5-897ca975da71} + + + {f1889d31-a64f-4163-af5f-c4408931dd8b} + diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_LEFT.BMP b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_LEFT.BMP new file mode 100644 index 0000000..17da0e4 Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_LEFT.BMP differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_RIGHT.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_RIGHT.bmp new file mode 100644 index 0000000..180e529 Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/X_RIGHT.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Backward.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Backward.bmp new file mode 100644 index 0000000..7d84e6b Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Backward.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Frontward.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Frontward.bmp new file mode 100644 index 0000000..940f644 Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Y_Frontward.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_DOWN.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_DOWN.bmp new file mode 100644 index 0000000..c35094c Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_DOWN.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_UP.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_UP.bmp new file mode 100644 index 0000000..83b4a72 Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/Z_UP.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/minus.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/minus.bmp new file mode 100644 index 0000000..2913bce Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/minus.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/plus.bmp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/plus.bmp new file mode 100644 index 0000000..bf96f70 Binary files /dev/null and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/res/bmp/plus.bmp differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h index 52f7fb9..f97e896 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h @@ -46,6 +46,15 @@ #define IDD_SO7_UTIL_MANUAL_MACHINE 167 #define IDD_SO7_UTIL_VERIFICATION_ALGORITHM 168 #define IDD_SO7_VIDEOCARD_SV4000E 169 +#define IDD_SO7_UTIL_PROGRAM 170 +#define IDB_BITMAP_MINUS_SPEED 176 +#define IDB_BITMAP_PLUS_SPEED 177 +#define IDB_BITMAP_Y_BACKWARD 180 +#define IDB_BITMAP_Y_FRONTWARD 181 +#define IDB_BITMAP_Z_DOWN 182 +#define IDB_BITMAP_Z_UP 183 +#define IDB_BITMAP_X_LEFT 184 +#define IDB_BITMAP_X_RIGHT 187 #define IDC_BUTTON_INIT_MVUSB 1001 #define IDC_BUTTON_START_MACHINE 1002 #define IDC_BUTTON_START_POLL_58 1004 @@ -347,6 +356,7 @@ #define IDC_EDIT_FRESHSPEED_X1 1274 #define IDC_EDIT_SO7CONFIG_ZOOM_FASTSPEED 1274 #define IDC_EDIT_IMAGEDLL_2LASER_TOPZ1 1274 +#define IDC_EDIT_SO7_PROGRAM_Z_MOVETO 1274 #define IDC_EDIT_FRESHSPEED_X2 1275 #define IDC_EDIT_IMAGEDLL_2LASER_TOPZ2 1275 #define IDC_EDIT_MANUAL_MACHINE_MSG 1275 @@ -631,6 +641,7 @@ #define IDC_BUTTON_SCAN_KEYENCE_LK_GLASER 1518 #define IDC_BUTTON_IMAGEDLL_START_SCAN_LASER 1518 #define IDC_BUTTON_SO7_MANUAL_MACHINE_START_MACHINE 1518 +#define IDC_BUTTON_PROGRAM_SET_ZERO_X 1518 #define IDC_STATIC_CANVAS 1519 #define IDC_BUTTON_SCAN_KEYENCE_LK_HLASER 1519 #define IDC_BUTTON_STATUS_OVERHEAT_X 1520 @@ -647,6 +658,7 @@ #define IDC_BUTTON_IMAGEDLL_GET_SCAN_LASER_DATA 1524 #define IDC_BUTTON_SO7_MANUAL_MACHINE_STOP_MACHINE 1524 #define IDC_BUTTON_SO7_TEST_Z_SIGNAL 1524 +#define IDC_BUTTON_PROGRAM_SET_ZERO_Y 1524 #define IDC_CUSTOM1 1525 #define IDC_CUSTOM_CANVAS 1525 #define IDC_BUTTON_STOP_SCAN_KEYENCE_LK_HLASER 1525 @@ -687,6 +699,8 @@ #define IDC_BUTTON_IMAGEDLL_PAUSE_AND_GET_SCAN_LASER_DATA 1562 #define IDC_BUTTON_TEST_KEYENCE_SAVE_LOG 1562 #define IDC_BUTTON_SO7_MANUAL_MACHINE_SEND_DATA 1562 +#define IDC_BUTTON_SO7_CNC_PROGRAM 1562 +#define IDC_BUTTON_PROGRAM_SET_ZERO_Z 1562 #define IDC_BUTTON_IMAGEDLL_STOP_SCAN_LASER 1563 #define IDC_STATIC_TC4000_PICTURE 1564 #define IDC_RADIO_SO7_IP_CAMERA 1565 @@ -745,7 +759,9 @@ #define IDC_BUTTON_TEST_KEYENCE_CLEAR_LOG 1606 #define IDC_BUTTON_KEYENCE_LASER_CALIBRATE_VALUE 1607 #define IDC_EDIT_KEYENCE_LASER_CALIBRATE_VALUE 1608 +#define IDC_EDIT_KEYENCE_LASER_CALIBRATE_VALUE0 1609 #define IDC_EDIT_IMAGEDLL_2LASER_MEASURED_VALUE9 1610 +#define IDC_BUTTON_KEYENCE_LASER_CALIBRATE_VALUE0 1610 #define IDC_EDIT_TEST_KEYENCE_SETFOCUS 1650 #define IDC_RADIO_SO7_VERIFICATION_ALGORITHM 1651 #define IDC_BUTTON_SO7_MANUAL_MACHINEREAD_POS 1652 @@ -769,14 +785,42 @@ #define IDC_SV4000E_CHECK_MIRROR_VERTICALLY 1675 #define IDC_BUTTON_SV4000E_SAVEFILE 1676 #define IDC_STATIC_SV4000E_PICTURE 1677 +#define IDC_CHECK_SO7_MOTION_OUTPUT_TIME 1678 +#define IDC_MFCBUTTON_SO7_PROGRAM_X_LEFT 1682 +#define IDC_MFCBUTTON_SO7_PROGRAM_X_RIGHT 1683 +#define IDC_MFCBUTTON_SO7_PROGRAM_Y_FRONTWARD 1684 +#define IDC_MFCBUTTON_SO7_PROGRAM_Y_BACKWARD 1685 +#define IDC_MFCBUTTON_SO7_PROGRAM_Z_UP 1686 +#define IDC_MFCBUTTON_SO7_PROGRAM_Z_DOWN 1687 +#define IDC_MFCBUTTON_SPEEDGEAR 1688 +#define IDC_MFCBUTTON_SO7_PROGRAM_PLUS_SPEED 1691 +#define IDC_MFCBUTTON_SO7_PROGRAM_MINUS_SPEED 1692 +#define IDC_LIST_REPORT_OUTPUT 1693 +#define IDC_RADIO1 1697 +#define IDC_RADIO_SO7_PROGRAM_MOVE 1697 +#define IDC_RADIO2 1698 +#define IIDC_RADIO_SO7_PROGRAM_MOVE_TO 1698 +#define IDC_EDIT_SO7_PROGRAM_Y_MOVETO 1699 +#define IDC_EDIT_SO7_PROGRAM_X_MOVETO 1700 +#define IDC_BUTTON_SO7_PROGRAM_ADD_CNC_PROGRAM 1701 +#define IDC_BUTTON_SO7_PROGRAM_RUN_CNC 1703 +#define IDC_EDIT_SO7_PROGRAM_MSG_OUTPUT 1704 +#define IDC_EDIT_READOUT_X 1705 +#define IDC_RICHEDIT21 1706 +#define IDC_RICHEDIT2__READOUT_X 1706 +#define IDC_EDIT_READOUT_Z 1706 +#define IDC_EDIT_READOUT_Y 1707 +#define IDC_BUTTON_SO7_PROGRAM_NEW_CNC 1710 +#define IDC_BUTTON_SO7_PROGRAM_SAVE_CNC_FILE 1711 +#define IDC_BUTTON_SO7_PROGRAM_OPEN_CNC 1712 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 169 +#define _APS_NEXT_RESOURCE_VALUE 188 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1678 +#define _APS_NEXT_CONTROL_VALUE 1713 #define _APS_NEXT_SYMED_VALUE 104 #endif #endif diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo index 8e46315..715681e 100644 Binary files a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/Sa7134Capture.lib b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/Sa7134Capture.lib index bfd0d6c..4c62663 100644 Binary files a/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/Sa7134Capture.lib and b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/Sa7134Capture.lib differ diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V6.0/Sa7134Capture.h b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V6.0/Sa7134Capture.h new file mode 100644 index 0000000..44670ff --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V6.0/Sa7134Capture.h @@ -0,0 +1,273 @@ +#ifndef VC404_CAPTURE_SAA7134 +#define VC404_CAPTURE_SAA7134 + +#ifdef SAA7134CAPTURE_EXPORTS +#define SAA7134CAPTURE_API __declspec(dllexport) +#else +#define SAA7134CAPTURE_API __declspec(dllimport) +#endif + +#include"..\VideocardCommonDefine.h" + + +/////////////////////////////////////////////////////////// +//注意:VC枚举类型为32位,4字节;这里的枚举类型为4字节。 +// C++ builder枚举类型为8位,1字节,要重定义,例如: +//typedef int COLORCONTROL; +//COLORCONTROL BRIGHTNESS = 0; +//COLORCONTROL CONTRAST = 1; +//COLORCONTROL SATURATION = 2; +//COLORCONTROL HUE = 3; +//COLORCONTROL SHARPNESS = 4; + +//描述:在VC中enum、ULONG、LONG、BOOL、DWORD 都为32位,4字节, +//这里使用的是VC定义标准。 +///////////////////////////////////////////////////////////// + + +typedef enum { //@enum Decoder control types + XVID_CBR_MODE = 0, + XVID_VBR_MODE = 1//, +}COMPRESSMODE; + +typedef enum{ + COLOR_DECODER = 0, //解码器(包括视频预览和视频捕获) + COLOR_PREVIEW = 1, //视频预览 + COLOR_CAPTURE = 2 //视频捕获 +}COLORDEVICETYPE; + + +typedef enum{ + VID_CAPTURE_EVENT = 0, + AUD_CAPTURE_EVENT1 = 1, + AUD_CAPTURE_EVENT2 = 2, + IO_ALERT_EVENT = 3, + MOTION_DETECT = 4, + VID_PREVIEW_EVENT = 5 +}EVENTTYPE; + + +typedef enum +{ + RGB32 = 0x0, + RGB24 = 0x1, + RGB16 = 0x2, + RGB15 = 0x3, + YUY2 = 0x4, + BTYUV = 0x5, + Y8 = 0x6, + RGB8 = 0x7, + PL422 = 0x8, + PL411 = 0x9, + YUV12 = 0xA, + YUV9 = 0xB, + RAW = 0xE +}COLORFORMAT; + +typedef enum +{ + CAP_NULL_STREAM = 0, //捕获无效 + CAP_ORIGIN_STREAM = 1, /*原始流回调*/ + CAP_MPEG4_STREAM = 2, /*Mpeg4流*/ + CAP_MPEG4_XVID_STREAM = 3, + CAP_ORIGIN_MPEG4_STREAM = 4, + CAP_ORIGIN_XVID_STREAM = 5, + CAP_WMV9_STREAM = 6, + CAP_ORIGIN_WMV9_STREAM = 7 + +}CAPMODEL; + + +typedef enum +{ + MPEG4_AVIFILE_ONLY = 0, //存为MPEG文件 + MPEG4_CALLBACK_ONLY = 1, //MPEG数据回调 + MPEG4_AVIFILE_CALLBACK = 2 //存为MPEG文件并回调 +}MP4MODEL; + + + +typedef enum { //电平等级 + HIGH_VOLTAGE = 0, //高电平 + LOW_VOLTAGE = 1 //低电平 +}eVOLTAGELEVEL; + +typedef enum { + NOT_DISPLAY = 0, + PCI_VIEDOMEMORY = 1, + PCI_MEMORY_VIDEOMEMORY = 2 +}DISPLAYTRANSTYPE; + + + +//error define area + +#define ERR_SUCCESS 0 //no error,success +#define ERR_NODEVICEFOUND 1 //no device found in system +#define ERR_UNSUPPORTFUNC 2 //unsupport func tempro? +#define ERR_ALLOCRESOURCE 3 //alloc resource error +#define ERR_INITDIRECTDRAW 4 //Init Directdraw error +#define ERR_INITDIRECTSOUND 5 //Init Directdraw error +#define ERR_NOT_10MOONSDEV 6 //it is not device of 10Moons + +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC4000/VC8000/VC404P公有函数 +///////////////////////////////////////////////////////////////////////////////////////////////// + +//动态检测回调, +//如果VCAEnableMotionDetect 参数nPersistTime = -1;则回调运动检测地图。取消(开始、停止)回调。bMove将无效。 +//如果VCAEnableMotionDetect 参数nPersistTime != -1;则回调开始、停止运动检测;取消回调运动检测地图。pbuff、dwSize将无效。 +typedef void (CALLBACK *PrcCbMotionDetect_TC4000)( DWORD dwCard, BOOL bMove, BYTE *pbuff, DWORD dwSize, LPVOID lpContext ); +//视频捕获原始数据回调 +typedef void (CALLBACK *PrcVidCapCallBack)( DWORD dwCard, BYTE *pbuff, DWORD dwSize ); +//视频MPEG压缩数据回调 +typedef void (CALLBACK *PrcVidMpegCallBack)( DWORD dwCard, BYTE *pbuff, DWORD dwSize, BOOL isKeyFrm ); +//音频捕获原始数据回调 +//音频包原始大小16 Bit PCM格式,8080 BYTE,2声道,32000Hz +typedef void (CALLBACK *PrcAudCapCallBack)( DWORD dwCard, BYTE *pbuff,DWORD dwSize ); +//音频MPEG压缩数据回调 +typedef void (CALLBACK *PrcAudMpegCallBack)( DWORD dwCard, BYTE *pbuff,DWORD dwSize ); +//IO报警回调 +typedef void (CALLBACK *PrcIoAlertCallBack)( DWORD dwCard ); +//视频Mpeg处理回调 ,pPorcess 返回为TRUE 表示当前帧压缩;返回为FALSE 表示丢掉当前帧 +typedef void (CALLBACK *PrcVidMpegPorCallBack)( DWORD dwCard, BOOL* pPorcess ); +//音频Mpeg处理回调,pPorcess 返回为TRUE 表示当音频包压缩;返回为FALSE 表示丢掉当前音频包。 +typedef void (CALLBACK *PrcAudMpegPorCallBack)( DWORD dwCard, BOOL* pPorcess ); +//注册视频捕获原始数据回调 +BOOL WINAPI VCARegVidCapCallBack( DWORD dwCard, PrcVidCapCallBack ppCall ); +//注册视频MPEG压缩数据回调 +BOOL WINAPI VCARegVidMpegCallBack( DWORD dwCard, PrcVidMpegCallBack ppCall ); +//设置错误序号 +void WINAPI VCASetLastError( DWORD dwError ); +//得到错误序号 +DWORD WINAPI VCAGetLastError(); +//初始化SDK,hWndMain:overlay窗口句柄,overlay窗口就是包含多路显示小窗口的大窗口。overlay窗口必须有一个,多路显示小窗口必须包含再其内部。 +//bInitVidDev:是否初始化视频设备用于预览,当视频不显示,只需视频录像或音频处理时可以设置为FALSE. +//bInitAudDev:是否初始化音频设备用于声音播放,当不音频不需要播放,只需音频录像或视频处理时、或没有安装声卡,可以设置为FALSE. +BOOL WINAPI VCAInitSdk( HWND hWndMain, DISPLAYTRANSTYPE eDispTransType = PCI_VIEDOMEMORY, BOOL bInitAudDev = FALSE ); +//释放SDK资源 +void WINAPI VCAUnInitSdk(); +//得到设备总数 +LONG WINAPI VCAGetDevNum(); +//打开设备,hPreviewWnd为视频预览窗口的句柄,该窗口背景色用户必需设置为RGB(255,0,255) +BOOL WINAPI VCAOpenDevice( DWORD dwCard,HWND hPreviewWnd ); +//关闭设备 +BOOL WINAPI VCACloseDevice( DWORD dwCard ); +//开始视频预览 +BOOL WINAPI VCAStartVideoPreview( DWORD dwCard ); +//停止视频预览 +BOOL WINAPI VCAStopVideoPreview( DWORD dwCard ); +//更新视频预览,比如改变了显示窗口时,调用。 +BOOL WINAPI VCAUpdateVideoPreview( DWORD dwCard, HWND hPreviewWnd ); +//更新overlay窗口,当overlay窗口句柄改变或尺寸,位置改变时调用,overlay窗口就是包含多路显示小窗口的大窗口。overlay窗口必须有一个,多路显示小窗口必须包含再其内部。 +BOOL WINAPI VCAUpdateOverlayWnd(HWND hOverlayWnd); + +//保存快照数据到相应的缓冲区 +BOOL WINAPI VCASaveBitsToBuf( DWORD dwCard, PVOID pDestBuf, DWORD& dwWidth, DWORD& dwHeight ); +//保存快照为JPEG文件 +BOOL WINAPI VCASaveAsJpegFile( DWORD dwCard, LPCTSTR lpFileName, DWORD dwQuality = 100 ); +//保存快照为BMP文件 +BOOL WINAPI VCASaveAsBmpFile( DWORD dwCard, LPCTSTR lpFileName ); +//开始视频捕获 +BOOL WINAPI VCAStartVideoCapture(unsigned long ,CAPMODEL,MP4MODEL,char const *); + //( DWORD dwCard,CAPMODEL enCapMode,MP4MODEL enMp4Mode,LPCTSTR lpFileName ); +//停止视频捕获 +BOOL WINAPI VCAStopVideoCapture( DWORD dwCard ); +//设置视频捕获尺寸, dwWidth和dwHeight最好为16的倍数,否则,动态检测为16*16一个检测小块,检测将会不准确。 +BOOL WINAPI VCASetVidCapSize( DWORD dwCard, DWORD dwWidth, DWORD dwHeight ); +//得到视频捕获尺寸 +BOOL WINAPI VCAGetVidCapSize( DWORD dwCard, DWORD &dwWidth, DWORD &dwHeight ); + +/*设置视频捕获帧率,bFrameRateReduction参数为保留参数。 + PAL显示帧率显示帧率始终为25,NTSC显示帧率始终为30 + PAL捕获帧率最大为25,NTSC捕获帧率最大为30 +*/ +BOOL WINAPI VCASetVidCapFrameRate( DWORD dwCard, DWORD dwFrameRate, BOOL bFrameRateReduction = FALSE ); + +//设置MPEG压缩的位率,范围:56bps ~ 10Mbps; 单位Kbps +BOOL WINAPI VCASetBitRate( DWORD dwCard, DWORD dwBitRate); +//设置MPEG压缩的关键帧间隔,必须大于等于帧率 +BOOL WINAPI VCASetKeyFrmInterval( DWORD dwCard, DWORD dwKeyFrmInterval); +//设置MPEG4_XVID压缩的质量 dwQuantizer: 1 ~ 31 (1为最小量度,压缩质量最好); dwMotionPrecision: 0 ~ 6 (0最小运动精度) +BOOL WINAPI VCASetXVIDQuality( DWORD dwCard, DWORD dwQuantizer, DWORD dwMotionPrecision); +//设置MPEG4_XVID压缩模式 +BOOL WINAPI VCASetXVIDCompressMode( DWORD dwCard, COMPRESSMODE enCompessMode ); + +//设置动态检测,视频捕获停止时调用有效,VCASetVidCapSize 的设置参数 dwWidth和dwHeight最好为16的倍数,否则,动态检测因16*16一个检测小块,检测将会不准确。 +BOOL WINAPI VCAEnableMotionDetect( DWORD dwCard, + BOOL bEnaDetect, //是否允许动态检测 + BYTE *pAreaMap, //运动检测地图 + LONG nSizeOfMap, //pAreaMap尺寸,以BYTE为单位 + LONG nPersistTime, //物体持续nPersistTime秒不动则认为停止 1-30s ,如果nPersistTime = -1;则回调运动检测地图。取消(开始、停止)回调。 + INT nFrameRateReduce, // zdp add 降低采样比较倍数 + LPVOID lpContext, //监测上下文 + PrcCbMotionDetect_TC4000 OnObjectMove ); //运动/停止回调函数 + +//设置视频色彩 +BOOL WINAPI VCASetVidDeviceColor( DWORD dwCard, COLORCONTROL enCtlType, DWORD dwValue ); + +//得到视频源输入频率( 0HZ / 50HZ / 60HZ )对应( 无信号 / PAL制 / NTSC制 ), 参考枚举变量eFieldFrequency +BOOL WINAPI VCAGetVidFieldFrq( DWORD dwCard, eFieldFrequency &eVidSourceFieldRate ); +//设置视频源输入频率( 0HZ / 50HZ / 60HZ )对应( 无信号 / PAL制 / NTSC制 ), 参考枚举变量eFieldFrequency +BOOL WINAPI VCASetVidFieldFrq( DWORD dwCard, eFieldFrequency eVidSourceFieldRate ); + +//暂停捕获,暂停视频捕获和音频捕获,可用于快速改变音视频捕获类型和文件切换,设置视频捕获字幕叠加 +BOOL WINAPI VCAPauseCapture( DWORD dwCard ); +//设置视频捕获文本叠加 +BOOL WINAPI VCASetVidCapTextOSD( DWORD dwCard, BOOL bEnableOSD, TCHAR* tcText, POINT& ptTopLeft, OSDPARAM* pOSDParm ); +//设置视频捕获时间、日期叠加,在VCASetVidCapDateTimeOSDPARAM()函数设置后调用有效 +BOOL WINAPI VCASetVidCapDateTimeOSD( DWORD dwCard, BOOL bEnableOSD, POINT& ptTopLeft); +//设置视频捕获字幕叠加 +BOOL WINAPI VCASetVidCapDateTimeOSDParam( OSDPARAM* pOSDParm ); +//允许视频Mpeg处理回调 +BOOL WINAPI VCAEnableVidMpegProcess( DWORD dwCard, BOOL bEnPorcess, PrcVidMpegPorCallBack ppCall ); +//得到设备芯片ID +BOOL WINAPI VCAGetDeviceID( DWORD dwCard, DWORD& dwDeviceID ); +//初始化视频设备,当视频不显示,只需视频录像或音频处理时、或通过VCAInitSdk()函数已经初始化完成可以不初始化。 +BOOL WINAPI VCAInitVidDev( DISPLAYTRANSTYPE eDispTransType = PCI_VIEDOMEMORY); +//读E2C +BOOL WINAPI VCAIsE2C( DWORD dwCard, BOOL& bIsE2C ); +//读E2C +BOOL WINAPI VCAGetE2C( DWORD dwCard, int iSubAddr, BYTE& ucData ); +//写E2C +BOOL WINAPI VCASetE2C( DWORD dwCard, int iSubAddr, BYTE ucData ); +//检验客户信息 pKey:长度为16 字节,用户加密Key值;bSuccess:表示验证是否通过 。 +BOOL WINAPI VCACheckValidate( BYTE* pKey, BOOL& bSuccess ); + +BOOL WINAPI VCAGetFileLength(DWORD dwCard, DWORD & FileLength); + +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC404P音频处理函数 +///////////////////////////////////////////////////////////////////////////////////////////////// +//初始化音频设备,是否初始化音频设备用于声音播放,当不音频不需要播放,只需音频录像或视频处理时、或没有安装声卡或通过VCAInitSdk()函数已经初始化完成可以不初始化。 +//dwAudFreq:音频播放频率,默认为32K,但有些主板因为某些原因,上传的音频频率可能高于或低于32K,所以根据实际情况,传入这个参数。 +BOOL WINAPI VCAInitAudDev( DWORD dwAudFreq = 32000 ); +//注册音频捕获原始数据回调 +BOOL WINAPI VCARegAudCapCallBack( DWORD dwCard, PrcAudCapCallBack ppCall ); +//注册音频MPEG压缩数据回调 +BOOL WINAPI VCARegAudMpegCallBack( DWORD dwCard, PrcAudMpegCallBack ppCall ); +//开始音频捕获,如果音频捕获方式为MPEG4,视频捕获MPEG4方式开始时,调用有效 +BOOL WINAPI VCAStartAudioCapture( DWORD dwCard, + CAPMODEL enCapMode, + MP4MODEL enMp4Mode ); + +//允许音频从声卡输出,当dwCard >= 100 时,为静音;开始音频捕获时有效 +BOOL WINAPI VCASetAudioCardOutOn( DWORD dwCard ); +//停止音频捕获,如果音频捕获方式为MPEG4,视频捕获MPEG4方式开始时,调用有效 +BOOL WINAPI VCAStopAudioCapture( DWORD dwCard ); +//允许音频Mpeg处理回调 +BOOL WINAPI VCAEnableAudMpegProcess( DWORD dwCard, BOOL bEnPorcess, PrcAudMpegPorCallBack ppCall ); +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC404P IO处理函数 +///////////////////////////////////////////////////////////////////////////////////////////////// +//注册IO报警回调 +BOOL WINAPI VCARegIoAlertCallBack( DWORD dwCard, PrcIoAlertCallBack ppCall ); +//设置IO输入报警当前电平 +BOOL WINAPI VCASetIOAlertLevelIn( DWORD dwCard, eVOLTAGELEVEL enCurrentLevel ); +//开始IO输入报警,enSpringLevel为触发电平 +BOOL WINAPI VCAStartIOAlertIn( DWORD dwCard, eVOLTAGELEVEL enSpringLevel ); +//停止IO输入报警 +BOOL WINAPI VCAStopIOAlertIn( DWORD dwCard ); +//IO输出报警 +BOOL WINAPI VCAIOAlertOut( DWORD dwCard, eVOLTAGELEVEL enLevel ); +#endif diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V7.5/Sa7134Capture.h b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V7.5/Sa7134Capture.h new file mode 100644 index 0000000..fd83c75 --- /dev/null +++ b/PcDmis/Base/Interfac/Msi/Hsi/Videocard/TC4000/V7.5/Sa7134Capture.h @@ -0,0 +1,409 @@ +#ifndef VC404_CAPTURE_SAA7134 +#define VC404_CAPTURE_SAA7134 + +#ifdef SAA7134CAPTURE_EXPORTS +#define SAA7134CAPTURE_API __declspec(dllexport) +#else +#define SAA7134CAPTURE_API __declspec(dllimport) +#endif + +static const ULONG BrightnessDefault = 0x80; +static const ULONG ContrastDefault = 0x46;//0x44; +static const ULONG SaturationDefault = 0x44;//0x3C; +static const ULONG HueDefault = 0x00; +static const ULONG SharpnessDefault = 0x01; + +#define MIN_VAMP_BRIGHTNESS_UNITS 0 +#define MAX_VAMP_BRIGHTNESS_UNITS 255 + +#define MIN_VAMP_CONTRAST_UNITS -128 +#define MAX_VAMP_CONTRAST_UNITS 127 + +#define MIN_VAMP_HUE_UNITS -128 +#define MAX_VAMP_HUE_UNITS 127 + +#define MIN_VAMP_SATURATION_UNITS -128 +#define MAX_VAMP_SATURATION_UNITS 127 + +#define MIN_VAMP_SHARPNESS_UNITS -8 +#define MAX_VAMP_SHARPNESS_UNITS 7 + +/////////////////////////////////////////////////////////// +//注意:VC枚举类型为32位,4字节;这里的枚举类型为4字节。 +// C++ builder枚举类型为8位,1字节,要重定义,例如: +//typedef int COLORCONTROL; +//COLORCONTROL BRIGHTNESS = 0; +//COLORCONTROL CONTRAST = 1; +//COLORCONTROL SATURATION = 2; +//COLORCONTROL HUE = 3; +//COLORCONTROL SHARPNESS = 4; + +//描述:在VC中enum、ULONG、LONG、BOOL、DWORD 都为32位,4字节, +//这里使用的是VC定义标准。 +///////////////////////////////////////////////////////////// + +typedef enum { //@enum Decoder control types + BRIGHTNESS = 0, //@emem control for brightness + CONTRAST = 1, //@emem control for contrast + SATURATION = 2, //@emem control for saturation + HUE = 3, //@emem control for hue + SHARPNESS = 4 //@emem control for sharpness +}COLORCONTROL; + +typedef enum { //@enum Decoder control types + XVID_CBR_MODE = 0, + XVID_VBR_MODE = 1//, +}COMPRESSMODE; + +typedef enum{ + COLOR_DECODER = 0, //解码器(包括视频预览和视频捕获) + COLOR_PREVIEW = 1, //视频预览 + COLOR_CAPTURE = 2 //视频捕获 +}COLORDEVICETYPE; + + +typedef enum{ + VID_CAPTURE_EVENT = 0, + AUD_CAPTURE_EVENT1 = 1, + AUD_CAPTURE_EVENT2 = 2, + IO_ALERT_EVENT = 3, + MOTION_DETECT = 4, + VID_PREVIEW_EVENT = 5 +}EVENTTYPE; + +typedef enum enColorFormat +{ + UYVY = 0, //@emem BO_1234 - YUV422 + YUY2 = 1, //@emem BO_2143 - YUV422 + Y41P = 2, //@emem BO_1234 - YUV411 + Y8 = 3, //@emem BO_1234 - Y8 + YV12 = 4, //@emem BO_1234 - YUV420 planar + YU12 = 5, //@emem BO_1234 - YVU420 planar + YVU9 = 6, //@emem BO_1234 - YUV9(indeo) planar + RGB565 = 7, //@emem BO_1234 - RGB565 + RGB888 = 8, //@emem BO_1234 - RGB24 + RGB888a = 9, //@emem BO_1234 - aRGB32 + RGBa555 = 10, //@emem BO_1234 - RGBa555 + RGB55a5 = 11 //@emem BO_1234 - RGB55a5 +} COLOR_FORMAT; + +typedef enum +{ + CAP_NULL_STREAM = 0, //捕获无效 + CAP_ORIGIN_STREAM = 1, /*原始流回调*/ + CAP_MPEG4_STREAM = 2, /*Mpeg4流*/ + CAP_MPEG4_XVID_STREAM = 3, + CAP_ORIGIN_MPEG4_STREAM = 4, + CAP_ORIGIN_XVID_STREAM = 5, + CAP_WMV9_STREAM = 6, + CAP_ORIGIN_WMV9_STREAM = 7 +}CAPMODEL; + +typedef enum +{ + MPEG4_AVIFILE_ONLY = 0, //存为MPEG文件 + MPEG4_CALLBACK_ONLY = 1, //MPEG数据回调 + MPEG4_AVIFILE_CALLBACK = 2 //存为MPEG文件并回调 +}MP4MODEL; + +typedef enum +{ //@enum Field frequency + FIELD_FREQ_50HZ = 0, //@emem source is 50 Hz (PAL) + FIELD_FREQ_60HZ = 1, //@emem source is 60 Hz (NTSC) + FIELD_FREQ_0HZ = 2, //@emem source is 0 Hz (NO SIGNL) + FIELD_FREQ_50HZ_NULL = 3, + FIELD_FREQ_60HZ_NULL = 4 +}eFieldFrequency; + +typedef enum +{ //电平等级 + HIGH_VOLTAGE = 0, //高电平 + LOW_VOLTAGE = 1 //低电平 +}eVOLTAGELEVEL; + +typedef enum +{ + NOT_DISPLAY = 0, + PCI_VIEDOMEMORY = 1, //VGA的OVERLAY显示模式 + PCI_MEMORY_VIDEOMEMORY = 2, //PCI_E的OVERLAY显示模式 + PCI_OFFSCREEN_VIDEOMEMORY = 3 //OFFSCREEN表面显示模式 +}DISPLAYTRANSTYPE; + +typedef enum +{ + VideoStandard_None = 0x00000000, + VideoStandard_NTSC_M = 0x00000001, + VideoStandard_NTSC_M_J = 0x00000002, + VideoStandard_NTSC_433 = 0x00000004, + VideoStandard_PAL_B = 0x00000010, + VideoStandard_PAL_D = 0x00000020, + VideoStandard_PAL_H = 0x00000080, + VideoStandard_PAL_I = 0x00000100, + VideoStandard_PAL_M = 0x00000200, + VideoStandard_PAL_N = 0x00000400, + VideoStandard_PAL_60 = 0x00000800, + VideoStandard_SECAM_B = 0x00001000, + VideoStandard_SECAM_D = 0x00002000, + VideoStandard_SECAM_G = 0x00004000, + VideoStandard_SECAM_H = 0x00008000, + VideoStandard_SECAM_K = 0x00010000, + VideoStandard_SECAM_K1 = 0x00020000, + VideoStandard_SECAM_L = 0x00040000, + VideoStandard_SECAM_L1 = 0x00080000, +} +VideoStandard; + +typedef struct +{ + LONG cfHeight; //字符高度 + LONG cfWidth; //字符宽度 + LONG cfWeight; //字符粗细 + LONG cfSpacing; //字符间距 + BOOL cfItalic; //斜体 + BOOL cfUnderline; //下划线 + BOOL cfStrikeOut; //删除线 + BOOL bTransparent; //透明 + COLORREF cfBkColor; //背景色 + COLORREF cfTextColor; //前景色 + TCHAR cfFaceName[32]; //字体名 + +}OSDPARAM; + +//error define area + +#define ERR_SUCCESS 0 //no error,success +#define ERR_NODEVICEFOUND 1 //no device found in system +#define ERR_UNSUPPORTFUNC 2 //unsupport func tempro? +#define ERR_ALLOCRESOURCE 3 //alloc resource error +#define ERR_INITDIRECTDRAW 4 //Init Directdraw error +#define ERR_INITDIRECTSOUND 5 //Init Directdraw error +#define ERR_NOT_10MOONSDEV 6 //it is not device of 10Moons + +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC4000/VC8000/VC404P公有函数 +///////////////////////////////////////////////////////////////////////////////////////////////// + +//动态检测回调, +//如果VCAEnableMotionDetect 参数nPersistTime = -1;则回调运动检测地图。取消(开始、停止)回调。bMove将无效。 +//如果VCAEnableMotionDetect 参数nPersistTime != -1;则回调开始、停止运动检测;取消回调运动检测地图。pbuff、dwSize将无效。 +typedef void (CALLBACK *PrcCbMotionDetect)( DWORD dwCard, BOOL bMove, BYTE *pbuff, DWORD dwSize, LPVOID lpContext ); +//视频捕获原始数据回调 +typedef void (CALLBACK *PrcVidCapCallBack)( DWORD dwCard, BYTE *pbuff, DWORD dwSize ); +//视频压缩数据回调 +typedef void (CALLBACK *PrcVidMpegCallBack)( DWORD dwCard, BYTE *pbuff, DWORD dwSize, BOOL isKeyFrm ); +//音频捕获原始数据回调 +//音频包原始大小16 Bit PCM格式,8080 BYTE,2声道,32000Hz +typedef void (CALLBACK *PrcAudCapCallBack)( DWORD dwCard, BYTE *pbuff,DWORD dwSize ); +//音频MPEG压缩数据回调 +typedef void (CALLBACK *PrcAudMpegCallBack)( DWORD dwCard, BYTE *pbuff,DWORD dwSize ); +//IO报警回调 +typedef void (CALLBACK *PrcIoAlertCallBack)( DWORD dwCard ); +//视频Mpeg处理回调 ,pPorcess 返回为TRUE 表示当前帧压缩;返回为FALSE 表示丢掉当前帧 +typedef void (CALLBACK *PrcVidMpegPorCallBack)( DWORD dwCard, BOOL* pPorcess ); +//音频Mpeg处理回调,pPorcess 返回为TRUE 表示当音频包压缩;返回为FALSE 表示丢掉当前音频包。 +typedef void (CALLBACK *PrcAudMpegPorCallBack)( DWORD dwCard, BOOL* pPorcess ); +//视频预览离屏显存区域的回调 +typedef void (CALLBACK *PrcVidPreViewCallBack)(DWORD dwCard, BYTE *pbuff, DWORD dwMemWidth, DWORD dwWidth, DWORD dwHeight); +//注册视频捕获原始数据回调 +BOOL WINAPI VCARegVidCapCallBack( DWORD dwCard, PrcVidCapCallBack ppCall ); +//注册视频压缩数据回调 +BOOL WINAPI VCARegVidMpegCallBack( DWORD dwCard, PrcVidMpegCallBack ppCall ); +//注册视频预览流回调 +BOOL WINAPI VCARegVidPreViewCallBack(DWORD dwCard, PrcVidPreViewCallBack ppCall); +//设置错误序号 +void WINAPI VCASetLastError( DWORD dwError ); +//得到错误序号 +DWORD WINAPI VCAGetLastError(); +//初始化SDK,hWndMain:overlay窗口句柄,overlay窗口就是包含多路显示小窗口的大窗口。overlay窗口必须有一个,多路显示小窗口必须包含再其内部。 +//bInitVidDev:是否初始化视频设备用于预览,当视频不显示,只需视频录像或音频处理时可以设置为FALSE. +//bInitAudDev:是否初始化音频设备用于声音播放,当不音频不需要播放,只需音频录像或视频处理时、或没有安装声卡,可以设置为FALSE. +BOOL WINAPI VCAInitSdk( HWND hWndMain, DISPLAYTRANSTYPE eDispTransType = PCI_VIEDOMEMORY, BOOL bInitAudDev = FALSE ); +//释放SDK资源 +void WINAPI VCAUnInitSdk(); +//得到设备总数 +LONG WINAPI VCAGetDevNum(); +//打开设备,hPreviewWnd为视频预览窗口的句柄,该窗口背景色用户必需设置为RGB(255,0,255) +BOOL WINAPI VCAOpenDevice( DWORD dwCard,HWND hPreviewWnd ); +//关闭设备 +BOOL WINAPI VCACloseDevice( DWORD dwCard ); +//开始视频预览 +BOOL WINAPI VCAStartVideoPreview( DWORD dwCard ); +//停止视频预览 +BOOL WINAPI VCAStopVideoPreview( DWORD dwCard ); +//更新视频预览,比如改变了显示窗口时,调用。 +BOOL WINAPI VCAUpdateVideoPreview( DWORD dwCard, HWND hPreviewWnd ); +//更新overlay窗口,当overlay窗口句柄改变或尺寸,位置改变时调用,overlay窗口就是包含多路显示小窗口的大窗口。overlay窗口必须有一个,多路显示小窗口必须包含再其内部。 +BOOL WINAPI VCAUpdateOverlayWnd(HWND hOverlayWnd); +//设置视频预览尺寸, dwWidth和dwHeight最好为2的倍数。 +BOOL WINAPI VCASetVidPreviewSize( DWORD dwCard, DWORD dwWidth, DWORD dwHeight ); +//得到视频预览尺寸 +BOOL WINAPI VCAGetVidPreviewSize( DWORD dwCard, DWORD &dwWidth, DWORD &dwHeight ); +//裁剪预览流的边,只有OFFSCREEN表面显示模式有效 +BOOL WINAPI VCAClipVidPreview(DWORD dwCard, int nLeft, int nTop, int nRight, int nBottom); +BOOL WINAPI VCAStartVideoPreviewEx( DWORD dwCard, HWND hPreviewWnd); + + +//保存快照数据到相应的缓冲区 +BOOL WINAPI VCASaveBitsToBuf( DWORD dwCard, PVOID pDestBuf, DWORD& dwWidth, DWORD& dwHeight ); +//保存快照为JPEG文件 +BOOL WINAPI VCASaveAsJpegFile( DWORD dwCard, LPCTSTR lpFileName, DWORD dwQuality = 100 ); +//保存快照为BMP文件 +BOOL WINAPI VCASaveAsBmpFile( DWORD dwCard, LPCTSTR lpFileName ); +//开始视频捕获 +BOOL WINAPI VCAStartVideoCapture( DWORD dwCard, + CAPMODEL enCapMode, + MP4MODEL enMp4Mode, + LPCTSTR lpFileName ); +//停止视频捕获 +BOOL WINAPI VCAStopVideoCapture( DWORD dwCard ); +//设置视频捕获尺寸, dwWidth和dwHeight最好为16的倍数,否则,动态检测为16*16一个检测小块,检测将会不准确。 +BOOL WINAPI VCASetVidCapSize( DWORD dwCard, DWORD dwWidth, DWORD dwHeight ); +//得到视频捕获尺寸 +BOOL WINAPI VCAGetVidCapSize( DWORD dwCard, DWORD &dwWidth, DWORD &dwHeight ); +//设置捕获流的颜色格式,请在VCAOpenDevice之前调用 +BOOL WINAPI VCASetVidCapColorFormat(DWORD dwCard, COLOR_FORMAT cfColor); + +/*设置视频捕获帧率,bFrameRateReduction参数为保留参数。 + PAL显示帧率显示帧率始终为25,NTSC显示帧率始终为30 + PAL捕获帧率最大为25,NTSC捕获帧率最大为30*/ +BOOL WINAPI VCASetVidCapFrameRate( DWORD dwCard, DWORD dwFrameRate, BOOL bFrameRateReduction = FALSE ); + +//设置MPEG压缩的位率,范围:56bps ~ 10Mbps; 单位Kbps +BOOL WINAPI VCASetBitRate( DWORD dwCard, DWORD dwBitRate); +//设置MPEG压缩的关键帧间隔,必须大于等于帧率 +BOOL WINAPI VCASetKeyFrmInterval( DWORD dwCard, DWORD dwKeyFrmInterval); +//设置MPEG4_XVID压缩的质量 dwQuantizer: 1 ~ 31 (1为最小量度,压缩质量最好); dwMotionPrecision: 0 ~ 6 (0最小运动精度) +BOOL WINAPI VCASetXVIDQuality( DWORD dwCard, DWORD dwQuantizer, DWORD dwMotionPrecision); +//设置MPEG4_XVID压缩模式 +BOOL WINAPI VCASetXVIDCompressMode( DWORD dwCard, COMPRESSMODE enCompessMode ); + +//设置动态检测,视频捕获停止时调用有效,VCASetVidCapSize 的设置参数 dwWidth和dwHeight最好为16的倍数,否则,动态检测因16*16一个检测小块,检测将会不准确。 +BOOL WINAPI VCAEnableMotionDetect( DWORD dwCard, + BOOL bEnaDetect, //是否允许动态检测 + BYTE *pAreaMap, //运动检测地图 + LONG nSizeOfMap, //pAreaMap尺寸,以BYTE为单位 + LONG nPersistTime, //物体持续nPersistTime秒不动则认为停止 1-30s ,如果nPersistTime = -1;则回调运动检测地图。取消(开始、停止)回调。 + INT nFrameRateReduce, // zdp add 降低采样比较倍数 + LPVOID lpContext, //监测上下文 + PrcCbMotionDetect OnObjectMove ); //运动/停止回调函数 + +//设置视频色彩 +BOOL WINAPI VCASetVidDeviceColor( DWORD dwCard, COLORCONTROL enCtlType, DWORD dwValue ); +//获取视频色彩 +BOOL WINAPI VCAGetVidDeviceColor( DWORD dwCard, COLORCONTROL enCtlType, DWORD & dwValue); + +//得到视频源输入频率( 0HZ / 50HZ / 60HZ )对应( 无信号 / PAL制 / NTSC制 ), 参考枚举变量eFieldFrequency +BOOL WINAPI VCAGetVidFieldFrq( DWORD dwCard, eFieldFrequency &eVidSourceFieldRate ); +//设置视频源输入频率( 0HZ / 50HZ / 60HZ )对应( 无信号 / PAL制 / NTSC制 ), 参考枚举变量eFieldFrequency +BOOL WINAPI VCASetVidFieldFrq( DWORD dwCard, eFieldFrequency eVidSourceFieldRate ); +//暂停捕获,暂停视频捕获和音频捕获,可用于快速改变音视频捕获类型和文件切换,设置视频捕获字幕叠加 +BOOL WINAPI VCAPauseCapture( DWORD dwCard ); +//设置视频捕获文本叠加 +BOOL WINAPI VCASetVidCapTextOSD( DWORD dwCard, BOOL bEnableOSD, TCHAR* tcText, POINT& ptTopLeft, OSDPARAM* pOSDParm ); +//设置视频捕获时间、日期叠加,在VCASetVidCapDateTimeOSDPARAM()函数设置后调用有效 +BOOL WINAPI VCASetVidCapDateTimeOSD( DWORD dwCard, BOOL bEnableOSD, POINT& ptTopLeft); +//设置视频捕获字幕叠加 +BOOL WINAPI VCASetVidCapDateTimeOSDParam( OSDPARAM* pOSDParm ); +//设计视频录像类型字幕叠加(此接口只在OFFSCREEN表面显示模式下才有用) +BOOL WINAPI VCASetVidCapType(DWORD dwCard, BOOL bEnableOSD, TCHAR* tcText, POINT& ptTopLeft, OSDPARAM* pOSDParm); +//允许视频Mpeg处理回调 +BOOL WINAPI VCAEnableVidMpegProcess( DWORD dwCard, BOOL bEnPorcess, PrcVidMpegPorCallBack ppCall ); +BOOL WINAPI VCAGetDeviceID( DWORD dwCard, DWORD& dwDeviceID ); +//得到设备芯片ID +//初始化视频设备,当视频不显示,只需视频录像或音频处理时、或通过VCAInitSdk()函数已经初始化完成可以不初始化。 +BOOL WINAPI VCAInitVidDev( DISPLAYTRANSTYPE eDispTransType = PCI_VIEDOMEMORY); +//读E2C +BOOL WINAPI VCAIsE2C( DWORD dwCard, BOOL& bIsE2C ); +//读E2C +BOOL WINAPI VCAGetE2C( DWORD dwCard, int iSubAddr, BYTE& ucData ); +//写E2C +BOOL WINAPI VCASetE2C( DWORD dwCard, int iSubAddr, BYTE ucData ); +//检验客户信息 pKey:长度为16 字节,用户加密Key值;bSuccess:表示验证是否通过 。 +BOOL WINAPI VCACheckValidate( BYTE* pKey, BOOL& bSuccess ); + +BOOL WINAPI VCAGetFileLength(DWORD dwCard, DWORD & FileLength); +//认证随机数 +BOOL WINAPI VCAVerifyRand(BYTE * pRand, int nReserve); +//请传入RGB24的BMP文件名 +BOOL WINAPI VCASetCoMsgBmp(char * chFileName); + +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC404P音频处理函数 +///////////////////////////////////////////////////////////////////////////////////////////////// +//初始化音频设备,是否初始化音频设备用于声音播放,当不音频不需要播放,只需音频录像或视频处理时、或没有安装声卡或通过VCAInitSdk()函数已经初始化完成可以不初始化。 +//dwAudFreq:音频播放频率,默认为32K,但有些主板因为某些原因,上传的音频频率可能高于或低于32K,所以根据实际情况,传入这个参数。 +BOOL WINAPI VCAInitAudDev( DWORD dwAudFreq = 32000 ); +//注册音频捕获原始数据回调 +BOOL WINAPI VCARegAudCapCallBack( DWORD dwCard, PrcAudCapCallBack ppCall ); +//注册音频MPEG压缩数据回调 +BOOL WINAPI VCARegAudMpegCallBack( DWORD dwCard, PrcAudMpegCallBack ppCall ); +//开始音频捕获,如果音频捕获方式为MPEG4,视频捕获MPEG4方式开始时,调用有效 +BOOL WINAPI VCAStartAudioCapture( DWORD dwCard, + CAPMODEL enCapMode, + MP4MODEL enMp4Mode ); + +//允许音频从声卡输出,当dwCard >= 100 时,为静音;开始音频捕获时有效 +BOOL WINAPI VCASetAudioCardOutOn( DWORD dwCard ); +//停止音频捕获,如果音频捕获方式为MPEG4,视频捕获MPEG4方式开始时,调用有效 +BOOL WINAPI VCAStopAudioCapture( DWORD dwCard ); +//允许音频Mpeg处理回调 +BOOL WINAPI VCAEnableAudMpegProcess( DWORD dwCard, BOOL bEnPorcess, PrcAudMpegPorCallBack ppCall ); +///////////////////////////////////////////////////////////////////////////////////////////////// +//VC404P IO处理函数 +///////////////////////////////////////////////////////////////////////////////////////////////// +//注册IO报警回调 +BOOL WINAPI VCARegIoAlertCallBack( DWORD dwCard, PrcIoAlertCallBack ppCall ); +//设置IO输入报警当前电平 +BOOL WINAPI VCASetIOAlertLevelIn( DWORD dwCard, eVOLTAGELEVEL enCurrentLevel ); +//开始IO输入报警,enSpringLevel为触发电平 +BOOL WINAPI VCAStartIOAlertIn( DWORD dwCard, eVOLTAGELEVEL enSpringLevel ); +//停止IO输入报警 +BOOL WINAPI VCAStopIOAlertIn( DWORD dwCard ); +//IO输出报警 +BOOL WINAPI VCAIOAlertOut( DWORD dwCard, eVOLTAGELEVEL enLevel ); + +//////////////////////////////////////////////////////////////////////////////////////////////// +//VC404P 录像处理, +//////////////////////////////////////////////////////////////////////////////////////////////// +//************************************************************************** +//add 20101214 用于偶数通道(0,2,4,6...)出捕获流回调,奇数通道(1,3,5,7...)出预览流回调 +//新增的接口不影响旧接口的使用 +//打开设备,只打开与回调流有关的资源(包括IO报警) +BOOL WINAPI VCAOpenDeviceEx( DWORD dwCard,HWND hPreviewWnd, BOOL bCaptureStream=TRUE); +//关闭设备,只打开关闭与回调流有关的资源(包括IO报警) +BOOL WINAPI VCACloseDeviceEx( DWORD dwCard); +//设置预览流的颜色格式 +BOOL WINAPI VCASetVidPrevColorFormat(DWORD dwCard, COLOR_FORMAT cfColor); +//设置预览流的帧率 +BOOL WINAPI VCASetVidPrevFrameRate( DWORD dwCard, DWORD dwFrameRate); +//打开预览流 +int WINAPI VCAStartVidPreviewEx( DWORD dwCard ); +//关闭预览流 +int WINAPI VCAStopVidPreviewEx( DWORD dwCard ); +//add end +//************************************************************************** +//打开视频流 +int WINAPI VCAStartVideoCaptureEx( DWORD dwCard ); +//关闭视频流 +int WINAPI VCAStopVideoCaptureEx( DWORD dwCard ); +//打开音频流 +int WINAPI VCAStartAudioCaptureEx( DWORD dwCard); +//关闭音频流 +int WINAPI VCAStopAudioCaptureEx( DWORD dwCard); +//打开音频流(包括原始音频流) add 20100930 +int WINAPI VCAStartOriginAudioCaptureEx( DWORD dwCard); +// +//开启编码器 +int WINAPI VCACreateEnCodec(DWORD dwCard, CAPMODEL enCapMode); +//停止编码器 +int WINAPI VCACloseEnCodec(DWORD dwCard); +//设置当前帧是否为关键帧 +int WINAPI VCASetCurFrame(DWORD dwCard, BOOL bIsKeyFrame); +//创建AVI文件 +int WINAPI VCACreateAVIFile(DWORD dwCard, char * pFileName); +//写AVI文件,nFrameType=0 关键帧,nFrameType=1 非关键帧,nFrameType=5或6 音频帧 +int WINAPI VCAWriteFrameToAVIFile(DWORD dwCard, char * lpData, long lSize, int nFrameType); +//关闭AVI文件 +int WINAPI VCACloseAVIFile(DWORD dwCard); + +#endif