新增LKG5000的ethernet通信,发送开始、停止扫描命令。
This commit is contained in:
@@ -15,6 +15,7 @@ CKeyence_Laser_LK_H::CKeyence_Laser_LK_H()
|
||||
m_StoredDataNumber=0;
|
||||
m_NeedStorageDataNumber=0;
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_100;
|
||||
m_DeviceID=LKG5000DEVICEMAXNO;
|
||||
}
|
||||
|
||||
CKeyence_Laser_LK_H::~CKeyence_Laser_LK_H()
|
||||
@@ -90,7 +91,7 @@ BOOL CKeyence_Laser_LK_H::OpenDeviceEthernet(IN_ADDR _IPAddr)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_result = LKIF2_OpenDeviceETHER(¶mEther);
|
||||
m_result = m_pOpenDeviceETHER(¶mEther);
|
||||
if (m_result==RC_OK)
|
||||
{
|
||||
ReturnStatus=TRUE;
|
||||
@@ -103,6 +104,40 @@ BOOL CKeyence_Laser_LK_H::OpenDeviceEthernet(IN_ADDR _IPAddr)
|
||||
return ReturnStatus;
|
||||
}
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser_LK_H::SetDeviceIPADDR(int _DeviceID,IN_ADDR _IPAddr)
|
||||
{
|
||||
BOOL ReturnStatus(FALSE);
|
||||
if (0<=_DeviceID && _DeviceID<LKG5000DEVICEMAXNO)
|
||||
{
|
||||
m_DeviceIDAddr[_DeviceID]=_IPAddr;
|
||||
ReturnStatus=TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnStatus=FALSE;
|
||||
}
|
||||
return ReturnStatus;
|
||||
}
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser_LK_H::SetDeviceID(int _DeviceID)
|
||||
{
|
||||
BOOL ReturnStatus(FALSE);
|
||||
if (0<=_DeviceID && _DeviceID<LKG5000DEVICEMAXNO)
|
||||
{
|
||||
if (m_DeviceID!=_DeviceID)
|
||||
{
|
||||
m_DeviceID=_DeviceID;
|
||||
OpenDeviceEthernet(m_DeviceIDAddr[_DeviceID]);
|
||||
}
|
||||
ReturnStatus=TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnStatus=FALSE;
|
||||
}
|
||||
return ReturnStatus;
|
||||
}
|
||||
//==============================================
|
||||
/***********************************************
|
||||
LaserValue1:为第一个OUT01值
|
||||
LaserValue2:为第二个OUT01值
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef RC (WINAPI* pLKIF2_DataStorageGetStatus)(OUT BOOL * lsStorage,OUT int *
|
||||
// Set Data Storage
|
||||
typedef RC (WINAPI* pLKIF2_SetDataStorage)(IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle);
|
||||
|
||||
const int LKG5000DEVICEMAXNO=10;
|
||||
//======================================================================================
|
||||
class CKeyence_Laser_LK_H
|
||||
{
|
||||
@@ -48,6 +49,8 @@ protected:
|
||||
LKIF_STORAGECYCLE m_StorageCycle;
|
||||
HMODULE m_hLkif;
|
||||
RC m_result;
|
||||
int m_DeviceID;
|
||||
IN_ADDR m_DeviceIDAddr[10];
|
||||
public:
|
||||
|
||||
CKeyence_Laser_LK_H();
|
||||
@@ -80,7 +83,10 @@ public:
|
||||
void KeyenceLaserInit(void);
|
||||
void Get_KeyenceLaserData(float *LaserValue1,float *LaserValue2);
|
||||
BOOL OpenDeviceUsb(void);
|
||||
|
||||
BOOL OpenDeviceEthernet(IN_ADDR _IPAddr);
|
||||
BOOL SetDeviceIPADDR(int _DeviceID,IN_ADDR _IPAddr);
|
||||
BOOL SetDeviceID(int _DeviceID);
|
||||
|
||||
BOOL StartStoreData(int _StorageOutNumber,int _NeedStorageDataNumber,int _SampleTime);
|
||||
BOOL StopStoreData();
|
||||
|
||||
Reference in New Issue
Block a user