#ifndef __SEAMAX_H__ #define __SEAMAX_H__ #ifdef LINUX #include "wincompat.h" #endif typedef void *LPVOID; #define SM_HANDLE void* #define SME_HANDLE void* #define SDL_HANDLE void* /// \page Enumerations Global Types and Enumerations. /// Listed here are the types, enumerations, and definitions used throughout the %SeaMAX library. /// /// \section semax_enumerations SeaMAX Enumerations /// /// \subsection sm_deviceconfig DeviceConfig /// \code typedef struct configuration { int model; int commType; int baudrate; int parity; int firmware; } DeviceConfig; /// \endcode extern "C" { extern int __stdcall SM_Version(int* major, int* minor, int* revision, int* build); extern int __stdcall SM_Open(SM_HANDLE* handle, char* connection); extern int __stdcall SM_ConfigureSerialConnection(SM_HANDLE handle, int baudrate, int parity); extern int __stdcall SM_ConfigureSerialTimeouts(SM_HANDLE handle, int multiple, int constant, int interval); extern int __stdcall SM_SelectDevice(SM_HANDLE handle, int slaveID); extern int __stdcall SM_GetDeviceConfig(SM_HANDLE handle, DeviceConfig* config); extern int __stdcall SM_Close(SM_HANDLE handle); extern int __stdcall SM_GetAnalogInputConfig(SM_HANDLE handle, unsigned char* reference, unsigned char* mode); extern int __stdcall SM_GetAnalogInputRanges(SM_HANDLE handle, unsigned char* ranges); extern int __stdcall SM_SetAnalogInputConfig(SM_HANDLE handle, unsigned char reference, unsigned char mode); extern int __stdcall SM_SetAnalogInputRanges(SM_HANDLE handle, unsigned char* ranges); extern int __stdcall SM_GetAnalogOutputRanges(SM_HANDLE handle, unsigned char* ranges); extern int __stdcall SM_GetPIOPresets(SM_HANDLE handle, unsigned char* config); extern int __stdcall SM_SetPIOPresets(SM_HANDLE handle, unsigned char* config); extern int __stdcall SM_GetPIODirection(SM_HANDLE handle, unsigned char* config); extern int __stdcall SM_SetPIODirection(SM_HANDLE handle, unsigned char* config); extern int __stdcall SM_ReadPIO(SM_HANDLE handle, unsigned char* values); extern int __stdcall SM_WritePIO(SM_HANDLE handle, unsigned char* values); extern int __stdcall SM_SetCommunications(SM_HANDLE handle, int baudrate, int parity); extern int __stdcall SM_SetSoftwareAddress(SM_HANDLE handle, int slaveID); extern int __stdcall SM_ReadDigitalInputs(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_ReadAnalogInputs(SM_HANDLE handle, int start, int number, double* analogValues, unsigned char* ranges, unsigned char *byteValues); extern int __stdcall SM_WriteDigitalOutputs(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_ReadDigitalOutputs(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_WriteAnalogOutputs(SM_HANDLE handle, int start, int number, double* analogValues, unsigned char* ranges, unsigned char *byteValues); extern int __stdcall SM_SetBridgeType(SM_HANDLE handle, int bridgeType); // Customer specific methods (Oncology Inc.) extern int __stdcall SM_GlobalCommsReset(SM_HANDLE handle); #ifndef LINUX extern int __stdcall SM_NotifyInputState(SM_HANDLE handle, int cancel); extern int __stdcall SM_NotifyOnInputChange(SM_HANDLE handle, int start, int number, unsigned char* values, int delay, int blocking); #endif // Deprecated Functions extern int __stdcall SM_GetConfig(SM_HANDLE handle, int* model, int* commType, int* baudrate, int* parity); extern int __stdcall SM_ReadDiscreteInputs(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_ReadHoldingRegisters(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_ReadInputRegisters(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_WriteCoils(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_ReadCoils(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_WriteHoldingRegisters(SM_HANDLE handle, int start, int number, unsigned char *values); extern int __stdcall SM_GetADDAExtendedConfig(SM_HANDLE handle, int* multiplierEnabled, unsigned char* daConfig); extern int __stdcall SM_SetADDAConfig(SM_HANDLE handle, unsigned char* deviceConfig, unsigned char* channelsConfig); extern int __stdcall SM_GetADDAConfig(SM_HANDLE handle, unsigned char* deviceConfig, unsigned char* channelsConfig); extern int __stdcall SM_AtoDConversion(SM_HANDLE handle, double *value, unsigned char *data, int channelRange); extern int __stdcall SM_DtoAConversion(SM_HANDLE handle, double value, unsigned char *data, int channelRange); extern int __stdcall SME_Initialize(SME_HANDLE* handle); extern int __stdcall SME_Cleanup(SME_HANDLE handle); extern int __stdcall SME_SearchForModules(SME_HANDLE handle); extern int __stdcall SME_FirstModule(SME_HANDLE handle); extern int __stdcall SME_NextModule(SME_HANDLE handle); extern int __stdcall SME_Ping(SME_HANDLE handle); extern int __stdcall SME_ModuleByName(SME_HANDLE handle, char* moduleName); extern int __stdcall SME_ModuleByIP(SME_HANDLE handle, char* ipAddress); extern int __stdcall SME_ModuleByMAC(SME_HANDLE handle, char* mac); extern int __stdcall SME_ModuleCount(SME_HANDLE handle); extern int __stdcall SME_GetName(SME_HANDLE handle, char* moduleName); extern int __stdcall SME_GetNetworkConfig(SME_HANDLE handle, char* ipAddress, char* netmask, char* gateway); extern int __stdcall SME_GetNetworkConfigBytes(SME_HANDLE handle, unsigned char* ipAddress, unsigned char* netmask, unsigned char* gateway); extern int __stdcall SME_GetMACAddress(SME_HANDLE handle, char* address); extern int __stdcall SME_GetDHCPConfig(SME_HANDLE handle, int* status); extern int __stdcall SME_GetType(SME_HANDLE handle, char* type); extern int __stdcall SME_GetFirmwareVersion(SME_HANDLE handle, int* major, int* minor); extern int __stdcall SME_GetNetworkSerialParams(SME_HANDLE handle, int* baudrate, int* parity); extern int __stdcall SME_SetName(SME_HANDLE handle, char *name); extern int __stdcall SME_SetNetworkConfig(SME_HANDLE handle, char* ipAddress, char* netmask, char* gateway); extern int __stdcall SME_SetNetworkConfigBytes(SME_HANDLE handle, unsigned char* ipAddress, unsigned char* netmask, unsigned char* gateway); extern int __stdcall SME_SetDHCPConfig(SME_HANDLE handle, int status); extern int __stdcall SME_RebootModule(SME_HANDLE handle); extern int __stdcall SME_SetNetworkSerialParams(SME_HANDLE handle, int baudrate, int parity); extern int __stdcall SME_GetNetworkSerialParams(SME_HANDLE handle, int* baudrate, int* parity); extern int __stdcall SME_GetWirelessConfig(SME_HANDLE handle, int* network, char* SSID, int* channel, int* security, int* keyType); extern int __stdcall SME_SetWirelessConfig(SME_HANDLE handle, int network, char* SSID, int channel, int security, int keyType, char* key); extern int __stdcall SME_ARPAddress(SME_HANDLE handle, char* ipAddress); extern int __stdcall SME_IsReachable(SME_HANDLE handle); extern int __stdcall SDL_Initialize(SDL_HANDLE* handle); extern int __stdcall SDL_Cleanup(SDL_HANDLE handle); extern int __stdcall SDL_SearchForDevices(SDL_HANDLE handle); extern int __stdcall SDL_FirstDevice(SDL_HANDLE handle); extern int __stdcall SDL_NextDevice(SDL_HANDLE handle); extern int __stdcall SDL_DeviceCount(SDL_HANDLE handle); extern int __stdcall SDL_GetName(SDL_HANDLE handle, char* deviceName); extern int __stdcall SDL_GetModel(SDL_HANDLE handle, int* model); extern int __stdcall SDL_GetDeviceID(SDL_HANDLE handle, int* id); extern int __stdcall SDL_GetSerial(SDL_HANDLE handle, char* serialNumber); extern int __stdcall SDL_GetNameBySerial(SDL_HANDLE handle, char* serialNumber, char* deviceName); } #ifndef ENUMERATIONS #define ENUMERATIONS /// /// \page Enumerations /// \subsection sm_baudrates Baudrates /// /// \code enum { SM_BAUD_INVALID = 0, SM_BAUD_1200 = 1, SM_BAUD_2400 = 2, SM_BAUD_4800 = 3, SM_BAUD_9600 = 4, SM_BAUD_14400 = 5, SM_BAUD_19200 = 6, SM_BAUD_28800 = 7, SM_BAUD_38400 = 8, SM_BAUD_57600 = 9, SM_BAUD_115200 = 10 }; /// \endcode /// /// \page Enumerations /// \subsection sm_databits Databits /// \code enum { SM_DATABITS_5 = 5, SM_DATABITS_6 = 6, SM_DATABITS_7 = 7, SM_DATABITS_8 = 8 }; /// \endcode /// /// \page Enumerations /// \subsection sm_parity Parity /// \code enum { SM_PARITY_NONE = 0, SM_PARITY_ODD = 1, SM_PARITY_EVEN = 2, SM_PARITY_MARK = 3, SM_PARITY_SPACE = 4 }; /// \endcode /// /// \page Enumerations /// \subsection sm_stopbits Stopbits /// \code enum { SM_STOPBITS_1 = 0, SM_STOPBITS_1_5 = 1, SM_STOPBITS_2 = 2 }; /// \endcode /// /// \page Enumerations /// \subsection sm_comtype Communications Type /// \code enum { SM_COMTYPE_RS485 = 0, SM_COMTYPE_ETHERNET = 1, SM_COMTYPE_USB = 2, SM_COMTYPE_RS232 = 3, SM_COMTYPE_EXPANSION = 4, SM_COMTYPE_RS422 = 5, SM_COMTYPE_WIRELESS = 6, SM_COMTYPE_INTELLIGENT = 7, SM_COMTYPE_P_O_ETH = 8, SM_COMTYPE_P_O_USB = 9 }; /// \endcode /// /// \subsection ad_reference Analog to Digital Voltage Reference /// \code enum { ANALOG = 0, GROUND = 1, AD_REFERENCE = 2, FLOATING = 3, DA_CHANNEL_1 = 4, DA_CHANNEL_2 = 8 }; /// \endcode /// /// \subsection ad_channel_modes Analog to Digital Channel Modes /// \code enum { SINGLE_ENDED = 0, DIFFERENTIAL = 1, CURRENT_LOOP = 2 }; /// \endcode /// /// \subsection channel_ranges Channel Range Values /// \code enum { ZERO_TO_FIVE = 0, PLUS_MINUS_FIVE = 1, ZERO_TO_TEN = 2, PLUS_MINUS_TEN = 3, ZERO_TO_FIFTEEN = 2, PLUS_MINUS_FIFTEEN = 3 }; /// \endcode /// /// \section sme_enumerations SeaMAX Ethernet Enumerations /// /// \subsection network_types Network Types /// \code enum { NETWORK_INFRASTRUCTURE = 0, NETWORK_ADHOC = 1 }; /// \endcode /// /// \subsection security_enum Security Type /// \code enum { SECURITY_NONE = 0, SECURITY_WEP_OPEN_64 = 1, SECURITY_WEP_SHARED_64 = 2, SECURITY_WEP_OPEN_128 = 3, SECURITY_WEP_SHARED_128 = 4, SECURITY_WPA_TKIP = 5, SECURITY_WPA2_AES = 6, SECURITY_UNKNOWN = 0xFF }; /// \endcode /// /// \subsection seckey_enum Key Type /// \code enum { HEX_KEY = 0, PASSPHRASE_KEY = 1 }; /// \endcode #endif #endif