From 1dcdb580086d1332328ff0b6ddc758ab3f10ca99 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Wed, 26 Sep 2018 16:49:31 -0400 Subject: [PATCH] Skeleton legacy API --- CMakeLists.txt | 11 + api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp | 233 ++++ api/icsneolegacy/dllhelper/include/icsnVC40.h | 1188 +++++++++++++++++ .../dllhelper/include/icsneo40DLLAPI.h | 201 +++ api/icsneolegacy/icsneolegacy.cpp | 338 +++++ api/icsneolegacy/include/icsneolegacy.h | 100 ++ 6 files changed, 2071 insertions(+) create mode 100644 api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp create mode 100644 api/icsneolegacy/dllhelper/include/icsnVC40.h create mode 100644 api/icsneolegacy/dllhelper/include/icsneo40DLLAPI.h create mode 100644 api/icsneolegacy/icsneolegacy.cpp create mode 100644 api/icsneolegacy/include/icsneolegacy.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a4742d..4e110ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,16 @@ add_library(icsneoc SHARED ${SRC_FILES} ) +add_library(icsneolegacy SHARED + api/icsneolegacy/icsneolegacy.cpp + api/icsneoc/icsneoc.cpp + api/icsneocpp/icsneocpp.cpp + ${SRC_FILES} +) + target_compile_features(icsneocpp PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums) target_compile_features(icsneoc PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums) +target_compile_features(icsneolegacy PRIVATE cxx_auto_type cxx_constexpr cxx_lambdas cxx_nullptr cxx_range_for cxx_rvalue_references cxx_sizeof_member cxx_strong_enums) # libftdi if(NOT WIN32) @@ -74,10 +82,13 @@ if(NOT WIN32) set_property(TARGET ftdipp1-static PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(icsneocpp ftdipp1-static) target_link_libraries(icsneoc ftdipp1-static) + target_link_libraries(icsneolegacy ftdipp1-static) target_link_libraries(icsneocpp ftdi1-static) target_link_libraries(icsneoc ftdi1-static) + target_link_libraries(icsneolegacy ftdi1-static) target_link_libraries(icsneocpp ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(icsneoc ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(icsneolegacy ${CMAKE_THREAD_LIBS_INIT}) endif() set(CPACK_PROJECT_NAME ${PROJECT_NAME}) diff --git a/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp new file mode 100644 index 0000000..a62cce0 --- /dev/null +++ b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp @@ -0,0 +1,233 @@ +//FILE: icsneo40DLLAPI.cpp +#include "icsneo40DLLAPI.h" +#include + +//Basic Functions +FINDNEODEVICES icsneoFindNeoDevices; +OPENNEODEVICE icsneoOpenNeoDevice; +CLOSEPORT icsneoClosePort; +FREEOBJECT icsneoFreeObject; +////OPENPORTEX icsneoOpenPortEx; +SERIALNUMBERTOSTRING icsneoSerialNumberToString; + + +//Message Functions +GETMESSAGES icsneoGetMessages; +TXMESSAGES icsneoTxMessages; +TXMESSAGESEX icsneoTxMessagesEx; +WAITFORRXMSGS icsneoWaitForRxMessagesWithTimeOut; +GETTSFORMSG icsneoGetTimeStampForMsg; +ENABLERXQUEUE icsneoEnableNetworkRXQueue; +GETISO15765STATUS icsneoGetISO15765Status; +SETISO15765RXPARMS icsneoSetISO15765RxParameters; +////ENABLENETWORKCOM icsneoEnableNetworkCom; + + +//Device Functions +GETCONFIG icsneoGetConfiguration; +SENDCONFIG icsneoSendConfiguration; +GETFIRESETTINGS icsneoGetFireSettings; +SETFIRESETTINGS icsneoSetFireSettings; +GETVCAN3SETTINGS icsneoGetVCAN3Settings; +SETVCAN3SETTINGS icsneoSetVCAN3Settings; + +GETFIRE2SETTINGS icsneoGetFire2Settings; +SETFIRE2SETTINGS icsneoSetFire2Settings; +GETVCANRFSETTINGS icsneoGetVCANRFSettings; +SETVCANRFSETTINGS icsneoSetVCANRFSettings; +GETRADGalaxySETTINGS icsneoGetRADGalaxySettings; +SETRADGalaxySETTINGS icsneoSetRADGalaxySettings; +GETRADSTAR2SETTINGS icsneoGetRADStar2Settings; +SETRADSTAR2SETTINGS icsneoSetRADStar2Settings; +GETVCAN412SETTINGS icsneoGetVCAN412Settings; +SETVCAN412SETTINGS icsneoSetVCAN412Settings; + +SETBITRATE icsneoSetBitRate; +GETDEVICEPARMS icsneoGetDeviceParameters; +SETDEVICEPARMS icsneoSetDeviceParameters; + +//Error Functions +GETLASTAPIERROR icsneoGetLastAPIError; +GETERRMSGS icsneoGetErrorMessages; +GETERRORINFO icsneoGetErrorInfo; + +//ISO15765-2 +ISO15765ENABLENETWORKS icsneoISO15765_EnableNetworks; +ISO15765DISABLENETWORKS icsneoISO15765_DisableNetworks; +ISO15765TXMSG icsneoISO15765_TransmitMessage; +ISO15765RXMSG icsneoISO15765_ReceiveMessage; + +//General Utility Functions +VALIDATEHOBJECT icsneoValidateHObject; +GETDLLVERSION icsneoGetDLLVersion; +GETSERIALNUMBER icsneoGetSerialNumber; +STARTSOCKSERVER icsneoStartSockServer; +STOPSOCKSERVER icsneoStopSockServer; + +//CoreMini Functions +SCRIPTLOAD icsneoScriptLoad; +SCRIPTSTART icsneoScriptStart; +SCRIPTSTOP icsneoScriptStop; +SCRIPTCLEAR icsneoScriptClear; +SCRIPTSTARTFBLOCK icsneoScriptStartFBlock; +SCRIPTSTOPFBLOCK icsneoScriptStopFBlock; +SCRIPTGETFBLOCKSTATUS icsneoScriptGetFBlockStatus; +SCRIPTGETSCRIPTSTATUS icsneoScriptGetScriptStatus; +SCRIPTREADAPPSIGNAL icsneoScriptReadAppSignal; +SCRIPTWRITEAPPSIGNAL icsneoScriptWriteAppSignal; +//SCRIPTREADRXMESSAGE icsneoScriptReadRxMessage; +//SCRIPTREADTXMESSAGE icsneoScriptReadTxMessage; +//SCRIPTWRITERXMESSAGE icsneoScriptWriteRxMessage; +//SCRIPTWRITETXMESSAGE icsneoScriptWriteTxMessage; + + +//The following are valid strings for setting parameters on devices +//using the icsneoGetDeviceParameters() and icsneoSetDeviceParameters() functions +char *FireParameters[] = +{ + "can1", "can2", "can3", "can4", "swcan", "lsftcan", "lin1", "lin2", + "lin3", "lin4", "cgi_baud", "cgi_tx_ifs_bit_times", + "cgi_rx_ifs_bit_times", "cgi_chksum_enable", "network_enables", + "network_enabled_on_boot", "pwm_man_timeout", "pwr_man_enable", + "misc_io_initial_ddr", "misc_io_initial_latch", "misc_io_analog_enable", + "misc_io_report_period", "misc_io_on_report_events", "ain_sample_period", + "ain_threshold", "iso15765_separation_time_offset", "iso9141_kwp_settings", + "perf_en", "iso_parity", "iso_msg_termination", "network_enables_2" +}; + + +char *VCAN3Parameters[] = +{ + "can1", "can2", "network_enables", "network_enabled_on_boot", "iso15765_separation_time_offset", + "perf_en", "misc_io_initial_ddr", "misc_io_initial_latch", "misc_io_report_period", + "misc_io_on_report_events" +}; + +char *CANParameters[] = +{ + "Mode", "SetBaudrate", "Baudrate", "NetworkType", "TqSeg1", + "TqSeg2", "TqProp", "TqSync", "BRP", "auto_baud" +}; + +char *SWCANParameters[] = +{ + "Mode", "SetBaudrate", "Baudrate", "NetworkType", "TqSeg1", "TqSeg2", + "TqProp", "TqSync", "BRP", "high_speed_auto_switch", "auto_baud" +}; + +char *LINParameters[] = +{ + "Baudrate", "spbrg", "brgh", "MasterResistor", "Mode" +}; + +char *ISOKWPParms[] = +{ + "Baudrate", "spbrg", "brgh", "init_steps", "init_step_count", + "p2_500us", "p3_500us", "p4_500us", "chksum_enabled" +}; + + +bool LoadDLLAPI(HINSTANCE &hAPIDLL) +{ + if((hAPIDLL = LoadLibrary(_T("icsneo40.dll"))) == NULL) + return false; + + + + icsneoFindNeoDevices = (FINDNEODEVICES) GetProcAddress(hAPIDLL, "icsneoFindNeoDevices"); + icsneoOpenNeoDevice = (OPENNEODEVICE) GetProcAddress(hAPIDLL, "icsneoOpenNeoDevice"); + icsneoClosePort = (CLOSEPORT) GetProcAddress(hAPIDLL, "icsneoClosePort"); + icsneoFreeObject = (FREEOBJECT) GetProcAddress(hAPIDLL, "icsneoFreeObject"); +//// icsneoOpenPortEx = (OPENPORTEX) GetProcAddress(hAPIDLL, "icsneoOpenPortEx"); +//// icsneoEnableNetworkCom = (ENABLENETWORKCOM) GetProcAddress(hAPIDLL, "icsneoEnableNetworkCom"); + icsneoGetDLLVersion = (GETDLLVERSION) GetProcAddress(hAPIDLL, "icsneoGetDLLVersion"); + icsneoSerialNumberToString = (SERIALNUMBERTOSTRING) GetProcAddress(hAPIDLL, "icsneoSerialNumberToString"); + + icsneoTxMessages = (TXMESSAGES) GetProcAddress(hAPIDLL, "icsneoTxMessages"); + icsneoTxMessagesEx = (TXMESSAGESEX) GetProcAddress(hAPIDLL, "icsneoTxMessagesEx"); + icsneoGetMessages = (GETMESSAGES) GetProcAddress(hAPIDLL, "icsneoGetMessages"); + icsneoWaitForRxMessagesWithTimeOut = (WAITFORRXMSGS) GetProcAddress(hAPIDLL, "icsneoWaitForRxMessagesWithTimeOut"); + icsneoGetTimeStampForMsg = (GETTSFORMSG) GetProcAddress(hAPIDLL, "icsneoGetTimeStampForMsg"); + icsneoEnableNetworkRXQueue = (ENABLERXQUEUE) GetProcAddress(hAPIDLL, "icsneoEnableNetworkRXQueue"); + icsneoGetISO15765Status = (GETISO15765STATUS) GetProcAddress(hAPIDLL, "icsneoGetISO15765Status"); + icsneoSetISO15765RxParameters = (SETISO15765RXPARMS) GetProcAddress(hAPIDLL, "icsneoSetISO15765RxParameters"); + + icsneoISO15765_EnableNetworks = (ISO15765ENABLENETWORKS) GetProcAddress(hAPIDLL, "icsneoISO15765_EnableNetworks"); + icsneoISO15765_DisableNetworks = (ISO15765DISABLENETWORKS) GetProcAddress(hAPIDLL, "icsneoISO15765_DisableNetworks"); + icsneoISO15765_TransmitMessage = (ISO15765TXMSG)GetProcAddress(hAPIDLL, "icsneoISO15765_TransmitMessage"); + icsneoISO15765_ReceiveMessage = (ISO15765RXMSG)GetProcAddress(hAPIDLL, "icsneoISO15765_ReceiveMessage"); + + icsneoGetConfiguration = (GETCONFIG) GetProcAddress(hAPIDLL, "icsneoGetConfiguration"); + icsneoSendConfiguration = (SENDCONFIG) GetProcAddress(hAPIDLL, "icsneoSendConfiguration"); + icsneoGetFireSettings = (GETFIRESETTINGS) GetProcAddress(hAPIDLL, "icsneoGetFireSettings"); + icsneoSetFireSettings = (SETFIRESETTINGS) GetProcAddress(hAPIDLL, "icsneoSetFireSettings"); + icsneoGetVCAN3Settings = (GETVCAN3SETTINGS) GetProcAddress(hAPIDLL, "icsneoGetVCAN3Settings"); + icsneoSetVCAN3Settings = (SETVCAN3SETTINGS) GetProcAddress(hAPIDLL, "icsneoSetVCAN3Settings"); + + + icsneoGetVCANRFSettings = (GETVCANRFSETTINGS) GetProcAddress(hAPIDLL, "icsneoGetVCANRFSettings"); + icsneoSetVCANRFSettings = (SETVCANRFSETTINGS) GetProcAddress(hAPIDLL, "icsneoSetVCANRFSettings"); + + icsneoGetFire2Settings = (GETFIRE2SETTINGS) GetProcAddress(hAPIDLL, "icsneoGetFire2Settings"); + icsneoSetFire2Settings = (SETFIRE2SETTINGS) GetProcAddress(hAPIDLL, "icsneoSetFire2Settings"); + + icsneoGetRADGalaxySettings = (GETRADGalaxySETTINGS) GetProcAddress(hAPIDLL, "icsneoGetRADGalaxySettings"); + icsneoSetRADGalaxySettings = (SETRADGalaxySETTINGS) GetProcAddress(hAPIDLL, "icsneoSetRADGalaxySettings"); + + icsneoGetRADStar2Settings = (GETRADSTAR2SETTINGS) GetProcAddress(hAPIDLL, "icsneoGetRADStar2Settings"); + icsneoSetRADStar2Settings = (SETRADSTAR2SETTINGS) GetProcAddress(hAPIDLL, "icsneoSetRADStar2Settings"); + + icsneoGetVCAN412Settings = (GETVCAN412SETTINGS) GetProcAddress(hAPIDLL, "icsneoGetVCAN412Settings"); + icsneoSetVCAN412Settings = (SETVCAN412SETTINGS) GetProcAddress(hAPIDLL, "icsneoSetVCAN412Settings"); + + + + icsneoSetBitRate = (SETBITRATE) GetProcAddress(hAPIDLL, "icsneoSetBitRate"); + icsneoGetDeviceParameters = (GETDEVICEPARMS) GetProcAddress(hAPIDLL, "icsneoGetDeviceParameters"); + icsneoSetDeviceParameters = (SETDEVICEPARMS) GetProcAddress(hAPIDLL, "icsneoSetDeviceParameters"); + + icsneoGetLastAPIError = (GETLASTAPIERROR) GetProcAddress(hAPIDLL, "icsneoGetLastAPIError"); + icsneoGetErrorMessages = (GETERRMSGS) GetProcAddress(hAPIDLL, "icsneoGetErrorMessages"); + icsneoGetErrorInfo = (GETERRORINFO) GetProcAddress(hAPIDLL, "icsneoGetErrorInfo"); + + icsneoScriptLoad = (SCRIPTLOAD) GetProcAddress(hAPIDLL, "icsneoScriptLoad"); + icsneoScriptStart = (SCRIPTSTART) GetProcAddress(hAPIDLL, "icsneoScriptStart"); + icsneoScriptStop = (SCRIPTSTOP) GetProcAddress(hAPIDLL, "icsneoScriptStop"); + icsneoScriptClear = (SCRIPTCLEAR) GetProcAddress(hAPIDLL, "icsneoScriptClear"); + icsneoScriptStartFBlock = (SCRIPTSTARTFBLOCK) GetProcAddress(hAPIDLL, "icsneoScriptStartFBlock"); + icsneoScriptStopFBlock = (SCRIPTSTOPFBLOCK) GetProcAddress(hAPIDLL, "icsneoScriptStopFBlock"); + icsneoScriptGetFBlockStatus = (SCRIPTGETFBLOCKSTATUS) GetProcAddress(hAPIDLL, "icsneoScriptGetFBlockStatus"); + icsneoScriptGetScriptStatus = (SCRIPTGETSCRIPTSTATUS) GetProcAddress(hAPIDLL, "icsneoScriptGetScriptStatus"); + icsneoScriptReadAppSignal = (SCRIPTREADAPPSIGNAL) GetProcAddress(hAPIDLL, "icsneoScriptReadAppSignal"); + icsneoScriptWriteAppSignal = (SCRIPTWRITEAPPSIGNAL) GetProcAddress(hAPIDLL, "icsneoScriptWriteAppSignal"); + + + + if(!icsneoFindNeoDevices || !icsneoOpenNeoDevice || !icsneoClosePort || !icsneoFreeObject || + !icsneoTxMessages || !icsneoGetMessages || !icsneoWaitForRxMessagesWithTimeOut || + !icsneoGetTimeStampForMsg || !icsneoEnableNetworkRXQueue || !icsneoGetISO15765Status || !icsneoTxMessagesEx || + !icsneoSetISO15765RxParameters || !icsneoGetConfiguration || !icsneoSendConfiguration || + !icsneoGetFireSettings || !icsneoSetFireSettings || !icsneoGetVCAN3Settings || + !icsneoSetVCAN3Settings || !icsneoGetVCANRFSettings || !icsneoSetVCANRFSettings || !icsneoGetFire2Settings || + !icsneoGetVCAN412Settings || !icsneoSetVCAN412Settings || + !icsneoSetFire2Settings || !icsneoGetRADGalaxySettings || !icsneoSetRADGalaxySettings || + !icsneoSetBitRate || !icsneoGetDeviceParameters || !icsneoSerialNumberToString || + !icsneoSetDeviceParameters || !icsneoGetLastAPIError || !icsneoGetErrorMessages || + !icsneoGetErrorInfo || !icsneoScriptLoad || !icsneoScriptStart || !icsneoScriptStop || + !icsneoScriptClear || !icsneoScriptStartFBlock || !icsneoScriptStopFBlock || + !icsneoScriptGetFBlockStatus || !icsneoScriptGetScriptStatus || !icsneoScriptReadAppSignal || + !icsneoScriptWriteAppSignal || !icsneoGetDLLVersion) + { + FreeLibrary(hAPIDLL); + return false; + } + + return true; +} + + +void UnloadDLLAPI(HINSTANCE &hAPIDLL) +{ + if(hAPIDLL) + FreeLibrary(hAPIDLL); +} \ No newline at end of file diff --git a/api/icsneolegacy/dllhelper/include/icsnVC40.h b/api/icsneolegacy/dllhelper/include/icsnVC40.h new file mode 100644 index 0000000..4ed86fe --- /dev/null +++ b/api/icsneolegacy/dllhelper/include/icsnVC40.h @@ -0,0 +1,1188 @@ + +#include "string.h" +#include +#include + +// OpenPort "OpenType" Argument Constants +#define NEOVI_COMMTYPE_RS232 0 +#define NEOVI_COMMTYPE_USB_BULK 1 +#define NEOVI_COMMTYPE_USB_ISO_DONT_USE 2 +#define NEOVI_COMMTYPE_TCPIP 3 + +//hardware constants +#define NEODEVICE_UNKNOWN 0 +#define NEODEVICE_BLUE 1 +#define NEODEVICE_SW_VCAN 2 +#define NEODEVICE_DW_VCAN 4 +#define NEODEVICE_FIRE 8 +#define NEODEVICE_VCAN3 16 +#define NEODEVICE_YELLOW 32 //Deprecated +#define NEODEVICE_RED 64 +#define NEODEVICE_ECU 128 +#define NEODEVICE_IEVB 256 +#define NEODEVICE_PENDANT 512 +#define NEODEVICE_VIRTUAL_NEOVI 1024 +#define NEODEVICE_ECUCHIP_UART 2048 +#define NEODEVICE_PLASMA_1_11 0x1000 +#define NEODEVICE_PLASMA_1_12 0x10000 +#define NEODEVICE_PLASMA_1_13 0x20000 +#define NEODEVICE_ANY_PLASMA 0x31000 +#define NEODEVICE_FIRE_VNET 0x2000 +#define NEODEVICE_NEOANALOG 0x4000 +#define NEODEVICE_ION_2 0x40000 +#define NEODEVICE_ION_3 0x100000 +#define NEODEVICE_ANY_ION 0x140000 +#define NEODEVICE_RADSTAR 0x80000 +#define NEODEVICE_VCANFD 0x200000 +#define NEODEVICE_VCAN412 0x400000 +#define NEODEVICE_ECU25 0x800000 +#define NEODEVICE_EEVB 0x1000000 +#define NEODEVICE_VCANRF 0x2000000 +#define NEODEVICE_FIRE2 0x4000000 +#define NEODEVICE_FLEX 0x8000000 +#define NEODEVICE_RADGALAXY 0x10000000 +#define NEODEVICE_RADSTAR2 0x20000000 +#define NEODEVICE_VIVIDCAN 0x40000000 +#define NEODEVICE_OBD2_SIM 0x80000000 +#define NEODEVICE_ALL 0xFFFFBFFF + +//device ID's +const int NETID_DEVICE = 0; +const int NETID_HSCAN = 1; +const int NETID_MSCAN = 2; +const int NETID_SWCAN = 3; +const int NETID_LSFTCAN = 4; +const int NETID_FORDSCP = 5; +const int NETID_J1708 = 6; +const int NETID_JVPW = 8; +const int NETID_ISO = 9; +const int NETID_ISO2 = 14; +const int NETID_ISO14230 = 15; +const int NETID_LIN = 16; +const int NETID_ISO3 = 41; +const int NETID_HSCAN2 = 42; +const int NETID_HSCAN3 = 44; +const int NETID_ISO4 = 47; +const int NETID_LIN2 = 48; +const int NETID_LIN3 = 49; +const int NETID_LIN4 = 50; +const int NETID_LIN5 = 84; +const int NETID_MOST = 51; +const int NETID_CGI = 53; +const int NETID_HSCAN4 = 61; +const int NETID_HSCAN5 = 62; +const int NETID_UART = 64; +const int NETID_UART2 = 65; +const int NETID_UART3 = 66; +const int NETID_UART4 = 67; +const int NETID_SWCAN2 = 68; //changed from ANALOG +const int NETID_ETHERNET_DAQ = 69; //NETID_WIZNET - plasma/ ion daq port ethernet +const int NETID_TEXTAPI_TO_HOST = 71; +const int NETID_FLEXRAY1A = 80; +const int NETID_FLEXRAY1B = 81; +const int NETID_FLEXRAY2A = 82; +const int NETID_FLEXRAY2B = 83; +const int NETID_FLEXRAY = 85; +const int NETID_MOST25 = 90; +const int NETID_MOST50 = 91; +const int NETID_MOST150 = 92; +const int NETID_ETHERNET = 93; +const int NETID_GMFSA = 94; +const int NETID_TCP = 95; +const int NETID_HSCAN6 = 96; +const int NETID_HSCAN7 = 97; +const int NETID_LIN6 = 98; +const int NETID_LSFTCAN2 = 99; +const int NETID_OP_ETHERNET1 = 17; +const int NETID_OP_ETHERNET2 = 18; +const int NETID_OP_ETHERNET3 = 19; +const int NETID_OP_ETHERNET4 = 45; +const int NETID_OP_ETHERNET5 = 46; +const int NETID_OP_ETHERNET6 = 73; +const int NETID_OP_ETHERNET7 = 75; +const int NETID_OP_ETHERNET8 = 76; +const int NETID_OP_ETHERNET9 = 77; +const int NETID_OP_ETHERNET10 = 78; +const int NETID_OP_ETHERNET11 = 79; +const int NETID_OP_ETHERNET12 = 87; + + +// Constants used to calculate the timestamp +const double NEOVI_TIMESTAMP_2 = 0.1048576; +const double NEOVI_TIMESTAMP_1 = 0.0000016; + +const double NEOVIPRO_VCAN_TIMESTAMP_2 = 0.065536; +const double NEOVIPRO_VCAN_TIMESTAMP_1 = 0.000001; + +const double NEOVI6_VCAN_TIMESTAMP_2 = 0.065536; +const double NEOVI6_VCAN_TIMESTAMP_1 = 0.000001; + +const double NEOVI_RED_TIMESTAMP_2_25NS = 107.3741824; +const double NEOVI_RED_TIMESTAMP_1_25NS = 0.000000025; + +const double NEOVI_RED_TIMESTAMP_2_10NS = 429.4967296; +const double NEOVI_RED_TIMESTAMP_1_10NS = 0.00000001; + +//Status Bitfield 1 +const long SPY_STATUS_GLOBAL_ERR = 0x01; +const long SPY_STATUS_TX_MSG = 0x02; +const long SPY_STATUS_XTD_FRAME = 0x04; +const long SPY_STATUS_REMOTE_FRAME = 0x08; + +const long SPY_STATUS_CRC_ERROR = 0x10; +const long SPY_STATUS_CAN_ERROR_PASSIVE = 0x20; +const long SPY_STATUS_INCOMPLETE_FRAME = 0x40; +const long SPY_STATUS_LOST_ARBITRATION = 0x80; + +const long SPY_STATUS_UNDEFINED_ERROR = 0x100; +const long SPY_STATUS_CAN_BUS_OFF = 0x200; +const long SPY_STATUS_CAN_ERROR_WARNING = 0x400; +const long SPY_STATUS_BUS_SHORTED_PLUS = 0x800; + +const long SPY_STATUS_BUS_SHORTED_GND = 0x1000; +const long SPY_STATUS_CHECKSUM_ERROR = 0x2000; +const long SPY_STATUS_BAD_MESSAGE_BIT_TIME_ERROR = 0x4000; +const long SPY_STATUS_IFR_DATA = 0x8000; + +const long SPY_STATUS_COMM_IN_OVERFLOW = 0x10000; +const long SPY_STATUS_COMM_OUT_OVERFLOW = 0x20000; +const long SPY_STATUS_COMM_MISC_ERROR = 0x40000; +const long SPY_STATUS_BREAK = 0x80000; + +const long SPY_STATUS_AVSI_REC_OVERFLOW = 0x100000; +const long SPY_STATUS_TEST_TRIGGER = 0x200000; +const long SPY_STATUS_AUDIO_COMMENT = 0x400000; +const long SPY_STATUS_GPS_DATA = 0x800000; + +const long SPY_STATUS_ANALOG_DIGITAL_INPUT = 0x1000000; +const long SPY_STATUS_TEXT_COMMENT = 0x2000000; +const long SPY_STATUS_NETWORK_MESSAGE_TYPE = 0x4000000; +const long SPY_STATUS_VSI_TX_UNDERRUN = 0x8000000; + +const long SPY_STATUS_VSI_IFR_CRC_BIT = 0x10000000; +const long SPY_STATUS_INIT_MESSAGE = 0x20000000; +const long SPY_STATUS_HIGH_SPEED = 0x40000000; +const long SPY_STATUS_FLEXRAY_SECOND_STARTUP_FRAME = 0x40000000; +const long SPY_STATUS_EXTENDED = 0x80000000; // if this bit is set than decode status bitfield3 in the ackbytes + +// Configuration Array constants +// high speed CAN neoVI / valuecan baud rate constants +const long NEO_CFG_MPIC_HS_CAN_CNF1 = 512 + 10; +const long NEO_CFG_MPIC_HS_CAN_CNF2 = 512 + 9; +const long NEO_CFG_MPIC_HS_CAN_CNF3 = 512 + 8; +const long NEO_CFG_MPIC_HS_CAN_MODE = 512 + 54; +// med speed CAN +const long NEO_CFG_MPIC_MS_CAN_CNF1 = 512 + 22; +const long NEO_CFG_MPIC_MS_CAN_CNF2 = 512 + 21; +const long NEO_CFG_MPIC_MS_CAN_CNF3 = 512 + 20; +//SW CAN +const long NEO_CFG_MPIC_SW_CAN_CNF1 = 512 + 34; +const long NEO_CFG_MPIC_SW_CAN_CNF2 = 512 + 33; +const long NEO_CFG_MPIC_SW_CAN_CNF3 = 512 + 32; +//LSFT CAN +const long NEO_CFG_MPIC_LSFT_CAN_CNF1 = 512 + 46; +const long NEO_CFG_MPIC_LSFT_CAN_CNF2 = 512 + 45; +const long NEO_CFG_MPIC_LSFT_CAN_CNF3 = 512 + 44; + +// The second status bitfield +const long SPY_STATUS2_HAS_VALUE = 1; +const long SPY_STATUS2_VALUE_IS_BOOLEAN = 2; +const long SPY_STATUS2_HIGH_VOLTAGE = 4; +const long SPY_STATUS2_LONG_MESSAGE = 8; +const long SPY_STATUS2_GLOBAL_CHANGE = 0x10000; +const long SPY_STATUS2_ERROR_FRAME = 0x20000; +const long SPY_STATUS2_END_OF_LONG_MESSAGE = 0x100000; //for ISO and J1708; +//LIN/ISO Specific - check protocol before handling +const long SPY_STATUS2_LIN_ERR_RX_BREAK_NOT_0 = 0x200000; +const long SPY_STATUS2_LIN_ERR_RX_BREAK_TOO_SHORT = 0x400000; +const long SPY_STATUS2_LIN_ERR_RX_SYNC_NOT_55 = 0x800000; +const long SPY_STATUS2_LIN_ERR_RX_DATA_GREATER_8 = 0x1000000; +const long SPY_STATUS2_LIN_ERR_TX_RX_MISMATCH = 0x2000000; +const long SPY_STATUS2_LIN_ERR_MSG_ID_PARITY = 0x4000000; +const long SPY_STATUS2_ISO_FRAME_ERROR = 0x8000000; +const long SPY_STATUS2_LIN_SYNC_FRAME_ERROR = 0x8000000; +const long SPY_STATUS2_ISO_OVERFLOW_ERROR = 0x10000000; +const long SPY_STATUS2_LIN_ID_FRAME_ERROR = 0x10000000; +const long SPY_STATUS2_ISO_PARITY_ERROR = 0x20000000; +const long SPY_STATUS2_LIN_SLAVE_BYTE_ERROR = 0x20000000; +const long SPY_STATUS2_RX_TIMEOUT_ERROR = 0x40000000; +const long SPY_STATUS2_LIN_NO_SLAVE_DATA = 0x80000000; +//MOST Specific - check protocol before handling +const long SPY_STATUS2_MOST_PACKET_DATA = 0x200000; +const long SPY_STATUS2_MOST_STATUS = 0x400000; //reflects changes in light/lock/MPR/SBC/etc. +const long PY_STATUS2_MOST_LOW_LEVEL = 0x800000; //MOST low level message, allocs, deallocs, remote requests. +const long SPY_STATUS2_MOST_CONTROL_DATA = 0x1000000; +const long SPY_STATUS2_MOST_MHP_USER_DATA = 0x2000000; //MOST HIGH User Data Frame +const long SPY_STATUS2_MOST_MHP_CONTROL_DATA = 0x4000000; //MOST HIGH Control Data +const long SPY_STATUS2_MOST_I2S_DUMP = 0x8000000; +const long SPY_STATUS2_MOST_TOO_SHORT = 0x10000000; +const long SPY_STATUS2_MOST_MOST50 = 0x20000000; //absence of MOST50 and MOST150 implies it's MOST25 +const long SPY_STATUS2_MOST_MOST150 = 0x40000000; +const long SPY_STATUS2_MOST_CHANGED_PAR = 0x80000000; //first byte in ack reflects what changed +//Ethernet Specific - check protocol before handling +const long SPY_STATUS2_ETHERNET_CRC_ERROR = 0x200000; +const long SPY_STATUS2_ETHERNET_FRAME_TOO_SHORT = 0x400000; +const long SPY_STATUS2_ETHERNET_FCS_AVAILABLE = 0x800000; //This frame contains FCS (4 bytes) obtained from ICS Ethernet hardware (ex. RAD-STAR) + +//Spy Status Bitfield 3 constants +const long SPY_STATUS3_LIN_JUST_BREAK_SYNC = 1; +const long SPY_STATUS3_LIN_SLAVE_DATA_TOO_SHORT = 2; +const long SPY_STATUS3_LIN_ONLY_UPDATE_SLAVE_TABLE_ONCE = 4; + +//Protocols +const int SPY_PROTOCOL_CUSTOM = 0; +const int SPY_PROTOCOL_CAN = 1; +const int SPY_PROTOCOL_GMLAN = 2; +const int SPY_PROTOCOL_J1850VPW = 3; +const int SPY_PROTOCOL_J1850PWM = 4; +const int SPY_PROTOCOL_ISO9141 = 5; +const int SPY_PROTOCOL_Keyword2000 = 6; +const int SPY_PROTOCOL_GM_ALDL_UART = 7; +const int SPY_PROTOCOL_CHRYSLER_CCD = 8; +const int SPY_PROTOCOL_CHRYSLER_SCI = 9; +const int SPY_PROTOCOL_FORD_UBP = 10; +const int SPY_PROTOCOL_BEAN = 11; +const int SPY_PROTOCOL_LIN = 12; +const int SPY_PROTOCOL_J1708 = 13; +const int SPY_PROTOCOL_CHRYSLER_JVPW = 14; +const int SPY_PROTOCOL_J1939 = 15; +const int SPY_PROTOCOL_FLEXRAY = 16; +const int SPY_PROTOCOL_MOST = 17; +const int SPY_PROTOCOL_CGI = 18; +const int SPY_PROTOCOL_GME_CIM_SCL_KLINE = 19; +const int SPY_PROTOCOL_SPI = 20; +const int SPY_PROTOCOL_I2C = 21; +const int SPY_PROTOCOL_GENERIC_UART = 22; +const int SPY_PROTOCOL_JTAG = 23; +const int SPY_PROTOCOL_UNIO = 24; +const int SPY_PROTOCOL_DALLAS_1WIRE = 25; +const int SPY_PROTOCOL_GENERIC_MANCHSESTER = 26; +const int SPY_PROTOCOL_SENT_PROTOCOL = 27; +const int SPY_PROTOCOL_UART = 28; +const int SPY_PROTOCOL_ETHERNET = 29; +const int SPY_PROTOCOL_CANFD = 30; +const int SPY_PROTOCOL_GMFSA = 31; +const int SPY_PROTOCOL_TCP = 32; + + +// these are used in status2 for Vehicle Spy 3 +const long icsspystatusChangeLength =0x10; +const long icsspystatusChangeBitH1 = 0x20; +const long icsspystatusChangeBitH2 = 0x40; +const long icsspystatusChangeBitH3 = 0x80 ; +const long icsspystatusChangeBitB1 = 0x100; +const long icsspystatusChangeBitB2 = 0x200 ; +const long icsspystatusChangeBitB3 = 0x400 ; +const long icsspystatusChangeBitB4 = 0x800 ; +const long icsspystatusChangeBitB5 = 0x1000; +const long icsspystatusChangeBitB6 = 0x2000; +const long icsspystatusChangeBitB7 = 0x4000; +const long icsspystatusChangeBitB8 = 32768 ; +const long icsspystatusChangedGlobal = 65536 ; + +const long SCRIPT_STATUS_STOPPED = 0; +const long SCRIPT_STATUS_RUNNING = 1; + +const long SCRIPT_LOCATION_FLASH_MEM = 0; //(Valid only on a neoVI Fire or neoVI Red) +const long SCRIPT_LOCATION_SDCARD = 1; //(Valid only on a neoVI Fire or neoVI Red) +const long SCRIPT_LOCATION_VCAN3_MEM = 2; //(Valid only on a ValueCAN 3 device) + +//ISO15765 constants +const int ISO15765_2_NETWORK_HSCAN = 0x1; +const int ISO15765_2_NETWORK_MSCAN = 0x2; +const int ISO15765_2_NETWORK_HSCAN2 = 0x4; +const int ISO15765_2_NETWORK_HSCAN3 = 0x8; +const int ISO15765_2_NETWORK_SWCAN = 0x10; +const int ISO15765_2_NETWORK_HSCAN4 = 0x14; +const int ISO15765_2_NETWORK_HSCAN5 = 0x18; +const int ISO15765_2_NETWORK_HSCAN6 = 0x1C; +const int ISO15765_2_NETWORK_HSCAN7 = 0x20; +const int ISO15765_2_NETWORK_SWCAN2 = 0x24; + +//Structure for neoVI device types + +#pragma pack(push) +#pragma pack(1) +//One byte aligned + +typedef struct __declspec(align(1)) +{ + int iType;// 1,2,3 for Generation of HW + + // Date and Time type 1 and 2 + int iMainFirmDateDay; + int iMainFirmDateMonth; + int iMainFirmDateYear; + int iMainFirmDateHour; + int iMainFirmDateMin; + int iMainFirmDateSecond; + int iMainFirmChkSum; + + // Version data (only valid for type 3) + unsigned char iAppMajor; + unsigned char iAppMinor; + unsigned char iManufactureDay; + unsigned char iManufactureMonth; + unsigned char iManufactureYear; + unsigned char iBoardRevMajor; + unsigned char iBoardRevMinor; + unsigned char iBootLoaderVersionMajor; + unsigned char iBootLoaderVersionMinor; + + unsigned char iMainVnetHWrevMajor; + unsigned char iMainVnetHWrevMinor; + unsigned char iMainVnetSRAMSize; +}stAPIFirmwareInfo; + +#pragma pack(pop) + + + +#pragma pack(push) +#pragma pack(2) +//two byte aligned + +typedef struct __declspec(align(2)) +{ + unsigned char Mode; + unsigned char SetBaudrate; + unsigned char Baudrate; + unsigned char Transceiver_Mode; + unsigned char TqSeg1; + unsigned char TqSeg2; + unsigned char TqProp; + unsigned char TqSync; + unsigned short BRP; + unsigned char auto_baud; + unsigned char innerFrameDelay25us; +} CAN_SETTINGS; + +typedef struct __declspec(align(2)) +{ + unsigned char FDMode; /* mode, secondary baudrate for canfd */ + unsigned char FDBaudrate; + unsigned char FDTqSeg1; + unsigned char FDTqSeg2; + unsigned char FDTqProp; + unsigned char FDTqSync; + unsigned short FDBRP; + unsigned char FDTDC; + unsigned char reserved; +} CANFD_SETTINGS; + +typedef struct __declspec(align(2)) +{ + unsigned char Mode; + unsigned char SetBaudrate; + unsigned char Baudrate; + unsigned char Transceiver_Mode; + unsigned char TqSeg1; + unsigned char TqSeg2; + unsigned char TqProp; + unsigned char TqSync; + unsigned short BRP; + unsigned short high_speed_auto_switch; + unsigned char auto_baud; + unsigned char Reserved; //leave as 0 +} SWCAN_SETTINGS; + +typedef struct __declspec(align(2)) +{ + unsigned int Baudrate; + unsigned short spbrg; + unsigned char brgh; + unsigned char NumBitsDelay; + unsigned char MasterResistor; + unsigned char Mode; +} LIN_SETTINGS; + +typedef struct __declspec(align(2)) +{ + uint16_t monkey; + unsigned char duplex; /* 0 = half, 1 = full */ + unsigned char link_speed; + unsigned char auto_neg; + unsigned char led_mode; + unsigned char rsvd[4]; +} ETHERNET_SETTINGS; + +typedef struct __declspec(align(2)) +{ + //CAN + unsigned int can1_tx_id; + unsigned int can1_rx_id; + union + { + struct + { + unsigned bExtended:1; + unsigned :15; + }; + unsigned int DWord; + }can1_options; + + unsigned int can2_tx_id; + unsigned int can2_rx_id; + union + { + struct + { + unsigned bExtended:1; + unsigned :15; + }; + unsigned int DWord; + }can2_options; + + unsigned int network_enables; + + unsigned int can3_tx_id; + unsigned int can3_rx_id; + union + { + struct + { + unsigned bExtended:1; + unsigned :15; + }; + unsigned int DWord; + }can3_options; + + unsigned int can4_tx_id; + unsigned int can4_rx_id; + union + { + struct + { + unsigned bExtended:1; + unsigned :15; + }; + unsigned int DWord; + }can4_options; + + unsigned int reserved[5]; + +}STextAPISettings; + +typedef struct __declspec(align(2)) +{ + unsigned short time_500us; + unsigned short k; + unsigned short l; +}ISO9141_KEYWORD2000__INIT_STEP; + +typedef struct __declspec(align(2)) +{ + unsigned int Baudrate; + unsigned short spbrg; + unsigned short brgh; + ISO9141_KEYWORD2000__INIT_STEP init_steps[16]; //See the ISO9141_KW2000__INIT_STEP structure + unsigned char init_step_count; + unsigned short p2_500us; + unsigned short p3_500us; + unsigned short p4_500us; + unsigned short chksum_enabled; +} ISO9141_KEYWORD2000_SETTINGS; + +typedef struct __declspec (align(2)) +{ + uint8_t ucInterfaceType; + uint8_t reserved0; + uint8_t reserved1; + uint8_t reserved2; + uint8_t reserved3; + uint16_t tapPair0; + uint16_t tapPair1; + uint16_t tapPair2; + uint16_t tapPair3; + uint16_t tapPair4; + uint16_t tapPair5; + uint32_t uFlags; +}OP_ETH_GENERAL_SETTINGS; + +typedef struct __declspec (align(2)) +{ + uint8_t ucConfigMode; + uint8_t preemption_en; + uint8_t reserved0[14]; +}OP_ETH_SETTINGS; + +typedef struct __declspec (align(2)) +{ + uint32_t ecu_id; + CAN_SETTINGS can1; + SWCAN_SETTINGS swcan1; + CAN_SETTINGS lsftcan1; + uint16_t network_enables; + uint16_t network_enabled_on_boot; + uint16_t iso15765_separation_time_offset; + uint16_t perf_en; + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + uint16_t can_switch_mode; + uint16_t rsvd; +}SVividCANSettings; + +typedef struct __declspec (align(2)) +{ + CAN_SETTINGS can1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd1; + CANFD_SETTINGS canfd2; + + uint64_t network_enables; + uint16_t network_enabled_on_boot; + + int16_t iso15765_separation_time_offset; + + uint16_t perf_en; + + uint16_t misc_io_initial_ddr; + uint16_t misc_io_initial_latch; + uint16_t misc_io_report_period; + uint16_t misc_io_on_report_events; + uint16_t misc_io_analog_enable; + uint16_t ain_sample_period; + uint16_t ain_threshold; + + struct + { + uint32_t : 1; + uint32_t enableLatencyTest : 1; + uint32_t reserved : 30; + } flags; + + STextAPISettings text_api; +} SOBD2SimSettings; + +typedef struct __declspec(align(2)) +{ + unsigned short perf_en; + + //CAN + CAN_SETTINGS can1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd2; + CAN_SETTINGS can3; + CANFD_SETTINGS canfd3; + CAN_SETTINGS can4; + CAN_SETTINGS can5; + CAN_SETTINGS can6; + CAN_SETTINGS can7; + CAN_SETTINGS can8; + + //Native CAN are either LS1/LS2 or SW1/SW2 + SWCAN_SETTINGS swcan1; + unsigned short network_enables; + SWCAN_SETTINGS swcan2; + unsigned short network_enables_2; + + LIN_SETTINGS lin1; + unsigned short misc_io_initial_ddr; + unsigned short misc_io_initial_latch; + unsigned short misc_io_report_period; + unsigned short misc_io_on_report_events; + unsigned short misc_io_analog_enable; + unsigned short ain_sample_period; + unsigned short ain_threshold; + + unsigned int pwr_man_timeout; + unsigned short pwr_man_enable; + + unsigned short network_enabled_on_boot; + + //ISO15765-2 Transport Layer + unsigned short iso15765_separation_time_offset; + + //ISO9141 - Keyword + unsigned short iso_9141_kwp_enable_reserved; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1; + unsigned short iso_parity_1; + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + unsigned short iso_parity_2; + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_3; + unsigned short iso_parity_3; + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_4; + unsigned short iso_parity_4; + + unsigned short iso_msg_termination_1; + unsigned short iso_msg_termination_2; + unsigned short iso_msg_termination_3; + unsigned short iso_msg_termination_4; + + unsigned short idle_wakeup_network_enables_1; + unsigned short idle_wakeup_network_enables_2; + + //reserved for HSCAN6/7, LSFT2, etc.. + unsigned short network_enables_3; + unsigned short idle_wakeup_network_enables_3; + + unsigned short can_switch_mode; + STextAPISettings text_api; +}SRADGalaxySettings; + +typedef struct __declspec (align(2)) +{ + /* Performance Test */ + uint16_t perf_en; + + CAN_SETTINGS can1; + CANFD_SETTINGS canfd1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd2; + + uint64_t network_enables; + uint64_t termination_enables; + + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + + uint16_t network_enabled_on_boot; + + /* ISO15765-2 Transport Layer */ + int16_t iso15765_separation_time_offset; + + STextAPISettings text_api; + struct + { + uint32_t disableUsbCheckOnBoot : 1; + uint32_t enableLatencyTest : 1; + uint32_t reserved : 30; + } flags; +} SVCAN412Settings; + + +typedef struct __declspec (align(2)) +{ + uint16_t perf_en; + OP_ETH_GENERAL_SETTINGS opEthGen; + OP_ETH_SETTINGS opEth1; + OP_ETH_SETTINGS opEth2; + CAN_SETTINGS can1; + CANFD_SETTINGS canfd1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd2; + uint16_t network_enables; + uint16_t network_enables_2; + LIN_SETTINGS lin1; + uint16_t misc_io_initial_ddr; + uint16_t misc_io_initial_latch; + uint16_t misc_io_report_period; + uint16_t misc_io_on_report_events; + uint16_t misc_io_analog_enable; + uint16_t ain_sample_period; + uint16_t ain_threshold; + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + uint16_t network_enabled_on_boot; + uint16_t iso15765_separation_time_offset; + uint16_t iso_9141_kwp_enable_reserved; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1; + uint16_t iso_parity_1; + uint16_t iso_msg_termination_1; + uint16_t idle_wakeup_network_enables_1; + uint16_t idle_wakeup_network_enables_2; + uint16_t network_enables_3; + uint16_t idle_wakeup_network_enables_3; + uint16_t can_switch_mode; + STextAPISettings text_api; +}SRADStar2Settings; + + //_stChipVersions +typedef struct __declspec(align(2)) +{ + unsigned char mpic_maj; + unsigned char mpic_min; + unsigned char upic_maj; + unsigned char upic_min; + unsigned char lpic_maj; + unsigned char lpic_min; + unsigned char jpic_maj; + unsigned char jpic_min; +}fire_versions; + +typedef struct __declspec(align(2)) +{ + unsigned char mpic_maj; + unsigned char mpic_min; + unsigned char core_maj; + unsigned char core_min; + unsigned char lpic_maj; + unsigned char lpic_min; + unsigned char hid_maj; + unsigned char hid_min; +}plasma_fire_vnet; + +typedef struct __declspec(align(2)) +{ + unsigned char mpic_maj; + unsigned char mpic_min; + unsigned int Reserve; + unsigned short Reserve2; +}vcan3_versions; + +typedef struct __declspec(align(2)) +{ + CAN_SETTINGS can1; + CAN_SETTINGS can2; + CAN_SETTINGS can3; + CAN_SETTINGS can4; + + LIN_SETTINGS lin1; + LIN_SETTINGS lin2; + + unsigned short network_enables; + unsigned short network_enabled_on_boot; + + unsigned int pwr_man_timeout; + unsigned short pwr_man_enable; // 0 - off, 1 - sleep enabled, 2- idle enabled (fast wakeup) + + unsigned short misc_io_initial_ddr; + unsigned short misc_io_initial_latch; + unsigned short misc_io_analog_enable; + unsigned short misc_io_report_period; + unsigned short misc_io_on_report_events; + + //ISO 15765-2 Transport Layer + short iso15765_separation_time_offset; + + //ISO9141 - KEYWORD 2000 1 + short iso9141_kwp_enable_reserved; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings; + + //Performance Test + unsigned short perf_en; + + //ISO9141 - Parity + unsigned short iso_parity; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination; // 0 - use inner frame time, 1 - GME CIM-SCL + unsigned short iso_tester_pullup_enable; + + //Additional network enables + unsigned short network_enables_2; + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + unsigned short iso_parity_2; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination_2; // 0 - use inner frame time, 1 - GME CIM-SCL + + unsigned short idle_wakeup_network_enables_1; + unsigned short idle_wakeup_network_enables_2; + + unsigned short reservedZero; +}SVCANRFSettings; + +typedef struct __declspec(align(2)) +{ + unsigned int ecu_id; + CAN_SETTINGS can1; + + unsigned short network_enables; + unsigned short network_enabled_on_boot; + + // ISO 15765-2 Transport layer + unsigned short iso15765_separation_time_offset; + + // Performance test + unsigned short perf_en; + + // Analog input + unsigned short ain_sample_period; + unsigned short ain_threshold; + + unsigned int rsvd; +}SEEVBSettings; + +// --- J1708 Settings +typedef struct __declspec(align(2)) +{ + unsigned short enable_convert_mode; +} J1708_SETTINGS; + + +// --- UART Settings +typedef struct __declspec(align(2)) +{ + unsigned short Baudrate; + unsigned short spbrg; + unsigned short brgh; + unsigned short parity; + unsigned short stop_bits; + byte flow_control; // 0- off, 1 - Simple CTS RTS, + byte reserved_1; + + union + { + unsigned int bOptions; + struct + { + unsigned invert_tx : 1; + unsigned invert_rx : 1; + unsigned half_duplex : 1; + unsigned reserved_bits : 13; + unsigned reserved_bits2 : 16; + }; + }; +} UART_SETTINGS; + + typedef struct __declspec(align(2)) + { + unsigned short netId; // Netid of CAN network to use. + unsigned char zero0; + unsigned char Config; + //Bit 0: enable bit to enalbe most + ///Bit 1-3: index of which miscio to use for timestamp sync. 0 => MISC1 + //Bit 4: Echo to CAN enable + //Bit 5-7: Reserve + } SNeoMostGatewaySettings; + +typedef struct __declspec(align(2)) +{ + CAN_SETTINGS can1; + CAN_SETTINGS can2; + CAN_SETTINGS can3; + CAN_SETTINGS can4; + + SWCAN_SETTINGS swcan; + CAN_SETTINGS lsftcan; + + LIN_SETTINGS lin1; + LIN_SETTINGS lin2; + LIN_SETTINGS lin3; + LIN_SETTINGS lin4; + + unsigned short cgi_enable_reserved; + unsigned short cgi_baud; + unsigned short cgi_tx_ifs_bit_times; + unsigned short cgi_rx_ifs_bit_times; + unsigned short cgi_chksum_enable; + + unsigned short network_enables; + unsigned short network_enabled_on_boot; + + unsigned int pwm_man_timeout; + unsigned short pwr_man_enable; + + unsigned short misc_io_initial_ddr; + unsigned short misc_io_initial_latch; + unsigned short misc_io_analog_enable; + unsigned short misc_io_report_period; + unsigned short misc_io_on_report_events; + unsigned short ain_sample_period; + unsigned short ain_threshold; + + //ISO 15765-2 Transport Layer + short iso15765_separation_time_offset; + + //ISO9141 - KEYWORD 2000 + short iso9141_kwp_enable_reserved; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings; + + //Performance Test + unsigned short perf_en; + + //ISO9141 - Parity + unsigned short iso_parity; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination; // 0 - use inner frame time, 1 - GME CIM-SCL + unsigned short iso_tester_pullup_enable; + + //Additional network enables + unsigned short network_enables_2; + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + unsigned short iso_parity_2; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination_2; // 0 - use inner frame time, 1 - GME CIM-SCL + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_3; + unsigned short iso_parity_3; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination_3; // 0 - use inner frame time, 1 - GME CIM-SCL + + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_4; + unsigned short iso_parity_4; // 0 - no parity, 1 - event, 2 - odd + unsigned short iso_msg_termination_4; // 0 - use inner frame time, 1 - GME CIM-SCL + + unsigned short fast_init_network_enables_1; + unsigned short fast_init_network_enables_2; + + UART_SETTINGS uart; + UART_SETTINGS uart2; + + STextAPISettings text_api; + + SNeoMostGatewaySettings neoMostGateway; + unsigned short vnetBits; //First bit enables Android Messages +}SFireSettings; + +typedef struct __declspec (align(2)) +{ + uint16_t perf_en; + CAN_SETTINGS can1; + CANFD_SETTINGS canfd1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd2; + CAN_SETTINGS can3; + CANFD_SETTINGS canfd3; + CAN_SETTINGS can4; + CANFD_SETTINGS canfd4; + CAN_SETTINGS can5; + CANFD_SETTINGS canfd5; + CAN_SETTINGS can6; + CANFD_SETTINGS canfd6; + CAN_SETTINGS can7; + CANFD_SETTINGS canfd7; + CAN_SETTINGS can8; + CANFD_SETTINGS canfd8; + SWCAN_SETTINGS swcan1; + uint16_t network_enables; + SWCAN_SETTINGS swcan2; + uint16_t network_enables_2; + CAN_SETTINGS lsftcan1; + CAN_SETTINGS lsftcan2; + LIN_SETTINGS lin1; + uint16_t misc_io_initial_ddr; + LIN_SETTINGS lin2; + uint16_t misc_io_initial_latch; + LIN_SETTINGS lin3; + uint16_t misc_io_report_period; + LIN_SETTINGS lin4; + uint16_t misc_io_on_report_events; + LIN_SETTINGS lin5; + uint16_t misc_io_analog_enable; + uint16_t ain_sample_period; + uint16_t ain_threshold; + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + uint16_t network_enabled_on_boot; + uint16_t iso15765_separation_time_offset; + uint16_t iso_9141_kwp_enable_reserved; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1; + uint16_t iso_parity_1; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + uint16_t iso_parity_2; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_3; + uint16_t iso_parity_3; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_4; + uint16_t iso_parity_4; + uint16_t iso_msg_termination_1; + uint16_t iso_msg_termination_2; + uint16_t iso_msg_termination_3; + uint16_t iso_msg_termination_4; + uint16_t idle_wakeup_network_enables_1; + uint16_t idle_wakeup_network_enables_2; + uint16_t network_enables_3; + uint16_t idle_wakeup_network_enables_3; + uint16_t can_switch_mode; + STextAPISettings text_api; + uint64_t termination_enables; + LIN_SETTINGS lin6; + ETHERNET_SETTINGS ethernet; + uint16_t slaveVnetA; + uint16_t slaveVnetB; + uint32_t flags; + uint16_t digitalIoThresholdTicks; + uint16_t digitalIoThresholdEnable; +}SFire2Settings; + +typedef struct __declspec(align(2)) +{ + CAN_SETTINGS can1; + CAN_SETTINGS can2; + unsigned short network_enables; + unsigned short network_enabled_on_boot; + short iso15765_separation_time_offset; + unsigned short perf_en; + unsigned short misc_io_initial_ddr; + unsigned short misc_io_initial_latch; + unsigned short misc_io_report_period; + unsigned short misc_io_on_report_events; +} SVCAN3Settings; + + +typedef struct __declspec(align(2)) _stCM_ISO157652_TxMessage +{ + //transmit message + unsigned short vs_netid; ///< The netid of the message (determines which network to transmit on), not supported + + unsigned char padding; ///< The padding byte to use to fill the unused portion of + /// transmitted CAN frames (single frame, first frame, consecutive frame), + /// not supported as it is always 0xAA. + + unsigned char reserved2; + + unsigned int id; ///< arbId of transmitted frames (CAN id to transmit to). + unsigned int fc_id; ///< flow control arb id filter value (response id from receiver). + unsigned int fc_id_mask; ///< The flow control arb filter mask (response id from receiver). + + unsigned char stMin; ///< Overrides the stMin that the receiver reports, see overrideSTmin. Set to J2534's STMIN_TX if <= 0xFF + unsigned char blockSize;///< Overrides the block size that the receiver reports, see overrideBlockSize. Set to J2534's BS_TX if <= 0xFF. + unsigned char flowControlExtendedAddress; ///< Expected Extended Address byte of response from receiver. see fc_ext_address_enable, not supported. + unsigned char extendedAddress; ///< Extended Address byte of transmitter. see ext_address_enable, not supported. + + //flow control timeouts + unsigned short fs_timeout; ///< max timeout (ms) for waiting on flow control respons, not supported. + unsigned short fs_wait; ///< max timeout (ms) for waiting on flow control response that does not have + ///flow status set to WAIT, not supported. + + unsigned char data[4*1024]; ///< The data + + unsigned int num_bytes; ///< Number of data bytes + + //option bits + union + { + struct + { + unsigned id_29_bit_enable:1; ///< Enables 29 bit arbId for transmitted frames. Set to 1 so transmitted frames use 29 bit ids, not supported. + unsigned fc_id_29_bit_enable:1; ///< Enables 29 bit arbId for Flow Control filter. Set to 1 if receiver response uses 29 bit ids, not supported. + unsigned ext_address_enable:1; ///< Enables Extended Addressing, Set to 1 if transmitted frames should have extended addres byte, not supported. + unsigned fc_ext_address_enable:1; ///< Enables Extended Addressing for Flow Control filter. Set to 1 if receiver responds with extended address byte, not supported. + unsigned overrideSTmin:1; ///< Uses member stMin and not receiver's flow control's stMin. + unsigned overrideBlockSize:1; ///< Uses member BlockSize and not receiver's flow control's BlockSize. + unsigned paddingEnable:1; ///< Enable's padding + unsigned iscanFD : 1; //Enables CANFD + unsigned isBRSEnabled : 1; //Enables bitrate switch + unsigned Padding: 15; + unsigned tx_dl : 8; + }; + unsigned int flags; + }; + + +}stCM_ISO157652_TxMessage; + + + +typedef struct __declspec(align(2)) +{ + //transmit message + unsigned short vs_netid; ///< The netid of the message (determines which network to decode receives), not supported + + unsigned char padding; ///< The padding byte to use to fill the unused portion of + /// transmitted CAN frames (flow control), see paddingEnable. + + unsigned int id; ///< ArbId filter value for frames from transmitter (from ECU to neoVI). + unsigned int id_mask; ///< ArbId filter mask for frames from transmitter (from ECU to neoVI). + unsigned int fc_id; ///< flow control arbId to transmit in flow control (from neoVI to ECU). + + unsigned char flowControlExtendedAddress; ///< Extended Address byte used in flow control (from neoVI to ECU). see fc_ext_address_enable. + unsigned char extendedAddress; ///< Expected Extended Address byte of frames sent by transmitter (from ECU to neoVI). see ext_address_enable. + + unsigned char blockSize; ///< Block Size to report in flow control response. + unsigned char stMin; ///< Minimum seperation time (between consecutive frames) to report in flow control response. + + //flow control timeouts + unsigned short cf_timeout; ///< max timeout (ms) for waiting on consecutive frame. Set this to N_CR_MAX's value in J2534. + + //option bits + union + { + struct + { + unsigned id_29_bit_enable:1; ///< Enables 29 bit arbId filter for frames (from ECU to neoVI). + unsigned fc_id_29_bit_enable:1; ///< Enables 29 bit arbId for Flow Control (from neoVI to ECU). + unsigned ext_address_enable:1; ///< Enables Extended Addressing (from ECU to neoVI). + unsigned fc_ext_address_enable:1; ///< Enables Extended Addressing (from neoVI to ECU). + unsigned enableFlowControlTransmission:1; ///< Enables Flow Control frame transmission (from neoVI to ECU). + unsigned paddingEnable:1; ///< Enable's padding + unsigned iscanFD : 1; // +#include "icsnVC40.h" + + + +bool LoadDLLAPI(HINSTANCE &hAPIDLL); +void UnloadDLLAPI(HINSTANCE &hAPIDLL); + +//Basic Functions +typedef int (__stdcall *FINDNEODEVICES)(unsigned long DeviceTypes, NeoDevice *pNeoDevice, int *pNumDevices); +typedef int (__stdcall *OPENNEODEVICE)(NeoDevice *pNeoDevice, void * hObject, unsigned char *bNetworkIDs, int bConfigRead, int bSyncToPC); +typedef int (__stdcall *CLOSEPORT)(void * hObject, int *pNumberOfErrors); +typedef void (__stdcall *FREEOBJECT)(void * hObject); +typedef int (__stdcall *OPENPORTEX)(void * lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, + int bConfigRead, unsigned char *bNetworkID, int * hObject); +typedef int (__stdcall *SERIALNUMBERTOSTRING) (unsigned long serial, char *data,unsigned long data_size); + +//Message Functions +typedef int (__stdcall *GETMESSAGES)(void * hObject, icsSpyMessage *pMsg, int * pNumberOfMessages, int * pNumberOfErrors); +typedef int (__stdcall *TXMESSAGES)(void * hObject, icsSpyMessage *pMsg, int lNetworkID, int lNumMessages); +typedef int (__stdcall *TXMESSAGESEX)(void * hObject,icsSpyMessage *pMsg, unsigned int lNetworkID,unsigned int lNumMessages,unsigned int *NumTxed, unsigned int zero2); +typedef int (__stdcall *WAITFORRXMSGS)(void * hObject, unsigned int iTimeOut); +typedef int (__stdcall *ENABLERXQUEUE)(void * hObject, int iEnable); +typedef int (__stdcall *GETTSFORMSG)(void * hObject, icsSpyMessage *pMsg, double *pTimeStamp); +typedef void (__stdcall *GETISO15765STATUS)(void * hObject, int lNetwork, int lClearTxStatus, + int lClearRxStatus, int *lTxStatus, int *lRxStatus); +typedef void (__stdcall *SETISO15765RXPARMS)(void * hObject, int lNetwork, int lEnable, + spyFilterLong *pFF_CFMsgFilter, icsSpyMessage *pTxMsg, + int lCFTimeOutMs, int lFlowCBlockSize, + int lUsesExtendedAddressing, int lUseHardwareIfPresent); +typedef int (__stdcall *DOWNLOADISO15765_2_TXSCRIPT)(void * hObject, unsigned int NetworkID); +typedef int (__stdcall *CLEARISO15765_2_TXSCRIPT)(void * hObject); +typedef int (__stdcall *TXISO15765_2_MESSAGE)(void * hObject, stCM_ISO157652_TxMessage *pTxMessage); + +//Device Functions +typedef int (__stdcall *GETCONFIG)(void * hObject, unsigned char * pData, int * lNumBytes); +typedef int (__stdcall *SENDCONFIG)(void * hObject, unsigned char * pData, int lNumBytes); +typedef int (__stdcall *GETFIRESETTINGS)(void * hObject, SFireSettings *pSettings, int iNumBytes); +typedef int (__stdcall *SETFIRESETTINGS)(void * hObject, SFireSettings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETVCAN3SETTINGS)(void * hObject, SVCAN3Settings *pSettings, int iNumBytes); +typedef int (__stdcall *SETVCAN3SETTINGS)(void * hObject, SVCAN3Settings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETFIRE2SETTINGS)(void * hObject, SFire2Settings *pSettings, int iNumBytes); +typedef int (__stdcall *SETFIRE2SETTINGS)(void * hObject, SFire2Settings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETVCANRFSETTINGS)(void * hObject, SVCANRFSettings *pSettings, int iNumBytes); +typedef int (__stdcall *SETVCANRFSETTINGS)(void * hObject, SVCANRFSettings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETVCAN412SETTINGS)(void * hObject, SVCAN412Settings *pSettings, int iNumBytes); +typedef int (__stdcall *SETVCAN412SETTINGS)(void * hObject, SVCAN412Settings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETRADGalaxySETTINGS)(void * hObject, SRADGalaxySettings *pSettings, int iNumBytes); +typedef int (__stdcall *SETRADGalaxySETTINGS)(void * hObject, SRADGalaxySettings *pSettings, int iNumBytes, int bSaveToEEPROM); + +typedef int (__stdcall *GETRADSTAR2SETTINGS)(void * hObject, SRADStar2Settings *pSettings, int iNumBytes); +typedef int (__stdcall *SETRADSTAR2SETTINGS)(void * hObject, SRADStar2Settings *pSettings, int iNumBytes, int bSaveToEEPROM); + + +typedef int (__stdcall *SETBITRATE)(void * hObject, int BitRate, int NetworkID); +typedef int (__stdcall *GETDEVICEPARMS)(void * hObject, char *pParameter, char *pValues, short ValuesLength); +typedef int (__stdcall *SETDEVICEPARMS)(void * hObject, char *pParmValue, int *pErrorIndex, int bSaveToEEPROM); + +//Error Functions +typedef int (__stdcall *GETLASTAPIERROR)(void * hObject, unsigned long *pErrorNumber); +typedef int (__stdcall *GETERRMSGS)(void * hObject, int * pErrorMsgs, int * pNumberOfErrors); +typedef int (__stdcall *GETERRORINFO)(int lErrorNumber, TCHAR *szErrorDescriptionShort, + TCHAR *szErrorDescriptionLong, int * lMaxLengthShort, + int * lMaxLengthLong,int * lErrorSeverity,int * lRestartNeeded); + +//ISO15765-2 Functions +typedef int (__stdcall *ISO15765ENABLENETWORKS)(void * hObject, unsigned long ulNetworks); +typedef int (__stdcall *ISO15765DISABLENETWORKS)(void * hObject); +typedef int (__stdcall *ISO15765TXMSG)(void * hObject, unsigned long ulNetworkID,stCM_ISO157652_TxMessage *pMsg, unsigned long ulBlockingTimeout); +typedef int (__stdcall *ISO15765RXMSG)(void * hObject,int ulNetworkID,stCM_ISO157652_RxMessage * pMsg); + +//General Utility Functions +typedef int (__stdcall *VALIDATEHOBJECT)(void * hObject); +typedef int (__stdcall *GETDLLVERSION)(void); +typedef int (__stdcall *GETSERIALNUMBER)(void * hObject, unsigned int *iSerialNumber); +typedef int (__stdcall *STARTSOCKSERVER)(void * hObject, int iPort); +typedef int (__stdcall *STOPSOCKSERVER)(void * hObject); + +//CoreMini Script functions +typedef int (__stdcall *SCRIPTSTART)(void * hObject, int iLocation); +typedef int (__stdcall *SCRIPTSTOP)(void * hObject); +typedef int (__stdcall *SCRIPTLOAD)(void * hObject, const unsigned char * bin, unsigned long len_bytes, int iLocation); +typedef int (__stdcall *SCRIPTCLEAR)(void * hObject, int iLocation); +typedef int (__stdcall *SCRIPTSTARTFBLOCK)(void * hObject,unsigned int fb_index); +typedef int (__stdcall *SCRIPTGETFBLOCKSTATUS)(void * hObject, unsigned int fb_index, int *piRunStatus); +typedef int (__stdcall *SCRIPTSTOPFBLOCK)(void * hObject,unsigned int fb_index); +typedef int (__stdcall *SCRIPTGETSCRIPTSTATUS)(void * hObject, int *piStatus); +typedef int (__stdcall *SCRIPTREADAPPSIGNAL)(void * hObject, unsigned int iIndex, double *dValue); +typedef int (__stdcall *SCRIPTWRITEAPPSIGNAL)(void * hObject, unsigned int iIndex, double dValue); +typedef int (__stdcall *SCRIPTREADISO15765TXMESSAGE)(void * hObject, unsigned int iIndex, stCM_ISO157652_TxMessage *pTxMessage); +typedef int (__stdcall *SCRIPTWRITEISO15765TXMESSAGE)(void * hObject, unsigned int iIndex, const stCM_ISO157652_TxMessage *pTxMessage); + + +//Deprecated (but still suppored in the DLL) +//////typedef int (__stdcall *OPENPORTEX)(int lPortSerialNumber, int lPortType, int lDriverType, +////// int lIPAddressMSB, int lIPAddressLSBOrBaudRate,int bConfigRead, +////// unsigned char * bNetworkID, int * hObject); +////// +//////typedef int (__stdcall *OPENPORT)(int lPortNumber, int lPortType, int lDriverType, +////// unsigned char *bNetworkID, unsigned char *bSCPIDs, int * hObject); +//////typedef int (__stdcall *ENABLENETWORKCOM)(void * hObject, int Enable); +//////typedef int (__stdcall *FINDCOMDEVICES)(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, +////// int *p_lDeviceTypes, int *p_lComPorts, int *p_lSerialNumbers, int *lNumDevices); + + + +//Basic Functions +extern FINDNEODEVICES icsneoFindNeoDevices; +extern OPENNEODEVICE icsneoOpenNeoDevice; +extern CLOSEPORT icsneoClosePort; +extern FREEOBJECT icsneoFreeObject; +extern SERIALNUMBERTOSTRING icsneoSerialNumberToString; +////extern OPENPORTEX icsneoOpenPortEx; +////extern ENABLENETWORKCOM icsneoEnableNetworkCom; + +//Message Functions +extern GETMESSAGES icsneoGetMessages; +extern TXMESSAGES icsneoTxMessages; +extern TXMESSAGESEX icsneoTxMessagesEx; +extern WAITFORRXMSGS icsneoWaitForRxMessagesWithTimeOut; +extern GETTSFORMSG icsneoGetTimeStampForMsg; +extern ENABLERXQUEUE icsneoEnableNetworkRXQueue; +extern GETISO15765STATUS icsneoGetISO15765Status; +extern SETISO15765RXPARMS icsneoSetISO15765RxParameters; +extern DOWNLOADISO15765_2_TXSCRIPT icsneoDownloadISO15765_2_TXScript; +extern CLEARISO15765_2_TXSCRIPT icsneoClearISO15765_2_TxScript; +extern TXISO15765_2_MESSAGE icsneoTransmitISO15765_2_Message; + + +//Device Functions +extern GETCONFIG icsneoGetConfiguration; +extern SENDCONFIG icsneoSendConfiguration; +extern GETFIRESETTINGS icsneoGetFireSettings; +extern SETFIRESETTINGS icsneoSetFireSettings; +extern GETVCAN3SETTINGS icsneoGetVCAN3Settings; +extern SETVCAN3SETTINGS icsneoSetVCAN3Settings; + + +extern GETFIRE2SETTINGS icsneoGetFire2Settings; +extern SETFIRE2SETTINGS icsneoSetFire2Settings; +extern GETVCANRFSETTINGS icsneoGetVCANRFSettings; +extern SETVCANRFSETTINGS icsneoSetVCANRFSettings; +extern GETRADGalaxySETTINGS icsneoGetRADGalaxySettings; +extern SETRADGalaxySETTINGS icsneoSetRADGalaxySettings; +extern GETRADSTAR2SETTINGS icsneoGetRADStar2Settings; +extern SETRADSTAR2SETTINGS icsneoSetRADStar2Settings; +extern GETVCAN412SETTINGS icsneoGetVCAN412Settings; +extern SETVCAN412SETTINGS icsneoSetVCAN412Settings; + +extern SETBITRATE icsneoSetBitRate; +extern GETDEVICEPARMS icsneoGetDeviceParameters; +extern SETDEVICEPARMS icsneoSetDeviceParameters; + +//Error Functions +extern GETLASTAPIERROR icsneoGetLastAPIError; +extern GETERRMSGS icsneoGetErrorMessages; +extern GETERRORINFO icsneoGetErrorInfo; + +//ISO15765-2 +extern ISO15765ENABLENETWORKS icsneoISO15765_EnableNetworks; +extern ISO15765DISABLENETWORKS icsneoISO15765_DisableNetworks; +extern ISO15765TXMSG icsneoISO15765_TransmitMessage; +extern ISO15765RXMSG icsneoISO15765_ReceiveMessage; + +//General Utility Functions +extern VALIDATEHOBJECT icsneoValidateHObject; +extern GETDLLVERSION icsneoGetDLLVersion; +extern GETSERIALNUMBER icsneoGetSerialNumber; +extern STARTSOCKSERVER icsneoStartSockServer; +extern STOPSOCKSERVER icsneoStopSockServer; + +//CoreMini Functions +extern SCRIPTSTART icsneoScriptStart; +extern SCRIPTSTOP icsneoScriptStop; +extern SCRIPTLOAD icsneoScriptLoad; +extern SCRIPTCLEAR icsneoScriptClear; +extern SCRIPTSTARTFBLOCK icsneoScriptStartFBlock; +extern SCRIPTGETFBLOCKSTATUS icsneoScriptGetFBlockStatus; +extern SCRIPTSTOPFBLOCK icsneoScriptStopFBlock; +extern SCRIPTGETSCRIPTSTATUS icsneoScriptGetScriptStatus; +extern SCRIPTREADAPPSIGNAL icsneoScriptReadAppSignal; +extern SCRIPTWRITEAPPSIGNAL icsneoScriptWriteAppSignal; +//extern SCRIPTREADRXMESSAGE icsneoScriptReadRxMessage; +//extern SCRIPTREADTXMESSAGE icsneoScriptReadTxMessage; +//extern SCRIPTWRITERXMESSAGE icsneoScriptWriteRxMessage; +//extern SCRIPTWRITETXMESSAGE icsneoScriptWriteTxMessage; +extern SCRIPTREADISO15765TXMESSAGE icsneoScriptReadISO15765_2_TxMessage; +extern SCRIPTWRITEISO15765TXMESSAGE icsneoScriptWriteISO15765_2_TxMessage; + + + + + + diff --git a/api/icsneolegacy/icsneolegacy.cpp b/api/icsneolegacy/icsneolegacy.cpp new file mode 100644 index 0000000..e834746 --- /dev/null +++ b/api/icsneolegacy/icsneolegacy.cpp @@ -0,0 +1,338 @@ +#define ICSNEOC_MAKEDLL +#include "api/icsneolegacy/include/icsneolegacy.h" + +#undef ICSNEOC_MAKEDLL +#include "api/icsneoc/include/icsneoc.h" + +static NeoDevice OldNeoDeviceFromNew(const neodevice_t* newnd) { + NeoDevice oldnd = { 0 }; + oldnd.SerialNumber = icsneo_serialStringToNum(newnd->serial); + oldnd.NumberOfClients = 0; + oldnd.MaxAllowedClients = 1; + static_assert(sizeof(neodevice_handle_t) <= sizeof(oldnd.Handle), "neodevice_handle_t size must be at least sizeof(int) for compatibility reasons"); + *(neodevice_handle_t*)(&oldnd.Handle) = newnd->handle; + return oldnd; +} + +//Basic Functions +int icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice* pNeoDevice, int* pNumDevices) { + constexpr size_t MAX_DEVICES = 255; + size_t count = MAX_DEVICES; + + if(pNumDevices == nullptr) + return 0; + + if(pNeoDevice == nullptr) { + icsneo_findAllDevices(nullptr, &count); + *pNumDevices = (int)count; + return 1; + } + + size_t bufferSize = (size_t)*pNumDevices; + if(*pNumDevices < 0 || bufferSize > MAX_DEVICES) + return 0; + + neodevice_t devices[MAX_DEVICES]; + icsneo_findAllDevices(devices, &count); + if(bufferSize < count) + count = bufferSize; + *pNumDevices = (int)count; + + for(int i = 0; i < count; i++) + pNeoDevice[i] = OldNeoDeviceFromNew(&devices[i]); + + return 1; +} + +int icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void* hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC) { + // TODO Implement + return false; +} + +int icsneoClosePort(void* hObject, int* pNumberOfErrors) { + // TODO Implement + return false; +} + +void icsneoFreeObject(void* hObject) { + // TODO Implement + return; +} + +int icsneoSerialNumberToString(unsigned long serial, char* data, unsigned long data_size) { + size_t length = (size_t)data_size; + return icsneo_serialNumToString((uint32_t)serial, data, &length); +} + +//Message Functions +int icsneoGetMessages(void* hObject, icsSpyMessage* pMsg, int* pNumberOfMessages, int* pNumberOfErrors) { + // TODO Implement + return false; +} + +int icsneoTxMessages(void* hObject, icsSpyMessage* pMsg, int lNetworkID, int lNumMessages) { + // TODO Implement + return false; +} + +int icsneoTxMessagesEx(void* hObject,icsSpyMessage* pMsg, unsigned int lNetworkID, unsigned int lNumMessages, unsigned int* NumTxed, unsigned int zero2) { + // TODO Implement + return false; +} + +int icsneoWaitForRxMessagesWithTimeOut(void* hObject, unsigned int iTimeOut) { + // TODO Implement + return false; +} + +int icsneoEnableNetworkRXQueue(void* hObject, int iEnable) { + // TODO Implement + return false; +} + +int icsneoGetTimeStampForMsg(void* hObject, icsSpyMessage* pMsg, double* pTimeStamp) { + // TODO Implement + return false; +} + +void icsneoGetISO15765Status(void* hObject, int lNetwork, int lClearTxStatus, int lClearRxStatus, int*lTxStatus, int*lRxStatus) { + // TODO Implement + return; +} + +void icsneoSetISO15765RxParameters(void* hObject, int lNetwork, int lEnable, spyFilterLong* pFF_CFMsgFilter, icsSpyMessage* pTxMsg, + int lCFTimeOutMs, int lFlowCBlockSize, int lUsesExtendedAddressing, int lUseHardwareIfPresent) { + // TODO Implement + return; +} + +//Device Functions +int icsneoGetConfiguration(void* hObject, unsigned char* pData, int* lNumBytes) { + // TODO Implement + return false; +} + +int icsneoSendConfiguration(void* hObject, unsigned char* pData, int lNumBytes) { + // TODO Implement + return false; +} + +int icsneoGetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoGetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes) { + // TODO Implement + return false; +} + +int icsneoSetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +int icsneoSetBitRate(void* hObject, int BitRate, int NetworkID) { + // TODO Implement + return false; +} + +int icsneoGetDeviceParameters(void* hObject, char* pParameter, char* pValues, short ValuesLength) { + // TODO Implement + return false; +} + +int icsneoSetDeviceParameters(void* hObject, char* pParmValue, int* pErrorIndex, int bSaveToEEPROM) { + // TODO Implement + return false; +} + +//Error Functions +int icsneoGetLastAPIError(void* hObject, unsigned long* pErrorNumber) { + // TODO Implement + return false; +} + +int icsneoGetErrorMessages(void* hObject, int* pErrorMsgs, int* pNumberOfErrors) { + // TODO Implement + return false; +} + +int icsneoGetErrorInfo(int lErrorNumber, TCHAR*szErrorDescriptionShort, TCHAR*szErrorDescriptionLong, int* lMaxLengthShort, int* lMaxLengthLong,int* lErrorSeverity,int* lRestartNeeded) { + // TODO Implement + return false; +} + +//ISO15765-2 Functions +int icsneoISO15765_EnableNetworks(void* hObject, unsigned long ulNetworks) { + // TODO Implement + return false; +} + +int icsneoISO15765_DisableNetworks(void* hObject) { + // TODO Implement + return false; +} + +int icsneoISO15765_TransmitMessage(void* hObject, unsigned long ulNetworkID, stCM_ISO157652_TxMessage* pMsg, unsigned long ulBlockingTimeout) { + // TODO Implement + return false; +} + +int icsneoISO15765_ReceiveMessage(void* hObject,int ulNetworkID, stCM_ISO157652_RxMessage* pMsg) { + // TODO Implement + return false; +} + +//General Utility Functions +int icsneoValidateHObject(void* hObject) { + // TODO Implement + return false; +} + +int icsneoGetDLLVersion(void) { + // TODO Implement + return false; +} + +int icsneoGetSerialNumber(void* hObject, unsigned int*iSerialNumber) { + // TODO Implement + return false; +} + +int icsneoStartSockServer(void* hObject, int iPort) { + // TODO Implement + return false; +} + +int icsneoStopSockServer(void* hObject) { + // TODO Implement + return false; +} + +//CoreMini Script functions +int icsneoScriptStart(void* hObject, int iLocation) { + // TODO Implement + return false; +} + +int icsneoScriptStop(void* hObject) { + // TODO Implement + return false; +} + +int icsneoScriptLoad(void* hObject, const unsigned char* bin, unsigned long len_bytes, int iLocation) { + // TODO Implement + return false; +} + +int icsneoScriptClear(void* hObject, int iLocation) { + // TODO Implement + return false; +} + +int icsneoScriptStartFBlock(void* hObject,unsigned int fb_index) { + // TODO Implement + return false; +} + +int icsneoScriptGetFBlockStatus(void* hObject, unsigned int fb_index, int* piRunStatus) { + // TODO Implement + return false; +} + +int icsneoScriptStopFBlock(void* hObject,unsigned int fb_index) { + // TODO Implement + return false; +} + +int icsneoScriptGetScriptStatus(void* hObject, int* piStatus) { + // TODO Implement + return false; +} + +int icsneoScriptReadAppSignal(void* hObject, unsigned int iIndex, double*dValue) { + // TODO Implement + return false; +} + +int icsneoScriptWriteAppSignal(void* hObject, unsigned int iIndex, double dValue) { + // TODO Implement + return false; +} + +//Deprecated (but still suppored in the DLL) +int icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject) { + // TODO Implement + return false; +} + +int icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char* bNetworkID, unsigned char* bSCPIDs, int* hObject) { + // TODO Implement + return false; +} + +int icsneoEnableNetworkCom(void* hObject, int Enable) { + // TODO Implement + return false; +} + +int icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int*lNumDevices) { + // TODO Implement + return false; +} \ No newline at end of file diff --git a/api/icsneolegacy/include/icsneolegacy.h b/api/icsneolegacy/include/icsneolegacy.h new file mode 100644 index 0000000..e0e3509 --- /dev/null +++ b/api/icsneolegacy/include/icsneolegacy.h @@ -0,0 +1,100 @@ +#ifndef __ICSNEOLEGACY_H_ +#define __ICSNEOLEGACY_H_ + +#include "platform/include/dynamiclib.h" // Dynamic library loading and exporting + +#include +typedef uint8_t byte; // Typedef helper for the following include +#include "api/icsneolegacy/dllhelper/include/icsnVC40.h" // Definitions for structs + +#ifdef __cplusplus +extern "C" { +#endif + +//Basic Functions +extern int DLLExport icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice* pNeoDevice, int* pNumDevices); +extern int DLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void* hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC); +extern int DLLExport icsneoClosePort(void* hObject, int* pNumberOfErrors); +extern void DLLExport icsneoFreeObject(void* hObject); +extern int DLLExport icsneoSerialNumberToString(unsigned long serial, char*data,unsigned long data_size); + +//Message Functions +extern int DLLExport icsneoGetMessages(void* hObject, icsSpyMessage* pMsg, int* pNumberOfMessages, int* pNumberOfErrors); +extern int DLLExport icsneoTxMessages(void* hObject, icsSpyMessage* pMsg, int lNetworkID, int lNumMessages); +extern int DLLExport icsneoTxMessagesEx(void* hObject,icsSpyMessage* pMsg, unsigned int lNetworkID, unsigned int lNumMessages, unsigned int* NumTxed, unsigned int zero2); +extern int DLLExport icsneoWaitForRxMessagesWithTimeOut(void* hObject, unsigned int iTimeOut); +extern int DLLExport icsneoEnableNetworkRXQueue(void* hObject, int iEnable); +extern int DLLExport icsneoGetTimeStampForMsg(void* hObject, icsSpyMessage* pMsg, double* pTimeStamp); +extern void DLLExport icsneoGetISO15765Status(void* hObject, int lNetwork, int lClearTxStatus, int lClearRxStatus, int*lTxStatus, int*lRxStatus); +extern void DLLExport icsneoSetISO15765RxParameters(void* hObject, int lNetwork, int lEnable, spyFilterLong* pFF_CFMsgFilter, icsSpyMessage* pTxMsg, + int lCFTimeOutMs, int lFlowCBlockSize, int lUsesExtendedAddressing, int lUseHardwareIfPresent); + +//Device Functions +extern int DLLExport icsneoGetConfiguration(void* hObject, unsigned char* pData, int* lNumBytes); +extern int DLLExport icsneoSendConfiguration(void* hObject, unsigned char* pData, int lNumBytes); +extern int DLLExport icsneoGetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetFireSettings(void* hObject, SFireSettings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetVCAN3Settings(void* hObject, SVCAN3Settings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetFire2Settings(void* hObject, SFire2Settings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetVCANRFSettings(void* hObject, SVCANRFSettings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetVCAN412Settings(void* hObject, SVCAN412Settings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetRADGalaxySettings(void* hObject, SRADGalaxySettings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoGetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes); +extern int DLLExport icsneoSetRADStar2Settings(void* hObject, SRADStar2Settings* pSettings, int iNumBytes, int bSaveToEEPROM); + +extern int DLLExport icsneoSetBitRate(void* hObject, int BitRate, int NetworkID); +extern int DLLExport icsneoGetDeviceParameters(void* hObject, char* pParameter, char* pValues, short ValuesLength); +extern int DLLExport icsneoSetDeviceParameters(void* hObject, char* pParmValue, int* pErrorIndex, int bSaveToEEPROM); + +//Error Functions +extern int DLLExport icsneoGetLastAPIError(void* hObject, unsigned long* pErrorNumber); +extern int DLLExport icsneoGetErrorMessages(void* hObject, int* pErrorMsgs, int* pNumberOfErrors); +extern int DLLExport icsneoGetErrorInfo(int lErrorNumber, TCHAR*szErrorDescriptionShort, TCHAR*szErrorDescriptionLong, int* lMaxLengthShort, int* lMaxLengthLong,int* lErrorSeverity,int* lRestartNeeded); + +//ISO15765-2 Functions +extern int DLLExport icsneoISO15765_EnableNetworks(void* hObject, unsigned long ulNetworks); +extern int DLLExport icsneoISO15765_DisableNetworks(void* hObject); +extern int DLLExport icsneoISO15765_TransmitMessage(void* hObject, unsigned long ulNetworkID, stCM_ISO157652_TxMessage* pMsg, unsigned long ulBlockingTimeout); +extern int DLLExport icsneoISO15765_ReceiveMessage(void* hObject,int ulNetworkID, stCM_ISO157652_RxMessage* pMsg); + +//General Utility Functions +extern int DLLExport icsneoValidateHObject(void* hObject); +extern int DLLExport icsneoGetDLLVersion(void); +extern int DLLExport icsneoGetSerialNumber(void* hObject, unsigned int*iSerialNumber); +extern int DLLExport icsneoStartSockServer(void* hObject, int iPort); +extern int DLLExport icsneoStopSockServer(void* hObject); + +//CoreMini Script functions +extern int DLLExport icsneoScriptStart(void* hObject, int iLocation); +extern int DLLExport icsneoScriptStop(void* hObject); +extern int DLLExport icsneoScriptLoad(void* hObject, const unsigned char* bin, unsigned long len_bytes, int iLocation); +extern int DLLExport icsneoScriptClear(void* hObject, int iLocation); +extern int DLLExport icsneoScriptStartFBlock(void* hObject,unsigned int fb_index); +extern int DLLExport icsneoScriptGetFBlockStatus(void* hObject, unsigned int fb_index, int* piRunStatus); +extern int DLLExport icsneoScriptStopFBlock(void* hObject,unsigned int fb_index); +extern int DLLExport icsneoScriptGetScriptStatus(void* hObject, int* piStatus); +extern int DLLExport icsneoScriptReadAppSignal(void* hObject, unsigned int iIndex, double*dValue); +extern int DLLExport icsneoScriptWriteAppSignal(void* hObject, unsigned int iIndex, double dValue); + +//Deprecated (but still suppored in the DLL) +extern int DLLExport icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject); +extern int DLLExport icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char* bNetworkID, unsigned char* bSCPIDs, int* hObject); +extern int DLLExport icsneoEnableNetworkCom(void* hObject, int Enable); +extern int DLLExport icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int*lNumDevices); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif \ No newline at end of file