From 111f4b35df589fe2c76bc42bb5f8194a278142fb Mon Sep 17 00:00:00 2001 From: Georgi Tushev Date: Wed, 2 Jan 2019 22:41:30 +0100 Subject: [PATCH] add macx epos lib --- libs/epos/macx/Definitions.cpp | 129 +++++++++++++++++++++++++++++++++ libs/epos/macx/Definitions.h | 72 ++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 libs/epos/macx/Definitions.cpp create mode 100644 libs/epos/macx/Definitions.h diff --git a/libs/epos/macx/Definitions.cpp b/libs/epos/macx/Definitions.cpp new file mode 100644 index 0000000..7fbe121 --- /dev/null +++ b/libs/epos/macx/Definitions.cpp @@ -0,0 +1,129 @@ +#include "Definitions.h" + +HANDLE VCS_OpenDevice(char deviceName[], + char protocolStackName[], + char interfaceName[], + char portName[], + DWORD *errorCode) +{ + WORD handle = DEVICE_ID; + void *pHandle = &handle; + std::cout << "VCS_OpenDevice" << std::endl; + std::cout << "\t" << deviceName << std::endl; + std::cout << "\t" << protocolStackName << std::endl; + std::cout << "\t" << interfaceName << std::endl; + std::cout << "\t" << portName << std::endl; + *errorCode = 0; + return pHandle; +} + +BOOL VCS_CloseDevice(HANDLE deviceHandle, DWORD *errorCode) +{ + std::cout << "VCS_CloseDevice" << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_GetFaultState(HANDLE deviceHandle, WORD nodeId, BOOL *isFaultState, DWORD *errorCode) +{ + std::cout << "VCS_GetFaultState " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + *isFaultState = TRUE; + } + + return TRUE; +} + +BOOL VCS_GetErrorInfo(DWORD errorCode, char errorInfo[], WORD errorInfoSize) +{ + std::cout << "VCS_GetErrorInfo " << errorCode << std::endl; + std::cout << "\t" << errorInfo << " " << errorInfoSize; + + return TRUE; +} + +BOOL VCS_ClearFault(HANDLE deviceHandle, WORD nodeId, DWORD *errorCode) +{ + std::cout << "VCS_ClearFault " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_SetEnableState(HANDLE deviceHandle, WORD nodeId, DWORD *errorCode) +{ + std::cout << "VCS_SetEnableState " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_SetDisableState(HANDLE deviceHandle, WORD nodeId, DWORD *errorCode) +{ + std::cout << "VCS_SetDisableState " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_ActivateVelocityMode(HANDLE deviceHandle, WORD nodeId, DWORD *errorCode) +{ + std::cout << "VCS_ActivateVelocityMode " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_SetVelocityMust(HANDLE deviceHandle, WORD nodeId, int velocity, DWORD *errorCode) +{ + std::cout << "VCS_SetVelocityMust " << nodeId << " " << velocity << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_SetQuickStopState(HANDLE deviceHandle, WORD nodeId, DWORD *errorCode) +{ + std::cout << "VCS_SetQuickStopState " << nodeId << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} + +BOOL VCS_DigitalOutputConfiguration(HANDLE deviceHandle, WORD nodeId, WORD digitalOutputNb, WORD configuration, BOOL state, BOOL mask, BOOL polarity, DWORD *errorCode) +{ + std::cout << "VCS_DigitalOutputConfiguration " << nodeId << std::endl; + std::cout << "\t" << digitalOutputNb << std::endl; + std::cout << "\t" << configuration << std::endl; + std::cout << "\t" << state << "\t" << mask << "\t" << polarity << std::endl; + + if (deviceHandle) { + *errorCode = 0; + } + + return TRUE; +} diff --git a/libs/epos/macx/Definitions.h b/libs/epos/macx/Definitions.h new file mode 100644 index 0000000..ac0b462 --- /dev/null +++ b/libs/epos/macx/Definitions.h @@ -0,0 +1,72 @@ +#ifndef EPOS_DEFINITIONS +#define EPOS_DEFINITIONS + +#include + +typedef void *PVOID; +typedef int BOOL; +typedef PVOID HANDLE; +typedef unsigned short WORD; +typedef unsigned long DWORD; + +const BOOL TRUE = 1; +const BOOL FALSE = 0; + +const WORD DIC_GENERAL_PURPOSE_C = 1; +const WORD DIC_GENERAL_PURPOSE_D = 2; +const WORD DEVICE_ID = 1234; + +HANDLE VCS_OpenDevice(char deviceName[], + char protocolStackName[], + char interfaceName[], + char portName[], + DWORD *errorCode); + +BOOL VCS_CloseDevice(HANDLE deviceHandle, + DWORD *errorCode); + +BOOL VCS_GetFaultState(HANDLE deviceHandle, + WORD nodeId, + BOOL *isFaultState, + DWORD *errorCode); + +BOOL VCS_GetErrorInfo(DWORD errorCode, + char errorInfo[], + WORD errorInfoSize); + +BOOL VCS_ClearFault(HANDLE deviceHandle, + WORD nodeId, + DWORD *errorCode); + +BOOL VCS_SetEnableState(HANDLE deviceHandle, + WORD nodeId, + DWORD *errorCode); + +BOOL VCS_SetDisableState(HANDLE deviceHandle, + WORD nodeId, + DWORD *errorCode); + +BOOL VCS_ActivateVelocityMode(HANDLE deviceHandle, + WORD nodeId, + DWORD *errorCode); + +BOOL VCS_SetVelocityMust(HANDLE deviceHandle, + WORD nodeId, + int velocity, + DWORD *errorCode); + +BOOL VCS_SetQuickStopState(HANDLE deviceHandle, + WORD nodeId, + DWORD *errorCode); + +BOOL VCS_DigitalOutputConfiguration(HANDLE deviceHandle, + WORD nodeId, + WORD digitalOutputNb, + WORD configuration, + BOOL state, + BOOL mask, + BOOL polarity, + DWORD *errorCode); + + +#endif /* EPOS_DEFINITIONS */