添加项目文件。
parent
5053cfe364
commit
2590fbe704
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
ヘフL?
|
||||||
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
\ActCoordErr\2018_06_2219_08_17_X_ErrCnt_[5.0].txt
|
||||||
@ -0,0 +1 @@
|
|||||||
|
\ActCoordErr\2018_06_2219_08_20_X_ErrCnt_[5.0].txt
|
||||||
@ -0,0 +1 @@
|
|||||||
|
\ActCoordErr\2018_06_2219_08_21_X_ErrCnt_[5.0].txt
|
||||||
@ -0,0 +1,768 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) Advantech Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Use of this source code is subject to the terms of the Advantech end-user
|
||||||
|
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
|
||||||
|
// If you did not accept the terms of the EULA, you are not authorized to use
|
||||||
|
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
|
||||||
|
// install media.
|
||||||
|
//
|
||||||
|
//研华运动控制卡接口头文件
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "AdvMotDev.h"
|
||||||
|
#include "AdvMotDrv.h"
|
||||||
|
#include "AdvMotPropID.h"
|
||||||
|
#include "AdvMotErr.h"
|
||||||
|
|
||||||
|
|
||||||
|
//Add for other Corp. // [6/8/2011 dan.yang]
|
||||||
|
#ifndef tagPT_DEVLIST
|
||||||
|
#define tagPT_DEVLIST
|
||||||
|
typedef struct tagPT_DEVLIST
|
||||||
|
{
|
||||||
|
DWORD dwDeviceNum;
|
||||||
|
char szDeviceName[50];
|
||||||
|
SHORT nNumOfSubdevices;
|
||||||
|
} DEVLIST, *LPDEVLIST;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// [11/26/2014 dan]
|
||||||
|
#ifndef _DEV_IO_MAP_INFO
|
||||||
|
#define _DEV_IO_MAP_INFO
|
||||||
|
typedef struct _DEV_IO_MAP_INFO
|
||||||
|
{
|
||||||
|
char Name[50];
|
||||||
|
ULONG Index;
|
||||||
|
ULONG Offset;
|
||||||
|
ULONG ByteLength;
|
||||||
|
ULONG SlotID;
|
||||||
|
|
||||||
|
ULONG PortChanID;
|
||||||
|
ULONG ModuleID;
|
||||||
|
char ModuleName[16];
|
||||||
|
char Description[100];
|
||||||
|
} DEV_IO_MAP_INFO, *PDEV_IO_MAP_INFO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ADVAPI_SLAVE_INFO
|
||||||
|
#define _ADVAPI_SLAVE_INFO
|
||||||
|
typedef struct {
|
||||||
|
ULONG desc; /**< Port descriptors. */
|
||||||
|
ULONG link_up; /**< Link detected. */
|
||||||
|
ULONG loop_closed; /**< Loop closed. */
|
||||||
|
ULONG next_slave; /**< Connected Position of slaves. */
|
||||||
|
ULONG delay_to_next_dc;
|
||||||
|
} port_info;
|
||||||
|
|
||||||
|
typedef struct _ADVAPI_SLAVE_INFO_
|
||||||
|
{
|
||||||
|
ULONG SlaveID;
|
||||||
|
ULONG Position;
|
||||||
|
ULONG VendorID;
|
||||||
|
ULONG ProductID;
|
||||||
|
ULONG RevisionNo;
|
||||||
|
ULONG SerialNo;
|
||||||
|
ULONG driverCnts;
|
||||||
|
port_info ports[4];
|
||||||
|
ULONG transmission_delay;
|
||||||
|
char DeviceName[64];
|
||||||
|
}ADVAPI_SLAVE_INFO, *PADVAPI_SLAVE_INFO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _DEV_ARES_INFO
|
||||||
|
#define _DEV_ARES_INFO
|
||||||
|
typedef struct _DEV_ARES_INFO
|
||||||
|
{
|
||||||
|
char Name[10][32];
|
||||||
|
} DEV_ARES_INFO, *PDEV_ARES_INFO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _DEV_PRE_SCAN_DATA
|
||||||
|
#define _DEV_PRE_SCAN_DATA
|
||||||
|
typedef struct _DEV_PRE_SCAN_DATA
|
||||||
|
{
|
||||||
|
F64 XScanData;
|
||||||
|
F64 YScanData;
|
||||||
|
F64 ZScanData;
|
||||||
|
} DEV_PRE_SCAN_DATA, *PDEV_PRE_SCAN_DATA;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ADVCMNAPI
|
||||||
|
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
|
||||||
|
#define ADVCMNAPI __stdcall
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
+-----------------------------------------------------------------------------+
|
||||||
|
| ************ Advantech Motion Master Device Type ID************************ |
|
||||||
|
+-----------------------------------------------------------------------------+
|
||||||
|
*/
|
||||||
|
//U32 ADVCMNAPI Acm_GetAvailableDevNum(U32 *DeviceNum); //Add for other corp. [dan.yang 2011.06.08]
|
||||||
|
U32 ADVCMNAPI Acm_GetAvailableDevs(DEVLIST *DeviceList, U32 MaxEntries, PU32 OutEntries); //Add for other corp. [dan.yang 2011.06.08]
|
||||||
|
void ADVCMNAPI GetAvailalbe_AMONet(DWORD dwMasDevNum, //Add for other corp. [dan.yang 2011.07.13]
|
||||||
|
DEVLIST *DeviceList,
|
||||||
|
ULONG *devIndex,
|
||||||
|
ULONG *OutEntries);
|
||||||
|
BOOL ADVCMNAPI Acm_GetErrorMessage(U32 ErrorCode, PI8 lpszError, U32 nMaxError);// [9/5/2011 dan.yang]
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularRel_Angle(HAND GroupHandle, // [8/15/2012 dan.yang]
|
||||||
|
PF64 CenterArray,
|
||||||
|
U16 Degree,
|
||||||
|
PU32 ArrayElements,
|
||||||
|
I16 Direction);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularAbs_Angle(HAND GroupHandle, // [8/15/2012 dan.yang]
|
||||||
|
PF64 CenterArray,
|
||||||
|
U16 Degree,
|
||||||
|
PU32 ArrayElements,
|
||||||
|
I16 Direction);
|
||||||
|
//Device operation
|
||||||
|
U32 ADVCMNAPI Acm_DevOpen(U32 DeviceNumber, PHAND DeviceHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevReOpen(HAND DeviceHandle); // [11/25/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_DevClose(PHAND DeviceHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevReadEEPROM(HAND DeviceHandle, U16 EEPROMAddr, PU16 readValue);
|
||||||
|
U32 ADVCMNAPI Acm_DevWriteEEPROM(HAND DeviceHandle, U16 EEPROMAddr, U16 writeValue);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_DevReadEEPROM_Ex(HAND DeviceHandle, U16 PrivateID, PU32 PassWordArray, U32 PassArrayCnt, PU32 ReadArray, U32 BufferLength);// [6/15/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_DevWriteEEPROM_Ex(HAND DeviceHandle, U16 PrivateID, PU32 PassWordArray, U32 PassArrayCnt, PU32 WriteArray, U32 BufferLength); // [6/15/2012 dan.yang]
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GetProperty(HAND Handle, U32 ProperyID, PVOID Buffer, PU32 BufferLength);
|
||||||
|
U32 ADVCMNAPI Acm_SetProperty(HAND Handle, U32 ProperyID, PVOID Buffer, U32 BufferLength);
|
||||||
|
U32 ADVCMNAPI Acm_EnableMotionEvent(HAND DeviceHandle,
|
||||||
|
PU32 AxEnableEvtArray,
|
||||||
|
PU32 GpEnableEvtArray,
|
||||||
|
U32 AxArrayElements,
|
||||||
|
U32 GpArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_CheckMotionEvent(HAND DeviceHandle,
|
||||||
|
PU32 AxEvtStatusArray,
|
||||||
|
PU32 GpEvtStatusArray,
|
||||||
|
U32 AxArrayElements,
|
||||||
|
U32 GpArrayElements,
|
||||||
|
U32 Millisecond);
|
||||||
|
U32 ADVCMNAPI Acm_CancelCheckEvent (HAND ObjectHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevLoadConfig(HAND DeviceHandle, PI8 ConfigPath);
|
||||||
|
U32 ADVCMNAPI Acm_DevFwDownload(HAND DeviceHandle, U32 Data, U32 DataID); //internal function don't release.
|
||||||
|
U32 ADVCMNAPI Acm_DevSlaveFwDownload(HAND DeviceHandle, U16 RingNo, U16 Position, PI8 FileName, PI8 FilePath, U32 Password); // [6/4/2015 andy.wang]
|
||||||
|
U32 ADVCMNAPI Acm_DevDownloadCAMTable (HAND DeviceHandle,
|
||||||
|
U32 CamTableID,
|
||||||
|
PF64 pMasterArray,
|
||||||
|
PF64 pSlaveArray,
|
||||||
|
PF64 pPointRangeArray,
|
||||||
|
PF64 pPointSlopeArray,
|
||||||
|
U32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_DevLoadCAMTableFile(HAND DeviceHandle, PI8 FilePath, U32 CamTableID, PU32 Range, PU32 PointsCount); // [dan.yang 2011.08.22]
|
||||||
|
U32 ADVCMNAPI Acm_DevConfigCAMTable(HAND DeviceHandle, //Add for pci1265 and pci1245 [dan.yang 2011.06.23]
|
||||||
|
U32 CamTableID,
|
||||||
|
U32 Periodic,
|
||||||
|
U32 MasterAbsolute,
|
||||||
|
U32 SlaveAbsolute);
|
||||||
|
U32 ADVCMNAPI Acm_DevReadMailBox(HAND Handle, U16 par_id, U32 data_index, U32 data_count, PU32 DataBuffer); //[dan.yang 2012.12.28]
|
||||||
|
U32 ADVCMNAPI Acm_DevWriteMailBox(HAND Handle, U16 par_id, U32 data_index, U32 data_count, PU32 DataBuffer); //[dan.yang 2012.12.28]
|
||||||
|
U32 ADVCMNAPI Acm_LoadENI(HAND DeviceHandle, PI8 FilePath); // [11/12/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_DevGetComStatus(HAND DeviceHandle, U16 RingNo, PU16 pStatus); // [11/20/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_DevGetSlaveStates(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, PU16 pStatus);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetErrorTable(HAND DeviceHandle, U16 RingNo, PU32 ErrorTableArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_DevEnableEvent(HAND DeviceHandle, U32 MasEnableEvt); // [11/20/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_DevCheckEvent(HAND DeviceHandle, PU32 MasCheckEvt, U32 Millisecond); // [11/20/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_DevGetSlaveInfo(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, PVOID pInfo);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetMasInfo(HAND DeviceHandle, PVOID pMasInfo, PU16 SlaveIPArray, PU32 SlvCnt);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetSlaveDataCnt(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, U8 DataType, PU32 DataCnt);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetSlaveFwVersion(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, OUT char *VersionInfo); // [6/4/2015 andy.wang]
|
||||||
|
U32 ADVCMNAPI Acm_DevSetSlaveID(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, U16 SlaveNewIP); // [6/23/2015 andy.wang]
|
||||||
|
U32 ADVCMNAPI Acm_WriteRingBuffer(HAND Handle, U32 cmd_id, U32 data_index, U32 data_cnt, PU32 dataBuffer);
|
||||||
|
U32 ADVCMNAPI Acm_ReadRingBuffer(HAND Handle, PU32 cmd_id, PU32 data_index, U32 data_cnt, PU32 dataBuffer);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetModuleInfo(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, PU32 ModIDArray, PU32 ModCnt);
|
||||||
|
U32 ADVCMNAPI Acm_DevSetSlaveID(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, U16 SlaveNewIP);
|
||||||
|
// [2/28/2014 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GetU32Property(HAND Handle, U32 ProperyID, PU32 Value);
|
||||||
|
U32 ADVCMNAPI Acm_GetI32Property(HAND Handle, U32 ProperyID, PI32 Value);
|
||||||
|
U32 ADVCMNAPI Acm_GetF64Property(HAND Handle, U32 ProperyID, PF64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_GetStringProperty (HAND Handle, U32 ProperyID, PU8 Value);
|
||||||
|
U32 ADVCMNAPI Acm_SetU32Property (HAND Handle, U32 ProperyID, U32 Value);
|
||||||
|
U32 ADVCMNAPI Acm_SetI32Property (HAND Handle, U32 ProperyID, I32 Value);
|
||||||
|
U32 ADVCMNAPI Acm_SetF64Property (HAND Handle, U32 ProperyID, F64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_SetStringProperty (HAND Handle, U32 ProperyID, PU8 Value);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_CheckVersion(HAND DeviceHandle, U32 VersionID, PU32 Result); // [11/3/2015 dandan.yang]:just for utility
|
||||||
|
|
||||||
|
// [11/20/2014 dan]
|
||||||
|
U32 ADVCMNAPI Acm_GetChannelProperty(HAND Handle, U32 ChannelID, U32 ProperyID, PF64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_SetChannelProperty(HAND Handle, U32 ChannelID, U32 ProperyID, F64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_GetMultiChannelProperty(HAND Handle, U32 ProperyID, U32 StartChID, U32 ChCount, PF64 ValueArray);
|
||||||
|
U32 ADVCMNAPI Acm_SetMultiChannelProperty(HAND Handle, U32 ProperyID, U32 StartChID, U32 ChCount, PF64 ValueArray);
|
||||||
|
U32 ADVCMNAPI Acm_DevMutiTrigSetCmpDO(HAND DeviceHandle,U32 OFForON);
|
||||||
|
U32 ADVCMNAPI Acm_DevMutiTrigForceCmpOut(HAND DeviceHandle, U32 OFForON);
|
||||||
|
//Master device operation
|
||||||
|
U32 ADVCMNAPI Acm_MasStartRing(HAND DeviceHandle, U16 RingNo);
|
||||||
|
U32 ADVCMNAPI Acm_MasStopRing(HAND DeviceHandle, U16 RingNo);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetComStatus(HAND DeviceHandle, U16 RingNo, PU16 pStatus);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetComCyclicTime(HAND DeviceHandle, U16 RingNo, PF64 pTime);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetDataCyclicTime(HAND DeviceHandle, U16 RingNo, PF64 DataCyclicTime);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetActiveTable(HAND DeviceHandle, U16 RingNo, PU32 ActiveTableArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetErrorTable(HAND DeviceHandle, U16 RingNo, PU32 ErrorTableArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_MasGetSlaveInfo(HAND DeviceHandle, U16 RingNo, U16 SlaveIP, PU32 pInfo);
|
||||||
|
U32 ADVCMNAPI Acm_MasLogComStatus(HAND DeviceHandle, U16 RingNo);
|
||||||
|
U32 ADVCMNAPI Acm_MasTrigOut(HAND DeviceHandle, U16 RingNo);//Engineer function, don't release
|
||||||
|
U32 ADVCMNAPI Acm_MasGetRingStatus(HAND DeviceHandle, U16 RingNo, PU16 pStatus);//internal function don't release.
|
||||||
|
|
||||||
|
//Axis operation
|
||||||
|
U32 ADVCMNAPI Acm_AxOpen(HAND DeviceHandle, U16 PhyAxis, PHAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxOpenbyID(HAND DeviceHandle, U16 SlaveIP, PHAND AxisHandle);//Add for pci1203
|
||||||
|
U32 ADVCMNAPI Acm_AxClose(PHAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetSvOn(HAND AxisHandle, U32 OnOff);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetErcOn(HAND AxisHandle, U32 OnOff);
|
||||||
|
U32 ADVCMNAPI Acm_AxResetAlm(HAND AxisHandle, U32 OnOff);
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveRel(HAND AxisHandle, F64 Distance);
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveAbs(HAND AxisHandle, F64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveRel_EC(HAND AxisHandle, F64 Position);//zhaocui add 20131203 for hongjin
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveVel(HAND AxisHandle, U16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_AxStopDec(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxStopEmg(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveImpose(HAND AxisHandle, F64 Position, F64 NewVel); //Add for pci1265 and pci1245 [dan.yang 2011.04.20]
|
||||||
|
U32 ADVCMNAPI Acm_AxHomeEx(HAND AxisHandle, U32 DirMode);
|
||||||
|
U32 ADVCMNAPI Acm_AxHome(HAND AxisHandle, U32 HomeMode, U32 DirMode);
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveHome(HAND AxisHandle, U32 HomeMode, U32 Dir);
|
||||||
|
// U32 Acm_AxPauseMotion(U32 AxisHandle);
|
||||||
|
// U32 Acm_AxResumeMotion(U32 AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxChangeVel(HAND AxisHandle, F64 NewVel);
|
||||||
|
U32 ADVCMNAPI Acm_AxChangePos(HAND AxisHandle, F64 NewPos);
|
||||||
|
U32 ADVCMNAPI Acm_AxChangeVelByRate(HAND AxisHandle, U32 Rate); // [11/21/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_AxResetError(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetState(HAND AxisHandle, PU16 State);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetMotionIO(HAND AxisHandle, PU32 Status);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetMotionStatus(HAND AxisHandle, PU32 Status);
|
||||||
|
U32 ADVCMNAPI Acm_GetLastError(HAND Handle);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetCmdPosition(HAND AxisHandle, PF64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetMachPosition(HAND AxisHandle, PF64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmdPosition(HAND AxisHandle, F64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetActualPosition(HAND AxisHandle, PF64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetActualPosition(HAND AxisHandle, F64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetCmdVelocity(HAND AxisHandle, PF64 Velocity);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetLagCounter(HAND AxisHandle, PF64 Position);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetLatchData(HAND AxisHandle, U32 PositionNo, PF64 Position); // [5/30/2011 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_AxStartSoftLatch(U32 AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetExtDrive(HAND AxisHandle, U16 ExtDrvMode);
|
||||||
|
U32 ADVCMNAPI Acm_AxDoSetBit(HAND AxisHandle, U16 DoChannel, U8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_AxDoGetBit(HAND AxisHandle, U16 DoChannel, PU8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_AxDiGetBit(HAND AxisHandle, U16 DiChannel, PU8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_AxSimStartSuspendVel(HAND AxisHandle, U16 DriDir);
|
||||||
|
U32 ADVCMNAPI Acm_AxSimStartSuspendRel(HAND AxisHandle,F64 Distance);
|
||||||
|
U32 ADVCMNAPI Acm_AxSimStartSuspendAbs(HAND AxisHandle,F64 EndPoint);
|
||||||
|
U32 ADVCMNAPI Acm_AxSimStart(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxSimStop(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxResetLatch(HAND AxisHandle);//Add for pci1245 and pci1265 [dan.yang 2011.05.05]
|
||||||
|
U32 ADVCMNAPI Acm_AxGetLatchFlag(HAND AxisHandle, PU8 LatchFlag);//Add for pci1245 and pci1265 [dan.yang 2011.05.05]
|
||||||
|
U32 ADVCMNAPI Acm_AxTriggerLatch(HAND AxisHandle); //Add for pci1245 and pci1265 [dan.yang 2011.05.10]
|
||||||
|
U32 ADVCMNAPI Acm_AxCamInAx (HAND AxisHandle, //Add for pci1245 and pci1265 [dan.yang 2011.05.10]
|
||||||
|
HAND MasAxisHandle,
|
||||||
|
F64 MasterOffset,
|
||||||
|
F64 SlaveOffset,
|
||||||
|
F64 MasterScaling,
|
||||||
|
F64 SlaveScaling,
|
||||||
|
U32 CamTableID,
|
||||||
|
U32 RefSrc);
|
||||||
|
U32 ADVCMNAPI Acm_AxGearInAx(HAND AxisHandle, //Add for pci1245 and pci1265 [dan.yang 2011.06.23]
|
||||||
|
HAND MasAxisHandle,
|
||||||
|
I32 Numerator,
|
||||||
|
I32 Denominator,
|
||||||
|
U32 RefSrc,
|
||||||
|
U32 Absolute);
|
||||||
|
U32 ADVCMNAPI Acm_AxTangentInGp (HAND AxisHandle, //Add for pci1245 and pci1265 [dan.yang 2011.06.24]
|
||||||
|
HAND MasGroupHandle,
|
||||||
|
PI16 StartVectorArray, //must three dimension
|
||||||
|
U8 Working_plane, // 0: XY plane (default), 1: YZ plane, 2: XZ plane
|
||||||
|
I16 Direction); //0: same with master group. 1:opposite
|
||||||
|
U32 ADVCMNAPI Acm_AxGantryInAx (HAND AxisHandle, //Add for pci1245 and pci1265 [dan.yang 2011.06.24]
|
||||||
|
HAND MasAxisHandle,
|
||||||
|
I16 RefMasterSrc,
|
||||||
|
I16 direction); //0: same with master axis. 1:opposite
|
||||||
|
U32 ADVCMNAPI Acm_AxPhaseAx(HAND AxisHandle, F64 Acc, F64 Dec, F64 PhaseSpeed, F64 PhaseDist);
|
||||||
|
// [12/14/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_AxChangeVelEx(HAND AxisHandle,
|
||||||
|
F64 NewVel,
|
||||||
|
F64 NewAcc,
|
||||||
|
F64 NewDec);
|
||||||
|
U32 ADVCMNAPI Acm_AxChangeVelExByRate(HAND AxisHandle,
|
||||||
|
U32 Rate, //The percentage of velocity to be changed.
|
||||||
|
F64 NewAcc, // New acceleration.
|
||||||
|
F64 NewDec); // New deceleration.
|
||||||
|
// [12/14/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_AxStopDecEx(HAND AxisHandle,
|
||||||
|
F64 NewDec);
|
||||||
|
|
||||||
|
// [10/30/2013 dan.yang]: Add compare channel
|
||||||
|
U32 ADVCMNAPI Acm_AxSetChannelCmpSetting(HAND AxisHandle, U16 ChannelID, U32 CmpSrc, U32 CmpMethod, U32 CmpPulseMode, U32 CmpPulseWidth);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetChannelCmpSetting(HAND AxisHandle, U16 ChannelID, PU32 CmpSrc, PU32 CmpMethod, PU32 CmpPulseMode, PU32 CmpPulseWidth);
|
||||||
|
U32 ADVCMNAPI Acm_AxResetChannelCmp (HAND AxisHandle, U16 ChannelID);
|
||||||
|
U32 ADVCMNAPI Acm_AxAddChannelCmpDatas(HAND AxisHandle, U16 ChannelID, PF64 TableArray, U32 ArrayCount);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetChannelCmpData(HAND AxisHandle, U16 ChannelID, PF64 CmpData);
|
||||||
|
U32 ADVCMNAPI Acm_AxLoadChannelNextData(HAND AxisHandle, U16 ChannelID);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetCmpbufferRemainCount(HAND AxisHandle, U16 ChannelID,PU32 DataCount);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxDoSetByte(HAND AxisHandle, U16 DoPort, U8 ByteData);
|
||||||
|
U32 ADVCMNAPI Acm_AxDoGetByte(HAND AxisHandle, U16 DoPort, PU8 ByteData);
|
||||||
|
U32 ADVCMNAPI Acm_AxDiGetByte(HAND AxisHandle, U16 DiPort, PU8 ByteData);
|
||||||
|
//Group operation
|
||||||
|
U32 ADVCMNAPI Acm_GpAddAxis(PHAND GpHandle,HAND AxHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpRemAxis(HAND GroupHandle, HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpClose(PHAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetState(HAND GroupHandle, PU16 State);
|
||||||
|
U32 ADVCMNAPI Acm_GpResetError(HAND GroupHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveLinearRel(HAND GroupHandle, PF64 DistanceArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveLinearAbs(HAND GroupHandle, PF64 PositionArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveDirectRel(HAND GroupHandle, PF64 DistanceArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveDirectAbs(HAND GroupHandle, PF64 PositionArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularRel(HAND GroupHandle, PF64 CenterArray, PF64 EndArray,
|
||||||
|
PU32 ArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularAbs(HAND GroupHandle, PF64 CenterArray, PF64 EndArray,
|
||||||
|
PU32 ArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularRel_3P(HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction );
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveCircularAbs_3P(HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction );
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixAbs(HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction); // [6/21/2011 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixRel(HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction); // [6/21/2011 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixAbs_3P(HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction ); // [6/21/2011 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixRel_3P(HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction ); // [6/21/2011 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpLoadPath(HAND GroupHandle, PI8 FilePath, PHAND PathHandle, PU32 pTotalCount);
|
||||||
|
U32 ADVCMNAPI Acm_GpUnloadPath(HAND GroupHandle, PHAND PathHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpMovePath(HAND GroupHandle, HAND PathHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveAllPath(PHAND GroupHandle, U32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpAddPath (HAND GroupHandle,U16 MoveCmd,U16 MoveMode,F64 FH,F64 FL,
|
||||||
|
PF64 EndPoint_DataArray,PF64 CenPoint_DataArray,PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpResetPath (PHAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetPathStatus (HAND GroupHandle, // IN, Group Handle
|
||||||
|
PU32 pCurIndex, // IN, OUT, Current index of path data in path buffer
|
||||||
|
PU32 pCurCmdFunc, // IN, OUT, Return current command function in executing
|
||||||
|
PU32 pRemainCount, // IN, OUT, Number of unexecuted path data in path
|
||||||
|
PU32 pFreeSpaceCount );
|
||||||
|
U32 ADVCMNAPI Acm_GpStopDec(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpStopEmg(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpChangeVel(HAND GroupHandle, F64 NewVelocity);
|
||||||
|
U32 ADVCMNAPI Acm_GpChangeVelByRate(HAND GroupHandle, U32 Rate);// [11/21/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpGetCmdVel(HAND GroupHandle, PF64 CmdVel); //Add for PCI1245 and PCI1265.[Dan.Yang 20110607]
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveSelPath(HAND GroupHandle, // [6/22/2011 dan.yang]
|
||||||
|
HAND PathHandle,
|
||||||
|
U32 StartIndex, // range: 0~9999
|
||||||
|
U32 EndIndex, // range: 0~9999
|
||||||
|
U8 Repeat);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetPathIndexStatus(HAND GroupHandle, // [6/22/2011 dan.yang]
|
||||||
|
U32 Index, // index of path
|
||||||
|
PU16 CmdFunc,
|
||||||
|
PU16 MoveMode,
|
||||||
|
PF64 FH,
|
||||||
|
PF64 FL,
|
||||||
|
PF64 EndPoint_DataArray,
|
||||||
|
PF64 CenPoint_DataArray,
|
||||||
|
PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_GpResumeMotion(HAND GroupHandle); // [10/12/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpPauseMotion(HAND GroupHandle); // [10/12/2012 dan.yang]
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcAbs( HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//zhaocui add 201308
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcRel( HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//zhaocui add 201308
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcAbs_V( HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 NVectorArray,
|
||||||
|
F64 Degree,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//zhaocui add 201308
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcRel_V( HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 NVectorArray,
|
||||||
|
F64 Degree,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//zhaocui add 201308
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcAbs_3P( HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction,
|
||||||
|
U16 cycCount);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMove3DArcRel_3P( HAND GroupHandle,
|
||||||
|
PF64 RefArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction,
|
||||||
|
U16 cycCount);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpAddBSplinePath(
|
||||||
|
HAND GroupHandle, // Handle
|
||||||
|
F64 FH, // Feed rate
|
||||||
|
F64 FL, // Initial feed rate
|
||||||
|
F64 *CtrlP0List, // The control points of axis 0 (X-Axis)
|
||||||
|
F64 *CtrlP1List, // The control points of axis 1 (Y-Axis)
|
||||||
|
U32 CtrlPCount, // The number of control points
|
||||||
|
F64 *NodeList, // *B-Spine knot list
|
||||||
|
U32 NodeCount, // *The number of knot
|
||||||
|
U32 Degree, // B-Spline degree
|
||||||
|
U32 CutPointCount // The number of line segments used in interpolation
|
||||||
|
);
|
||||||
|
|
||||||
|
U32 Acm_GpAddCSplinePath(
|
||||||
|
HAND GroupHandle, // Group Handle
|
||||||
|
F64 FH, // Feed rate
|
||||||
|
F64 FL, // Initial feed rate
|
||||||
|
F64 *CtrlP0List, // The control points of axis 0 (X-Axis)
|
||||||
|
F64 *CtrlP1List, // The control points of axis 1 (Y-Axis)
|
||||||
|
F64 *Tightness, //
|
||||||
|
U32 CtrlPCount, // The number of control points
|
||||||
|
U32 CutPointCount // The number of line segments used in interpolation
|
||||||
|
);
|
||||||
|
|
||||||
|
// DIO
|
||||||
|
U32 ADVCMNAPI Acm_DaqDiGetByte(HAND DeviceHandle, U16 DiPort,PU8 ByteData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDiGetBit(HAND DeviceHandle, U16 DiChannel, PU8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoSetByte(HAND DeviceHandle, U16 DoPort, U8 ByteData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoSetBit(HAND DeviceHandle, U16 DoChannel, U8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoGetByte(HAND DeviceHandle, U16 DoPort, PU8 ByteData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoGetBit(HAND DeviceHandle, U16 DoChannel, PU8 BitData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDiGetBytes(HAND DeviceHandle, U16 StartPort, U16 NumPort, PU8 ByteDataArray);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoSetBytes(HAND DeviceHandle, U16 StartPort, U16 NumPort, PU8 ByteDataArray);
|
||||||
|
U32 ADVCMNAPI Acm_DaqDoGetBytes(HAND DeviceHandle, U16 StartPort, U16 NumPort, PU8 ByteDataArray);
|
||||||
|
|
||||||
|
//AIO [Dan.Yang 2011.07.19]
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiGetRawData(HAND DeviceHandle, U16 AiChannel, PU16 AiData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiGetVoltData(HAND DeviceHandle, U16 AiChannel, PF32 AiData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiGetCurrData(HAND DeviceHandle, U16 AiChannel, PF32 AiData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiZeroCalibration(HAND DeviceHandle, U16 AiChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiSpanCalibration(HAND DeviceHandle, U16 AiChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAiGetChannelStatus(HAND DeviceHandle, U16 AiChannel, PU32 ChanStatus);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoSetRawData(HAND DeviceHandle, U16 AoChannel, U16 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoSetVoltData(HAND DeviceHandle, U16 AoChannel, F32 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoSetCurrData(HAND DeviceHandle, U16 AoChannel, F32 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoGetRawData(HAND DeviceHandle, U16 AoChannel, PU16 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoGetVoltData(HAND DeviceHandle, U16 AoChannel, PF32 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoGetCurrData(HAND DeviceHandle, U16 AoChannel, PF32 AoData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoSetCaliType(HAND DeviceHandle, U16 AoChannel, U16 TrimType);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoSetCaliValue(HAND DeviceHandle, U16 AoChannel, U16 CaliData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoCaliDone(HAND DeviceHandle, U16 AoChannel, bool done);
|
||||||
|
U32 ADVCMNAPI Acm_DaqAoCaliDefault(HAND DeviceHandle, U16 AoChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqGetIOLinkStatus(HAND DeviceHandle, PU32 pStatus); //ydd 16.2.4
|
||||||
|
|
||||||
|
//Counter [Andy.Wang 2015.04.21]
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntTriggerCmp(HAND DeviceHandle, U16 CntChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntResetLatch(HAND DeviceHandle, U16 CntChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntResetCmp(HAND DeviceHandle, U16 CntChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntResetCnt(HAND DeviceHandle, U16 CntChannel);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntGetCounterData(HAND DeviceHandle, U16 CntChannel, PI32 CounterData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntGetLatchData(HAND DeviceHandle, U16 CntChannel, PI32 LatchData);
|
||||||
|
U32 ADVCMNAPI Acm_DaqCntGetCmpData(HAND DeviceHandle, U16 CntChannel, PI32 CmpData);
|
||||||
|
|
||||||
|
//mining: Compare functions
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmpAuto(HAND AxisHandle, F64 Start, F64 End, F64 Interval);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetCmpData(HAND AxisHandle, PF64 CmpPosition);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmpData(HAND AxisHandle, F64 CmpPosition);
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmpTable(HAND AxisHandle, PF64 TableArray, I32 ArrayCount);
|
||||||
|
|
||||||
|
//Dan.Yang 2011.07.12 :Add for download Dsp Firmware program.
|
||||||
|
U32 ADVCMNAPI Acm_GetDSPFrmWareDwnLoadRate(HAND DeviceHandle, PF64 Percentage);
|
||||||
|
U32 ADVCMNAPI Acm_DevDownLoadDSPFrmWare_STP1(HAND DeviceHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevDownLoadDSPFrmWare_STP2(HAND DeviceHandle, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DevDownLoadDSPFrmWare_STP3(HAND DeviceHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_DownLoadMCU_ST2(HAND DeviceHandle, U16 CPLDNo, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DownLoadMCU_ST1(HAND DeviceHandle, U16 CPLDNo);
|
||||||
|
U32 ADVCMNAPI Acm_GetMCUDownLoadRate(HAND DeviceHandle, PF64 Percentage);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxPWMOut(HAND AxisHandle,U32 OFForON,U32 PulseCount);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetPWMOutState(HAND AxisHandle,PU32 OFForON);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_DownLoadCPLD_ST2(HAND DeviceHandle, U16 CPLDNo, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DownLoadCPLD_ST1(HAND DeviceHandle, U16 CPLDNo);
|
||||||
|
U32 ADVCMNAPI Acm_GetCPLDDownLoadRate(HAND DeviceHandle, PF64 Percentage);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqConfig(HAND DeviceHandle, U16 ChannelID, U32 Period, U32 AxisNo, U32 Method, U32 ChanType, U32 Count);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqStart(HAND DeviceHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqStop(HAND DeviceHandle);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqReset(HAND DeviceHandle, U16 ChannelID);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqGetStatus(HAND DeviceHandle, U16 ChannelID, PU16 CurrentCnt, PU8 Status);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqGetData(HAND DeviceHandle, U16 ChannelID, U16 StartIndex, U16 MaxCount, PI32 DataBuffer);
|
||||||
|
U32 ADVCMNAPI Acm_DevMDaqGetConfig(HAND DeviceHandle, U16 ChannelID, PU32 Period, PU32 AxisNo, PU32 Method, PU32 ChanType, PU32 Count);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxReadLatchBuffer(HAND AxisHandle, PF64 LatchDataArray, PU32 DataCnt);
|
||||||
|
U32 ADVCMNAPI Acm_AxResetLatchBuffer(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxGetLatchBufferStatus(HAND AxisHandle, PU32 RemainCnt, PU32 SpaceCnt);
|
||||||
|
|
||||||
|
//******************SCARA Robot*************************************************/
|
||||||
|
U32 Acm_GpRbSetMode(HAND GroupHandle, U16 Mode, PI32 CurActPosiArray, U32 ArrayElement);
|
||||||
|
U32 Acm_GpRbGetCmdPosition(HAND GroupHandle, PF64 PositionArray, U32 ArrayElement);
|
||||||
|
U32 Acm_GpRbGetActualPosition(HAND GroupHandle, PF64 PositionArray, U32 ArrayElement);
|
||||||
|
U32 Acm_GpRbGetArmCmdPosition(HAND GroupHandle, U16 ArmID, PF64 CurPosi);
|
||||||
|
U32 Acm_GpRbGetArmActualPosition(HAND GroupHandle, U16 ArmID, PF64 CurPosi);
|
||||||
|
//******************************************************************************/
|
||||||
|
|
||||||
|
//add by dujunling on 2012.11.22,for GM code function ,
|
||||||
|
U32 ADVCMNAPI Acm_GmOpen( IN HAND DeviceHandle, OUT PHAND GMSHandle );
|
||||||
|
U32 ADVCMNAPI Acm_GmClose(IN HAND GMSHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmLoadJob(IN HAND GMSHandle, IN PI8 JobFilePath, OUT PU32 ErrorRow);
|
||||||
|
U32 ADVCMNAPI Acm_GmUploadJob( IN HAND GMSHandle, IN OUT PI8 GCodeBuffer, IN OUT PU32 GCodeLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmResetJob( IN HAND GMSHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmCommand(IN HAND GMSHandle, IN PI8 InputCmd);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmRemoveAxisFromSystem(IN HAND GMSHandle, IN U32 uAxisId);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetCompensationRadius(IN HAND GMSHandle, IN U32 DValue,IN F64 Radius);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCompensationRadius(IN HAND GMSHandle, OUT PU32 pCRArray,IN OUT PU32 pCRArrayLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetCurrentCompensationRadius(IN HAND GMSHandle, IN F64 Radius);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentCompensationRadius(IN HAND GMSHandle, IN OUT PF64 pCRadius);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetToolLengthOffset(IN HAND GMSHandle, IN U32 HValue,IN F64 ToolLengthOffset);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetToolLengthOffset(IN HAND GMSHandle, OUT PU32 pTLOArray,IN OUT PU32 pTLOArrayLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetCurrentToolLengthOffset(IN HAND GMSHandle,IN F64 ToolLengthOffset);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentToolLengthOffset(IN HAND GMSHandle, IN OUT PF64 pToolLengthOffset);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetMacro(IN HAND GMSHandle, IN U32 uMacroCmd,IN const PI8 MacroCmdContent);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetMacro(IN HAND GMSHandle, IN U32 uMacroCmd,OUT PI8 pMacroCmdContent,IN OUT PU32 pMacroCmdContentLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetMacroArray(IN HAND GMSHandle,OUT PU32 pMacroArray,IN OUT PU32 pMacroArrayLength);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetPreCustomFunction(IN HAND GMSHandle, IN U32 (*ptrPreCustomFunction)(const U32 CustomMCommand,U32 TWordValue,bool &bDone));
|
||||||
|
U32 ADVCMNAPI Acm_GmSetFinalCustomFunction(IN HAND GMSHandle, IN U32 (*ptrFinalCustomFunction)(const U32 CustomMCommand,U32 TWordValue,bool &bDone));
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetExtDoFunction(IN HAND GMSHandle, IN U32 (*ptrExtDoFunction)(U32 uDoCh,U32 uDoLevel));
|
||||||
|
U32 ADVCMNAPI Acm_GmSetExtDiFunction(IN HAND GMSHandle, IN U32 (*ptrExtDiFunction)(U32 uDiCh));
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetBreakPoint(IN HAND GMSHandle, IN U32 uBreakPoint);
|
||||||
|
U32 ADVCMNAPI Acm_GmAddBreakPoint(IN HAND GMSHandle, IN U32 uBreakPoint);
|
||||||
|
U32 ADVCMNAPI Acm_GmRemoveBreakPoint(IN HAND GMSHandle, IN U32 uBreakPoint);
|
||||||
|
U32 ADVCMNAPI Acm_GmClearBreakPoint(IN HAND GMSHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetSpindleRatio(IN HAND GMSHandle, IN F64 fSpindleRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetJogRatio(IN HAND GMSHandle, IN F64 fJogRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetFastFeedRateRatio(IN HAND GMSHandle, IN U32 uAxis,IN F64 fFastFeedRateRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetFastFeedRateRatio(IN HAND GMSHandle, IN U32 uAxis,OUT PF64 pFastFeedRateRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetFeedRateRatio(IN HAND GMSHandle, IN F64 fFeedRateRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetFeedRateRatio(IN HAND GMSHandle, OUT PF64 pFeedRateRatio);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetFeedRate(IN HAND GMSHandle, IN F64 fFeedRate);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetFeedRate(IN HAND GMSHandle, IN PF64 pFeedRate);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetFastFeedRate(IN HAND GMSHandle, IN F64 fFastFeedRate);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetFastFeedRate(IN HAND GMSHandle, OUT PF64 pFastFeedRate);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetOptionPause(IN HAND GMSHandle, IN U32 uOptionPause);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetOptionPause(IN HAND GMSHandle, OUT PU32 pOptionPause);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetOptionSkip(IN HAND GMSHandle, IN U32 uOptionSkip);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetOptionSkip(IN HAND GMSHandle, OUT PU32 pOptionSkip);
|
||||||
|
U32 ADVCMNAPI Acm_GmSetModuleRange(IN HAND GMSHandle, IN U32 ModuleRange);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetModuleRange(IN HAND GMSHandle, IN PU32 pModuleRange);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentFeedRate(IN HAND GMSHandle, OUT PF64 pCurrentFeedRate);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentRow(IN HAND GMSHandle, OUT PU32 CurrentRow);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetErrorRow(IN HAND GMSHandle, OUT PU32 ErrorRow);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentCommand(IN HAND GMSHandle, OUT PI8 CurrentCmd, IN OUT PU32 CurrentCmdLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetState(IN HAND GMSHandle, OUT PU32 GmsState);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetPattern(IN HAND GMSHandle, IN U32 GmsPatternId, PVOID Buffer, PU32 BufferLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetCurrentCoordinateSystem(IN HAND GMSHandle, OUT PU32 pCurrentCoordinateIndex,OUT PF64 pCoordinateArray,IN OUT PU32 pArrayLength);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetError(IN HAND GMSHandle, OUT PU32 ErrorCode, OUT PU32 LastError);
|
||||||
|
U32 ADVCMNAPI Acm_GmDxfToGCodeTextEx(IN PI8 DxfFilePath, IN F64 DxfProportion, IN U32 Ellipse_Cut_Min_Angel , IN U32 Spline_Cut_Step ,OUT PI8 GCodeBuffer, IN OUT PU32 Length);
|
||||||
|
U32 ADVCMNAPI Acm_GmDxfToGCodeText(IN PI8 DxfFilePath, IN F64 DxfProportion, OUT PI8 GCodeBuffer, IN OUT PU32 Length);
|
||||||
|
U32 ADVCMNAPI Acm_GmDxfToGCodeFileEx(IN PI8 DxfFilePath, IN F64 DxfProportion,IN U32 Ellipse_Cut_Min_Angel , IN U32 Spline_Cut_Step ,IN PI8 GcodeFilePath,OUT PU32 Length);
|
||||||
|
U32 ADVCMNAPI Acm_GmDxfToGCodeFile(IN PI8 DxfFilePath, IN F64 DxfProportion,IN PI8 GcodeFilePath,PU32 Length);
|
||||||
|
|
||||||
|
//Added by W.Y.Z on 2014.08.28 for P point function
|
||||||
|
U32 ADVCMNAPI Acm_GmSetPoint(IN HAND GMSHandle, IN U32 id, IN PF64 fPoint);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetPoint(IN HAND GMSHandle, IN U32 id,OUT PF64 fPoint);
|
||||||
|
U32 ADVCMNAPI Acm_GmLoadPoint(IN HAND GMSHandle, IN PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_GmSavePoint(IN HAND GMSHandle, IN PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_GmResetPoint(IN HAND GMSHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GmSetPointF(IN HAND GMSHandle, IN U32 id, IN PF64 fPoint,IN U32 filterFlag);
|
||||||
|
U32 ADVCMNAPI Acm_GmGetPointF(IN HAND GMSHandle, IN U32 id,OUT PF64 fPoint,OUT PU32 filterflag);
|
||||||
|
//U32 ADVCMNAPI Acm_GmLoadPointF(IN HAND GMSHandle, IN PI8 FilePath);
|
||||||
|
//U32 ADVCMNAPI Acm_GmSavePointF(IN HAND GMSHandle, IN PI8 FilePath);
|
||||||
|
//U32 ADVCMNAPI Acm_GmResetPointF(IN HAND GMSHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixRel_Angle(HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//added by zhaocui 201305
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveHelixAbs_Angle(HAND GroupHandle,
|
||||||
|
PF64 CenterArray,
|
||||||
|
PF64 EndArray,
|
||||||
|
PU32 pArrayElements,
|
||||||
|
I16 Direction);//added by zhaocui 201305
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxSetPWMTableOnTime(HAND AxisHandle, PU32 TimeTableArray, I32 ArrayCount);//zhaocui add
|
||||||
|
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxGetINxStopStatus(HAND AxisHandle,PU32 Stop_Flag);// [2/28/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_AxResetINxStopStatus(HAND AxisHandle);// [2/28/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_GpGetINxStopStatus(HAND GroupHandle,PU32 Stop_Flag);// [2/28/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_GpResetINxStopStatus(HAND GroupHandle);// [2/28/2014 deng]
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxJog(HAND AxisHandle,U16 Direction); //[5/22/2014 kai.yang]
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmpDO(HAND AxisHandle,U32 OFForON);// [12/3/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_AxDownloadTorqueTable (HAND AxisHandle, PF64 pPositionArray, PF64 pTorqueArray, U32 ArrayElements); //[8/6/2015 andy.wang]
|
||||||
|
U32 ADVCMNAPI Acm_AxLoadTorqueTableFile(HAND AxisHandle, PI8 FilePath, PU32 PointsCount); //[8/6/2015 andy.wang]
|
||||||
|
U32 ADVCMNAPI Acm_AxResetPVTTable(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxLoadPVTTable(HAND AxisHandle, U16 Num, PF64 Pos, PF64 Vel, PF64 Time);
|
||||||
|
U32 ADVCMNAPI Acm_AxStartPVT(HAND AxisHandle, U16 rNum);
|
||||||
|
U32 ADVCMNAPI Acm_AxCheckPTBuffer(HAND AxisHandle,U16* remainblock);
|
||||||
|
U32 ADVCMNAPI Acm_AxAddPTData(HAND AxisHandle, F64 Pos, F64 time);
|
||||||
|
U32 ADVCMNAPI Acm_AxStartPT(HAND AxisHandle, U8 BfMode, U16 rNum);
|
||||||
|
U32 ADVCMNAPI Acm_AxResetPTData(HAND AxisHandle);
|
||||||
|
U32 ADVCMNAPI Acm_AxAddPVAData(HAND AxisHandle, F64 Position, PF64 VelArray, PF64 AccArray, PF64 DecArray, U32 ArrayElements);
|
||||||
|
|
||||||
|
//zhao cui add for robot 201307
|
||||||
|
U32 ADVCMNAPI Acm_RbGetActualPosition(HAND RbHandle, PF64 PositionArray, U32 ArrayElement);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetCmdPosition(HAND RbHandle, PF64 PositionArray, U32 ArrayElement);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetArmActualPosition(HAND RbHandle, U16 ArmID, PF64 CurPosi);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetArmCmdPosition(HAND RbHandle, U16 ArmID, PF64 CurPosi);
|
||||||
|
U32 ADVCMNAPI Acm_RbOpen (HAND DeviceHandle,PHAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbClose (PHAND pRbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbResetError (HAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetState (HAND RbHandle, PU16 PStates);
|
||||||
|
U32 ADVCMNAPI Acm_RbSetActPosition (HAND RbHandle, PF64 PositionArray, U32 ArrayElement);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveRel(HAND RbHandle, PF64 PosArray, PU32 ArrayElement);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveAbs(HAND RbHandle, PF64 PosArray, PU32 ArrayElement);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveDirectRel (HAND RbHandle, PF64 PositionArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveDirectAbs (HAND RbHandle, PF64 PositionArray, PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveLinearRel( HAND RbHandle,PF64 PositionArray,PU32 pArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveLinearAbs( HAND RbHandle,PF64 PositionArray,PU32 pArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveArcAbs( HAND RbHandle,PF64 CenterArray,PF64 EndArray,PU32 pArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveArcRel( HAND RbHandle,PF64 CenterArray,PF64 EndArray,PU32 pArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveArcRel_3P ( HAND RbHandle,PF64 RefArray,PF64 EndArray,PU32 pArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveArcAbs_3P ( HAND RbHandle,PF64 RefArray,PF64 EndArray,PU32 pArrayElements, I16 Direction);
|
||||||
|
U32 ADVCMNAPI Acm_RbAddPath (HAND RbHandle,U16 MoveCmd,U16 MoveMode,F64 FH,F64 FL,
|
||||||
|
PF64 EndPoint_DataArray,PF64 CenPoint_DataArray,PU32 ArrayElements);
|
||||||
|
U32 ADVCMNAPI Acm_RbResetPath (PHAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetPathStatus (HAND RbHandle, // IN, Group Handle
|
||||||
|
PU32 pCurIndex, // IN, OUT, Current index of path data in path buffer
|
||||||
|
PU32 pCurCmdFunc, // IN, OUT, Return current command function in executing
|
||||||
|
PU32 pRemainCount, // IN, OUT, Number of unexecuted path data in path
|
||||||
|
PU32 pFreeSpaceCount );
|
||||||
|
U32 ADVCMNAPI Acm_RbMovePath(HAND RbHandle, HAND PathHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbChangeVel(HAND RbHandle, F64 NewVelocity);
|
||||||
|
U32 ADVCMNAPI Acm_RbChangeVelByRate(HAND RbHandle, U32 Rate);
|
||||||
|
U32 ADVCMNAPI Acm_RbGetCmdVel(HAND RbHandle, PF64 CmdVel);
|
||||||
|
U32 ADVCMNAPI Acm_RbStopDec ( HAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbStopEmg(HAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbPauseMotion(HAND RbHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbResumeMotion(HAND RbHandle);
|
||||||
|
bool IsGMSHandleValid(HAND GMSHandle);
|
||||||
|
U32 ADVCMNAPI Acm_RbLoadPath(HAND RbHandle, PI8 FilePath, PHAND PathHandle, PU32 pTotalCount);// [6/26/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbUnloadPath(HAND RbHandle, PHAND PathHandle);// [6/26/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbMoveSelPath(HAND RbHandle,
|
||||||
|
HAND PathHandle,
|
||||||
|
U32 StartIndex, // range: 0~9999
|
||||||
|
U32 EndIndex, // range: 0~9999
|
||||||
|
U8 Repeat);// [6/26/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbGetPathIndexStatus(HAND RbHandle,
|
||||||
|
U32 Index, // index of path
|
||||||
|
PU16 CmdFunc,
|
||||||
|
PU16 MoveMode,
|
||||||
|
PF64 FH,
|
||||||
|
PF64 FL,
|
||||||
|
PF64 EndPoint_DataArray,
|
||||||
|
PF64 CenPoint_DataArray,
|
||||||
|
PU32 ArrayElements);// [6/26/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbSetExtDrive(HAND RbHandle, U16 ExtDrvMode);// [7/3/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbJog(HAND RbHandle,U16 Direction);// [7/3/2014 deng]
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_ServoSetCom(U32 ComPortID, U32 Baudrate, U32 Timeout);// [7/17/2014 yang.kai]
|
||||||
|
U32 ADVCMNAPI Acm_ServoGetAbsPosition(
|
||||||
|
U32 ComPortID,
|
||||||
|
U32 ServoType,
|
||||||
|
U32 ServoID,
|
||||||
|
U32 ServoAbsResolution,
|
||||||
|
U32 ServoCmdResolution,
|
||||||
|
U32 EncoderDir,
|
||||||
|
PF64 AbsPosition
|
||||||
|
); // [7/17/2014 yang.kai]
|
||||||
|
U32 ADVCMNAPI Acm_AxSetCmdPosi_Pulse(HAND AxisHandle,F64 Position); // [7/17/2014 yang.kai]
|
||||||
|
U32 ADVCMNAPI Acm_AxMoveAbs_EC(HAND AxisHandle, F64 Position);// [8/18/2014 deng]
|
||||||
|
U32 ADVCMNAPI Acm_RbGetWorldPosFromJoint(HAND RbHandle,PF64 JointPosArray, PF64 WorldPosArray); // [8/12/2014 yang.kai]
|
||||||
|
U32 ADVCMNAPI Acm_GetDevNum(U32 DevType,U32 BoardID,PU32 DeviceNumber); // [9/2/2014 yang.kai]
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveArcRel_Angle(HAND GroupHandle, // [9/22/2014 yang.kai]
|
||||||
|
PF64 CenterArray,
|
||||||
|
F64 Degree,
|
||||||
|
PU32 ArrayElements,
|
||||||
|
I16 Direction);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpMoveArcAbs_Angle(HAND GroupHandle, // [9/22/2014 yang.kai]
|
||||||
|
PF64 CenterArray,
|
||||||
|
F64 Degree,
|
||||||
|
PU32 ArrayElements,
|
||||||
|
I16 Direction);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_AxChangeCmpIndex(HAND AxisHandle, // [9/22/2014 yang.kai]
|
||||||
|
U32 CmpIndex);
|
||||||
|
|
||||||
|
//mapping
|
||||||
|
U32 ADVCMNAPI Acm_DevSaveMapFile(HAND DeviceHandle, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DevLoadMapFile(HAND DeviceHandle, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DevUpLoadMapInfo(HAND DeviceHandle, U16 MapType, PDEV_IO_MAP_INFO MapInfoArray, PU32 ArrayLength);
|
||||||
|
U32 ADVCMNAPI Acm_DevDownLoadMapInfo(HAND DeviceHandle, U16 MapType, PDEV_IO_MAP_INFO MapInfoArray, U32 ArrayLength);
|
||||||
|
//SDO
|
||||||
|
U32 ADVCMNAPI Acm_DevWriteSDOData(HAND DeviceHandle, IN U16 RingNo, IN U16 SlaveIP, IN U16 Index, IN U16 SubIndex, IN U16 Type, IN U16 DataSize, IN VOID *pValue);
|
||||||
|
U32 ADVCMNAPI Acm_DevReadSDOData(HAND DeviceHandle, IN U16 RingNo, IN U16 SlaveIP, IN U16 Index, IN U16 SubIndex, IN U16 Type, IN U16 DataSize, OUT VOID *pValue);
|
||||||
|
|
||||||
|
//ARES
|
||||||
|
U32 ADVCMNAPI Acm_DevDownloadAres(HAND DeviceHandle, PI8 FilePath);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetAresVariable(HAND DeviceHandle, U32 Address, PF64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_DevSetAresVariable(HAND DeviceHandle, U32 Address, F64 Value);
|
||||||
|
U32 ADVCMNAPI Acm_DevGetDownloadedAresName(HAND DeviceHandle, PDEV_ARES_INFO FileName, PU32 Count);
|
||||||
|
U32 ADVCMNAPI Acm_DevDeleteAresFile(HAND DeviceHandle, PI8 FileName);
|
||||||
|
U32 ADVCMNAPI Acm_DevClearAresFile(HAND DeviceHandle);
|
||||||
|
|
||||||
|
U32 ADVCMNAPI Acm_GpGetRunningAresName(HAND GroupHandle, PI8 FileName);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetAresState(HAND GroupHandle, PU16 pState);
|
||||||
|
U32 ADVCMNAPI Acm_GpLoadAresProgram(HAND GroupHandle, PI8 FileName);
|
||||||
|
U32 ADVCMNAPI Acm_GpRunAres(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpHoldAres(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpStopAres(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetAresCrc(HAND GroupHandle, PU32 Crc);
|
||||||
|
U32 ADVCMNAPI Acm_GpStepAres(HAND GroupHandle, U32 Offset);
|
||||||
|
U32 ADVCMNAPI Acm_GpSetAresBreakPoint(HAND GroupHandle, U32 Offset);
|
||||||
|
U32 ADVCMNAPI Acm_GpRemoveAresBreakPoint(HAND GroupHandle, U32 Offset);
|
||||||
|
U32 ADVCMNAPI Acm_GpClearAresBreakPoints(HAND GroupHandle);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetAresBreakPoints(HAND GroupHandle, PU32 Breakpoints, PU32 Count);
|
||||||
|
U32 ADVCMNAPI Acm_GpGetAresNextOffset(HAND GroupHandle, PU32 Offset);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "ApplicationPriority.h"
|
||||||
|
#include "PropertieMgr.h"
|
||||||
|
#include "Propertie.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "AuthorityMgr.h"
|
||||||
|
|
||||||
|
CAppPriorityMgr *gAppPriorityMgr = new CAppPriorityMgr;
|
||||||
|
|
||||||
|
CAppPriorityMgr::CAppPriorityMgr(void)
|
||||||
|
{
|
||||||
|
m_bGetHighestPriority = false;//是否在打开软件时获取最高优先级
|
||||||
|
}
|
||||||
|
CAppPriorityMgr::~CAppPriorityMgr(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CMFCPropertyGridProperty *CAppPriorityMgr::CreatGridProperty()
|
||||||
|
{
|
||||||
|
CString PropertyName;//属性名称
|
||||||
|
CString Description;//描述
|
||||||
|
CString Path = _T("AppPriority");//存储路径
|
||||||
|
CString Name;
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
PropertyName = _T("程序优先级");
|
||||||
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bGetHighestPriority");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bGetHighestPriority);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("最高优先级");
|
||||||
|
Description = _T("是否将程序优先级提升致系统最高级别,设置后需要重启软件");
|
||||||
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bGetHighestPriority, Description);
|
||||||
|
pGroup->AddSubItem(p);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
return pGroup;
|
||||||
|
}
|
||||||
|
void CAppPriorityMgr::ExportPar(ofstream *pFile)
|
||||||
|
{
|
||||||
|
(*pFile)<<"[模块] [CAppPriorityMgr]------------------------------------------------"<<endl;
|
||||||
|
(*pFile)<<"[最高优先级][m_bGetHighestPriority] = "<<m_bGetHighestPriority<<endl;
|
||||||
|
}
|
||||||
|
void CAppPriorityMgr::Ini()
|
||||||
|
{
|
||||||
|
if(m_bGetHighestPriority)
|
||||||
|
{
|
||||||
|
//获取最高权限
|
||||||
|
GetHighestPriority();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取最高权限
|
||||||
|
void CAppPriorityMgr::GetHighestPriority()
|
||||||
|
{
|
||||||
|
CString str = "[result] [进程获取系统最高优先级OK]";
|
||||||
|
//提升当前程序的优先级
|
||||||
|
if(SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS ))
|
||||||
|
{
|
||||||
|
str += "成功";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str += "失败";
|
||||||
|
gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "module.h"
|
||||||
|
#include "EnumPropertieType.h"
|
||||||
|
|
||||||
|
//程序的优先级管理
|
||||||
|
class CAppPriorityMgr :public CModule
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAppPriorityMgr(void);
|
||||||
|
~CAppPriorityMgr(void);
|
||||||
|
virtual void Ini();
|
||||||
|
virtual MODULE GetModuleType(){return _APP_PRIORITY_PROP;};
|
||||||
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
||||||
|
virtual void ExportPar(ofstream *pFile);
|
||||||
|
private:
|
||||||
|
void GetHighestPriority();
|
||||||
|
private:
|
||||||
|
bool m_bGetHighestPriority;//是否在打开软件时获取最高优先级
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CAppPriorityMgr *gAppPriorityMgr;
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "ArrayMgr.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
#include "CommandArray.h"
|
||||||
|
#include "CommandMgr.h"
|
||||||
|
|
||||||
|
|
||||||
|
CArrayMgr::CArrayMgr(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CArrayMgr::~CArrayMgr(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CArrayMgr::Creat(SArrayPar &ArrayPar)
|
||||||
|
{
|
||||||
|
//初始化
|
||||||
|
m_ObjContainer.Clear();
|
||||||
|
if(ArrayPar.m_bRectArray)
|
||||||
|
{
|
||||||
|
RectCreat(ArrayPar);
|
||||||
|
}
|
||||||
|
else if(ArrayPar.m_bCircleArray)
|
||||||
|
{
|
||||||
|
CircleCreat(ArrayPar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FillCreat(ArrayPar);
|
||||||
|
}
|
||||||
|
//创建指令
|
||||||
|
CreatCmd();
|
||||||
|
}
|
||||||
|
//矩形阵列方式
|
||||||
|
void CArrayMgr::RectCreat(SArrayPar &ArrayPar)
|
||||||
|
{
|
||||||
|
//按照指定个数每次克隆一个obj 到m_ObjContainer 中
|
||||||
|
for(int i=0;i<ArrayPar.m_ArrayCntV;i++)
|
||||||
|
{
|
||||||
|
for(int j=0;j<ArrayPar.m_ArrayCntH;j++)
|
||||||
|
{
|
||||||
|
//导入当前选择的obj (此时为选择状态)
|
||||||
|
GetLayerInstance().CloneObj(m_ObjContainer,true);
|
||||||
|
//移动到阵列的位置--------------------------------------
|
||||||
|
SObjOperatePar par;
|
||||||
|
par.OpType = _OP_MOVE;
|
||||||
|
par.MoveX = ArrayPar.m_ArrayOffsetV*i;
|
||||||
|
par.MoveY = ArrayPar.m_ArrayOffsetH*j;
|
||||||
|
m_ObjContainer.OperateObj(par,true);
|
||||||
|
//操作完成后变为非选择状态
|
||||||
|
m_ObjContainer.NotSelAllObj();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//圆形阵列方式
|
||||||
|
void CArrayMgr::CircleCreat(SArrayPar &ArrayPar)
|
||||||
|
{
|
||||||
|
//先X 方向阵列,在偏移旋转成圆形-----------------------------------------------------
|
||||||
|
//计算圆的周长
|
||||||
|
double Perimeter = 2*PI*ArrayPar.m_Radius;
|
||||||
|
//计算阵列间隔
|
||||||
|
ArrayPar.m_ArrayCntH = 1;//1行
|
||||||
|
ArrayPar.m_ArrayCntV = ArrayPar.m_ArrayCnt;//1行
|
||||||
|
ArrayPar.m_ArrayOffsetV = Perimeter*(ArrayPar.m_GapAngle/360);
|
||||||
|
ArrayPar.m_ArrayOffsetH = 0;
|
||||||
|
RectCreat(ArrayPar);
|
||||||
|
|
||||||
|
//计算出圆心点
|
||||||
|
DbRect AllCharRect = m_ObjContainer.GetObjRect(false);//所有obj 的范围
|
||||||
|
//底部中心点
|
||||||
|
Dbxy BottomCenterPt = AllCharRect.GetBottomCenterPt();
|
||||||
|
Dbxy CenterPt;//圆心点
|
||||||
|
CenterPt.x = BottomCenterPt.x;
|
||||||
|
CenterPt.y = BottomCenterPt.y - ArrayPar.m_Radius;
|
||||||
|
|
||||||
|
//依次旋转偏移到合适的位置
|
||||||
|
int size = m_ObjContainer.GetSize();
|
||||||
|
for(int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
DbRect ObjRect = m_ObjContainer.GetObjRect(i);
|
||||||
|
Dbxy pt = ObjRect.GetBottomCenterPt();
|
||||||
|
//旋转角度(360)
|
||||||
|
double angle = 360*(BottomCenterPt.x-pt.x)/Perimeter;
|
||||||
|
//旋转后的点
|
||||||
|
Dbxy pt2 = RotatoPt(BottomCenterPt,_360ToAngle(angle),CenterPt);
|
||||||
|
//计算偏移量
|
||||||
|
double OffsetX = pt2.x-pt.x;
|
||||||
|
double OffsetY = pt2.y-pt.y;
|
||||||
|
|
||||||
|
//旋转字符
|
||||||
|
SObjOperatePar par;
|
||||||
|
par.OpType = _OP_ROTATO;
|
||||||
|
par.BasePt = ObjRect.GetCenterPt();
|
||||||
|
par.Angle = angle;
|
||||||
|
m_ObjContainer.Operate(par,i);
|
||||||
|
//偏移字符
|
||||||
|
par.OpType = _OP_MOVE;
|
||||||
|
par.MoveX = OffsetX;
|
||||||
|
par.MoveY = OffsetY;
|
||||||
|
m_ObjContainer.Operate(par,i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CArrayMgr::FillCreat(SArrayPar &ArrayPar)
|
||||||
|
{
|
||||||
|
for(int k=0;k<=ArrayPar.m_FillCnt;k++)
|
||||||
|
{
|
||||||
|
bool flg = false;
|
||||||
|
//导入当前选择的obj (此时为选择状态)
|
||||||
|
GetLayerInstance().CloneObj(m_ObjContainer,true);
|
||||||
|
DbRect Rect = m_ObjContainer.GetObjRect(false);//所有obj 的范围
|
||||||
|
double w = Rect.Width();
|
||||||
|
{
|
||||||
|
SObjOperatePar par;
|
||||||
|
par.OpType = _OP_STRETCH;
|
||||||
|
par.BasePt = Rect.GetCenterPt();
|
||||||
|
par.OldSize = Rect.Width();
|
||||||
|
par.Diff = ArrayPar.m_FillOffset*k;
|
||||||
|
par.NewSize = par.OldSize + par.Diff;
|
||||||
|
if(par.NewSize < ArrayPar.m_FillOffset)
|
||||||
|
flg = true;
|
||||||
|
par.xy = _X;
|
||||||
|
m_ObjContainer.OperateObj(par,true);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
SObjOperatePar par;
|
||||||
|
par.OpType = _OP_STRETCH;
|
||||||
|
par.BasePt = Rect.GetCenterPt();
|
||||||
|
par.OldSize = Rect.Height();
|
||||||
|
par.Diff = ArrayPar.m_FillOffset*k;
|
||||||
|
par.NewSize = par.OldSize + par.Diff;
|
||||||
|
if(par.NewSize < ArrayPar.m_FillOffset)
|
||||||
|
flg = true;
|
||||||
|
par.xy = _Y;
|
||||||
|
m_ObjContainer.OperateObj(par,true);
|
||||||
|
}
|
||||||
|
//操作完成后变为非选择状态
|
||||||
|
m_ObjContainer.NotSelAllObj();
|
||||||
|
if(flg)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建指令
|
||||||
|
void CArrayMgr::CreatCmd()
|
||||||
|
{
|
||||||
|
if(!m_ObjContainer.Empty())
|
||||||
|
{
|
||||||
|
//创建撤销指令-------start
|
||||||
|
CCommandArray *pCmd = new CCommandArray;
|
||||||
|
gCommandMgr.AddUndoCommand(pCmd,m_ObjContainer.GetObjVec());
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
pCmd->SaveBaseObj(layer.GetObjContainer());
|
||||||
|
//创建撤销指令-------end
|
||||||
|
pCmd->Excute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ObjContainer.h"
|
||||||
|
//阵列用参数
|
||||||
|
struct SArrayPar{
|
||||||
|
public:
|
||||||
|
SArrayPar()
|
||||||
|
{
|
||||||
|
m_bRectArray = true;//是否为矩形阵列
|
||||||
|
m_bCircleArray = false;
|
||||||
|
m_bFillArray = false;
|
||||||
|
m_ArrayCntH = 10;//阵列行数
|
||||||
|
m_ArrayCntV = 10;//阵列行数
|
||||||
|
m_ArrayOffsetH = 1;//横向间距
|
||||||
|
m_ArrayOffsetV = 1;//纵向间距
|
||||||
|
|
||||||
|
m_ArrayCnt = 36;//圆形阵列的数量
|
||||||
|
m_Radius = 10;//阵列半径
|
||||||
|
m_StartAngle = 90;//阵列开始角度
|
||||||
|
m_GapAngle = 10;//阵列间隔角度(360 度角)
|
||||||
|
|
||||||
|
m_FillOffset = -0.1;
|
||||||
|
m_FillCnt = 1000;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
bool m_bRectArray;//是否为矩形阵列
|
||||||
|
bool m_bCircleArray;
|
||||||
|
bool m_bFillArray;
|
||||||
|
|
||||||
|
int m_ArrayCntH;//阵列行数
|
||||||
|
int m_ArrayCntV;//阵列列数
|
||||||
|
double m_ArrayOffsetH;//横向间距
|
||||||
|
double m_ArrayOffsetV;//纵向间距
|
||||||
|
|
||||||
|
int m_ArrayCnt;//圆形阵列的数量
|
||||||
|
double m_Radius;//阵列半径
|
||||||
|
double m_StartAngle;//阵列开始角度(360 度角)
|
||||||
|
double m_GapAngle;//阵列间隔角度(360 度角)
|
||||||
|
|
||||||
|
double m_FillOffset;
|
||||||
|
int m_FillCnt;
|
||||||
|
};
|
||||||
|
class CArrayMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CArrayMgr(void);
|
||||||
|
~CArrayMgr(void);
|
||||||
|
void Creat(SArrayPar &par);
|
||||||
|
private:
|
||||||
|
void RectCreat(SArrayPar &ArrayPar);
|
||||||
|
void CircleCreat(SArrayPar &ArrayPar);
|
||||||
|
void FillCreat(SArrayPar &ArrayPar);
|
||||||
|
void CreatCmd();
|
||||||
|
private:
|
||||||
|
CObjContainer m_ObjContainer;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,285 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "AuthorityMgr.h"
|
||||||
|
#include "MsgBox.h"
|
||||||
|
#include "FileMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "PropertieMgr.h"
|
||||||
|
#include "Propertie.h"
|
||||||
|
|
||||||
|
#define LAIPU_NAME "laipu"
|
||||||
|
#define LAIPU_PASSWORD "laipu"
|
||||||
|
#define FILE_PATH _T("\\Parameter\\Authority\\Authority.par")
|
||||||
|
|
||||||
|
bool CompareUser(CAccount Account1,CAccount Account2)
|
||||||
|
{
|
||||||
|
return Account1.m_Authority>Account2.m_Authority;
|
||||||
|
}
|
||||||
|
CAuthorityMgr *gAuthorityMgr = new CAuthorityMgr;
|
||||||
|
CAuthorityMgr::CAuthorityMgr(void)
|
||||||
|
{
|
||||||
|
m_CurAuthority = _USER;//当前权限
|
||||||
|
m_AutoFactory = false;//打开软件自动升级到管理员权限
|
||||||
|
}
|
||||||
|
CAuthorityMgr::~CAuthorityMgr(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CMFCPropertyGridProperty *CAuthorityMgr::CreatGridProperty()
|
||||||
|
{
|
||||||
|
CString PropertyName;//属性名称
|
||||||
|
CString Description;//描述
|
||||||
|
CString Path = _T("AuthorityMgr");//存储路径
|
||||||
|
CString Name;
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
PropertyName = _T("程序权限");
|
||||||
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_AutoFactory");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_AutoFactory);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("厂家权限");
|
||||||
|
Description = _T("打开软件时自动获得厂家权限,调试用");
|
||||||
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_AutoFactory, Description);
|
||||||
|
pGroup->AddSubItem(p);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
return pGroup;
|
||||||
|
}
|
||||||
|
void CAuthorityMgr::Ini()
|
||||||
|
{
|
||||||
|
SaveOrLoad(false);//读取文件
|
||||||
|
if(m_AutoFactory)
|
||||||
|
m_CurAuthority = _FACTORY;
|
||||||
|
}
|
||||||
|
//检查当前权限
|
||||||
|
bool CAuthorityMgr::CheckAuthority(AUTHORITY_TYPE authority,bool bShowMsgbox)
|
||||||
|
{
|
||||||
|
if((int)m_CurAuthority >= (int)authority)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(bShowMsgbox)
|
||||||
|
{
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
CString str = "需要["+GetAccountName(authority) + "]权限!";
|
||||||
|
MsgBox.Show(str, true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//是否登录
|
||||||
|
bool CAuthorityMgr::IsLogin()
|
||||||
|
{
|
||||||
|
return m_CurAuthority != _NO_LOGIN;
|
||||||
|
}
|
||||||
|
//锁定用户,权限变成未登录
|
||||||
|
void CAuthorityMgr::Lock()
|
||||||
|
{
|
||||||
|
SetAuthority(_NO_LOGIN);
|
||||||
|
m_CurUserName = "空";
|
||||||
|
}
|
||||||
|
//登录
|
||||||
|
bool CAuthorityMgr::Login(CString name,CString PassWord)
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
AUTHORITY_TYPE authority = GetCurAuthority();
|
||||||
|
if(name == LAIPU_NAME && PassWord == LAIPU_PASSWORD)
|
||||||
|
{
|
||||||
|
ret = true;
|
||||||
|
authority = _FACTORY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vector<CAccount>::iterator iter = m_UserVec.begin();
|
||||||
|
vector<CAccount>::iterator iter_end = m_UserVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).m_Name == name)
|
||||||
|
{
|
||||||
|
if((*iter).m_PassWord == PassWord)
|
||||||
|
{
|
||||||
|
ret = true;
|
||||||
|
authority = (*iter).m_Authority;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
MsgBox.Show("密码和账号不匹配");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(iter==iter_end)
|
||||||
|
{
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
MsgBox.Show("账号或密码错误!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret)
|
||||||
|
{
|
||||||
|
SetAuthority(authority);
|
||||||
|
m_CurUserName = name;
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
CString str("登录成功---->");
|
||||||
|
str += ("[Type:") + GetCurAccountName() + "]";
|
||||||
|
str += ("[Name:") + m_CurUserName + "]";
|
||||||
|
MsgBox.Show(str);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
CString CAuthorityMgr::GetAccountName(AUTHORITY_TYPE authority)
|
||||||
|
{
|
||||||
|
if(authority==_FACTORY)
|
||||||
|
return ACCOUNT_FACTORY;
|
||||||
|
if(authority==_ADMIN)
|
||||||
|
return ACCOUNT_ADMIN;
|
||||||
|
if(authority==_USER)
|
||||||
|
return ACCOUNT_USER;
|
||||||
|
return ACCOUNT_NO_LOGIN;
|
||||||
|
}
|
||||||
|
//当前账户类型
|
||||||
|
CString CAuthorityMgr::GetCurAccountName()
|
||||||
|
{
|
||||||
|
return GetAccountName(GetCurAuthority());
|
||||||
|
}
|
||||||
|
//保存或者读取
|
||||||
|
void CAuthorityMgr::SaveOrLoad(bool bSave)
|
||||||
|
{
|
||||||
|
CFileMgr FileMgr;
|
||||||
|
char filepath[1024];
|
||||||
|
FileMgr.GetFullFilePath(filepath,FILE_PATH);//获取完整路径
|
||||||
|
|
||||||
|
if(bSave)
|
||||||
|
{
|
||||||
|
CFile file(filepath,CFile::modeReadWrite|CFile::modeCreate);
|
||||||
|
CArchive ar(&file,CArchive::store);
|
||||||
|
SaveOrLoadExt(ar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CFile file;
|
||||||
|
if(file.Open(filepath,CFile::modeRead))
|
||||||
|
{
|
||||||
|
CArchive ar(&file,CArchive::load);
|
||||||
|
SaveOrLoadExt(ar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gLogMgr->WriteDebugLog("权限文件读取失败", _LOG_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CAuthorityMgr::SaveOrLoadExt(CArchive &ar)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
if(ar.IsStoring())
|
||||||
|
{
|
||||||
|
size = m_UserVec.size();//area 的数量
|
||||||
|
ar<<size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ar>>size;
|
||||||
|
for(int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
CAccount Area;
|
||||||
|
m_UserVec.push_back(Area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
m_UserVec[i].Serialize(ar);
|
||||||
|
}
|
||||||
|
if(!ar.IsStoring())
|
||||||
|
{
|
||||||
|
//重新排序
|
||||||
|
SortUserVec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CAuthorityMgr::AddAccount(CAccount Account)
|
||||||
|
{
|
||||||
|
//检查是否有重复的用户名
|
||||||
|
vector<CAccount>::iterator iter = m_UserVec.begin();
|
||||||
|
vector<CAccount>::iterator iter_end = m_UserVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).m_Name == Account.m_Name)
|
||||||
|
{
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
CString str(_T("用户:"));
|
||||||
|
str += Account.m_Name + "已存在!";
|
||||||
|
MsgBox.Show(str);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_UserVec.push_back(Account);
|
||||||
|
//重新排序
|
||||||
|
SortUserVec();
|
||||||
|
SaveOrLoad(true);
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
MsgBox.Show("创建成功!");
|
||||||
|
}
|
||||||
|
//删除指定的用户
|
||||||
|
void CAuthorityMgr::DelUser(int idx)
|
||||||
|
{
|
||||||
|
if(gAuthorityMgr->CheckAuthority(_ADMIN,true)==false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vector<CAccount>::iterator iter = m_UserVec.begin();
|
||||||
|
vector<CAccount>::iterator iter_end = m_UserVec.end();
|
||||||
|
for(int i=0;iter!=iter_end;iter++,i++)
|
||||||
|
{
|
||||||
|
if(i==idx)
|
||||||
|
{
|
||||||
|
CMsgBox MsgBox;
|
||||||
|
|
||||||
|
if((*iter).m_Authority>m_CurAuthority)
|
||||||
|
{
|
||||||
|
MsgBox.Show(_T("不能删除更高级的用户!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString str(_T("删除"));
|
||||||
|
str += (*iter).m_Name + "?";
|
||||||
|
if(MsgBox.ConfirmOkCancel(str))
|
||||||
|
{
|
||||||
|
m_UserVec.erase(iter);
|
||||||
|
SortUserVec();
|
||||||
|
SaveOrLoad(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CAuthorityMgr::InsertToList(CListCtrl &List)
|
||||||
|
{
|
||||||
|
int size = m_UserVec.size();
|
||||||
|
for(int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
List.InsertItem(i," ");//插入一行
|
||||||
|
List.SetItemText(i,idx++,GetAccountName(m_UserVec[i].m_Authority));//权限类型
|
||||||
|
List.SetItemText(i,idx++,(m_UserVec[i].m_Name));//用户名
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新排序
|
||||||
|
void CAuthorityMgr::SortUserVec()
|
||||||
|
{
|
||||||
|
sort(m_UserVec.begin(),m_UserVec.end(),CompareUser);
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
#define ACCOUNT_NO_LOGIN "未登录"
|
||||||
|
#define ACCOUNT_USER "操作员"
|
||||||
|
#define ACCOUNT_ADMIN "管理员"
|
||||||
|
#define ACCOUNT_FACTORY "厂家"
|
||||||
|
|
||||||
|
enum AUTHORITY_TYPE
|
||||||
|
{
|
||||||
|
_NO_LOGIN = 0,//未登录
|
||||||
|
_USER,//操作员
|
||||||
|
_ADMIN,//管理员
|
||||||
|
_FACTORY,//厂家
|
||||||
|
};
|
||||||
|
|
||||||
|
//账号
|
||||||
|
class CAccount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAccount()
|
||||||
|
{
|
||||||
|
m_Authority = _NO_LOGIN;
|
||||||
|
}
|
||||||
|
void Serialize(CArchive& ar)
|
||||||
|
{
|
||||||
|
if(ar.IsStoring())
|
||||||
|
{
|
||||||
|
ar<<(int)m_Authority;
|
||||||
|
ar<<m_Name;
|
||||||
|
ar<<m_PassWord;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
ar>>tmp;
|
||||||
|
m_Authority = (AUTHORITY_TYPE)tmp;
|
||||||
|
ar>>m_Name;
|
||||||
|
ar>>m_PassWord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
AUTHORITY_TYPE m_Authority;//权限
|
||||||
|
CString m_Name;//用户名
|
||||||
|
CString m_PassWord;//密码
|
||||||
|
};
|
||||||
|
//权限管理
|
||||||
|
class CAuthorityMgr:public CModule
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAuthorityMgr(void);
|
||||||
|
~CAuthorityMgr(void);
|
||||||
|
virtual void Ini();
|
||||||
|
virtual MODULE GetModuleType(){return _AUTHORITY_PROP;};
|
||||||
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
||||||
|
|
||||||
|
void SetAuthority(AUTHORITY_TYPE authority){m_CurAuthority = authority;};//设置当前权限
|
||||||
|
bool CheckAuthority(AUTHORITY_TYPE authority,bool bShowMsgbox = false);//检查当前权限
|
||||||
|
AUTHORITY_TYPE GetCurAuthority(){return m_CurAuthority;};
|
||||||
|
void AddAccount(CAccount Account);
|
||||||
|
bool Login(CString name,CString PassWord);
|
||||||
|
CString GetAccountName(AUTHORITY_TYPE authority);
|
||||||
|
void SaveOrLoad(bool bSave);
|
||||||
|
void InsertToList(CListCtrl &List);
|
||||||
|
void DelUser(int idx);
|
||||||
|
CString GetCurAccountName();
|
||||||
|
CString GetCurUserName(){return m_CurUserName;};
|
||||||
|
bool IsAutoFactory(){return m_AutoFactory;};
|
||||||
|
void Lock();
|
||||||
|
bool IsLogin();
|
||||||
|
private:
|
||||||
|
void SaveOrLoadExt(CArchive &ar);
|
||||||
|
void SortUserVec();
|
||||||
|
private:
|
||||||
|
AUTHORITY_TYPE m_CurAuthority;//当前权限
|
||||||
|
CString m_CurUserName;//当前用户名
|
||||||
|
vector<CAccount> m_UserVec;//所有的用户
|
||||||
|
bool m_AutoFactory;//打开软件自动升级到管理员权限
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CAuthorityMgr *gAuthorityMgr;
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "BarCodeModule.h"
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
//管理条码或者二位码的一个小块
|
||||||
|
class CBarCodeModule{
|
||||||
|
public:
|
||||||
|
CBarCodeModule(bool bBlack)
|
||||||
|
{
|
||||||
|
m_bBlack = bBlack;//是否是黑色的
|
||||||
|
}
|
||||||
|
bool IsBlack(){return m_bBlack;};
|
||||||
|
private:
|
||||||
|
bool m_bBlack;//是否是黑色的
|
||||||
|
};
|
||||||
Binary file not shown.
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
//位运算函数
|
||||||
|
|
||||||
|
//PortVal 的PortIdx 位设置为1
|
||||||
|
inline long SetBitOn(long PortVal,int PortIdx)
|
||||||
|
{
|
||||||
|
PortVal= PortVal |(1<<PortIdx);
|
||||||
|
return PortVal;
|
||||||
|
}
|
||||||
|
//PortVal 的PortIdx 位设置为0
|
||||||
|
inline BYTE SetBitOff(BYTE PortVal,int PortIdx)
|
||||||
|
{
|
||||||
|
PortVal = (PortVal)&(~(1<<PortIdx));
|
||||||
|
return PortVal;
|
||||||
|
}
|
||||||
|
//判断某位是否为1,PortIdx 从右到左
|
||||||
|
inline BOOL IsBitOn(BYTE PortVal,int PortIdx)
|
||||||
|
{
|
||||||
|
if((PortVal>>PortIdx)&1)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline long SetBitByBool(BYTE PortVal,int PortIdx,bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
return SetBitOn(PortVal,PortIdx);
|
||||||
|
return SetBitOff(PortVal,PortIdx);
|
||||||
|
}
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
[CameraParam]
|
||||||
|
Shutter=80000
|
||||||
Binary file not shown.
@ -0,0 +1,558 @@
|
|||||||
|
// 2003.09.10
|
||||||
|
// 2003.12.08 V1.2
|
||||||
|
// 2004.05.08 V1.3
|
||||||
|
// 2004.12.10 V1.5
|
||||||
|
//****************************************
|
||||||
|
//** Copyright (C) W.ch 1999-2004 **
|
||||||
|
//** Web: http://www.winchiphead.com **
|
||||||
|
//****************************************
|
||||||
|
//** DLL for PCI interface chip CH365 **
|
||||||
|
//** C, VC5.0 **
|
||||||
|
//****************************************
|
||||||
|
//
|
||||||
|
// PCI总线接口芯片CH365的应用层接口库 V1.5
|
||||||
|
// 南京沁恒电子有限公司 作者: W.ch 2004.12
|
||||||
|
// CH365-DLL V1.5 , Support: IO/MEM/INT
|
||||||
|
// 运行环境: Windows 98/ME, Windows 2000/XP
|
||||||
|
|
||||||
|
#ifndef _CH365_DLL_H
|
||||||
|
#define _CH365_DLL_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define mOFFSET( s, m ) ( (ULONG) & ( ( ( s * ) 0 ) -> m ) ) // 定义获取结构成员相对偏移地址的宏
|
||||||
|
|
||||||
|
#ifndef max
|
||||||
|
#define max( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) // 较大值
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) // 较小值
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ExAllocatePool
|
||||||
|
#undef ExAllocatePool // 删除带TAG的内存分配
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NTSTATUS
|
||||||
|
typedef LONG NTSTATUS; // 返回状态
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _PCI_CONFIG { // 定义PCI配置空间数据结构
|
||||||
|
USHORT mPcVendorId; // 00H 供应商标识
|
||||||
|
USHORT mPcDeviceId; // 02H 设备标识
|
||||||
|
USHORT mPcCommandReg; // 04H 命令寄存器
|
||||||
|
USHORT mPcStatusReg; // 06H 状态寄存器
|
||||||
|
UCHAR mPcRevisionId; // 08H 修改标识
|
||||||
|
UCHAR mPcProgramIf; // 09H 寄存器级编程接口
|
||||||
|
UCHAR mPcSubClass; // 0AH 子类代码
|
||||||
|
UCHAR mPcBaseClass; // 0BH 基本分类代码
|
||||||
|
UCHAR mPcCacheLine; // 0CH 缓存行长度
|
||||||
|
UCHAR mPcLatenTimer; // 0DH 延迟计数器
|
||||||
|
UCHAR mPcHeaderType; // 0EH 头标类型
|
||||||
|
UCHAR mPcBistReg; // 0FH 内含自测试寄存器
|
||||||
|
ULONG mPcBaseAddr0; // 10H 基址寄存器0
|
||||||
|
ULONG mPcBaseAddr1; // 14H 基址寄存器1
|
||||||
|
ULONG mPcBaseAddr2; // 18H 基址寄存器2
|
||||||
|
ULONG mPcBaseAddr3; // 1CH 基址寄存器3
|
||||||
|
ULONG mPcBaseAddr4; // 20H 基址寄存器4
|
||||||
|
ULONG mPcBaseAddr5; // 24H 基址寄存器5
|
||||||
|
ULONG mPcCardCis; // 28H
|
||||||
|
USHORT mPcSubSysVen; // 2CH 子系统供应商标识
|
||||||
|
USHORT mPcSubSysDev; // 2EH 子系统设备标识
|
||||||
|
ULONG mPcExpansRom; // 30H 扩展ROM基址寄存器
|
||||||
|
UCHAR mPcCapPtr; // 34H
|
||||||
|
UCHAR mPcReserved1[3]; // 35H
|
||||||
|
ULONG mPcReserved2; // 38H
|
||||||
|
UCHAR mPcInterLine; // 3CH 中断线寄存器
|
||||||
|
UCHAR mPcInterPin; // 3DH 中断引脚寄存器
|
||||||
|
UCHAR mPcMinGrant; // 3EH
|
||||||
|
UCHAR mPcMaxLatency; // 3FH
|
||||||
|
} mPCI_CONFIG, *mPPCI_CONFIG;
|
||||||
|
|
||||||
|
typedef struct _PCI_EXP_ROM { // PCI扩展ROM的数据结构
|
||||||
|
UCHAR mPerRomSig[4]; // 00H PCI扩展ROM签名字符串'PCIR'
|
||||||
|
USHORT mPerVendorId; // 04H 供应商标识
|
||||||
|
USHORT mPerDeviceId; // 06H 设备标识
|
||||||
|
USHORT mPerVpdPtr; // 08H 重要产品数据指针
|
||||||
|
USHORT mPerStrucLen; // 0AH PCI扩展ROM数据结构的长度
|
||||||
|
UCHAR mPerRevision; // 0CH PCI扩展ROM数据结构的修改版本
|
||||||
|
UCHAR mPerProgramIf; // 0DH 寄存器级编程接口
|
||||||
|
UCHAR mPerSubClass; // 0EH 子类代码
|
||||||
|
UCHAR mPerBaseClass; // 0FH 基本分类代码
|
||||||
|
USHORT mPerImageLen; // 10H 映像长度
|
||||||
|
USHORT mPerImageRev; // 12H 映像中代码/数据的修改版本
|
||||||
|
UCHAR mPerCodeType; // 14H 代码类型
|
||||||
|
UCHAR mPerIndicator; // 15H 映像指示标志
|
||||||
|
USHORT mPerReserved; // 16H
|
||||||
|
} mPCI_EXP_ROM, *mPPCI_EXP_ROM;
|
||||||
|
|
||||||
|
typedef struct _CH365_CFG_REG { // CH365芯片的配置寄存器
|
||||||
|
mPCI_CONFIG mCh365CfgPci; // 00H-3FH,共64字节为标准PCI配置空间
|
||||||
|
UCHAR mCh365CfgCtrl; // 40H 芯片控制寄存器,高5位只读
|
||||||
|
UCHAR mCh365CfgDin; // 41H 8位总线输入端口,只读
|
||||||
|
UCHAR mCh365CfgState; // 42H 芯片状态寄存器,只读
|
||||||
|
UCHAR mCh365CfgResv; // 43H
|
||||||
|
} mCH365_CFG_REG, *mPCH365_CFG_REG;
|
||||||
|
|
||||||
|
typedef struct _CH365_IO_REG { // CH365芯片的I/O空间
|
||||||
|
UCHAR mCh365IoPort[0xf0]; // 00H-EFH,共240字节为标准的I/O端口
|
||||||
|
union { // 以字或者以字节为单位进行存取
|
||||||
|
USHORT mCh365MemAddr; // F0H 存储器接口: A15-A0地址设定寄存器
|
||||||
|
struct { // 以字节为单位进行存取
|
||||||
|
UCHAR mCh365MemAddrL; // F0H 存储器接口: A7-A0地址设定寄存器
|
||||||
|
UCHAR mCh365MemAddrH; // F1H 存储器接口: A15-A8地址设定寄存器
|
||||||
|
};
|
||||||
|
};
|
||||||
|
UCHAR mCh365IoResv2; // F2H
|
||||||
|
UCHAR mCh365MemData; // F3H 存储器接口: 存储器数据存取寄存器
|
||||||
|
UCHAR mCh365I2cData; // F4H I2C串行接口: I2C数据存取寄存器
|
||||||
|
UCHAR mCh365I2cCtrl; // F5H I2C串行接口: I2C控制和状态寄存器
|
||||||
|
UCHAR mCh365I2cAddr; // F6H I2C串行接口: I2C地址设定寄存器
|
||||||
|
UCHAR mCh365I2cDev; // F7H I2C串行接口: I2C设备地址和命令寄存器
|
||||||
|
UCHAR mCh365IoCtrl; // F8H 芯片控制寄存器,高5位只读
|
||||||
|
UCHAR mCh365IoBuf; // F9H 本地数据输入缓存寄存器
|
||||||
|
UCHAR mCh365Speed; // FAH 芯片速度控制寄存器
|
||||||
|
UCHAR mCh365IoResv3; // FBH
|
||||||
|
UCHAR mCh365IoTime; // FCH 硬件循环计数寄存器
|
||||||
|
UCHAR mCh365IoResv4[3]; // FDH
|
||||||
|
} mCH365_IO_REG, *mPCH365_IO_REG;
|
||||||
|
|
||||||
|
typedef struct _CH365_MEM_REG { // CH365芯片的存储器空间
|
||||||
|
UCHAR mCh365MemPort[0x8000]; // 0000H-7FFFH,共32768字节为标准的存储器单元
|
||||||
|
} mCH365_MEM_REG, *mPCH365_MEM_REG;
|
||||||
|
|
||||||
|
typedef struct _WIN32_COMMAND { // 定义WIN32命令接口结构
|
||||||
|
union {
|
||||||
|
ULONG mFunction; // 输入时指定功能代码
|
||||||
|
NTSTATUS mStatus; // 输出时返回操作状态
|
||||||
|
};
|
||||||
|
PVOID mAddress; // 起始地址,返回地址
|
||||||
|
ULONG mLength; // 存取长度,返回后续数据的长度
|
||||||
|
UCHAR mBuffer[4]; // 数据缓冲区,长度为0至32KB
|
||||||
|
} mWIN32_COMMAND, *mPWIN32_COMMAND;
|
||||||
|
|
||||||
|
// WIN32应用层接口命令
|
||||||
|
#define IOCTL_CH365_COMMAND ( FILE_DEVICE_UNKNOWN << 16 | FILE_ANY_ACCESS << 14 | 0x0f36 << 2 | METHOD_BUFFERED ) // 专用接口
|
||||||
|
|
||||||
|
#define mWIN32_COMMAND_HEAD mOFFSET( mWIN32_COMMAND, mBuffer ) // WIN32命令接口的头长度
|
||||||
|
|
||||||
|
#define mCH365_MAX_NUMBER 16 // 最多同时连接的CH365数
|
||||||
|
|
||||||
|
#define mMAX_BUFFER_LENGTH max( sizeof( mCH365_IO_REG ), sizeof( mCH365_MEM_REG ) ) // 数据缓冲区最大长度
|
||||||
|
|
||||||
|
#define mMAX_COMMAND_LENGTH ( mWIN32_COMMAND_HEAD + mMAX_BUFFER_LENGTH ) // 最大数据长度加上命令结构头的长度
|
||||||
|
|
||||||
|
#define mCH365_MEM_BASE_AUTO ( (PVOID)0xffffffff ) // 自动设定CH365的存储器基址
|
||||||
|
|
||||||
|
#define mCH365_INT_TOOL_LINE_AUTO 0xffffffff // 自动检测CH365的中断号
|
||||||
|
|
||||||
|
|
||||||
|
// 寄存器的位定义
|
||||||
|
#define mBitAddr15Out 0x01 // 设定A15输出值,1*:high,0:low
|
||||||
|
#define mBitSysExtOut 0x02 // 设定SYS_EX输出值,1:high,0*:low
|
||||||
|
#define mBitIntAction 0x04 // 设定中断激活状态,1:action,0*:inaction
|
||||||
|
#define mBitPciIdDef 0x01 // 只读,PCI设备标识的当前选择,1*:default,0:external
|
||||||
|
#define mBitPortHit 0x04 // 只读,本地硬件定址功能的启用状态,1:启用,0*:禁用
|
||||||
|
#define mBitInterRom 0x10 // 只读,内部Mini-ROM功能的启用状态,1:启用,0*:禁用
|
||||||
|
#define mBitSysExtOe 0x40 // 只读,SYS_EX输出三态控制/输出使能,1*:启用,0:禁用
|
||||||
|
#define mBitIntEnable 0x80 // 只读,中断功能的启用状态,1:启用,0*:禁用
|
||||||
|
#define mBitI2cStatus 0x01 // I2C接口的操作控制和状态,1:开始/正在操作,0*:空闲/操作完成
|
||||||
|
#define mBitI2cSclOut 0x80 // 选择I2C接口的SCL输出,1:SYS_EX,0*:A15
|
||||||
|
#define mBitSpeedAct 0x07 // 速度控制,激活状态的脉冲宽度,实际宽度为该值乘以30nS
|
||||||
|
#define mBitSpeedInact 0x10 // 速度控制,非激活状态的空闲宽度,1:前45nS/后15nS,0:前15nS/后15nS
|
||||||
|
#define mBitSpeedPreft 0x80 // 速度控制,预取状态控制位,1:预取位有效,0:预取位无效
|
||||||
|
|
||||||
|
|
||||||
|
// 应用层接口的功能代码
|
||||||
|
#define mFuncNoOperation 0x00000000 // 无操作
|
||||||
|
#define mFuncGetVersion 0x00000001 // 获取驱动程序版本号
|
||||||
|
#define mFuncGetIoBaseAddr 0x00000004 // 读取I/O端口基址
|
||||||
|
#define mFuncSetIoBaseAddr 0x00000005 // 设置I/O端口基址
|
||||||
|
#define mFuncGetMemBaseAddr 0x00000006 // 读取存储器基址
|
||||||
|
#define mFuncSetMemBaseAddr 0x00000007 // 设置存储器基址,自动设定存储器基址
|
||||||
|
#define mFuncGetInterLine 0x00000008 // 读取中断号
|
||||||
|
#define mFuncSetInterLine 0x00000009 // 设置中断号,自动检测中断号
|
||||||
|
#define mFuncWaitInterrupt 0x0000000a // 等待中断,直到CH365产生中断
|
||||||
|
#define mFuncAbortWaitInter 0x0000000b // 放弃等待中断,终止等待
|
||||||
|
#define mFuncSetExclusive 0x0000000c // 设置独占使用
|
||||||
|
#define mFuncReadIoByte 0x00000010 // 读取输入输出端口,在同一个端口地址以字节为单位连续读取
|
||||||
|
#define mFuncReadIoWord 0x00000011 // 读取输入输出端口,在同一个端口地址以字为单位连续读取
|
||||||
|
#define mFuncReadIoDword 0x00000012 // 读取输入输出端口,在同一个端口地址以双字为单位连续读取
|
||||||
|
#define mFuncReadIoBlock 0x00000013 // 读取输入输出端口,每读取一个字节,端口地址加一
|
||||||
|
#define mFuncWriteIoByte 0x00000014 // 写入输入输出端口,在同一个端口地址以字节为单位连续写入
|
||||||
|
#define mFuncWriteIoWord 0x00000015 // 写入输入输出端口,在同一个端口地址以字为单位连续写入
|
||||||
|
#define mFuncWriteIoDword 0x00000016 // 写入输入输出端口,在同一个端口地址以双字为单位连续写入
|
||||||
|
#define mFuncWriteIoBlock 0x00000017 // 写入输入输出端口,每写入一个字节,端口地址加一
|
||||||
|
#define mFuncReadMemByte 0x00000018 // 读取存储器/寄存器
|
||||||
|
#define mFuncReadMemWord 0x00000019 // 读取存储器/寄存器
|
||||||
|
#define mFuncReadMemDword 0x0000001a // 读取存储器/寄存器
|
||||||
|
#define mFuncWriteMemByte 0x0000001c // 写入存储器/寄存器
|
||||||
|
#define mFuncWriteMemWord 0x0000001d // 写入存储器/寄存器
|
||||||
|
#define mFuncWriteMemDword 0x0000001e // 写入存储器/寄存器
|
||||||
|
#define mFuncReadConfig 0x00000020 // 读取PCI配置空间
|
||||||
|
#define mFuncWriteConfig 0x00000021 // 写入PCI配置空间
|
||||||
|
#define mFuncReadBuffer1 0x00000024 // 读取中断命令缓冲区1
|
||||||
|
#define mFuncWriteBuffer1 0x00000025 // 写入中断命令缓冲区1
|
||||||
|
#define mFuncReadBuffer2 0x00000026 // 读取中断命令缓冲区2
|
||||||
|
#define mFuncWriteBuffer2 0x00000027 // 写入中断命令缓冲区2
|
||||||
|
|
||||||
|
|
||||||
|
typedef VOID ( CALLBACK * mPCH365_INT_ROUTINE ) ( VOID ); // 中断服务程序
|
||||||
|
|
||||||
|
|
||||||
|
HANDLE WINAPI CH365OpenDevice( // 打开CH365设备,返回句柄,出错则无效
|
||||||
|
BOOL iEnableMemory, // 是否需要支持存储器
|
||||||
|
BOOL iEnableInterrupt ); // 是否需要支持中断
|
||||||
|
|
||||||
|
|
||||||
|
VOID WINAPI CH365CloseDevice( ); // 关闭CH365设备
|
||||||
|
|
||||||
|
|
||||||
|
ULONG WINAPI CH365GetVersion( ); // 获得DLL版本号,返回版本号
|
||||||
|
|
||||||
|
|
||||||
|
ULONG WINAPI CH365DriverCommand( // 直接传递命令给驱动程序,出错则返回0,否则返回数据长度
|
||||||
|
mPWIN32_COMMAND ioCommand ); // 命令结构的指针
|
||||||
|
// 该程序在调用后返回数据长度,并且仍然返回命令结构,如果是读操作,则数据返回在命令结构中,
|
||||||
|
// 返回的数据长度在操作失败时为0,操作成功时为整个命令结构的长度,例如读一个字节,则返回mWIN32_COMMAND_HEAD+1,
|
||||||
|
// 命令结构在调用前,分别提供:命令功能代码,起始地址(可选),存取数据的长度(可选),
|
||||||
|
// 命令结构在调用后,分别返回:操作状态代码,返回的基址(可选),后续数据的长度(可选),
|
||||||
|
// 操作状态代码是由WINDOWS定义的代码,可以参考NTSTATUS.H,
|
||||||
|
// 返回的基址只适用于下列命令:获取I/O基址,获取存储器基址,获取中断号,对于其它命令则保持输入时的起始地址
|
||||||
|
// 后续数据的长度是指读操作返回的数据长度,数据存放在随后的缓冲区中,对于写操作一般为0
|
||||||
|
|
||||||
|
|
||||||
|
ULONG WINAPI CH365GetDrvVersion( ); // 获得驱动程序版本号,返回版本号,出错则返回0
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365GetIoBaseAddr( // 获取I/O端口的基址
|
||||||
|
mPCH365_IO_REG *oIoBaseAddr ); // 保存I/O端口基址的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365SetIoBaseAddr( // 设定I/O端口的基址
|
||||||
|
mPCH365_IO_REG iIoBaseAddr ); // 指定I/O端口基址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365GetMemBaseAddr( // 获取存储器的基址
|
||||||
|
mPCH365_MEM_REG *oMemBaseAddr ); // 保存存储器基址的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365SetMemBaseAddr( // 设定存储器的基址
|
||||||
|
mPCH365_MEM_REG iMemBaseAddr ); // 指定存储器基址,为0则关闭存储器,为-1则自动设定
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365GetIntLine( // 获取中断号
|
||||||
|
PULONG oIntLine ); // 保存中断号的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365SetIntLine( // 设定中断号
|
||||||
|
ULONG iIntLine ); // 指定中断号,为0则关闭中断,为-1则自动检测并设定
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WaitInterrupt( ); // 等待中断事件
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365AbortWaitInt( ); // 放弃等待中断
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365SetIntRoutine( // 设定中断服务程序
|
||||||
|
mPCH365_INT_ROUTINE iIntRoutine ); // 指定中断服务程序,为NULL则取消中断服务,否则在中断时调用该程序
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadIntCommand( // 读取中断命令缓冲区
|
||||||
|
mPWIN32_COMMAND oCommand, // 指向一个足够大的缓冲区,用于保存读取的命令结构
|
||||||
|
ULONG iCmdIndex ); // 中断命令序号,为1或者2
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteIntCommand( // 写入中断命令缓冲区
|
||||||
|
mPWIN32_COMMAND iCommand, // 指向作为中断命令的命令结构
|
||||||
|
ULONG iCmdIndex ); // 中断命令序号,为1或者2
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadIoByte( // 从I/O端口读取一个字节
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadIoWord( // 从I/O端口读取一个字
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PUSHORT oWord ); // 指向一个字单元,用于保存读取的字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadIoDword( // 从I/O端口读取一个双字
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PULONG oDword ); // 指向一个双字单元,用于保存读取的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteIoByte( // 向I/O端口写入一个字节
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteIoWord( // 向I/O端口写入一个字
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
USHORT iWord ); // 待写入的字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteIoDword( // 向I/O端口写入一个双字
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
ULONG iDword ); // 待写入的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadMemByte( // 从存储器读取一个字节
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadMemDword( // 从存储器读取一个双字
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
PULONG oDword ); // 指向一个双字单元,用于保存读取的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteMemByte( // 向存储器写入一个字节
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteMemDword( // 向存储器写入一个双字
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
ULONG iDword ); // 待写入的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadConfig( // 从配置空间读取一个字节数据
|
||||||
|
PVOID iOffset, // 指定偏移地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteConfig( // 向配置空间写入一个字节数据
|
||||||
|
PVOID iOffset, // 指定偏移地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365SetA15_A8( // 设置高地址,即设置A15-A8的输出
|
||||||
|
UCHAR iA15_A8 ); // 位7-位0对应A15-A8的输出,1为高电平,0为低电平
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365ReadI2C( // 从I2C接口读取一个字节数据
|
||||||
|
UCHAR iDevice, // 低7位指定I2C设备地址
|
||||||
|
UCHAR iAddr, // 指定数据单元的地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365WriteI2C( // 向I2C接口写入一个字节数据
|
||||||
|
UCHAR iDevice, // 低7位指定I2C设备地址
|
||||||
|
UCHAR iAddr, // 指定数据单元的地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
HANDLE WINAPI CH365mOpenDevice( // 打开CH365设备,返回句柄,出错则无效
|
||||||
|
ULONG iIndex, // 指定CH365设备序号,0对应第一个设备
|
||||||
|
BOOL iEnableMemory, // 是否需要支持存储器
|
||||||
|
BOOL iEnableInterrupt ); // 是否需要支持中断
|
||||||
|
|
||||||
|
|
||||||
|
VOID WINAPI CH365mCloseDevice( // 关闭CH365设备
|
||||||
|
ULONG iIndex ); // 指定CH365设备序号
|
||||||
|
|
||||||
|
|
||||||
|
ULONG WINAPI CH365mDriverCommand( // 直接传递命令给驱动程序,出错则返回0,否则返回数据长度
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPWIN32_COMMAND ioCommand ); // 命令结构的指针
|
||||||
|
// 该程序在调用后返回数据长度,并且仍然返回命令结构,如果是读操作,则数据返回在命令结构中,
|
||||||
|
// 返回的数据长度在操作失败时为0,操作成功时为整个命令结构的长度,例如读一个字节,则返回mWIN32_COMMAND_HEAD+1,
|
||||||
|
// 命令结构在调用前,分别提供:命令功能代码,起始地址(可选),存取数据的长度(可选),
|
||||||
|
// 命令结构在调用后,分别返回:操作状态代码,返回的基址(可选),后续数据的长度(可选),
|
||||||
|
// 操作状态代码是由WINDOWS定义的代码,可以参考NTSTATUS.H,
|
||||||
|
// 返回的基址只适用于下列命令:获取I/O基址,获取存储器基址,获取中断号,对于其它命令则保持输入时的起始地址
|
||||||
|
// 后续数据的长度是指读操作返回的数据长度,数据存放在随后的缓冲区中,对于写操作一般为0
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mGetIoBaseAddr( // 获取I/O端口的基址
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPCH365_IO_REG *oIoBaseAddr ); // 保存I/O端口基址的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetIoBaseAddr( // 设定I/O端口的基址
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPCH365_IO_REG iIoBaseAddr ); // 指定I/O端口基址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mGetMemBaseAddr( // 获取存储器的基址
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPCH365_MEM_REG *oMemBaseAddr ); // 保存存储器基址的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetMemBaseAddr( // 设定存储器的基址
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPCH365_MEM_REG iMemBaseAddr ); // 指定存储器基址,为0则关闭存储器,为-1则自动设定
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mGetIntLine( // 获取中断号
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PULONG oIntLine ); // 保存中断号的单元地址
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetIntLine( // 设定中断号
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
ULONG iIntLine ); // 指定中断号,为0则关闭中断,为-1则自动检测并设定
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWaitInterrupt( // 等待中断事件
|
||||||
|
ULONG iIndex ); // 指定CH365设备序号
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mAbortWaitInt( // 放弃等待中断
|
||||||
|
ULONG iIndex ); // 指定CH365设备序号
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetIntRoutine( // 设定中断服务程序
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPCH365_INT_ROUTINE iIntRoutine ); // 指定中断服务程序,为NULL则取消中断服务,否则在中断时调用该程序
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadIntCommand( // 读取中断命令缓冲区
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPWIN32_COMMAND oCommand, // 指向一个足够大的缓冲区,用于保存读取的命令结构
|
||||||
|
ULONG iCmdIndex ); // 中断命令序号,为1或者2
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteIntCommand( // 写入中断命令缓冲区
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
mPWIN32_COMMAND iCommand, // 指向作为中断命令的命令结构
|
||||||
|
ULONG iCmdIndex ); // 中断命令序号,为1或者2
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadIoByte( // 从I/O端口读取一个字节
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadIoWord( // 从I/O端口读取一个字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PUSHORT oWord ); // 指向一个字单元,用于保存读取的字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadIoDword( // 从I/O端口读取一个双字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
PULONG oDword ); // 指向一个双字单元,用于保存读取的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteIoByte( // 向I/O端口写入一个字节
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteIoWord( // 向I/O端口写入一个字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
USHORT iWord ); // 待写入的字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteIoDword( // 向I/O端口写入一个双字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定I/O端口的地址
|
||||||
|
ULONG iDword ); // 待写入的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadMemByte( // 从存储器读取一个字节
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadMemDword( // 从存储器读取一个双字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
PULONG oDword ); // 指向一个双字单元,用于保存读取的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteMemByte( // 向存储器写入一个字节
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteMemDword( // 向存储器写入一个双字
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iAddr, // 指定存储器的地址,虚拟地址
|
||||||
|
ULONG iDword ); // 待写入的双字数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadConfig( // 从配置空间读取一个字节数据
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iOffset, // 指定偏移地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteConfig( // 向配置空间写入一个字节数据
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
PVOID iOffset, // 指定偏移地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetA15_A8( // 设置高地址,即设置A15-A8的输出
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
UCHAR iA15_A8 ); // 位7-位0对应A15-A8的输出,1为高电平,0为低电平
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mReadI2C( // 从I2C接口读取一个字节数据
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
UCHAR iDevice, // 低7位指定I2C设备地址
|
||||||
|
UCHAR iAddr, // 指定数据单元的地址
|
||||||
|
PUCHAR oByte ); // 指向一个字节单元,用于保存读取的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mWriteI2C( // 向I2C接口写入一个字节数据
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
UCHAR iDevice, // 低7位指定I2C设备地址
|
||||||
|
UCHAR iAddr, // 指定数据单元的地址
|
||||||
|
UCHAR iByte ); // 待写入的字节数据
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365DelayUS( // 延时指定微秒
|
||||||
|
ULONG iDelay ); // 指定要延时的微秒数,如果延时小于10则误差较大
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mAccessBlock( // 读取或者写入数据块
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
ULONG iAccessMode, // 参考下面的说明
|
||||||
|
PVOID iAddr, // 指定I/O端口或者存储器的地址
|
||||||
|
PVOID ioBuffer, // 指向输入或者输出的缓冲区
|
||||||
|
ULONG iLength ); // 数据块长度,也就是读取或者写入的字节数,长度不超过32KB
|
||||||
|
// iAccessMode 定义如下
|
||||||
|
// #define mFuncReadIoByte 0x00000010 // 读取输入输出端口,在同一个端口地址以字节为单位连续读取,最大长度32KB
|
||||||
|
// #define mFuncReadIoWord 0x00000011 // 读取输入输出端口,在同一个端口地址以字为单位连续读取,最大长度32KB
|
||||||
|
// #define mFuncReadIoDword 0x00000012 // 读取输入输出端口,在同一个端口地址以双字为单位连续读取,最大长度32KB
|
||||||
|
// #define mFuncReadIoBlock 0x00000013 // 读取输入输出端口,每读取一个字节,端口地址加一,最大长度240B(从偏移地址00H读到EFH)
|
||||||
|
// #define mFuncWriteIoByte 0x00000014 // 写入输入输出端口,在同一个端口地址以字节为单位连续写入,最大长度32KB
|
||||||
|
// #define mFuncWriteIoWord 0x00000015 // 写入输入输出端口,在同一个端口地址以字为单位连续写入,最大长度32KB
|
||||||
|
// #define mFuncWriteIoDword 0x00000016 // 写入输入输出端口,在同一个端口地址以双字为单位连续写入,最大长度32KB
|
||||||
|
// #define mFuncWriteIoBlock 0x00000017 // 写入输入输出端口,每写入一个字节,端口地址加一,最大长度240B(从偏移地址00H写到EFH)
|
||||||
|
// #define mFuncReadMemByte 0x00000018 // 读取存储器/寄存器,以字节为单位连续读,每读取一个字节,地址加一,最大长度32KB(从偏移地址0000H读到7FFFH)
|
||||||
|
// #define mFuncReadMemWord 0x00000019 // 读取存储器/寄存器,以字为单位连续读,每读取一个字,地址加二,最大长度32KB(从偏移地址0000H读到7FFFH)
|
||||||
|
// #define mFuncReadMemDword 0x0000001a // 读取存储器/寄存器,以双字为单位连续读,每读取一个字节,地址加四,最大长度32KB(从偏移地址0000H读到7FFFH)
|
||||||
|
// #define mFuncWriteMemByte 0x0000001c // 写入存储器/寄存器,以字节为单位连续写,每读取一个字节,地址加一,最大长度32KB(从偏移地址0000H写到7FFFH)
|
||||||
|
// #define mFuncWriteMemWord 0x0000001d // 写入存储器/寄存器,以字为单位连续写,每读取一个字,地址加二,最大长度32KB(从偏移地址0000H写到7FFFH)
|
||||||
|
// #define mFuncWriteMemDword 0x0000001e // 写入存储器/寄存器,以双字为单位连续写,每读取一个双字,地址加四,最大长度32KB(从偏移地址0000H写到7FFFH)
|
||||||
|
// 其它方式不支持,上述定义在文件CH365DLL.H中
|
||||||
|
|
||||||
|
|
||||||
|
BOOL WINAPI CH365mSetExclusive( // 设置独占使用当前CH365设备
|
||||||
|
ULONG iIndex, // 指定CH365设备序号
|
||||||
|
ULONG iExclusive ); // 为0则设备可以共享使用,非0则独占使用
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _CH365_DLL_H
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
|
||||||
|
#define TRUE_STR _T("TRUE")
|
||||||
|
#define FALSE_STR _T("FALSE")
|
||||||
|
//和MFC CString 相关的一些函数
|
||||||
|
|
||||||
|
//去掉小数点后面不要的0
|
||||||
|
inline void DeleteZero(CString &s)
|
||||||
|
{
|
||||||
|
int nIndex;
|
||||||
|
nIndex=s.Find('.');
|
||||||
|
if (nIndex>=0)
|
||||||
|
{
|
||||||
|
s.TrimRight('0');
|
||||||
|
if (s.GetLength()==nIndex+1)
|
||||||
|
{
|
||||||
|
s=s.Left(nIndex);
|
||||||
|
if (s.IsEmpty())
|
||||||
|
s='0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//double 转换为CString
|
||||||
|
inline CString Db2CString(double n)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
s.Format("%lf",n);
|
||||||
|
DeleteZero(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
//int 转换为CString
|
||||||
|
inline CString Int2CString(int n)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
s.Format("%ld",n);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
//获取bool 类型的str
|
||||||
|
inline CString GetBoolValStr(bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
return TRUE_STR;
|
||||||
|
else
|
||||||
|
return FALSE_STR;
|
||||||
|
}
|
||||||
|
//在str 中查找SubStr ,找到返回true
|
||||||
|
inline bool FindSubStr(CString &str,CString &SubStr)
|
||||||
|
{
|
||||||
|
return (str.Find(SubStr) != -1);
|
||||||
|
}
|
||||||
|
//删除子串,并返回剩余右边的部分
|
||||||
|
inline CString DelSubStr(CString str,CString &SubStr)
|
||||||
|
{
|
||||||
|
int pos = str.Find(SubStr);
|
||||||
|
if(pos != -1)
|
||||||
|
{
|
||||||
|
str = str.Right(str.GetLength()-(pos+SubStr.GetLength()));
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
inline int CStringToInt(CString &str)
|
||||||
|
{
|
||||||
|
return _tstoi(LPCTSTR(str));
|
||||||
|
}
|
||||||
|
inline double CStringToDouble(CString &str)
|
||||||
|
{
|
||||||
|
return _tstof(LPCTSTR(str));
|
||||||
|
}
|
||||||
|
inline bool CStringToBool(CString &str)
|
||||||
|
{
|
||||||
|
if(str == TRUE_STR)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inline CString Bool2Str(bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
return "TRUE";
|
||||||
|
else
|
||||||
|
return "FALSE";
|
||||||
|
}
|
||||||
|
inline bool Str2Bool(CString &str)
|
||||||
|
{
|
||||||
|
if(str == _T("TRUE"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inline CString Time2Str(int n)
|
||||||
|
{
|
||||||
|
CString s;
|
||||||
|
if(n<10)
|
||||||
|
s.Format("0%ld",n);//左边补0
|
||||||
|
else
|
||||||
|
s.Format("%ld",n);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
@ -0,0 +1,497 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Propertie.h"
|
||||||
|
#include "PropertieMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "AuthorityMgr.h"
|
||||||
|
#include "GlobalDrawMgr.h"
|
||||||
|
#include "DrawSimpleShape.h"
|
||||||
|
#include "PlatformXY.h"
|
||||||
|
#include "ExceptionMsg.h"
|
||||||
|
|
||||||
|
CCamera::CCamera(void)
|
||||||
|
{
|
||||||
|
m_OnePixDis = 1;//一个像素对应的实际尺寸(mm/pix)
|
||||||
|
m_bIni = false;//是否初始化成功
|
||||||
|
m_bRotatoPtByAngle = false;//是否根据相机的安装角度修正抓取结果
|
||||||
|
m_Angle = 0;
|
||||||
|
m_bUse = true;//是否使用
|
||||||
|
m_bLeftTop = true;//基准点是否为左上角(false 为左下角)
|
||||||
|
m_bPixCoord = true;//相机抓取的是否为像素坐标(基恩士返回的是mm 单位的值)
|
||||||
|
m_bCatch = true;//实际抓取
|
||||||
|
m_CatchFrontDelay = 100;//抓取前延时ms
|
||||||
|
m_CatchWaitDelay = 200;//抓取等待延时ms
|
||||||
|
}
|
||||||
|
CCamera::~CCamera(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CMFCPropertyGridProperty *CCamera::CreatGridProperty()
|
||||||
|
{
|
||||||
|
CString PropertyName;//属性名称
|
||||||
|
CString Description;//描述
|
||||||
|
CString Path = _T("Camera");;//存储路径
|
||||||
|
CString Name;
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
PropertyName = _T("共通设定");
|
||||||
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
||||||
|
{
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bUse");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bUse);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL );
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("是否使用");
|
||||||
|
Description = _T("是否使用camera");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bUse, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bCatch");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bCatch);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL );
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("是否抓取");
|
||||||
|
Description = _T("FALSE 的时候返回0,但是不报错");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatch, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_CatchFrontDelay");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_CatchFrontDelay);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_INT);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("抓取前延时");
|
||||||
|
Description = _T("相机抓取前的延时ms");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_CatchFrontDelay, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_CatchWaitDelay");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_CatchWaitDelay);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_INT);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("抓取等待延时");
|
||||||
|
Description = _T("识别触发后等待数据传到ocx 的延时ms");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_CatchWaitDelay, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bRotatoPtByAngle");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bRotatoPtByAngle);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL );
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("角度修正");
|
||||||
|
Description = _T("是否根据相机的安装角度修正抓取结果");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bRotatoPtByAngle, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Angle");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Angle);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("安装角度");
|
||||||
|
Description = _T("CCD X 方向相对于电机X 轴的角度");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Angle, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bLeftTop");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bLeftTop);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL );
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("左上角基准");
|
||||||
|
Description = _T("基准点是否为左上角(false 为左下角)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bLeftTop, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_bPixCoord");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_bPixCoord);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_BOOL );
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("像素坐标");
|
||||||
|
Description = _T("相机抓取的是否为像素坐标");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bPixCoord, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_OnePixDis");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_OnePixDis);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("像素尺寸");
|
||||||
|
Description = _T("一个像素对应的实际尺寸单位是(mm/像素)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_OnePixDis, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Coord_x");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Coord.x);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场基准坐标x");
|
||||||
|
Description = _T("CCD 的视场基准点相对于平台原点的坐标(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Coord.x, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Coord_y");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Coord.y);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场基准坐标y");
|
||||||
|
Description = _T("CCD 的视场基准点相对于平台原点的坐标(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Coord.y, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Coord2_x");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Coord2.x);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场2基准坐标x");
|
||||||
|
Description = _T("CCD2 的视场基准点相对于平台原点的坐标(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Coord2.x, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Coord2_y");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Coord2.y);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场2基准坐标y");
|
||||||
|
Description = _T("CCD2 的视场基准点相对于平台原点的坐标(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Coord2.y, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Size_w");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Size.w);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场宽度");
|
||||||
|
Description = _T("CCD 视场的实际宽度(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Size.w, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_Size_h");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_Size.h);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("视场高度");
|
||||||
|
Description = _T("CCD 视场的实际高度(单位:mm)");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Size.h, Description);
|
||||||
|
pGroup->AddSubItem(p1);
|
||||||
|
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
return pGroup;
|
||||||
|
}
|
||||||
|
void CCamera::ExportPar(ofstream *pFile)
|
||||||
|
{
|
||||||
|
(*pFile)<<"[模块] [Camera]------------------------------------------------"<<endl;
|
||||||
|
(*pFile)<<"[CCD 坐标x][m_Coord.x] = "<<m_Coord.x<<endl;
|
||||||
|
(*pFile)<<"[CCD 坐标y][m_Coord.y] = "<<m_Coord.y<<endl;
|
||||||
|
(*pFile)<<"[像素尺寸(mm/pix) ][m_OnePixDis] = "<<m_OnePixDis<<endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
void CCamera::Draw(CDC* pDC)
|
||||||
|
{
|
||||||
|
if(gDraw->IsShowPlatformPos())
|
||||||
|
{
|
||||||
|
DbRect Rect(m_Coord,gDraw->GetCatchNodeSize());
|
||||||
|
DrawCrossX(pDC,gDraw->GetMarkPointPen(),Rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//设置CCD 的坐标
|
||||||
|
void CCamera::SetCoord(Dbxy pt)
|
||||||
|
{
|
||||||
|
m_Coord = pt;
|
||||||
|
//强制保存所有的属性到文件
|
||||||
|
gDevicePropertieMgr.SaveAllPropertie();
|
||||||
|
}
|
||||||
|
//获取CCD 的中心点坐标(一般用来移动到CCD 观察)
|
||||||
|
Dbxy CCamera::GetCenterPt()
|
||||||
|
{
|
||||||
|
Dbxy ValidCoord = m_Coord;//实际使用的坐标
|
||||||
|
if (m_CamIndex!=0)
|
||||||
|
{
|
||||||
|
ValidCoord = m_Coord2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dbxy CenterPt;
|
||||||
|
CenterPt.x = ValidCoord.x + m_Size.w/2;
|
||||||
|
if(m_bLeftTop)
|
||||||
|
{
|
||||||
|
CenterPt.y = ValidCoord.y - m_Size.h/2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CenterPt.y = ValidCoord.y + m_Size.h/2;
|
||||||
|
}
|
||||||
|
return CenterPt;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dbxy CCamera::GetCoord()
|
||||||
|
{
|
||||||
|
if (m_CamIndex != 0)
|
||||||
|
{
|
||||||
|
return m_Coord2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_Coord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dbxy CCamera::CCDpt2Platcoord(Dbxy CCDpt)
|
||||||
|
{
|
||||||
|
Dbxy ValidCoord = m_Coord;//实际使用的坐标
|
||||||
|
if (m_CamIndex != 0)
|
||||||
|
{
|
||||||
|
ValidCoord = m_Coord2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dbxy pt;
|
||||||
|
pt.x = ValidCoord.x + CCDpt.x;
|
||||||
|
|
||||||
|
if(m_bLeftTop)//根据CCD 的基准点,y 值不一样
|
||||||
|
pt.y = ValidCoord.y - CCDpt.y;
|
||||||
|
else
|
||||||
|
pt.y = ValidCoord.y + CCDpt.y;
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
//将CCD 抓取坐标转换为相对于平台原点的坐标
|
||||||
|
//CCDpt 是CCD 抓取的坐标(相对于CCD 原点的值)
|
||||||
|
Dbxy CCamera::CCDcoord2Platformcoord(Dbxy CCDpt)
|
||||||
|
{
|
||||||
|
CString LogStr;
|
||||||
|
LogStr.Format(_T("CCDcoord2Platformcoord : CCD 返回值[x] = [%0.3f] ,[y] = [%0.3f]"),CCDpt.x,CCDpt.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
|
||||||
|
//像素坐标转换为mm 单位坐标-----------------------
|
||||||
|
if(m_bPixCoord)
|
||||||
|
{
|
||||||
|
CCDpt.x *= m_OnePixDis;
|
||||||
|
CCDpt.y *= m_OnePixDis;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(((CCDpt.x<0)||(CCDpt.x>m_Size.w))||((CCDpt.y<0)||(CCDpt.y>m_Size.h)))//避免错误的返回值
|
||||||
|
{
|
||||||
|
CString str = _T("定位抓取失败");
|
||||||
|
CExceptionMsg Msg;
|
||||||
|
Msg.SetMsg(str);
|
||||||
|
throw Msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogStr.Format(_T("[MM_Coordx] = [%0.3f] ,[MM_Coordy] = [%0.3f]"),CCDpt.x,CCDpt.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
|
||||||
|
//换算为平台 坐标-------------------------------------------
|
||||||
|
#if 0
|
||||||
|
Dbxy pt = CCDpt2Platcoord(CCDpt);
|
||||||
|
|
||||||
|
LogStr.Format(_T("[m_Coordx] = [%0.3f] ,[m_Coordy] = [%0.3f]"),m_Coord.x,m_Coord.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
|
||||||
|
|
||||||
|
//结果抵消平台当前的移动量,才是实际测量点的坐标
|
||||||
|
Dbxy PlatformPt = gPlatformXY->GetCoord();
|
||||||
|
LogStr.Format(_T("[PlatformPtx] = [%0.3f] ,[PlatformPty] = [%0.3f]"),PlatformPt.x,PlatformPt.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
|
||||||
|
pt.x -= PlatformPt.x;
|
||||||
|
pt.y -= PlatformPt.y;
|
||||||
|
#else
|
||||||
|
Dbxy CameraCoord = m_Coord; //GetCenterPt();
|
||||||
|
if (m_CamIndex != 0)
|
||||||
|
{
|
||||||
|
CameraCoord = m_Coord2;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogStr.Format(_T("[CameraCoord.x] = [%0.3f] ,[CameraCoord.y] = [%0.3f]"),CameraCoord.x,CameraCoord.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
Dbxy PlatformPt = gPlatformXY->GetCoord();
|
||||||
|
LogStr.Format(_T("[PlatformCoord.x] = [%0.3f] ,[PlatformCoord.y] = [%0.3f]"),PlatformPt.x,PlatformPt.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
CameraCoord.x = CameraCoord.x - PlatformPt.x;
|
||||||
|
CameraCoord.y = CameraCoord.y + PlatformPt.y;
|
||||||
|
LogStr.Format(_T("[CameraCoord_Now.x] = [%0.3f] ,[CameraCoord_Now.y] = [%0.3f]"),CameraCoord.x,CameraCoord.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
|
||||||
|
Dbxy pt;
|
||||||
|
pt.x = CameraCoord.x + CCDpt.x;
|
||||||
|
pt.y = CameraCoord.y - CCDpt.y;
|
||||||
|
|
||||||
|
LogStr.Format(_T("[CatchPt.x] = [%0.3f] ,[CatchPt.y] = [%0.3f]"),pt.x,pt.y);
|
||||||
|
gLogMgr->WriteDebugLog(LogStr);
|
||||||
|
#endif
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
//抓取点, 并转换为平台坐标(pt 保存抓取的结果)
|
||||||
|
bool CCamera::CatchPtToPlatformcoord(Dbxy &pt)
|
||||||
|
{
|
||||||
|
Dbxy CatchPt;
|
||||||
|
bool ret;
|
||||||
|
if(!m_bCatch)//不实际抓取
|
||||||
|
{
|
||||||
|
ret = true;
|
||||||
|
CatchPt.x = 1296;
|
||||||
|
CatchPt.y = 972;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = CatchPoint(CatchPt);
|
||||||
|
}
|
||||||
|
if(IsDbxyZero(CatchPt))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(ret)
|
||||||
|
{
|
||||||
|
pt = CCDcoord2Platformcoord(CatchPt);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
class CCamera:public CModule
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCamera(void);
|
||||||
|
virtual ~CCamera(void);
|
||||||
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
||||||
|
virtual void ExportPar(ofstream *pFile);
|
||||||
|
virtual void Draw(CDC* pDC);
|
||||||
|
virtual bool CatchPoint(Dbxy &pt){return false;};
|
||||||
|
virtual Dbxy GetCoord();// {return m_Coord;};
|
||||||
|
virtual Dbxy CCDpt2Platcoord(Dbxy CCDpt);
|
||||||
|
virtual Dbxy GetCenterPt();
|
||||||
|
void SetCoord(Dbxy pt);
|
||||||
|
|
||||||
|
void SetCamIndex(int index) { m_CamIndex = index; };//设置相机索引0,1
|
||||||
|
int GetCamIndex() {return m_CamIndex ; };//获取相机索引0,1
|
||||||
|
bool IsOpen() { return m_bOpen; };
|
||||||
|
void SetbOpen(bool bOpen) { m_bOpen=bOpen; };
|
||||||
|
|
||||||
|
Dbxy CCDcoord2Platformcoord(Dbxy CCDpt);
|
||||||
|
bool CatchPtToPlatformcoord(Dbxy &pt);
|
||||||
|
double GetOnePixDis(){return m_OnePixDis;};
|
||||||
|
double GetAngle(){return m_Angle;};
|
||||||
|
int GetCatchFrontDelay(){return m_CatchFrontDelay;};
|
||||||
|
protected:
|
||||||
|
bool m_bUse;//是否使用
|
||||||
|
bool m_bIni;//是否初始化成功
|
||||||
|
double m_OnePixDis;//一个像素对应的实际尺寸(mm/pix) ,通常需要定标得到这个值,不是所有的CCD 都会使用这个值,像基恩士的就是在其内部处理的
|
||||||
|
|
||||||
|
bool m_bLeftTop;//基准点是否为左上角(false 为左下角)
|
||||||
|
bool m_bPixCoord;//相机抓取的是否为像素坐标(基恩士返回的是mm 单位的值)
|
||||||
|
Dbxy m_Coord;//CCD 视场基准点相对于平台原点的坐标值(一般是左上角,或者左下角)
|
||||||
|
Dbxy m_Coord2;//信利双头,有两个相机,此为CCD2坐标
|
||||||
|
DbSize m_Size;//CCD 视场范围的实际尺寸(用来计算抓取定位的坐标值)
|
||||||
|
|
||||||
|
bool m_bRotatoPtByAngle;//是否根据相机的安装角度修正抓取结果
|
||||||
|
double m_Angle;//安装角度,相对于电机的X 轴(360 度角)
|
||||||
|
|
||||||
|
bool m_bCatch;//实际抓取
|
||||||
|
|
||||||
|
int m_CamIndex=0;//相机索引(信利 0 1)
|
||||||
|
bool m_bOpen = false;
|
||||||
|
|
||||||
|
int m_CatchFrontDelay;//抓取前延时ms
|
||||||
|
int m_CatchWaitDelay;//抓取等待延时ms
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CameraKeyence.h"
|
||||||
|
#include "SocketMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "Propertie.h"
|
||||||
|
#include "PropertieMgr.h"
|
||||||
|
#include "AuthorityMgr.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SEND_MASSAGE_TO_CCD_DELAYE_TIME 500//发送消息给CCD ,接收反馈的等待延时
|
||||||
|
|
||||||
|
CCameraKeyence *gCameraKeyence = new CCameraKeyence;
|
||||||
|
CCameraKeyence::CCameraKeyence(void)
|
||||||
|
:m_IPAddrStr("192.168.0.10")//CCD 主机的IP地址
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCameraKeyence::~CCameraKeyence(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#if 1
|
||||||
|
CMFCPropertyGridProperty *CCameraKeyence::CreatGridProperty()
|
||||||
|
{
|
||||||
|
CString PropertyName;//属性名称
|
||||||
|
CString Description;//描述
|
||||||
|
CString Path = _T("DaHenCCD");;//存储路径
|
||||||
|
CString Name;
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
PropertyName = _T("CCD ");
|
||||||
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
||||||
|
|
||||||
|
//先把共同设定加进来
|
||||||
|
CMFCPropertyGridProperty* pBase = CCamera::CreatGridProperty();
|
||||||
|
pGroup->AddSubItem(pBase);
|
||||||
|
//-------------------------------------------------------------------------------//
|
||||||
|
PropertyName = _T("特殊设定");
|
||||||
|
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(PropertyName);
|
||||||
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
||||||
|
{
|
||||||
|
//添加属性变量映射
|
||||||
|
Name = _T("m_IPAddrStr");//变量名字
|
||||||
|
CPropertie *pPropertie = new CPropertie;
|
||||||
|
pPropertie->SetpVal((void*)&m_IPAddrStr);
|
||||||
|
pPropertie->SetType(_PROP_TYPE_STRING);
|
||||||
|
pPropertie->SetpModule(this);
|
||||||
|
pPropertie->SetPath(Path);
|
||||||
|
pPropertie->SetName(Name);
|
||||||
|
pPropertie->WriteRead(true);//读取保存的属性
|
||||||
|
|
||||||
|
//添加属性显示
|
||||||
|
PropertyName = _T("CCD 主机IP 地址");
|
||||||
|
Description = _T("CCD 主机的IP 地址,用来和电脑通信");
|
||||||
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_IPAddrStr, Description);
|
||||||
|
pGroup1->AddSubItem(p1);
|
||||||
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
||||||
|
}
|
||||||
|
|
||||||
|
pGroup->AddSubItem(pGroup1);
|
||||||
|
return pGroup;
|
||||||
|
}
|
||||||
|
void CCameraKeyence::ExportPar(ofstream *pFile)
|
||||||
|
{
|
||||||
|
CCamera::ExportPar(pFile);
|
||||||
|
|
||||||
|
(*pFile)<<"[模块] [CCameraKeyence]------------------------------------------------"<<endl;
|
||||||
|
(*pFile)<<"[CCD 主机IP 地址][m_IPAddrStr] = "<<m_IPAddrStr<<endl;
|
||||||
|
}
|
||||||
|
//返回视场中心
|
||||||
|
Dbxy CCameraKeyence::GetCoord()
|
||||||
|
{
|
||||||
|
Dbxy pt;
|
||||||
|
pt.x = m_Coord.x + m_Size.w/2;
|
||||||
|
pt.y = m_Coord.y - m_Size.h/2;
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
bool CCameraKeyence::CatchPoint(Dbxy &pt)
|
||||||
|
{
|
||||||
|
if(gSocketMgr->Connect(m_IPAddrStr,8500))
|
||||||
|
{
|
||||||
|
gSocketMgr->Send("T1\r",strlen("T1\r")+1);
|
||||||
|
Sleep(SEND_MASSAGE_TO_CCD_DELAYE_TIME);
|
||||||
|
char recvBuf[100];//返回结果
|
||||||
|
gSocketMgr->Receive(recvBuf,sizeof(recvBuf));
|
||||||
|
CString str = recvBuf;
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
gSocketMgr->Close();
|
||||||
|
//提取CCD 返回结果中的数值
|
||||||
|
double arr[20];
|
||||||
|
if(GetNumFromRecvBuf(recvBuf,arr))
|
||||||
|
{
|
||||||
|
Dbxy CCDpt(arr[0],arr[1]);
|
||||||
|
if(IsDbxyZero(CCDpt))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//提取CCD 返回结果中的数值
|
||||||
|
BOOL CCameraKeyence::GetNumFromRecvBuf(char* recvBuf,double *arr)
|
||||||
|
{
|
||||||
|
CString Str = recvBuf;
|
||||||
|
int CommaPosPer;//第一个逗号的位置
|
||||||
|
CommaPosPer = Str.Find(",",0);
|
||||||
|
if(CommaPosPer == -1)//没找到直接返回
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
int CommaPosNext = CommaPosPer;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
CommaPosNext = Str.Find(",",CommaPosPer+1);//下一个逗号的位置
|
||||||
|
if(CommaPosNext==-1)//最后一个
|
||||||
|
{
|
||||||
|
CString Str1(recvBuf+CommaPosPer+1);
|
||||||
|
arr[idx] = atof(Str1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CString Str1(recvBuf+CommaPosPer+1,CommaPosNext-CommaPosPer);
|
||||||
|
arr[idx] = atof(Str1);
|
||||||
|
}
|
||||||
|
CommaPosPer = CommaPosNext;
|
||||||
|
idx++;
|
||||||
|
}while(CommaPosNext!=-1);
|
||||||
|
|
||||||
|
//未检测到mark 点
|
||||||
|
if((Str[0]!= 'T' && Str[1]!='1'))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
//打开CCD 光源
|
||||||
|
void CCameraKeyence::OpenCCDLight()
|
||||||
|
{
|
||||||
|
if(gSocketMgr->Connect(m_IPAddrStr,8500))
|
||||||
|
{
|
||||||
|
gSocketMgr->Send("CLV,2,100\r",strlen("CLV,1,100\r")+1);
|
||||||
|
Sleep(SEND_MASSAGE_TO_CCD_DELAYE_TIME);
|
||||||
|
gSocketMgr->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//关闭CCD 光源
|
||||||
|
void CCameraKeyence::CloseCCDLight()
|
||||||
|
{
|
||||||
|
if(gSocketMgr->Connect(m_IPAddrStr,8500))
|
||||||
|
{
|
||||||
|
gSocketMgr->Send("CLV,2,0\r",strlen("CLV,1,0\r")+1);
|
||||||
|
Sleep(SEND_MASSAGE_TO_CCD_DELAYE_TIME);
|
||||||
|
gSocketMgr->Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//切换CCD 的场景"PW," & CStr(sd) & "," & nnn & Chr(13) & Chr(10)
|
||||||
|
void CCameraKeyence::ChangeCCDScene()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
CGraphSoftView* pView= m_pView;
|
||||||
|
if(pView->GetDocument()->m_CurrOpenFileName=="")
|
||||||
|
return;
|
||||||
|
DEBUG_LOG_START
|
||||||
|
pView->m_DebugLogFile<< "Function :[ChangeCCDScene][自动切换CCD 场景]"<<endl;
|
||||||
|
DEBUG_LOG_END
|
||||||
|
|
||||||
|
pView->m_CommunicationManager.SocketConnect();
|
||||||
|
CString str1 = "PW,1,";
|
||||||
|
CString str2 = str1 + pView->GetDocument()->m_CurrOpenFileName+"\r";
|
||||||
|
pView->m_CommunicationManager.m_SocketClient.Send(str2,str2.GetLength()+1,0);
|
||||||
|
DEBUG_LOG_START
|
||||||
|
pView->m_DebugLogFile<< "发送命令: "<<str2<<endl;
|
||||||
|
DEBUG_LOG_END
|
||||||
|
Sleep(SEND_MASSAGE_TO_CCD_DELAYE_TIME);
|
||||||
|
pView->m_CommunicationManager.SocketClose();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
//切换当前显示的CCD 画面idx(1~4) 为0 表示显示全部
|
||||||
|
bool CCameraKeyence::ChangeCCDScreen(int idx)
|
||||||
|
{
|
||||||
|
if(gSocketMgr->Connect(m_IPAddrStr,8500))
|
||||||
|
{
|
||||||
|
if(idx == 1)
|
||||||
|
{
|
||||||
|
gLogMgr->WriteDebugLog("ChangeCCDScreen id = 1");
|
||||||
|
gSocketMgr->Send("VW,0,1\r",strlen("VW,0,1\r")+1);
|
||||||
|
}
|
||||||
|
if(idx == 2)
|
||||||
|
{
|
||||||
|
gLogMgr->WriteDebugLog("ChangeCCDScreen id = 2");
|
||||||
|
gSocketMgr->Send("VW,0,2\r",strlen("VW,0,1\r")+1);
|
||||||
|
}
|
||||||
|
Sleep(SEND_MASSAGE_TO_CCD_DELAYE_TIME);
|
||||||
|
char recvBuf[100];//返回结果
|
||||||
|
gSocketMgr->Receive(recvBuf,sizeof(recvBuf));
|
||||||
|
CString str = recvBuf;
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
gSocketMgr->Close();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
|
|
||||||
|
//基恩士CCD 的管理类
|
||||||
|
class CCameraKeyence:public CCamera
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCameraKeyence(void);
|
||||||
|
~CCameraKeyence(void);
|
||||||
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
||||||
|
virtual MODULE GetModuleType(){return _KEYENCE_CCD_PROP;};
|
||||||
|
virtual void ExportPar(ofstream *pFile);
|
||||||
|
virtual bool CatchPoint(Dbxy &pt);
|
||||||
|
virtual Dbxy GetCoord();
|
||||||
|
void OpenCCDLight();
|
||||||
|
void CloseCCDLight();
|
||||||
|
void ChangeCCDScene();
|
||||||
|
BOOL GetNumFromRecvBuf(char* recvBuf,double *arr);
|
||||||
|
bool ChangeCCDScreen(int idx);
|
||||||
|
private:
|
||||||
|
CString m_IPAddrStr;//CCD 主机的IP地址
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CCameraKeyence *gCameraKeyence;
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include "ObjBase.h"
|
||||||
|
#include "SmartPtr.h"
|
||||||
|
|
||||||
|
//鼠标捕捉管理
|
||||||
|
class CCatchMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCatchMgr(void);
|
||||||
|
~CCatchMgr(void);
|
||||||
|
void Clear();
|
||||||
|
void Catch(Dbxy DownPt,Dbxy pt,CDC* pDC,bool bCatchTemp);
|
||||||
|
void ResetCatchPoint(CDC* pDC);
|
||||||
|
bool GetCatchPoint(CPoint &pt);
|
||||||
|
private:
|
||||||
|
void CatchNode(DbRect rect);
|
||||||
|
void CatchIntersectPointOfLines(DbRect rect);
|
||||||
|
void CatchIntersectPointWithMouse(DbRect rect);
|
||||||
|
void ResetCatchNode();
|
||||||
|
bool HasCatchPoint();
|
||||||
|
void DrawCatchPoint(CCatchPoint pt,CDC* pDC);
|
||||||
|
void DrawCatchPointExt(CCatchPoint pt,CDC* pDC);
|
||||||
|
CCatchPoint GetNearestCatchPt(Dbxy pt);
|
||||||
|
void GetLineInRect(DbRect &rect,bool bCatchTemp);
|
||||||
|
void CatchOrthoPoint(Dbxy DownPt,Dbxy MousePt,DbRect rect);
|
||||||
|
void CatchCutTrack(DbRect rect);
|
||||||
|
private:
|
||||||
|
vector<DbLine> m_DataPtLineVec;//保存rect 范围内所有的线段
|
||||||
|
vector<CCatchPoint> m_CatchPointVec;//在鼠标范围内的捕获点的容器
|
||||||
|
CCatchPoint m_CatchNode;//之前抓取的点
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CCatchMgr gCatchMgr;
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
// ChildFrm.cpp : CChildFrame 类的实现
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "LaiPuLaser.h"
|
||||||
|
|
||||||
|
#include "ChildFrm.h"
|
||||||
|
#include "GlobalDrawMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// CChildFrame
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
|
||||||
|
ON_WM_SYSCOMMAND()
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
// CChildFrame 构造/析构
|
||||||
|
|
||||||
|
CChildFrame::CChildFrame()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加成员初始化代码
|
||||||
|
}
|
||||||
|
|
||||||
|
CChildFrame::~CChildFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式
|
||||||
|
|
||||||
|
if( !CMDIChildWndEx::PreCreateWindow(cs) )
|
||||||
|
return FALSE;
|
||||||
|
cs.style |= WS_MAXIMIZE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CChildFrame 诊断
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CChildFrame::AssertValid() const
|
||||||
|
{
|
||||||
|
CMDIChildWndEx::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CChildFrame::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CMDIChildWndEx::Dump(dc);
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
// CChildFrame 消息处理程序
|
||||||
|
void CChildFrame::OnSysCommand(UINT nID, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if(nID == SC_CLOSE)
|
||||||
|
return;
|
||||||
|
CMDIChildWndEx::OnSysCommand(nID, lParam);
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
// ChildFrm.h : CChildFrame 类的接口
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class CChildFrame : public CMDIChildWndEx
|
||||||
|
{
|
||||||
|
DECLARE_DYNCREATE(CChildFrame)
|
||||||
|
public:
|
||||||
|
CChildFrame();
|
||||||
|
|
||||||
|
// 特性
|
||||||
|
public:
|
||||||
|
|
||||||
|
// 操作
|
||||||
|
public:
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
public:
|
||||||
|
virtual ~CChildFrame();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
protected:
|
||||||
|
afx_msg void OnSysCommand( UINT nID, LPARAM lParam );
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
@ -0,0 +1 @@
|
|||||||
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
|
||||||
@ -0,0 +1,351 @@
|
|||||||
|
// CientMgr.cpp : 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ClientMgr.h"
|
||||||
|
#include "Program_SZ_XL.h"
|
||||||
|
#include "CameraHawkvis.h"
|
||||||
|
#include "FileMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "ObjComponentMgr.h"
|
||||||
|
// CCientMgr
|
||||||
|
CClientMgr * gClientMgr = new CClientMgr;
|
||||||
|
CClientMgr::CClientMgr()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CClientMgr::~CClientMgr()
|
||||||
|
{
|
||||||
|
DisConnectServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CClientMgr::Connect2Server()
|
||||||
|
{
|
||||||
|
if (m_bDisableServer)//屏蔽副机,则不连接不发指令
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_ClientIP = gProgram_SZ_XL->m_ServerIP;
|
||||||
|
m_ClientPort = gProgram_SZ_XL->m_ServerPort;
|
||||||
|
if (m_hSocket == INVALID_SOCKET)
|
||||||
|
{
|
||||||
|
if (!Socket())
|
||||||
|
{
|
||||||
|
AfxMessageBox("Socket初始化失败。");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!m_bOnline)
|
||||||
|
{
|
||||||
|
if (!Connect(m_ClientIP, m_ClientPort))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_bOnline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::DisConnectServer()
|
||||||
|
{
|
||||||
|
if (m_hSocket!=INVALID_SOCKET)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_TransFile(CString filePath)
|
||||||
|
{
|
||||||
|
|
||||||
|
int sPos = filePath.ReverseFind('\\');
|
||||||
|
int ePos1 = filePath.ReverseFind('.');
|
||||||
|
int ePos2 = filePath.GetLength();
|
||||||
|
CString fileName = filePath.Mid(sPos, ePos1 - sPos);
|
||||||
|
CString fileType = filePath.Mid(ePos1, ePos2 - ePos1); //.DXF OR .MAK
|
||||||
|
|
||||||
|
CFileMgr fg;
|
||||||
|
CString parFileDir = fg.GetWorkPath() + "\\Cutpar";
|
||||||
|
CString parFile = parFileDir + fileName + ".par";
|
||||||
|
CString areFile = parFileDir + fileName + ".are";
|
||||||
|
|
||||||
|
CString PIFileDir = fg.GetWorkPath() + "\\WorkPar";
|
||||||
|
CString PIFile = PIFileDir + fileName + ".txt";
|
||||||
|
|
||||||
|
CString DestFolder = fg.GetWorkPath() + "\\TempMarkData";
|
||||||
|
if (!PathIsDirectory(DestFolder))//不存在则创建文件夹
|
||||||
|
{
|
||||||
|
CreateDirectory(DestFolder, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CString NewFilePath = DestFolder + fileName + fileType;
|
||||||
|
CString NewParFilePath = DestFolder + fileName + ".par";
|
||||||
|
CString NewAreFilePath = DestFolder + fileName + ".are";
|
||||||
|
CString NewPIFilePath = DestFolder + fileName + ".txt";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CopyFile(filePath, NewFilePath, false);
|
||||||
|
CopyFile(parFile, NewParFilePath, false);
|
||||||
|
CopyFile(areFile, NewAreFilePath, false);
|
||||||
|
CopyFile(PIFile, NewPIFilePath, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_OpenFile(CString filePath)
|
||||||
|
{
|
||||||
|
|
||||||
|
SendCmd_TransFile(filePath);
|
||||||
|
Sleep(100);
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
CString str = "OPEN_FILE;" + filePath;
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_CollectData()
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
bool b = gProgram_SZ_XL->IsbSelMarkMode();
|
||||||
|
gClientMgr->SendCmd_bMarkSelMode(b);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
gClientMgr->SendCmd_SelObj();
|
||||||
|
Sleep(200);
|
||||||
|
}
|
||||||
|
CString str = ";COLLECT_DATA;";
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_ProductInfo(CProduct product)
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
m_bServerReady = false;
|
||||||
|
|
||||||
|
CString str = ACTION_TANSPRODUCTINFO;
|
||||||
|
if (gCameraHawkvis->GetCamIndex() == 0)
|
||||||
|
{
|
||||||
|
str += TRACK_1;
|
||||||
|
}
|
||||||
|
if (gCameraHawkvis->GetCamIndex() == 1)
|
||||||
|
{
|
||||||
|
str += TRACK_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString temp;
|
||||||
|
temp.Format("[%.6f][%.6f][%.6f][%.6f][%.6f][%.6f]", product.m_p00, product.m_p01, product.m_p02, \
|
||||||
|
product.m_p10, product.m_p11, product.m_p12);
|
||||||
|
str += temp;
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
//m_bServerMarkReady = false;
|
||||||
|
gLogMgr->WriteDebugLog("Send: "+str);
|
||||||
|
|
||||||
|
|
||||||
|
/*Send(str, str.GetLength());
|
||||||
|
Sleep(50);
|
||||||
|
Send(&product, sizeof(product));*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_SetSpecialObj()
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
int SelObjCnt = m_SelObjIndexVec.size();
|
||||||
|
if (SelObjCnt > 0)
|
||||||
|
{
|
||||||
|
CString str;
|
||||||
|
str.Format("%s%d", ACTION_SETSPECAILOBJ, SelObjCnt);
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
Sleep(50);
|
||||||
|
int* IdxArry = new int[SelObjCnt]();
|
||||||
|
for (int i = 0; i < SelObjCnt; i++)
|
||||||
|
{
|
||||||
|
IdxArry[i] = m_SelObjIndexVec[i];
|
||||||
|
}
|
||||||
|
Send(IdxArry, SelObjCnt*(sizeof(int)));
|
||||||
|
delete[]IdxArry;
|
||||||
|
IdxArry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_SelObj()
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
auto & ComponentVec = gObjComponentMgr->GetComponentVec();
|
||||||
|
auto & SelIndexVec = gClientMgr->m_SelObjIndexVec;
|
||||||
|
SelIndexVec.clear();
|
||||||
|
|
||||||
|
int cnt = ComponentVec.size();
|
||||||
|
if (cnt == 0)//没有打开文件,直接返回
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int idx = 0; idx < cnt; idx++)
|
||||||
|
{
|
||||||
|
if ((ComponentVec[idx]).IsSelected())
|
||||||
|
{
|
||||||
|
SelIndexVec.push_back(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int SelObjCnt = m_SelObjIndexVec.size();
|
||||||
|
|
||||||
|
CString str;
|
||||||
|
str.Format("%s%d", ACTION_SELECTOBJ, SelObjCnt);
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
|
||||||
|
if (SelObjCnt == 0)//无选中数据,不需再发数组
|
||||||
|
return;
|
||||||
|
|
||||||
|
int* IdxArry = new int[SelObjCnt]();
|
||||||
|
for (int i = 0; i < SelObjCnt; i++)
|
||||||
|
{
|
||||||
|
IdxArry[i] = m_SelObjIndexVec[i];
|
||||||
|
}
|
||||||
|
Send(IdxArry, SelObjCnt*(sizeof(int)));
|
||||||
|
delete[]IdxArry;
|
||||||
|
IdxArry = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_bMarkSelMode(int bMarkSel)
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
CString str;
|
||||||
|
str.Format("%s%d", ACTION_BMARKSELOBJMODE, bMarkSel);
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::SendCmd_StartLaserMark(int AreaIndex)
|
||||||
|
{
|
||||||
|
if (Connect2Server())
|
||||||
|
{
|
||||||
|
int cnt = 0;
|
||||||
|
while (!m_bServerReady&&cnt<100)
|
||||||
|
{
|
||||||
|
Sleep(200);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
if (cnt==15)
|
||||||
|
{
|
||||||
|
AfxMessageBox("副机准备数据超时!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString str;
|
||||||
|
str.Format("%s%d", ACTION_STARTWORK, AreaIndex);
|
||||||
|
Send(str, str.GetLength());
|
||||||
|
m_bAreaMarkDone = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CCientMgr 成员函数
|
||||||
|
|
||||||
|
|
||||||
|
int CClientMgr::Send(const void * lpBuf, int nBufLen, int nFlags)
|
||||||
|
{
|
||||||
|
if (!CheckServerDoneCmd())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int sendcnt = CSocket::Send(lpBuf, nBufLen, nFlags);
|
||||||
|
m_bLastCmdFinished = false;
|
||||||
|
return sendcnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::OnReceive(int nErrorCode)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加专用代码和/或调用基类
|
||||||
|
|
||||||
|
if (0 == nErrorCode)
|
||||||
|
{
|
||||||
|
char buf[512] = { 0 };
|
||||||
|
int nRcved = Receive(buf, sizeof(buf));
|
||||||
|
if (SOCKET_ERROR != nRcved)
|
||||||
|
{
|
||||||
|
CString RcvStr = (CString)buf;
|
||||||
|
if (RcvStr.Find("OK") != -1)
|
||||||
|
{
|
||||||
|
m_bLastCmdFinished = true;
|
||||||
|
}
|
||||||
|
if (RcvStr.Find("AREA_FINISHED") != -1)
|
||||||
|
{
|
||||||
|
m_bAreaMarkDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RcvStr.Find("READY") != -1)
|
||||||
|
{
|
||||||
|
m_bServerReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CSocket::OnReceive(nErrorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CClientMgr::OnClose(int nErrorCode)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加专用代码和/或调用基类
|
||||||
|
Close();
|
||||||
|
m_bOnline = false;
|
||||||
|
m_bLastCmdFinished = true;
|
||||||
|
m_bAreaMarkDone = true;
|
||||||
|
|
||||||
|
AfxMessageBox("与副机的连接已断开!");
|
||||||
|
CSocket::OnClose(nErrorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CClientMgr::OnConnect(int nErrorCode)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加专用代码和/或调用基类
|
||||||
|
if (nErrorCode == 0)
|
||||||
|
{
|
||||||
|
m_bOnline = true;
|
||||||
|
}
|
||||||
|
CSocket::OnConnect(nErrorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CClientMgr::CheckServerDoneCmd()
|
||||||
|
{
|
||||||
|
int waitCnt = 0;
|
||||||
|
while ((!m_bLastCmdFinished)||(!m_bAreaMarkDone) && waitCnt < 12000)
|
||||||
|
{
|
||||||
|
DoEvents();
|
||||||
|
Sleep(10);
|
||||||
|
waitCnt++;
|
||||||
|
}
|
||||||
|
if (waitCnt == 12000)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClientMgr::DoEvents()
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) //非阻塞查看消息队列是否有消息过来,有消息返回非零进入循环 //无消息返回0则跳出
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg); //有消息时,虚拟键消息转换为字符消息
|
||||||
|
DispatchMessage(&msg);//发送消息给窗口程序
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommPortMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
|
||||||
|
CCommPortMgr::CCommPortMgr(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
CCommPortMgr::~CCommPortMgr(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//打开com 口(dwBaudRate 是波特率)
|
||||||
|
bool CCommPortMgr::Open(DWORD dwPort, DWORD dwBaudRate)
|
||||||
|
{
|
||||||
|
if(IsOpen())//打开状态直接返回
|
||||||
|
return true;
|
||||||
|
|
||||||
|
CString str = "Function :[CCommPortMgr::Open][打开com 口]";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",dwPort);
|
||||||
|
|
||||||
|
str = "Result :[com 口<"+str1+">打开]";
|
||||||
|
bool ret;
|
||||||
|
if(m_Com.Open(dwPort,dwBaudRate) == false)
|
||||||
|
{
|
||||||
|
gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str += "[OK]";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
//打开串口, 使用类似"9600, n, 8, 1"的设置字符串设置串口
|
||||||
|
bool CCommPortMgr::Open(DWORD dwPort, char *szSetStr)
|
||||||
|
{
|
||||||
|
CString str = "Function :[CCommPortMgr::Open][打开com 口]";
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",dwPort);
|
||||||
|
|
||||||
|
str = "Result :[com 口<"+str1+">打开]";
|
||||||
|
bool ret;
|
||||||
|
if(m_Com.Open(dwPort,szSetStr) == false)
|
||||||
|
{
|
||||||
|
//gLogMgr->WriteDebugLog(str,_LOG_ERROR);
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str += "[OK]";
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绑定串口消息的窗口ID
|
||||||
|
void CCommPortMgr::SetWnd(HWND hWnd)
|
||||||
|
{
|
||||||
|
CString str = "Function :[SetWnd][绑定串口消息的响应窗口ID]";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
m_Com.SetWnd(hWnd);
|
||||||
|
}
|
||||||
|
//读取串口消息到szBuffer
|
||||||
|
CString CCommPortMgr::ReadBuf(char *szBuffer,DWORD dwBufferLength)
|
||||||
|
{
|
||||||
|
CString str = "Function :[ReadString][读取串口消息]";
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
m_Com.ReadString(szBuffer,dwBufferLength);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString CCommPortMgr::ReadStr()
|
||||||
|
{
|
||||||
|
CString str = "Function :[ReadString][读取串口消息]";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
const int dwBufferLength = 500;
|
||||||
|
char szBuffer[dwBufferLength];
|
||||||
|
memset(szBuffer,'0',dwBufferLength);
|
||||||
|
|
||||||
|
m_Com.ReadString(szBuffer,dwBufferLength);
|
||||||
|
//转化为CString
|
||||||
|
str = szBuffer;
|
||||||
|
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CCommPortMgr::Read(LPVOID Buffer, DWORD dwBufferLength)
|
||||||
|
{
|
||||||
|
//CString str = "Function :[ReadString][读取串口消息]";
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
return m_Com.Read(Buffer,dwBufferLength);
|
||||||
|
}
|
||||||
|
//发送消息到串口
|
||||||
|
void CCommPortMgr::Write(const char *szBuffer)
|
||||||
|
{
|
||||||
|
//CString str = "Function :[Write][发送消息到串口]";
|
||||||
|
//gLogMgr->WriteDebugLog(str+szBuffer);
|
||||||
|
|
||||||
|
m_Com.Write(szBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCommPortMgr::WriteBuf(LPVOID Buffer, DWORD dwBufferLength)
|
||||||
|
{
|
||||||
|
//CString str = "Function :[Write][发送消息到串口]";
|
||||||
|
//gLogMgr->WriteDebugLog(str);
|
||||||
|
m_Com.Write(Buffer,dwBufferLength);
|
||||||
|
}
|
||||||
|
//关闭串口
|
||||||
|
void CCommPortMgr::Close()
|
||||||
|
{
|
||||||
|
CString str = "Function :[Close][关闭串口]";
|
||||||
|
gLogMgr->WriteDebugLog(str);
|
||||||
|
|
||||||
|
m_Com.Close();
|
||||||
|
}
|
||||||
|
void CCommPortMgr::SetBufferSize(DWORD dwInputSize, DWORD dwOutputSize)
|
||||||
|
{
|
||||||
|
m_Com.SetBufferSize(dwInputSize,dwOutputSize);
|
||||||
|
}
|
||||||
|
int CCommPortMgr::GetInputSize()
|
||||||
|
{
|
||||||
|
gLogMgr->WriteDebugLog("BufferSize","",m_Com.GetInputSize());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CommPortClass.h"
|
||||||
|
//对第三方com 再封装一次
|
||||||
|
class CCommPortMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommPortMgr(void);
|
||||||
|
~CCommPortMgr(void);
|
||||||
|
bool Open(DWORD dwPort, DWORD dwBaudRate = 9600);
|
||||||
|
bool Open(DWORD dwPort, char *szSetStr);
|
||||||
|
void Close();
|
||||||
|
void SetWnd(HWND hWnd);
|
||||||
|
void Write(const char *szBuffer);
|
||||||
|
void WriteBuf(LPVOID Buffer, DWORD dwBufferLength);
|
||||||
|
CString ReadStr();
|
||||||
|
CString ReadBuf(char *szBuffer,DWORD dwBufferLength);
|
||||||
|
int Read(LPVOID Buffer, DWORD dwBufferLength);
|
||||||
|
bool IsOpen(){return m_Com.IsOpen();};
|
||||||
|
void SetBufferSize(DWORD dwInputSize, DWORD dwOutputSize);
|
||||||
|
int GetInputSize();
|
||||||
|
private:
|
||||||
|
cnComm m_Com;//PLC 串口管理对象
|
||||||
|
};
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandAddNode.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandAddNode::CCommandAddNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CCommandAddNode::~CCommandAddNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandAddNode::ExcuteExt()
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->InsertNode(m_idx,m_pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandAddNode::UndoExt()
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->DelNodePtByIdx(m_idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CString CCommandAddNode::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_add_node Ìí¼Ó½Úµã-----";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
void CCommandAddNode::SetPar(int idx,Dbxy pt)
|
||||||
|
{
|
||||||
|
m_idx = idx;
|
||||||
|
m_pt = pt;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
//添加节点
|
||||||
|
class CCommandAddNode :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandAddNode(void);
|
||||||
|
~CCommandAddNode(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetPar(int idx,Dbxy pt);
|
||||||
|
private:
|
||||||
|
int m_idx;//节点的索引值
|
||||||
|
Dbxy m_pt;//节点的坐标
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandArray.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandArray::CCommandArray(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandArray::~CCommandArray(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandArray::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
//先删除阵列基准obj
|
||||||
|
layer.DelObj(m_BaseObjContainer);
|
||||||
|
//再导入阵列对象
|
||||||
|
layer.AddObject(m_ObjContainer);
|
||||||
|
}
|
||||||
|
void CCommandArray::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
//删除阵列对象
|
||||||
|
layer.DelObj(m_ObjContainer);
|
||||||
|
//导入基准对象
|
||||||
|
layer.AddObject(m_BaseObjContainer);
|
||||||
|
}
|
||||||
|
CString CCommandArray::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_array 阵列-----";
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
if(vec.size()>1)
|
||||||
|
{
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",vec.size());
|
||||||
|
str +="[数量] : <"+str1+">";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
//保存基准obj
|
||||||
|
void CCommandArray::SaveBaseObj(CObjContainer &ObjContainer)
|
||||||
|
{
|
||||||
|
ObjContainer.AllObjAddToContainer(m_BaseObjContainer,true);
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandArray :
|
||||||
|
public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandArray(void);
|
||||||
|
~CCommandArray(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SaveBaseObj(CObjContainer &ObjContainer);
|
||||||
|
private:
|
||||||
|
CObjContainer m_BaseObjContainer;//基准对象的容器
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandBase.h"
|
||||||
|
#include "EasyOperationMgr.h"
|
||||||
|
|
||||||
|
CCommandBase::CCommandBase(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandBase::~CCommandBase(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//添加操作对象
|
||||||
|
void CCommandBase::AddOpObj(Sptr<CObjBase> p)
|
||||||
|
{
|
||||||
|
m_ObjContainer.AddObject(p);
|
||||||
|
}
|
||||||
|
void CCommandBase::AddOpObj(CObjBase *p)
|
||||||
|
{
|
||||||
|
//保存到智能指针
|
||||||
|
Sptr<CObjBase> sPtr(p);
|
||||||
|
AddOpObj(sPtr);
|
||||||
|
}
|
||||||
|
//是否有操作对象
|
||||||
|
bool CCommandBase::HasOpObj()
|
||||||
|
{
|
||||||
|
return !m_ObjContainer.Empty();
|
||||||
|
}
|
||||||
|
void CCommandBase::Excute()
|
||||||
|
{
|
||||||
|
ExcuteExt();
|
||||||
|
gEasyOperationMgr->Refresh();
|
||||||
|
}
|
||||||
|
void CCommandBase::Undo()
|
||||||
|
{
|
||||||
|
UndoExt();
|
||||||
|
gEasyOperationMgr->Refresh();
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include "SmartPtr.h"
|
||||||
|
#include "ObjContainer.h"
|
||||||
|
#include "ObjBase.h"
|
||||||
|
|
||||||
|
class CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandBase(void);
|
||||||
|
virtual ~CCommandBase(void);
|
||||||
|
virtual CString GetStr() = 0;
|
||||||
|
virtual void ExcuteExt(){};
|
||||||
|
virtual void UndoExt(){};
|
||||||
|
void Excute();
|
||||||
|
void Undo();
|
||||||
|
void AddOpObj(CObjBase *p);
|
||||||
|
void AddOpObj(Sptr<CObjBase>);
|
||||||
|
bool HasOpObj();
|
||||||
|
void SetOperatePar(SObjOperatePar par){m_Par = par;};
|
||||||
|
protected:
|
||||||
|
CObjContainer m_ObjContainer;//obj 对象容器管理对象
|
||||||
|
SObjOperatePar m_Par;//操作参数
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandBreakNode.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandBreakNode::CCommandBreakNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandBreakNode::~CCommandBreakNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//第一个是打断之前的obj
|
||||||
|
void CCommandBreakNode::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->SetSelected(true);
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
if(iter == vec.begin())
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandBreakNode::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->SetSelected(true);
|
||||||
|
if(iter == vec.begin())
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CString CCommandBreakNode::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_break 打断节点-----";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandBreakNode :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandBreakNode(void);
|
||||||
|
~CCommandBreakNode(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandCopy.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandCopy::CCommandCopy(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandCopy::~CCommandCopy(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandCopy::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.AddObject(m_ObjContainer);
|
||||||
|
}
|
||||||
|
void CCommandCopy::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.DelObj(m_ObjContainer);
|
||||||
|
}
|
||||||
|
CString CCommandCopy::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_copy ¸´ÖÆ-----";
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
if(vec.size()>1)
|
||||||
|
{
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",vec.size());
|
||||||
|
str +="[ÊýÁ¿] : <"+str1+">";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandCopy :
|
||||||
|
public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandCopy(void);
|
||||||
|
~CCommandCopy(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandCreat.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandCreat::CCommandCreat(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandCreat::~CCommandCreat(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CString CCommandCreat::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_creat ´´½¨-----";
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
str += ((*iter)->GetStr()+" ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(vec.size()>1)
|
||||||
|
{
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",vec.size());
|
||||||
|
str +="[ÊýÁ¿] : <"+str1+">";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
void CCommandCreat::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.AddObject(m_ObjContainer);
|
||||||
|
}
|
||||||
|
void CCommandCreat::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.DelObj(m_ObjContainer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CommandBase.h"
|
||||||
|
class CCommandCreat :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandCreat(void);
|
||||||
|
~CCommandCreat(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandCut.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandCut::CCommandCut(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandCut::~CCommandCut(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//m_ObjContainer 的第一个为剪切的obj
|
||||||
|
//剪切后的obj 可能为0~2 个
|
||||||
|
void CCommandCut::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->SetSelected(false);
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
if(iter == vec.begin())
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandCut::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
if(iter == vec.begin())
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CString CCommandCut::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_cut 修剪-----";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandCut :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandCut(void);
|
||||||
|
~CCommandCut(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandDelNode.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandDelNode::CCommandDelNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandDelNode::~CCommandDelNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandDelNode::ExcuteExt()
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->DelNodePtByIdx(m_idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandDelNode::UndoExt()
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->InsertNode(m_idx,m_pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CString CCommandDelNode::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_del_node ɾ³ý½Úµã-----";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
void CCommandDelNode::SetPar(int idx,Dbxy pt)
|
||||||
|
{
|
||||||
|
m_idx = idx;
|
||||||
|
m_pt = pt;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandDelNode :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandDelNode(void);
|
||||||
|
~CCommandDelNode(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetPar(int idx,Dbxy pt);
|
||||||
|
private:
|
||||||
|
int m_idx;
|
||||||
|
Dbxy m_pt;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandDelete.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandDelete::CCommandDelete(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCommandDelete::~CCommandDelete(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCommandDelete::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.DelObj(m_ObjContainer);
|
||||||
|
|
||||||
|
}
|
||||||
|
void CCommandDelete::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
layer.AddObject(m_ObjContainer);
|
||||||
|
}
|
||||||
|
CString CCommandDelete::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_erase ɾ³ý-----";
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
if(vec.empty()==false)
|
||||||
|
{
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",vec.size());
|
||||||
|
str +="[ÊýÁ¿] : <"+str1+">";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CommandBase.h"
|
||||||
|
class CCommandDelete :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandDelete(void);
|
||||||
|
~CCommandDelete(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandJion.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandJion::CCommandJion(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandJion::~CCommandJion(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//最后一个是合并后的obj
|
||||||
|
void CCommandJion::ExcuteExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->SetSelected(true);
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
if(iter == vec.end()-1)
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandJion::UndoExt()
|
||||||
|
{
|
||||||
|
CLayer &layer = GetLayerInstance();
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->SetSelected(true);
|
||||||
|
if(iter == vec.end()-1)
|
||||||
|
{
|
||||||
|
layer.DelObj((*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
layer.AddObject((*iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CString CCommandJion::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_jion 合并-----";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
//ºÏ²¢
|
||||||
|
class CCommandJion :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandJion(void);
|
||||||
|
~CCommandJion(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,125 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandMgr.h"
|
||||||
|
#include "LogMgr.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define MAX_UNDO_CNT 100//最大撤销次数
|
||||||
|
|
||||||
|
CCommandMgr gCommandMgr;
|
||||||
|
CCommandMgr::CCommandMgr(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandMgr::~CCommandMgr(void)
|
||||||
|
{
|
||||||
|
DelAllCmd();
|
||||||
|
}
|
||||||
|
void CCommandMgr::DelAllCmd()
|
||||||
|
{
|
||||||
|
m_UndoQueue.clear();
|
||||||
|
m_RedoQueue.clear();
|
||||||
|
}
|
||||||
|
//p 是指令特定的操作对象
|
||||||
|
void CCommandMgr::AddUndoCommand(CCommandBase *p)
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> Vec;
|
||||||
|
AddUndoCommand(p,Vec);
|
||||||
|
}
|
||||||
|
void CCommandMgr::AddUndoCommand(CCommandBase *p,vector<Sptr<CObjBase>> &pMarkObjectVec)
|
||||||
|
{
|
||||||
|
if(p->HasOpObj()==false)
|
||||||
|
{
|
||||||
|
//加入指定的
|
||||||
|
if(pMarkObjectVec.empty()==false)
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = pMarkObjectVec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = pMarkObjectVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
p->AddOpObj((*iter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else//没有指定就加入当前选择的obj
|
||||||
|
{
|
||||||
|
GetLayerInstance().GetObjContainer().AddObjToCmd(p,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p->HasOpObj()==false)//没有操作对象时不要添加指令
|
||||||
|
{
|
||||||
|
delete p;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gCommandMgr.AddUndoCommandExt(p);
|
||||||
|
}
|
||||||
|
//添加指令
|
||||||
|
void CCommandMgr::AddUndoCommandExt(CCommandBase *p)
|
||||||
|
{
|
||||||
|
//------------------------------------日志start
|
||||||
|
CLog log;
|
||||||
|
log.AddCmdLog();
|
||||||
|
log.str = p->GetStr();
|
||||||
|
gLogMgr->WriteLog(log);
|
||||||
|
//------------------------------------日志end
|
||||||
|
//保存到智能指针
|
||||||
|
Sptr<CCommandBase> sPtr(p);
|
||||||
|
|
||||||
|
m_UndoQueue.push_back(sPtr);
|
||||||
|
if(m_UndoQueue.size()>MAX_UNDO_CNT)
|
||||||
|
{
|
||||||
|
m_UndoQueue.pop_front();
|
||||||
|
}
|
||||||
|
//之前的redo 全部清除
|
||||||
|
m_RedoQueue.clear();
|
||||||
|
}
|
||||||
|
bool CCommandMgr::HasUndoCmd()
|
||||||
|
{
|
||||||
|
return !m_UndoQueue.empty();
|
||||||
|
}
|
||||||
|
bool CCommandMgr::HasRedoCmd()
|
||||||
|
{
|
||||||
|
return !m_RedoQueue.empty();
|
||||||
|
}
|
||||||
|
void CCommandMgr::Undo()
|
||||||
|
{
|
||||||
|
if(!m_UndoQueue.empty())
|
||||||
|
{
|
||||||
|
Sptr<CCommandBase> p = m_UndoQueue[m_UndoQueue.size()-1];
|
||||||
|
p->Undo();
|
||||||
|
m_RedoQueue.push_back(p);
|
||||||
|
m_UndoQueue.pop_back();
|
||||||
|
//------------------------------------日志start
|
||||||
|
CLog log;
|
||||||
|
log.AddCmdLog();
|
||||||
|
{
|
||||||
|
CString str = p->GetStr();
|
||||||
|
log.str = "_undo 撤销"+str;
|
||||||
|
}
|
||||||
|
gLogMgr->WriteLog(log);
|
||||||
|
//------------------------------------日志end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandMgr::Redo()
|
||||||
|
{
|
||||||
|
if(!m_RedoQueue.empty())
|
||||||
|
{
|
||||||
|
Sptr<CCommandBase> p = m_RedoQueue[m_RedoQueue.size()-1];
|
||||||
|
p->Excute();
|
||||||
|
m_UndoQueue.push_back(p);
|
||||||
|
m_RedoQueue.pop_back();
|
||||||
|
//------------------------------------日志start
|
||||||
|
CLog log;
|
||||||
|
log.AddCmdLog();
|
||||||
|
{
|
||||||
|
CString str = p->GetStr();
|
||||||
|
log.str = "_redo 重做"+str;
|
||||||
|
}
|
||||||
|
gLogMgr->WriteLog(log);
|
||||||
|
//------------------------------------日志end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//重置回撤指令状态
|
||||||
|
void CCommandMgr::Reset()
|
||||||
|
{
|
||||||
|
m_UndoQueue.clear();
|
||||||
|
m_RedoQueue.clear();
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CommandBase.h"
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
|
||||||
|
//³·ÏúÖ¸Áî¹ÜÀí
|
||||||
|
class CCommandMgr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandMgr(void);
|
||||||
|
~CCommandMgr(void);
|
||||||
|
void AddUndoCommand(CCommandBase *p);
|
||||||
|
void AddUndoCommand(CCommandBase *p,vector<Sptr<CObjBase>> &pMarkObjectVec);
|
||||||
|
void AddUndoCommandExt(CCommandBase *p);
|
||||||
|
bool HasUndoCmd();
|
||||||
|
bool HasRedoCmd();
|
||||||
|
void Undo();
|
||||||
|
void Redo();
|
||||||
|
void Reset();
|
||||||
|
void DelAllCmd();
|
||||||
|
private:
|
||||||
|
deque<Sptr<CCommandBase>> m_UndoQueue;
|
||||||
|
deque<Sptr<CCommandBase>> m_RedoQueue;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CCommandMgr gCommandMgr;
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandMirror.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandMirror::CCommandMirror(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandMirror::~CCommandMirror(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandMirror::ExcuteExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,false);
|
||||||
|
}
|
||||||
|
void CCommandMirror::UndoExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,false);
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CommandBase.h"
|
||||||
|
class CCommandMirror :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandMirror(void);
|
||||||
|
~CCommandMirror(void);
|
||||||
|
virtual CString GetStr(){return "¾µÏñ";};
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandModifiCircle.h"
|
||||||
|
#include "ObjCircle.h"
|
||||||
|
|
||||||
|
CCommandModifiCircle::CCommandModifiCircle(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandModifiCircle::~CCommandModifiCircle(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//b 为true 时设置旧参数
|
||||||
|
void CCommandModifiCircle::SetPar(double Radius,int EdgeCnt,bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
{
|
||||||
|
m_OldRadius = Radius;//半径
|
||||||
|
m_OldEdgeCnt = EdgeCnt;//边数
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Radius = Radius;//半径
|
||||||
|
m_EdgeCnt = EdgeCnt;//边数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandModifiCircle::ExcuteExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(true);
|
||||||
|
}
|
||||||
|
void CCommandModifiCircle::UndoExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(false);
|
||||||
|
}
|
||||||
|
void CCommandModifiCircle::ReCreatObj(bool bExcute)
|
||||||
|
{
|
||||||
|
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
|
||||||
|
if(pBase)
|
||||||
|
{
|
||||||
|
CObjCircle *p = dynamic_cast<CObjCircle*>(pBase);
|
||||||
|
if(bExcute)
|
||||||
|
{
|
||||||
|
p->ReCreat(m_Radius,m_EdgeCnt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->ReCreat(m_OldRadius,m_OldEdgeCnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
|
||||||
|
//修改圆
|
||||||
|
class CCommandModifiCircle :
|
||||||
|
public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandModifiCircle(void);
|
||||||
|
~CCommandModifiCircle(void);
|
||||||
|
virtual CString GetStr(){return "修改circle";};
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetPar(double Radius,int EdgeCnt,bool b);
|
||||||
|
private:
|
||||||
|
void ReCreatObj(bool bExcute);
|
||||||
|
private:
|
||||||
|
double m_OldRadius;//半径
|
||||||
|
int m_OldEdgeCnt;//边数
|
||||||
|
|
||||||
|
double m_Radius;//半径
|
||||||
|
int m_EdgeCnt;//边数
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandModifiFill.h"
|
||||||
|
|
||||||
|
CCommandModifiFill::CCommandModifiFill(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CCommandModifiFill::~CCommandModifiFill(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//b 为true 时设置旧参数
|
||||||
|
void CCommandModifiFill::SetPar(SFillPar par,bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
{
|
||||||
|
m_OldPar = par;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_NewPar = par;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandModifiFill::ExcuteExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.FillObj(m_NewPar,false);
|
||||||
|
}
|
||||||
|
void CCommandModifiFill::UndoExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.FillObj(m_OldPar,false);
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
#include "SFillPar.h"
|
||||||
|
|
||||||
|
//填充
|
||||||
|
class CCommandModifiFill :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandModifiFill(void);
|
||||||
|
~CCommandModifiFill(void);
|
||||||
|
virtual CString GetStr(){return "修改fill";};
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetPar(SFillPar par,bool b);
|
||||||
|
private:
|
||||||
|
//字体参数
|
||||||
|
SFillPar m_OldPar;
|
||||||
|
SFillPar m_NewPar;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandModifiFont.h"
|
||||||
|
#include "ObjTxt.h"
|
||||||
|
|
||||||
|
CCommandModifiFont::CCommandModifiFont(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CCommandModifiFont::~CCommandModifiFont(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//b Ϊtrue ʱÉèÖþɲÎÊý
|
||||||
|
void CCommandModifiFont::SetStringPar(SFontPar &par,bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
{
|
||||||
|
m_OldFontPar = par;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_NewFontPar = par;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandModifiFont::ExcuteExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(true);
|
||||||
|
}
|
||||||
|
void CCommandModifiFont::UndoExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(false);
|
||||||
|
}
|
||||||
|
void CCommandModifiFont::ReCreatObj(bool bExcute)
|
||||||
|
{
|
||||||
|
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
|
||||||
|
if(pBase)
|
||||||
|
{
|
||||||
|
CObjTxt *p = dynamic_cast<CObjTxt*>(pBase);
|
||||||
|
if(bExcute)
|
||||||
|
{
|
||||||
|
p->SetFontPar(m_NewFontPar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->SetFontPar(m_OldFontPar);
|
||||||
|
}
|
||||||
|
p->Creat();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
#include "SFontPar.h"
|
||||||
|
|
||||||
|
class CCommandModifiFont :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandModifiFont(void);
|
||||||
|
~CCommandModifiFont(void);
|
||||||
|
virtual CString GetStr(){return "修改font";};
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetStringPar(SFontPar &par,bool b);
|
||||||
|
private:
|
||||||
|
void ReCreatObj(bool bExcute);
|
||||||
|
private:
|
||||||
|
//字体参数
|
||||||
|
SFontPar m_OldFontPar;
|
||||||
|
SFontPar m_NewFontPar;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandModifiString.h"
|
||||||
|
#include "ObjTxt.h"
|
||||||
|
|
||||||
|
CCommandModifiString::CCommandModifiString()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandModifiString::~CCommandModifiString(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//b 为true 时设置旧参数
|
||||||
|
void CCommandModifiString::SetStringPar(SStringPar &par,bool b)
|
||||||
|
{
|
||||||
|
if(b)
|
||||||
|
{
|
||||||
|
m_OldStringPar.Copy(par);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_NewStringPar.Copy(par);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandModifiString::ExcuteExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(true);
|
||||||
|
}
|
||||||
|
void CCommandModifiString::UndoExt()
|
||||||
|
{
|
||||||
|
ReCreatObj(false);
|
||||||
|
}
|
||||||
|
void CCommandModifiString::ReCreatObj(bool bExcute)
|
||||||
|
{
|
||||||
|
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
|
||||||
|
if(pBase)
|
||||||
|
{
|
||||||
|
CObjString *p = dynamic_cast<CObjString*>(pBase);
|
||||||
|
if(bExcute)
|
||||||
|
{
|
||||||
|
//可变文本
|
||||||
|
p->SetValStr(m_NewStringPar.m_ValString);
|
||||||
|
//字体
|
||||||
|
p->SetFontTypeName(m_NewStringPar.m_FontTypeName);
|
||||||
|
p->SetFontName(m_NewStringPar.m_FontName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//可变文本
|
||||||
|
p->SetValStr(m_OldStringPar.m_ValString);
|
||||||
|
//字体
|
||||||
|
p->SetFontTypeName(m_OldStringPar.m_FontTypeName);
|
||||||
|
p->SetFontName(m_OldStringPar.m_FontName);
|
||||||
|
}
|
||||||
|
p->Creat();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
#include "SStringPar.h"
|
||||||
|
|
||||||
|
//修改合成对象
|
||||||
|
class CCommandModifiString :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandModifiString();
|
||||||
|
~CCommandModifiString(void);
|
||||||
|
virtual CString GetStr(){return "修改string";};
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetStringPar(SStringPar &par,bool b);
|
||||||
|
private:
|
||||||
|
void ReCreatObj(bool bExcute);
|
||||||
|
private:
|
||||||
|
SStringPar m_OldStringPar;
|
||||||
|
SStringPar m_NewStringPar;
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandMove.h"
|
||||||
|
|
||||||
|
CCommandMove::CCommandMove(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandMove::~CCommandMove(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CString CCommandMove::GetStr()
|
||||||
|
{
|
||||||
|
CString str1 = "_move ÒÆ¶¯--------[¾àÀëx ] : <";
|
||||||
|
CString str2;
|
||||||
|
str2.Format("%lf",m_Par.MoveX);
|
||||||
|
CString str3 = "> [¾àÀëy ] : <";
|
||||||
|
CString str4;
|
||||||
|
str4.Format("%lf",m_Par.MoveY);
|
||||||
|
CString str5 = ">";
|
||||||
|
return str1+str2+str3+str4+str5;
|
||||||
|
}
|
||||||
|
void CCommandMove::ExcuteExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,false);
|
||||||
|
}
|
||||||
|
void CCommandMove::UndoExt()
|
||||||
|
{
|
||||||
|
//·´ÏòÒÆ¶¯
|
||||||
|
SObjOperatePar par = m_Par;
|
||||||
|
par.MoveX = par.MoveX*(-1);
|
||||||
|
par.MoveY = par.MoveY*(-1);
|
||||||
|
m_ObjContainer.OperateObj(par,false);
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CommandBase.h"
|
||||||
|
|
||||||
|
class CCommandMove :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandMove(void);
|
||||||
|
~CCommandMove(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandMoveNode.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandMoveNode::CCommandMoveNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandMoveNode::~CCommandMoveNode(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CString CCommandMoveNode::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_moveNode 移动节点";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
void CCommandMoveNode::SetPar(int idx,Dbxy OldPt,Dbxy NewPt)
|
||||||
|
{
|
||||||
|
m_NodeIdx = idx;//操作node 节点的索引值
|
||||||
|
m_OldPt = OldPt;//旧的坐标
|
||||||
|
m_NewPt = NewPt;//新的坐标
|
||||||
|
}
|
||||||
|
void CCommandMoveNode::ExcuteExt()
|
||||||
|
{
|
||||||
|
SetNode(true);
|
||||||
|
}
|
||||||
|
void CCommandMoveNode::UndoExt()
|
||||||
|
{
|
||||||
|
SetNode(false);
|
||||||
|
}
|
||||||
|
void CCommandMoveNode::SetNode(bool bExcute)
|
||||||
|
{
|
||||||
|
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
|
||||||
|
if(pBase)
|
||||||
|
{
|
||||||
|
if(bExcute)
|
||||||
|
{
|
||||||
|
pBase->SetNodePtByIdx(m_NodeIdx,m_NewPt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pBase->SetNodePtByIdx(m_NodeIdx,m_OldPt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
class CCommandMoveNode :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandMoveNode(void);
|
||||||
|
~CCommandMoveNode(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetPar(int idx,Dbxy OldPt,Dbxy NewPt);
|
||||||
|
private:
|
||||||
|
void SetNode(bool bExcute);
|
||||||
|
private:
|
||||||
|
int m_NodeIdx;//操作node 节点的索引值
|
||||||
|
Dbxy m_OldPt;//旧的坐标
|
||||||
|
Dbxy m_NewPt;//新的坐标
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandReverse.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandReverse::CCommandReverse(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandReverse::~CCommandReverse(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCommandReverse::ExcuteExt()
|
||||||
|
{
|
||||||
|
Operater();
|
||||||
|
}
|
||||||
|
void CCommandReverse::UndoExt()
|
||||||
|
{
|
||||||
|
Operater();
|
||||||
|
}
|
||||||
|
CString CCommandReverse::GetStr()
|
||||||
|
{
|
||||||
|
CString str = "_reverse ·´×ª½áµã˳Ðò-----";
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
if(vec.empty()==false)
|
||||||
|
{
|
||||||
|
CString str1;
|
||||||
|
str1.Format("%ld",vec.size());
|
||||||
|
str +="[¶ÔÏóÊýÁ¿] : <"+str1+">";
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
void CCommandReverse::Operater()
|
||||||
|
{
|
||||||
|
vector<Sptr<CObjBase>> &vec = m_ObjContainer.GetObjVec();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter = vec.begin();
|
||||||
|
vector<Sptr<CObjBase>>::iterator iter_end = vec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsNull()==false)
|
||||||
|
{
|
||||||
|
(*iter)->Operate(m_Par);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandbase.h"
|
||||||
|
//反转节点顺序
|
||||||
|
class CCommandReverse :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandReverse(void);
|
||||||
|
~CCommandReverse(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
private:
|
||||||
|
void Operater();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandRotato.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandRotato::CCommandRotato(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCommandRotato::~CCommandRotato(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CString CCommandRotato::GetStr()
|
||||||
|
{
|
||||||
|
CString str1 = "_rotato Ðýת-------- [½Ç¶È] : <";
|
||||||
|
double angle = m_Par.Angle;
|
||||||
|
if(angle>180)
|
||||||
|
{
|
||||||
|
angle = (360-angle)*(-1);
|
||||||
|
}
|
||||||
|
CString str2;
|
||||||
|
str2.Format("%lf",angle);
|
||||||
|
CString str3 = ">";
|
||||||
|
return str1+str2+str3;
|
||||||
|
}
|
||||||
|
void CCommandRotato::ExcuteExt()
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,false);
|
||||||
|
}
|
||||||
|
void CCommandRotato::UndoExt()
|
||||||
|
{
|
||||||
|
SObjOperatePar par = m_Par;
|
||||||
|
par.Angle = par.Angle*(-1);
|
||||||
|
m_ObjContainer.OperateObj(par,false);
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CommandBase.h"
|
||||||
|
class CCommandRotato :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandRotato(void);
|
||||||
|
~CCommandRotato(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CommandStretch.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCommandStretch::CCommandStretch(void)
|
||||||
|
{
|
||||||
|
m_bSetXY = false;//是否同时设置XY 方向
|
||||||
|
}
|
||||||
|
CCommandStretch::~CCommandStretch(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CString CCommandStretch::GetStr()
|
||||||
|
{
|
||||||
|
CString str1 = "_stretch 拉伸-------- [方向] : <";
|
||||||
|
CString str2;
|
||||||
|
if(m_Par.xy == _X)
|
||||||
|
str2 = "X> [旧尺寸] : <";
|
||||||
|
else
|
||||||
|
str2 = "Y> [旧尺寸] : <";
|
||||||
|
CString str3;
|
||||||
|
str3.Format("%lf",m_Par.OldSize);
|
||||||
|
CString str4 = "> [新尺寸] : <";
|
||||||
|
CString str5;
|
||||||
|
str5.Format("%lf",m_Par.NewSize);
|
||||||
|
CString str6 = ">";
|
||||||
|
return str1+str2+str3+str4+str5+str6;
|
||||||
|
};
|
||||||
|
void CCommandStretch::SetOperateParY(SObjOperatePar par)
|
||||||
|
{
|
||||||
|
m_bSetXY = true;//是否同时设置XY 方向
|
||||||
|
m_ParY = par;
|
||||||
|
};
|
||||||
|
void CCommandStretch::ExcuteExt()
|
||||||
|
{
|
||||||
|
if(m_bSetXY)
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,true);
|
||||||
|
m_ObjContainer.OperateObj(m_ParY,true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(m_Par,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCommandStretch::UndoExt()
|
||||||
|
{
|
||||||
|
SObjOperatePar par = m_Par;
|
||||||
|
par.OpType = _OP_STRETCH;
|
||||||
|
par.BasePt = m_Par.BasePt;
|
||||||
|
par.OldSize = m_Par.NewSize;
|
||||||
|
par.Diff = m_Par.Diff*(-1);
|
||||||
|
par.xy = m_Par.xy;
|
||||||
|
|
||||||
|
SObjOperatePar parY = m_ParY;
|
||||||
|
parY.OpType = _OP_STRETCH;
|
||||||
|
parY.BasePt = m_ParY.BasePt;
|
||||||
|
parY.OldSize = m_ParY.NewSize;
|
||||||
|
parY.Diff = m_ParY.Diff*(-1);
|
||||||
|
parY.xy = m_ParY.xy;
|
||||||
|
|
||||||
|
if(m_bSetXY)
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(par,true);
|
||||||
|
m_ObjContainer.OperateObj(parY,true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ObjContainer.OperateObj(par,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "commandBase.h"
|
||||||
|
class CCommandStretch :public CCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandStretch(void);
|
||||||
|
~CCommandStretch(void);
|
||||||
|
virtual CString GetStr();
|
||||||
|
virtual void ExcuteExt();
|
||||||
|
virtual void UndoExt();
|
||||||
|
void SetOperateParY(SObjOperatePar par);
|
||||||
|
private:
|
||||||
|
bool m_bSetXY;//是否同时设置XY 方向
|
||||||
|
SObjOperatePar m_ParY;//操作参数
|
||||||
|
};
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,122 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
class CCamera;
|
||||||
|
class CProduct;
|
||||||
|
class CWorkCmdContainer;
|
||||||
|
//管理常用 的流程
|
||||||
|
class CCommonFlowMgr :public CModule
|
||||||
|
{
|
||||||
|
friend class DlgCutDeviceCtrl;
|
||||||
|
friend class CDlgSW_XL_Flow;
|
||||||
|
public:
|
||||||
|
CCommonFlowMgr(void);
|
||||||
|
~CCommonFlowMgr(void);
|
||||||
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
||||||
|
virtual MODULE GetModuleType(){return _COMMON_FLOW_PROP;};
|
||||||
|
virtual void Ini();
|
||||||
|
virtual void WriteWorkFileExt(vector<CLab> &LabVec);
|
||||||
|
virtual void ReadWorkFile(CLabVecRang &LabVecRang);
|
||||||
|
|
||||||
|
bool InitDevice();
|
||||||
|
bool CameraCatchTwoMark();
|
||||||
|
bool MultipleAreaMark(CProduct &Product,bool bSel);
|
||||||
|
bool CutShapeByPlatform(CProduct &Product,bool bSel);
|
||||||
|
bool NormalMarkByPciCard(bool bSel,int times,int CyclicTimes);
|
||||||
|
bool CameraCatch();
|
||||||
|
bool AutoMeasureVisionData();
|
||||||
|
void MovePtToCamera(vector<Dbxy> &PtVec,vector<Dbxy> &ResultVec,bool bCatch);
|
||||||
|
void MovePtToCamera(Dbxy pt);
|
||||||
|
int GetAreaCycleCnt(){return m_AreaCycleCnt;};
|
||||||
|
void SetAreaCycleCnt(int n){m_AreaCycleCnt = n;};
|
||||||
|
int GetOneObjMarkCnt(){return m_OneObjMarkCnt;};
|
||||||
|
void SetOneObjMarkCnt(int val){m_OneObjMarkCnt = val;};
|
||||||
|
int GetSpecialOneObjMarkCnt(){return m_SpecialOneObjMarkCnt;};
|
||||||
|
void SetSpecialOneObjMarkCnt(int val){m_SpecialOneObjMarkCnt = val;};
|
||||||
|
int GetCutSpeed(){return m_CutSpeed;};
|
||||||
|
void SetCutSpeed(int val){m_CutSpeed = val;};
|
||||||
|
bool IsbConnectObj(){return m_bConnectObj;};
|
||||||
|
void MoveSelObjToCamera(CProduct &Product);
|
||||||
|
double GetFirstGap(){return m_FirstGap;};
|
||||||
|
Dbxy GetAdjustOffset(){return m_AdjustOffset;};
|
||||||
|
void SetAdjustOffset(Dbxy pt){m_AdjustOffset = pt;};
|
||||||
|
Dbxy GetAdjustOffsetAll(){return m_AdjustOffsetAll;};
|
||||||
|
void SetAdjustOffsetAll(Dbxy Offset);
|
||||||
|
Dbxy GetAdjustSize(){return m_SizeAdjust;};
|
||||||
|
void SetAdjustSize(Dbxy s){m_SizeAdjust = s;};
|
||||||
|
double GetRotatoAdjust(){return m_RotatoAdjust;};
|
||||||
|
void SetRotatoAdjust(double val){m_RotatoAdjust = val;};
|
||||||
|
bool IsNoMarkCanWork(){return m_NoMarkCanWork;};
|
||||||
|
bool IsbWorkStop(){return m_bWorkStop;};
|
||||||
|
void SetbWorkStop(bool b){m_bWorkStop = b;};
|
||||||
|
void CameraCatchTwoMark(CProduct &Product);
|
||||||
|
void SetLightStateCmd(bool bStart);
|
||||||
|
bool StartWorkConfirm(bool bSelMark);
|
||||||
|
bool IsNeedExecAgain();
|
||||||
|
void ResetProductOffset();
|
||||||
|
void SetbCollectSpecialObj(bool b){m_bCollectSpecialObj = b;};
|
||||||
|
bool IsbCollectSpecialObj(){return m_bCollectSpecialObj;};
|
||||||
|
bool IsbStretchDataToRealSize(){return m_bStretchDataToRealSize;};
|
||||||
|
bool CameraCatchMark3(CProduct &Product);
|
||||||
|
|
||||||
|
Dbxy GetNPOffset(); //获取新增料片的位置偏移
|
||||||
|
private:
|
||||||
|
void SetLightStateCmd(CWorkCmdContainer &CmdContainer,bool bStart);
|
||||||
|
bool CameraCatchMarkExt(CProduct &Product);
|
||||||
|
void MoveToFirstArea();
|
||||||
|
private:
|
||||||
|
CCamera *m_CurCamera;//当前使用的相机
|
||||||
|
int m_AlamDelay;//报警延时(ms)
|
||||||
|
int m_FindOriginTimes;//自动回原点的加工次数(大于0 时生效)
|
||||||
|
int m_CurWorktimes;//当前的加工次数
|
||||||
|
int m_AllWorkExecTimes;//重复执行次数(用来拷机)
|
||||||
|
int m_CurWorkExecTimes;//当前执行次数(用来拷机)
|
||||||
|
bool m_bStartWorkMsg;//加工前提示
|
||||||
|
bool m_NoMarkCanWork;//没有定位点时也可以加工
|
||||||
|
bool m_bWorkStop;//工作是否停止
|
||||||
|
bool m_bVacuum;//是否使用真空吸附(加工前吸附,结束后放开)
|
||||||
|
bool m_bCheckObjDataConsistency;//是否检查数据的一致性(避免obj 数据不相等的情况)
|
||||||
|
//初始化相关参数-----------------------------------------------------
|
||||||
|
bool m_bIniConfirmMsgBox;//是否弹出初始化确认对话框
|
||||||
|
bool m_bIniPlatfrom;//是否初始化电机平台
|
||||||
|
bool m_bIniMotorX;//是否初始化电机X
|
||||||
|
bool m_bIniMotorY;//是否初始化电机Y
|
||||||
|
bool m_bIniMotorZ;//是否初始化电机Z
|
||||||
|
bool m_bInitedToProductPt;//初始化完成后是否返回上料点
|
||||||
|
//大幅面加工参数-------------------------------------------------------
|
||||||
|
//每个obj 的总加工次数= (m_FocalAdjustCnt-1)*m_AreaCycleCnt*m_OneObjMarkCnt
|
||||||
|
bool m_bFocalAdjust;//加工的时候是否实时调整焦距
|
||||||
|
double m_FocalAdjustDis;//变焦距离mm
|
||||||
|
int m_FocalAdjustCnt;//变焦次数(每变焦一次按照下面的参数加工一遍)
|
||||||
|
|
||||||
|
//产品相关的切割参数
|
||||||
|
int m_AreaCycleCnt;//每次一个workarea 的循环加工次数
|
||||||
|
int m_OneObjMarkCnt;//单个元件加工次数
|
||||||
|
int m_SpecialOneObjMarkCnt;//特殊刀增加的切割次数
|
||||||
|
bool m_bCollectSpecialObj;//是否正在收集特殊对象数据
|
||||||
|
int m_CutSpeed;//切割速度
|
||||||
|
Dbxy m_ProductOffset;//针对产品的切割偏移
|
||||||
|
|
||||||
|
|
||||||
|
bool m_bConnectObj;//是否连接多个obj 数据
|
||||||
|
bool m_bBackToProductPt;//加工完成后是否返回取料点
|
||||||
|
bool m_bSetLightState;//是否设置警示灯状态
|
||||||
|
|
||||||
|
int m_ConcentricCnt;//同心数据的数量
|
||||||
|
double m_FirstGap;//第一个拉伸尺寸
|
||||||
|
double m_ConcentricGap;//同心数据的间隔mm(大于0 向外)(小于0 向内)
|
||||||
|
|
||||||
|
Dbxy m_AdjustOffset;//偏移微调mm
|
||||||
|
Dbxy m_AdjustOffsetAll;//偏移微调mm (针对所有)
|
||||||
|
Dbxy m_SizeAdjust;//尺寸调整mm
|
||||||
|
double m_RotatoAdjust;//旋转调整mm
|
||||||
|
|
||||||
|
bool m_bStretchDataToRealSize;//根据抓取结果拉伸数据
|
||||||
|
//平台cut 参数--------------------------------------------------------------
|
||||||
|
bool m_bUseLaser;//是否开关激光
|
||||||
|
//振镜校准参数--------------------------------------------------------------
|
||||||
|
double m_CalibrationPointGap;//打点之间的间隔mm
|
||||||
|
double m_CalibrationRange;//振镜校准范围mm
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CCommonFlowMgr *gCommonFlowMgr;
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
|
||||||
|
//创建抓取定位点的指令
|
||||||
|
class CCreaterCatchMark :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterCatchMark(const CString &str);
|
||||||
|
~CCreaterCatchMark(void);
|
||||||
|
virtual void Creat();
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterCatchMarkFlow.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
#include "WorkCmdMovePlatformXY.h"
|
||||||
|
#include "CameraKeyence.h"
|
||||||
|
#include "WorkCmdCameraCatch.h"
|
||||||
|
#include "ProductMgr.h"
|
||||||
|
#include "ObjComponentMgr.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CCreaterCatchMarkFlow::CCreaterCatchMarkFlow(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterCatchMarkFlow::~CCreaterCatchMarkFlow(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterCatchMarkFlow::Creat()
|
||||||
|
{
|
||||||
|
//×Ô¶¯ÅŲ¼Ê±²»Òª×¥È¡
|
||||||
|
if(gObjComponentMgr->IsAutoArray())
|
||||||
|
return;
|
||||||
|
|
||||||
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
||||||
|
vector<CProduct>::iterator iter = ProductVec.begin();
|
||||||
|
vector<CProduct>::iterator iter_end = ProductVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
CreatExt(*iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCreaterCatchMarkFlow::CreatExt(CProduct &Product)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
class CProduct;
|
||||||
|
//创建抓取定位点的流程
|
||||||
|
class CCreaterCatchMarkFlow :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterCatchMarkFlow(const CString &str);
|
||||||
|
~CCreaterCatchMarkFlow(void);
|
||||||
|
virtual void Creat();
|
||||||
|
private:
|
||||||
|
void CreatExt(CProduct &Product);
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterCutFlow.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
#include "MarkAreaMgr.h"
|
||||||
|
#include "WorkCmdMovePlatformXY.h"
|
||||||
|
#include "WorkCmdPciPortSwitch.h"
|
||||||
|
#include "Laser.h"
|
||||||
|
#include "PciPortMgr.h"
|
||||||
|
|
||||||
|
#define MARK_ALL "ALL"
|
||||||
|
#define MARK_SEL "SEL"
|
||||||
|
|
||||||
|
CCreaterCutFlow::CCreaterCutFlow(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterCutFlow::~CCreaterCutFlow(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//根据工作区域的数据来创建切割流程
|
||||||
|
void CCreaterCutFlow::Creat()
|
||||||
|
{
|
||||||
|
//参数1 表示是否全部加工
|
||||||
|
CString MarkType = GetPar(1);
|
||||||
|
//搜集工作数据-------------------------------------------------
|
||||||
|
if(MarkType == MARK_SEL)
|
||||||
|
CollectWorkData(true);
|
||||||
|
else
|
||||||
|
CollectWorkData(false);
|
||||||
|
|
||||||
|
//使用数据来创建工作流程
|
||||||
|
vector<CMarkArea> &AreaVec = gMarkAreaMgr->GetAreaVec();
|
||||||
|
vector<CMarkArea>::iterator iter = AreaVec.begin();
|
||||||
|
vector<CMarkArea>::iterator iter_end = AreaVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
vector<vector<Dbxy>> &Vec = (*iter).GetDataVec();
|
||||||
|
CreatExt(Vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCreaterCutFlow::CreatExt(vector<vector<Dbxy>> &Vec)
|
||||||
|
{
|
||||||
|
vector<vector<Dbxy>>::iterator iter = Vec.begin();
|
||||||
|
vector<vector<Dbxy>>::iterator iter_end = Vec.end();
|
||||||
|
for(int i=0;iter!=iter_end;i++,iter++)
|
||||||
|
{
|
||||||
|
vector<Dbxy>::iterator iter1 = (*iter).begin();
|
||||||
|
vector<Dbxy>::iterator iter1_end = (*iter).end();
|
||||||
|
for(;iter1!=iter1_end;iter1++)
|
||||||
|
{
|
||||||
|
//移动平台---------------------------------------------
|
||||||
|
{
|
||||||
|
CWorkCmdMovePlatformXY *pCmd = new CWorkCmdMovePlatformXY();
|
||||||
|
pCmd->MoveToTargetPt((*iter1),gLaser->GetCoord());
|
||||||
|
if(iter1 != (*iter).begin())//移动到第一个点是空移
|
||||||
|
{
|
||||||
|
pCmd->InWorkState();//其他点是工作点
|
||||||
|
}
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
//开激光-------------------------------------------------
|
||||||
|
if(iter1==(*iter).begin())
|
||||||
|
{
|
||||||
|
CWorkCmd *pCmd = new CWorkCmdPciPortSwitch(PCI_PORT_LASER,true);
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//关激光-------------------------------------------------
|
||||||
|
{
|
||||||
|
CWorkCmd *pCmd = new CWorkCmdPciPortSwitch(PCI_PORT_LASER,false);
|
||||||
|
pCmd->CanNotCancel();//不能取消
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
//根据workarea 内的obj 数据来创建切割工作流程
|
||||||
|
class CCreaterCutFlow :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterCutFlow(const CString &str);
|
||||||
|
~CCreaterCutFlow(void);
|
||||||
|
virtual void Creat();
|
||||||
|
private:
|
||||||
|
void CreatExt(vector<vector<Dbxy>> &Vec);
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterDeviceParReset.h"
|
||||||
|
#include "WorkCmdDeviceParReset.h"
|
||||||
|
|
||||||
|
CCreaterDeviceParReset::CCreaterDeviceParReset(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterDeviceParReset::~CCreaterDeviceParReset(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterDeviceParReset::Creat()
|
||||||
|
{
|
||||||
|
CWorkCmd *pCmd = new CWorkCmdDeviceParReset;
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
//设备参数复位
|
||||||
|
class CCreaterDeviceParReset :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterDeviceParReset(const CString &str);
|
||||||
|
~CCreaterDeviceParReset(void);
|
||||||
|
virtual void Creat();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterMarkFlow.h"
|
||||||
|
#include "GlobalFunction.h"
|
||||||
|
#include "MarkAreaMgr.h"
|
||||||
|
#include "WorkCmdMovePlatformXY.h"
|
||||||
|
#include "Laser.h"
|
||||||
|
#include "WorkCmdMarkArea.h"
|
||||||
|
#include "ProductMgr.h"
|
||||||
|
#include "Motor.h"
|
||||||
|
#include "WorkCmdMoveMotor.h"
|
||||||
|
|
||||||
|
#define MARK_ALL "ALL"
|
||||||
|
#define MARK_SEL "SEL"
|
||||||
|
|
||||||
|
CCreaterMarkFlow::CCreaterMarkFlow(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterMarkFlow::~CCreaterMarkFlow(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//根据工作区域的数据来创建
|
||||||
|
void CCreaterMarkFlow::Creat()
|
||||||
|
{
|
||||||
|
//参数1 表示是否全部加工
|
||||||
|
CString MarkType = GetPar(1);
|
||||||
|
bool bMarkSel = (MarkType == MARK_SEL);
|
||||||
|
|
||||||
|
vector<CProduct> &ProductVec = gProductMgr->GetProductVec();
|
||||||
|
vector<CProduct>::iterator iter = ProductVec.begin();
|
||||||
|
vector<CProduct>::iterator iter_end = ProductVec.end();
|
||||||
|
for(int i=0;iter!=iter_end;i++,iter++)
|
||||||
|
{
|
||||||
|
if((*iter).IsUsed())
|
||||||
|
{
|
||||||
|
//设置当前的工件,用来计算偏移旋转
|
||||||
|
gProductMgr->SetCurProductIdx(i);
|
||||||
|
CreatExt(bMarkSel);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if(iter!=iter_end-1)//加工完一个先移动回原点
|
||||||
|
{
|
||||||
|
CWorkCmdMovePlatformXY *pCmd = new CWorkCmdMovePlatformXY();
|
||||||
|
Dbxy MovePt;
|
||||||
|
Dbxy TargetPt;
|
||||||
|
pCmd->MoveToTargetPt(MovePt,TargetPt);
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CCreaterMarkFlow::CreatExt(bool bMarkSel)
|
||||||
|
{
|
||||||
|
//搜集工作数据-------------------------------------------------
|
||||||
|
CollectWorkData(bMarkSel);
|
||||||
|
|
||||||
|
//以area 的中心点转换数据-------------------------------
|
||||||
|
CMarkAreaMgr *MarkAreaMgr = gMarkAreaMgr;
|
||||||
|
//使用数据来创建工作流程----------------------------
|
||||||
|
vector<CMarkArea> &AreaVec = MarkAreaMgr->GetAreaVec();
|
||||||
|
vector<CMarkArea>::iterator iter = AreaVec.begin();
|
||||||
|
vector<CMarkArea>::iterator iter_end = AreaVec.end();
|
||||||
|
for(;iter!=iter_end;iter++)
|
||||||
|
{
|
||||||
|
if((*iter).HasWorkData())
|
||||||
|
{
|
||||||
|
//移动area 实际中心点到振镜中心
|
||||||
|
{
|
||||||
|
CWorkCmdMovePlatformXY *pCmd = new CWorkCmdMovePlatformXY();
|
||||||
|
// pCmd->MoveToTargetPt((*iter).GetRealBasePt(),gLaser->GetCoord());
|
||||||
|
pCmd->InWorkState();//工作速度
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
//变焦次数
|
||||||
|
int FocalAdjustCnt = gProductMgr->GetFocalAdjustCnt();
|
||||||
|
double FocalAdjustDis = gProductMgr->GetFocalAdjustDis();
|
||||||
|
|
||||||
|
for(int i=0;i<FocalAdjustCnt+1;++i)
|
||||||
|
{
|
||||||
|
//标刻当前area
|
||||||
|
{
|
||||||
|
CWorkCmdMarkArea *pCmd = new CWorkCmdMarkArea((*iter));
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
//变焦
|
||||||
|
if(FocalAdjustCnt>0 && !IsDbEqualZero(FocalAdjustDis) && i<FocalAdjustCnt)
|
||||||
|
{
|
||||||
|
CMotor &Motor = *(CMotor::GetMotor(MOTOR_Z));
|
||||||
|
CWorkCmdMoveMotor *pCmd = new CWorkCmdMoveMotor(Motor,FocalAdjustDis);
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//焦距回调
|
||||||
|
if(FocalAdjustCnt>0 && !IsDbEqualZero(FocalAdjustDis))
|
||||||
|
{
|
||||||
|
for(int i=0;i<FocalAdjustCnt;i++)
|
||||||
|
{
|
||||||
|
CMotor &Motor = *(CMotor::GetMotor(MOTOR_Z));
|
||||||
|
CWorkCmdMoveMotor *pCmd = new CWorkCmdMoveMotor(Motor,FocalAdjustDis*(-1));
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
//´´½¨Æ½Ãæ±ê¿ÌÁ÷³Ì
|
||||||
|
class CCreaterMarkFlow :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterMarkFlow(const CString &str);
|
||||||
|
~CCreaterMarkFlow(void);
|
||||||
|
virtual void Creat();
|
||||||
|
private:
|
||||||
|
void CreatExt(bool bMarkSel);
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterMotorCheckLimit.h"
|
||||||
|
|
||||||
|
|
||||||
|
CCreaterMotorCheckLimit::CCreaterMotorCheckLimit(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterMotorCheckLimit::~CCreaterMotorCheckLimit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterMotorCheckLimit::Creat()
|
||||||
|
{
|
||||||
|
CWorkCmd *pCmd = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
//检查电机限位
|
||||||
|
class CCreaterMotorCheckLimit :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterMotorCheckLimit(const CString &str);
|
||||||
|
~CCreaterMotorCheckLimit(void);
|
||||||
|
virtual void Creat();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterMotorToMachineOrigin.h"
|
||||||
|
#include "WorkCmdMotorToMachineOrigin.h"
|
||||||
|
|
||||||
|
CCreaterMotorToMachineOrigin::CCreaterMotorToMachineOrigin(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterMotorToMachineOrigin::~CCreaterMotorToMachineOrigin(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterMotorToMachineOrigin::Creat()
|
||||||
|
{
|
||||||
|
CWorkCmd *pCmd = NULL;
|
||||||
|
//参数1 表示那个电机
|
||||||
|
CString Motor = GetPar(1);
|
||||||
|
pCmd = new CWorkCmdMotorToMachineOrigin(*(CMotor::GetMotor(Motor)));
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
|
||||||
|
//创建电机移动到机械原点的指令
|
||||||
|
class CCreaterMotorToMachineOrigin :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterMotorToMachineOrigin(const CString &str);
|
||||||
|
~CCreaterMotorToMachineOrigin(void);
|
||||||
|
virtual void Creat();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterMotorToOffsetPos.h"
|
||||||
|
#include "WorkCmdMotorToOffsetPos.h"
|
||||||
|
#include "Laser.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CCreaterMotorToOffsetPos::CCreaterMotorToOffsetPos(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterMotorToOffsetPos::~CCreaterMotorToOffsetPos(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterMotorToOffsetPos::Creat()
|
||||||
|
{
|
||||||
|
CWorkCmdMotorToOffsetPos *pCmd = NULL;
|
||||||
|
//参数1 表示那个电机
|
||||||
|
CString Motor = GetPar(1);
|
||||||
|
pCmd = new CWorkCmdMotorToOffsetPos(*(CMotor::GetMotor(Motor)));
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "createrworkcmd.h"
|
||||||
|
class CCreaterMotorToOffsetPos :public CCreaterWorkCmd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCreaterMotorToOffsetPos(const CString &str);
|
||||||
|
~CCreaterMotorToOffsetPos(void);
|
||||||
|
virtual void Creat();
|
||||||
|
};
|
||||||
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
#include "CreaterMsg.h"
|
||||||
|
#include "WorkCmdMsg.h"
|
||||||
|
|
||||||
|
CCreaterMsg::CCreaterMsg(const CString &str)
|
||||||
|
:CCreaterWorkCmd(str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
CCreaterMsg::~CCreaterMsg(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void CCreaterMsg::Creat()
|
||||||
|
{
|
||||||
|
//参数1 表示提示内容
|
||||||
|
CString msg = GetPar(1);
|
||||||
|
CWorkCmd *pCmd = NULL;
|
||||||
|
pCmd = new CWorkCmdMsg(msg);
|
||||||
|
AddCmd(pCmd);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue