1、合并master与2021.1
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
#pragma once
|
||||
|
||||
#define WM_MSG (WM_USER+101)
|
||||
#define RS232 (WM_USER+102)
|
||||
#define WM_COMM_USBIN (WM_USER+103)
|
||||
#define WM_IMAGE_MSG (WM_USER+104)
|
||||
#define WM_IMAGE_DAT (WM_USER+105)
|
||||
#define WM_MUL_CCD (WM_USER+106)
|
||||
#define WM_MUL_CCD1 (WM_USER+107)
|
||||
#define WM_M1K_CCD1 (WM_USER+108)
|
||||
#define WM_M1K_CCD2 (WM_USER+109)
|
||||
#define WM_GET_PIC (WM_USER+110)
|
||||
enum
|
||||
{
|
||||
VINIT_DLL,
|
||||
VSEND_DAT,
|
||||
VSWITCH_NO,
|
||||
VSET_PARAMETER,
|
||||
VGET_PARAMETER,
|
||||
VSAVE_PICTURE,
|
||||
VGET_PICTURE,
|
||||
VSET_CAP_VALUE,
|
||||
VSET_DISP_VALUE,
|
||||
VOUT_VALUE,
|
||||
VIN_VALUE,
|
||||
VIN_START,
|
||||
VIN_STOP,
|
||||
VRUN_VIDEO,
|
||||
VPUSE_VIDEO,
|
||||
VSTOP_VIDEO,
|
||||
VDISP_PROPERTY,
|
||||
VQUIT_DLL,
|
||||
RSDAT,
|
||||
|
||||
MINIT_USB,
|
||||
MWRITE_DAT,
|
||||
MREAD_DAT,
|
||||
MMOVEX,
|
||||
MMOVEY,
|
||||
MMOVEZ,
|
||||
MMOVEV,
|
||||
MMOVETOX,
|
||||
MMOVETOY,
|
||||
MMOVETOZ,
|
||||
MMOVETOV,
|
||||
MMOVETOXYZ,
|
||||
MMOVETOXYZV,
|
||||
MSTOP,
|
||||
MCLOSE,
|
||||
MREAD_AXIS,
|
||||
MREAD_PRODE,
|
||||
MRESET_V,
|
||||
|
||||
RWRITE_LIGHT1_SWITCH,
|
||||
RWRITE_LIGHT2_SWITCH,
|
||||
RWRITE_LIGHT3_SWITCH,
|
||||
RWRITE_LIGHT4_SWITCH,
|
||||
RSET_LIGHT1_SIZE,
|
||||
RSET_LIGHT2_SIZE,
|
||||
RSET_LIGHT3_SIZE,
|
||||
RSET_LIGHT4_SIZE,
|
||||
|
||||
CALE_XY_VALUE,
|
||||
CALE_Z_VALUE,
|
||||
GET_RECT,
|
||||
|
||||
SET_SPEED,
|
||||
SET_PRECISION,
|
||||
PRO_DOG,
|
||||
MRESETXY,
|
||||
MRESETXYZ,
|
||||
MRESET_ORG,
|
||||
MUSB_SEND_CMD,
|
||||
MUSB_SEND_DAT,
|
||||
PRO_BARCODE,
|
||||
CALE_Z_VALUE_DIY,
|
||||
|
||||
MUSB_SEND_MDAT,
|
||||
MUSB_READ_MDAT,
|
||||
MUSB_SEND_MCMD,
|
||||
READ_V,
|
||||
RSET_LIGHT_CMD,
|
||||
MUSB_GET_RESET_FLAG,
|
||||
MUSB_READ_ADC,
|
||||
MUSB_READ_ADC_INDEX,
|
||||
PRO_MOTOR_TYPE,
|
||||
PRO_MOTOR_SCALE,
|
||||
PRO_CHANGE_VIDEO_TYPE,
|
||||
PRO_SET_CURRENT_FLAG,
|
||||
PRO_CHANGE_VIDEO_PARAMETER,
|
||||
|
||||
VIDEO_GET_ALL_PARAMETER,
|
||||
VIDEO_SET_ALL_PARAMETER,
|
||||
VIDEO_ENABLE_AE,
|
||||
VIDEO_EXPOSURE,
|
||||
VIDEO_COLOR_CONTROL,
|
||||
VIDEO_AUTO_WB,
|
||||
VIDEO_ENHACEMENT,
|
||||
VIDEO_FRAME_SPEED,
|
||||
VIDEO_TRIGGER_CONTROL,
|
||||
VIDEO_SAVE_PARAMETER,
|
||||
VIDEO_READ_SAVE_PARAMETER,
|
||||
VIDEO_PRO_PARAMETER,
|
||||
VIDEO_SET_MODE,
|
||||
|
||||
MOTOR_XYZ_DXYZ,
|
||||
|
||||
RS232_FRESH_DAT,
|
||||
SET_TABLE_MODE,
|
||||
|
||||
PRO_IMAGE_MSG,
|
||||
PRO_IMAGE_DAT,
|
||||
INIT_RS232_PLC,
|
||||
|
||||
MUSB_READ_PLC,
|
||||
MUSB_WRITE_PLC,
|
||||
PRO_CHANGE_VIDEO_TYPE1,
|
||||
PRO_CAP_IMAGE,
|
||||
CALE_BARCODE_COOR_ANGLE,
|
||||
START_CAP_IMAGE,
|
||||
START_CAP_IMAGE1,
|
||||
START_MUL_NAV,
|
||||
STOP_MUL_NAV,
|
||||
|
||||
MMOVE_TOXYZ,
|
||||
MMOVE_TOXYZ_LASE,
|
||||
|
||||
//GET_MIN_BOX,
|
||||
|
||||
MUSB_GET_LASE_VALUE,
|
||||
Exit_DLL,
|
||||
MADD_M1000K,
|
||||
|
||||
SWITCH_USB_LASE,
|
||||
MMOVE_TOXYZV,
|
||||
SWITCH_WORK_MODE,
|
||||
DLL_DEBUG_ON,
|
||||
DLL_DEBUG_OFF,
|
||||
VIDEO_MIRROR_VH_MONO,
|
||||
CHANGE_M1K_MODE,
|
||||
MMOVE_TOXYZ_JM,
|
||||
|
||||
MVIDEO_NAV_START,
|
||||
MVAUTOZOOM,
|
||||
START_SCAN_LASER_POINTS,
|
||||
STOP_SCAN_LASER_POINTS,
|
||||
GET_SCAN_LASER_STATUS,
|
||||
MMOVEXY,
|
||||
VCOM_TOTAL
|
||||
};
|
||||
@@ -0,0 +1,416 @@
|
||||
// RS232_DLL.cpp : Defines the initialization routines for the DLL.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\SevenOcean\CMMIO_SERIAL.H"
|
||||
#include "EF8000_Define.h"
|
||||
#include "RS232_DLL.h"
|
||||
|
||||
CPSerial* g_pSO7_PCDSerial=NULL;
|
||||
|
||||
#define RS232THREAD_RUNNING_STATE 0
|
||||
#define RS232THREAD_RUNNING_STATE2 2
|
||||
|
||||
#define RS232THREAD_PAUSED_STATE 1
|
||||
#define RS232THREAD_EXIT_STATE -1
|
||||
|
||||
#define ERROR_RESULT_POS -9999.9
|
||||
|
||||
int CRS232_dll::g_ReadRS232Data_Thread_State=RS232THREAD_EXIT_STATE;
|
||||
HANDLE CRS232_dll::g_hReadRS232Data_Thread_Id=NULL;
|
||||
HANDLE CRS232_dll::g_hReadRS232DataExitMutex=NULL;
|
||||
|
||||
static double g_Rs232_PosX(0.0);
|
||||
static double g_Rs232_PosY(0.0);
|
||||
static double g_Rs232_PosZ(0.0);
|
||||
static HANDLE g_WR_COM_Mutex=NULL;
|
||||
static HWND g_MsgHwnd=NULL;
|
||||
static int g_MachineType=0;
|
||||
|
||||
//====================================================================================================================
|
||||
CRS232_dll::CRS232_dll()
|
||||
{
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
CRS232_dll::~CRS232_dll()
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
//====================================================================================================================
|
||||
void CRS232_dll::Startup(const int& _type)
|
||||
{
|
||||
g_MachineType=_type;
|
||||
if (!g_pSO7_PCDSerial)
|
||||
{
|
||||
g_pSO7_PCDSerial=new CPSerial();
|
||||
}
|
||||
CreateThread();
|
||||
}
|
||||
//====================================================================================================================
|
||||
void CRS232_dll::Shutdown()
|
||||
{
|
||||
if (g_pSO7_PCDSerial)
|
||||
{
|
||||
g_pSO7_PCDSerial->Close();
|
||||
Sleep(50);
|
||||
delete g_pSO7_PCDSerial;
|
||||
g_pSO7_PCDSerial=nullptr;
|
||||
}
|
||||
ReleaseMutex(g_WR_COM_Mutex);
|
||||
CloseHandle(g_WR_COM_Mutex);
|
||||
}
|
||||
void CRS232_dll::CreateThread()
|
||||
{
|
||||
if (g_WR_COM_Mutex==NULL)
|
||||
{
|
||||
g_WR_COM_Mutex=CreateMutex(NULL,FALSE,NULL);
|
||||
}
|
||||
if (g_hReadRS232Data_Thread_Id==NULL)
|
||||
{
|
||||
if (g_MachineType==E_MANUANL_MACHINE)
|
||||
{
|
||||
g_ReadRS232Data_Thread_State = RS232THREAD_RUNNING_STATE; // Set thread to running Thread Running = 0; Thread exit = 1
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ReadRS232Data_Thread_State = RS232THREAD_RUNNING_STATE2; // Set thread to running Thread Running = 0; Thread exit = 1
|
||||
}
|
||||
g_hReadRS232Data_Thread_Id = ::CreateThread(
|
||||
(LPSECURITY_ATTRIBUTES)NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE)g_ReadRS232Data_Thread,
|
||||
(LPVOID)this,
|
||||
0,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
void CRS232_dll::CloseThread()
|
||||
{
|
||||
if (g_hReadRS232Data_Thread_Id)
|
||||
{
|
||||
g_ReadRS232Data_Thread_State=RS232THREAD_EXIT_STATE;
|
||||
WaitForSingleObject(g_hReadRS232Data_Thread_Id, INFINITE);
|
||||
}
|
||||
ReleaseMutex(g_WR_COM_Mutex);
|
||||
CloseHandle(g_WR_COM_Mutex);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
double CRS232_dll::HEXDataToIntScalePosX(char* _RecvData)
|
||||
{
|
||||
char i=0,pc=0;
|
||||
char tc=0;
|
||||
float ine(0.0);
|
||||
float dResult(float(ERROR_RESULT_POS));
|
||||
tc=0;
|
||||
for(i=0;i<10;i++)
|
||||
tc+=_RecvData[i];
|
||||
tc=tc&0x7f;
|
||||
pc=_RecvData[10]&0x7f;
|
||||
|
||||
if(tc==pc)
|
||||
{
|
||||
unsigned char tbak;
|
||||
|
||||
for(i=1;i<10;i++)
|
||||
_RecvData[i]=_RecvData[i]-0x30;
|
||||
tbak=_RecvData[2];
|
||||
_RecvData[2]=_RecvData[4];
|
||||
_RecvData[4]=tbak;
|
||||
tbak=_RecvData[3];
|
||||
_RecvData[3]=_RecvData[5];
|
||||
_RecvData[5]=tbak;
|
||||
|
||||
for(i=2;i<6;i++)
|
||||
_RecvData[i]=_RecvData[i]^0x03;
|
||||
|
||||
ine=float(0.1),dResult=float(0.0);
|
||||
for(i=9;i>0;i--)
|
||||
{
|
||||
ine=ine*10;
|
||||
dResult+=ine*_RecvData[i];
|
||||
}
|
||||
dResult=dResult/10000;
|
||||
if(_RecvData[0]==16)
|
||||
dResult=-dResult;
|
||||
}
|
||||
return static_cast<double>(dResult);
|
||||
};
|
||||
//====================================================================================================================
|
||||
double CRS232_dll::HEXDataToIntScalePosY(char* _RecvData)
|
||||
{
|
||||
char i=0,pc=0;
|
||||
char tc=0;
|
||||
float ine(0.0);
|
||||
float dResult(float(ERROR_RESULT_POS));
|
||||
tc=0;
|
||||
for(i=0;i<10;i++)
|
||||
tc+=_RecvData[i];
|
||||
tc=tc&0x7f;
|
||||
pc=_RecvData[10]&0x7f;
|
||||
|
||||
if(tc==pc)
|
||||
{
|
||||
unsigned char tbak;
|
||||
|
||||
for(i=1;i<10;i++)
|
||||
_RecvData[i]=_RecvData[i]-0x30;
|
||||
tbak=_RecvData[3];
|
||||
_RecvData[3]=_RecvData[5];
|
||||
_RecvData[5]=tbak;
|
||||
tbak=_RecvData[4];
|
||||
_RecvData[4]=_RecvData[6];
|
||||
_RecvData[6]=tbak;
|
||||
for(i=3;i<7;i++)
|
||||
_RecvData[i]=_RecvData[i]^0x05;
|
||||
ine=float(0.1),dResult=float(0.0);
|
||||
for(i=9;i>0;i--)
|
||||
{
|
||||
ine=ine*10;
|
||||
dResult+=ine*_RecvData[i];
|
||||
}
|
||||
dResult = dResult/10000;
|
||||
if(_RecvData[0]==16)
|
||||
dResult=-dResult;
|
||||
}
|
||||
return static_cast<double>(dResult);
|
||||
};
|
||||
//====================================================================================================================
|
||||
double CRS232_dll::HEXDataToIntScalePosZ(char* _RecvData)
|
||||
{
|
||||
char i=0,pc=0;
|
||||
char tc=0;
|
||||
float ine(0.0);
|
||||
float dResult(float(ERROR_RESULT_POS));
|
||||
tc=0;
|
||||
for(i=0;i<10;i++)
|
||||
tc+=_RecvData[i];
|
||||
tc=tc&0x7f;
|
||||
pc=_RecvData[10]&0x7f;
|
||||
|
||||
if(tc==pc)
|
||||
{
|
||||
unsigned char tbak;
|
||||
|
||||
for(i=1;i<10;i++)
|
||||
_RecvData[i]=_RecvData[i]-0x30;
|
||||
tbak=_RecvData[4];
|
||||
_RecvData[4]=_RecvData[6];
|
||||
_RecvData[6]=tbak;
|
||||
tbak=_RecvData[5];
|
||||
_RecvData[5]=_RecvData[7];
|
||||
_RecvData[7]=tbak;
|
||||
|
||||
for(i=4;i<8;i++)
|
||||
_RecvData[i]=_RecvData[i]^0x07;
|
||||
|
||||
ine=float(0.1),dResult=float(0.0);
|
||||
for(i=9;i>0;i--)
|
||||
{
|
||||
ine=ine*10;
|
||||
dResult+=ine*_RecvData[i];
|
||||
}
|
||||
dResult=dResult/10000;
|
||||
if(_RecvData[0]==16)
|
||||
dResult=-dResult;
|
||||
}
|
||||
return static_cast<double>(dResult);
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
unsigned __stdcall CRS232_dll::g_ReadRS232Data_Thread(LPVOID pThis)
|
||||
{
|
||||
CRS232_dll* _This = (CRS232_dll*)pThis;
|
||||
int i(0);
|
||||
double dTmpPos(0.0);
|
||||
INT RecvDataBytes(0);
|
||||
char RecvDataBuff[MAX_RECIEVE_BUFFER_SIZE]={0};
|
||||
for (;;)
|
||||
{
|
||||
if(g_ReadRS232Data_Thread_State == RS232THREAD_EXIT_STATE)
|
||||
ExitThread(0);
|
||||
switch(g_ReadRS232Data_Thread_State)
|
||||
{
|
||||
case RS232THREAD_RUNNING_STATE:
|
||||
{
|
||||
//½ÓÊܹâÕ¤³ßÊý¾Ý
|
||||
if (g_pSO7_PCDSerial->m_iRecvState)
|
||||
{
|
||||
i=0;
|
||||
RecvDataBytes=0;
|
||||
memset(RecvDataBuff, 0, MAX_RECIEVE_BUFFER_SIZE);
|
||||
memcpy(RecvDataBuff, g_pSO7_PCDSerial->m_RecvData, g_pSO7_PCDSerial->m_iRecvBytes);
|
||||
RecvDataBytes=g_pSO7_PCDSerial->m_iRecvBytes;
|
||||
|
||||
g_pSO7_PCDSerial->m_iRecvState=FALSE;
|
||||
while(i<RecvDataBytes)
|
||||
{
|
||||
if (g_pSO7_PCDSerial->m_iRecvState)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ((BYTE)RecvDataBuff[i]==0xF4)//x
|
||||
{
|
||||
if ((RecvDataBytes-i)>=12)
|
||||
{
|
||||
dTmpPos=_This->HEXDataToIntScalePosX(&RecvDataBuff[i+1]);
|
||||
if (dTmpPos!=ERROR_RESULT_POS)
|
||||
{
|
||||
g_Rs232_PosX=dTmpPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
dTmpPos=0.0;
|
||||
}
|
||||
}
|
||||
i+=12;
|
||||
}
|
||||
else if ((BYTE)RecvDataBuff[i]==0xF5)//y
|
||||
{
|
||||
if ((RecvDataBytes-i)>=12)
|
||||
{
|
||||
dTmpPos=_This->HEXDataToIntScalePosY(&RecvDataBuff[i+1]);
|
||||
if (dTmpPos!=ERROR_RESULT_POS)
|
||||
{
|
||||
g_Rs232_PosY=dTmpPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
dTmpPos=0.0;
|
||||
}
|
||||
}
|
||||
i+=12;
|
||||
}
|
||||
else if ((BYTE)RecvDataBuff[i]==0xF6)//z
|
||||
{
|
||||
if ((RecvDataBytes-i)>=12)
|
||||
{
|
||||
dTmpPos=_This->HEXDataToIntScalePosZ(&RecvDataBuff[i+1]);
|
||||
if (dTmpPos!=ERROR_RESULT_POS)
|
||||
{
|
||||
g_Rs232_PosZ=dTmpPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
dTmpPos=0.0;
|
||||
}
|
||||
}
|
||||
i+=12;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RS232THREAD_RUNNING_STATE2:
|
||||
{
|
||||
WaitForSingleObject(g_WR_COM_Mutex,INFINITE);
|
||||
if (g_pSO7_PCDSerial->m_iRecvState)
|
||||
{
|
||||
if(g_pSO7_PCDSerial->m_RecvData[0]==0)
|
||||
{
|
||||
g_pSO7_PCDSerial->m_iRecvState=FALSE;
|
||||
INT iRetrys2(0);
|
||||
while(!g_pSO7_PCDSerial->m_iRecvState && iRetrys2<30)
|
||||
{
|
||||
iRetrys2++;
|
||||
Sleep(20);
|
||||
}
|
||||
}
|
||||
if (g_pSO7_PCDSerial->m_iRecvState)
|
||||
{
|
||||
INT RecvDataBytes(0);
|
||||
char RecvDataBuff[MAX_RECIEVE_BUFFER_SIZE];
|
||||
memset(RecvDataBuff, 0, MAX_RECIEVE_BUFFER_SIZE);
|
||||
memcpy(RecvDataBuff, g_pSO7_PCDSerial->m_RecvData, g_pSO7_PCDSerial->m_iRecvBytes);
|
||||
RecvDataBytes=g_pSO7_PCDSerial->m_iRecvBytes;
|
||||
for (int ii=0;ii<RecvDataBytes;ii++)
|
||||
{
|
||||
::PostMessage(g_MsgHwnd,WM_MSG,(WPARAM)RSDAT,(LPARAM)RecvDataBuff[ii]);
|
||||
}
|
||||
g_pSO7_PCDSerial->m_RecvData[0]=0;
|
||||
g_pSO7_PCDSerial->m_iRecvState=FALSE;
|
||||
}
|
||||
}
|
||||
ReleaseMutex(g_WR_COM_Mutex);
|
||||
Sleep(20);
|
||||
break;
|
||||
}
|
||||
case RS232THREAD_PAUSED_STATE:
|
||||
{
|
||||
Sleep(10);
|
||||
break;
|
||||
}
|
||||
case RS232THREAD_EXIT_STATE:
|
||||
{
|
||||
ExitThread(0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ExitThread(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Sleep(20);
|
||||
};
|
||||
g_ReadRS232Data_Thread_State = RS232THREAD_EXIT_STATE;
|
||||
ExitThread(0);
|
||||
};
|
||||
|
||||
//====================================================================================================================
|
||||
CRS232_dll g_Rs232;
|
||||
//====================================================================================================================
|
||||
S232DLL_API bool init_rs232(HWND hwnd, UINT com_type, UINT baud)
|
||||
{
|
||||
g_MsgHwnd=hwnd;
|
||||
g_Rs232.Startup(E_OTHER_MACHINE);
|
||||
if (g_pSO7_PCDSerial)
|
||||
{
|
||||
g_pSO7_PCDSerial->Close();
|
||||
Sleep(50);
|
||||
}
|
||||
g_pSO7_PCDSerial->SetPort(static_cast<int>(com_type),static_cast<int>(baud));
|
||||
DWORD rStatus=g_pSO7_PCDSerial->Open();
|
||||
if (rStatus)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
S232DLL_API void Write_Com(char* _SendData,int _DataLength)
|
||||
{
|
||||
WaitForSingleObject(g_WR_COM_Mutex,INFINITE);
|
||||
if (g_MachineType==E_MANUANL_MACHINE)
|
||||
{
|
||||
g_Rs232.g_ReadRS232Data_Thread_State=RS232THREAD_PAUSED_STATE;
|
||||
}
|
||||
BOOL rStatus(FALSE);
|
||||
char SendDataBuff[MAX_OUTPUT_BUFFER_SIZE];
|
||||
memset(SendDataBuff, 0, MAX_OUTPUT_BUFFER_SIZE);
|
||||
memcpy(SendDataBuff, _SendData, _DataLength);
|
||||
int iSendDataLength(_DataLength);
|
||||
if (_SendData[_DataLength-1]==0x0D)
|
||||
{
|
||||
g_pSO7_PCDSerial->Send(SendDataBuff,iSendDataLength-1);
|
||||
}
|
||||
if (g_MachineType==E_MANUANL_MACHINE)
|
||||
{
|
||||
g_Rs232.g_ReadRS232Data_Thread_State=RS232THREAD_RUNNING_STATE;
|
||||
}
|
||||
ReleaseMutex(g_WR_COM_Mutex);
|
||||
}
|
||||
//====================================================================================================================
|
||||
S232DLL_API void Get_Dat(char* Str)
|
||||
{
|
||||
* Str=0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
; RS232_DLL.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
@@ -0,0 +1,42 @@
|
||||
// RS232_DLL.h : main header file for the RS232_DLL DLL
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#define S232DLL_EXPORTS
|
||||
|
||||
#ifdef S232DLL_EXPORTS
|
||||
#define S232DLL_API extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define S232DLL_API extern "C" __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
S232DLL_API bool init_rs232(HWND hwnd, UINT com_type, UINT baud);
|
||||
S232DLL_API void Write_Com(char* Str,int len);
|
||||
S232DLL_API void Get_Dat(char* Str);
|
||||
enum E_MACHINE_TYPE
|
||||
{
|
||||
E_MANUANL_MACHINE,
|
||||
E_OTHER_MACHINE
|
||||
};
|
||||
// This class is exported from the MV8000E_MOCK.dll
|
||||
class CRS232_dll {
|
||||
public:
|
||||
CRS232_dll();
|
||||
~CRS232_dll();
|
||||
public:
|
||||
void Startup(const int& _type);
|
||||
void Shutdown();
|
||||
double HEXDataToIntScalePosX(char* _RecvData);
|
||||
double HEXDataToIntScalePosY(char* _RecvData);
|
||||
double HEXDataToIntScalePosZ(char* _RecvData);
|
||||
public:
|
||||
static int g_ReadRS232Data_Thread_State;
|
||||
static HANDLE g_hReadRS232Data_Thread_Id;
|
||||
static HANDLE g_hReadRS232DataExitMutex;
|
||||
static unsigned __stdcall g_ReadRS232Data_Thread(LPVOID pThis);
|
||||
static HANDLE m_Thread_Id;
|
||||
private:
|
||||
void CreateThread();
|
||||
void CloseThread();
|
||||
};
|
||||
Binary file not shown.
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D9FB0729-41E7-4F5F-975B-50FFD6B05DF1}</ProjectGuid>
|
||||
<RootNamespace>RS232_DLL</RootNamespace>
|
||||
<Keyword>MFCDLLProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ModuleDefinitionFile>.\RS232_DLL.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)\$(ProjectName).dll" ..\ConsoleTestDll\bin\Debug\*.* /D /F /Y
|
||||
xcopy "$(OutDir)\$(ProjectName).lib" ..\ConsoleTestDll\bin\Debug\*.* /D /F /Y
|
||||
xcopy "$(OutDir)\$(ProjectName).pdb" ..\ConsoleTestDll\bin\Debug\*.* /D /F /Y
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>.\RS232_DLL.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)\$(ProjectName).dll" E:\Tony\Hg_Tony\EF8000_MVIP\S232.dll /D /F /Y
|
||||
xcopy "$(OutDir)\$(ProjectName).dll" $(OutDir)\S232.dll /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="res\RS232_DLL.rc2" />
|
||||
<None Include="RS232_DLL.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\SevenOcean\CMMIO_BASE.CPP" />
|
||||
<ClCompile Include="..\..\..\SevenOcean\CMMIO_SERIAL.CPP" />
|
||||
<ClCompile Include="RS232_DLL.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="RS232_DLL.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="RS232_DLL.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="RS232_DLL.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="res\RS232_DLL.rc2">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="RS232_DLL.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\SevenOcean\CMMIO_SERIAL.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\SevenOcean\CMMIO_BASE.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="RS232_DLL.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="RS232_DLL.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>E:\Tony\Hg_Tony\MachineInterfaceUtility\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\ConsoleTestDll\bin\Debug\ConsoleTestDll.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by RS232_DLL.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NEXT_RESOURCE_VALUE 11000
|
||||
#define _APS_NEXT_CONTROL_VALUE 11000
|
||||
#define _APS_NEXT_SYMED_VALUE 11000
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#endif
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// RS232_DLL.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxole.h> // MFC OLE classes
|
||||
#include <afxodlgs.h> // MFC OLE dialog classes
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#endif // _AFX_NO_OLE_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_DB_SUPPORT
|
||||
#include <afxdb.h> // MFC ODBC database classes
|
||||
#endif // _AFX_NO_DB_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_DAO_SUPPORT
|
||||
#include <afxdao.h> // MFC DAO database classes
|
||||
#endif // _AFX_NO_DAO_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user