//--------------------------------------------------------------------------- // Main include file for MEServo.DLL #ifndef MEServoH #define MEServoH //--------------------------------------------------------------------------- #ifdef MES_DLL #define MES_EXPORT extern "C" __declspec(dllexport) #else #define MES_EXPORT extern "C" __declspec(dllimport) #endif //--------------------------------------------------------------------------- #define MES_VERSION_HIGH 1 #define MES_VERSION_LOW 0 #define MES_VERSION_BUILD 1 #define MES_VERSION_DWORD ((MES_VERSION_HIGH << 16) + MES_VERSION_LOW * 100 + MES_VERSION_BUILD) //--------------------------------------------------------------------------- // Error and Status return values for MEServo.DLL #pragma pack (push, 1) enum tMESServoErrors { MES_OK = 0, // successful call; OK button from dialog MES_CANCEL, // Cancel button from dialog MES_ERROR_BIT = 0x80000000, // All errors have top bit set MES_ERROR_INIT_FAIL, // DLL initialization failure or MES_Initialize not called MES_ERROR_EXCEPTION, // unhandled exception occured MES_ERROR_BUSY, // call not allowed due to tape motion, etc. MES_ERROR_OPEN_FAIL, // could not access serial port (config error?) MES_ERROR_NO_SERVO, // no response from servo (wrong serial port?) MES_ERROR_NOT_OPEN, // Serial port is not open MES_ERROR_INVALID_FILE, // bad file or path for inifile MES_ERROR_INVALID_PARAM, // bad value in parameter struct (check dwSize!) MES_ERROR_PARSE, // response from servo could not be parsed MES_ERROR_MENU, // couldn't change menus (servo crashed?) MES_ERROR_UNSUPPORTED, // command not supported on this firmware version MES_ERROR_TIMEOUT // servo has stopped responding (can be caused by severely out-of-sync menu state.) }; enum tMESServoNotify { MES_RESET = 0x01, MES_VERSION = 0x02, // dwData = firmware version MES_BOT = 0x04, MES_EOT = 0x08, MES_DONE = 0x10, MES_PASS = 0x20, // dwData = pass number MES_STATUS = 0x40, // dwData -> tMESServoStatus structure MES_SERVO = 0x80, // dwData -> tMESRawServoStatus structure MES_ANALOG = 0x100, // dwData -> tMESAnalogInputs structure MES_ERROR = 0x200, // dwData -> tMESError structure MES_UNLOAD_PHASE = 0x400, MES_DATA_VISIBLE = 0x800, // dwData = bool Visible MES_NOTIFY_ALL = -1 }; enum tMESStatusBits { MES_TENSION = 0x00000001, MES_MOTION = 0x00000002, MES_DIRECTION = 0x00000004, MES_SLOW = 0x00000008, MES_WIND = 0x00000010, MES_GOTO_POS = 0x00000020, MES_WEAR = 0x00000040, MES_UNLOAD = 0x00000080, MES_OFF = 0x00000000, MES_STOP = MES_TENSION, MES_FORWARD = MES_TENSION | MES_MOTION, MES_REVERSE = MES_FORWARD | MES_DIRECTION, MES_SLOW_FORWARD = MES_SLOW | MES_FORWARD, MES_SLOW_REVERSE = MES_SLOW | MES_REVERSE, MES_WIND_FORWARD = MES_WIND | MES_FORWARD, MES_WIND_REVERSE = MES_WIND | MES_REVERSE, MES_GOTO = MES_GOTO_POS | MES_TENSION | MES_MOTION, MES_SHORT_WEAR = MES_WEAR | MES_TENSION | MES_MOTION, MES_LONG_WEAR = MES_WEAR | MES_SLOW, MES_UNLOAD_FORWARD = MES_UNLOAD | MES_SLOW_FORWARD, MES_UNLOAD_REVERSE = MES_UNLOAD | MES_REVERSE, MES_UNLOAD_WIND_REV = MES_UNLOAD | MES_WIND_REVERSE }; //--------------------------------------------------------------------------- // Types and structures used in MEServo.DLL typedef void (WINAPI tMESCallbackProc(DWORD dwType, DWORD dwData)); struct tMESError { DWORD dwSize; // must be sizeof (tMESError) LPCSTR pszError; // error string from servo }; struct tMESServoParams { DWORD dwSize; // must be sizeof (tMESServoParams) DWORD dwSpeed; // Tape speed in cm/sec DWORD dwTension; // Tape tension in mN CHAR cSensor; // '1' '2' 'B' or 'N' }; struct tMESStatus { DWORD dwSize; // must be sizeof (tMESServoStatus) DWORD dwStatus; // status bits -- see tMESStatusBits above LONG lSupplyPos; // supply motor encoder position LONG lTakeupPos; // takeup motor encoder position DWORD dwTension1; // tension sensor 1 in mN DWORD dwTension2; // tension sensor 2 in mN }; struct tMESWearTestParams { DWORD dwSize; // must be sizeof (tMESServoParams) LONG lBotLimit; LONG lEotLimit; DWORD dwCycles; LONG lDrift; DWORD dwCurrentPass; }; //--------------------------------------------------------------------------- // MEServo.DLL functions #ifndef MES_NO_PROTOTYPES MES_EXPORT DWORD MES_Abort (); MES_EXPORT DWORD MES_Close (); MES_EXPORT DWORD MES_DisableKeyboard (); MES_EXPORT DWORD MES_EditConfig (); MES_EXPORT DWORD MES_EnableKeyboard (); MES_EXPORT DWORD MES_Forward (); MES_EXPORT DWORD MES_GetFirmwareVersion (); MES_EXPORT DWORD MES_GetInterfaceVersion (); MES_EXPORT DWORD MES_GetServoParams (tMESServoParams * pData); MES_EXPORT DWORD MES_GetStatus (tMESStatus * pStatus); MES_EXPORT DWORD MES_GetStatusBits (); MES_EXPORT DWORD MES_GetWearTestParams (tMESWearTestParams * pData); MES_EXPORT DWORD MES_Goto (LONG lPos); MES_EXPORT DWORD MES_HideSerialData (); MES_EXPORT DWORD MES_Initialize (HWND hwndOwner, LPCSTR lpszInifileName = NULL); MES_EXPORT DWORD MES_LoadConfig (LPCSTR lpszInifileName = NULL); MES_EXPORT DWORD MES_LongCycleWearTest (); MES_EXPORT DWORD MES_Open (); MES_EXPORT DWORD MES_RegisterCallback (tMESCallbackProc * CallbackProc); MES_EXPORT DWORD MES_RequestStatus (); MES_EXPORT DWORD MES_Reverse (); MES_EXPORT DWORD MES_SerialDataIsVisible (); MES_EXPORT DWORD MES_SetServoParams (const tMESServoParams * pData); MES_EXPORT DWORD MES_SetWearTestParams (const tMESWearTestParams * pData); MES_EXPORT DWORD MES_ShortCycleWearTest (); MES_EXPORT DWORD MES_ShowSerialData (); MES_EXPORT DWORD MES_SlowForward (); MES_EXPORT DWORD MES_SlowReverse (); MES_EXPORT DWORD MES_Stop (); MES_EXPORT DWORD MES_StoreConfig (LPCSTR lpszInifileName = NULL); MES_EXPORT DWORD MES_Tension (); MES_EXPORT DWORD MES_Terminate (); MES_EXPORT DWORD MES_Unload (); MES_EXPORT DWORD MES_WindForward (); MES_EXPORT DWORD MES_WindReverse (); MES_EXPORT DWORD MES_ZeroEncoders (); #endif // MES_NO_PROTOTYPES //--------------------------------------------------------------------------- #pragma pack (pop) #endif // MEServoH