diff --git a/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp index e7cf697..dafea23 100644 --- a/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp +++ b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.cpp @@ -5,6 +5,7 @@ //Basic Functions FINDNEODEVICES icsneoFindNeoDevices; OPENNEODEVICE icsneoOpenNeoDevice; +OPENDEVICE icsneoOpenDevice; CLOSEPORT icsneoClosePort; FREEOBJECT icsneoFreeObject; ////OPENPORTEX icsneoOpenPortEx; @@ -137,6 +138,7 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL) icsneoFindNeoDevices = (FINDNEODEVICES) GetProcAddress(hAPIDLL, "icsneoFindNeoDevices"); icsneoOpenNeoDevice = (OPENNEODEVICE) GetProcAddress(hAPIDLL, "icsneoOpenNeoDevice"); + icsneoOpenDevice = (OPENDEVICE) GetProcAddress(hAPIDLL, "icsneoOpenDevice"); icsneoClosePort = (CLOSEPORT) GetProcAddress(hAPIDLL, "icsneoClosePort"); icsneoFreeObject = (FREEOBJECT) GetProcAddress(hAPIDLL, "icsneoFreeObject"); //// icsneoOpenPortEx = (OPENPORTEX) GetProcAddress(hAPIDLL, "icsneoOpenPortEx"); @@ -204,7 +206,7 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL) icsneoEnableDOIPLine = (ENABLEDOIPACTIVATIONLINE)GetProcAddress(hAPIDLL, "icsneoEnableDOIPLine"); - if(!icsneoFindNeoDevices || !icsneoOpenNeoDevice || !icsneoClosePort || !icsneoFreeObject || + if(!icsneoFindNeoDevices || !icsneoOpenNeoDevice || !icsneoOpenDevice || !icsneoClosePort || !icsneoFreeObject || !icsneoTxMessages || !icsneoGetMessages || !icsneoWaitForRxMessagesWithTimeOut || !icsneoGetTimeStampForMsg || !icsneoEnableNetworkRXQueue || !icsneoGetISO15765Status || !icsneoTxMessagesEx || !icsneoSetISO15765RxParameters || !icsneoGetConfiguration || !icsneoSendConfiguration || diff --git a/api/icsneolegacy/dllhelper/icsneo40DLLAPI.h b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.h index aa2b80c..4bed6e0 100644 --- a/api/icsneolegacy/dllhelper/icsneo40DLLAPI.h +++ b/api/icsneolegacy/dllhelper/icsneo40DLLAPI.h @@ -11,6 +11,7 @@ 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 *OPENDEVICE)(NeoDeviceEx* pNeoDeviceEx, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int iOptions, OptionsOpenNeoEx* stOptionsOpenNeoEx, unsigned long reserved); 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, @@ -115,6 +116,7 @@ typedef int (__stdcall *SCRIPTWRITEISO15765TXMESSAGE)(void * hObject, unsigned //Basic Functions extern FINDNEODEVICES icsneoFindNeoDevices; extern OPENNEODEVICE icsneoOpenNeoDevice; +extern OPENDEVICE icsneoOpenDevice; extern CLOSEPORT icsneoClosePort; extern FREEOBJECT icsneoFreeObject; extern SERIALNUMBERTOSTRING icsneoSerialNumberToString; diff --git a/api/icsneolegacy/icsneolegacy.cpp b/api/icsneolegacy/icsneolegacy.cpp index 526f26c..d1ebbef 100644 --- a/api/icsneolegacy/icsneolegacy.cpp +++ b/api/icsneolegacy/icsneolegacy.cpp @@ -620,6 +620,35 @@ int LegacyDLLExport icsneoOpenNeoDevice(NeoDevice *pNeoDevice, void **hObject, u return icsneo_setPollingMessageLimit(device, 20000) && icsneo_enableMessagePolling(device) && icsneo_goOnline(device); } +int LegacyDLLExport icsneoOpenDevice( + NeoDeviceEx* pNeoDeviceEx, + void** hObject, + unsigned char* bNetworkIDs, + int bConfigRead, + int iOptions, + OptionsOpenNeoEx* stOptionsOpenNeoEx, + unsigned long reserved) +{ + if (pNeoDeviceEx == nullptr || hObject == nullptr) + return false; + + neodevice_t* device; + try + { + device = &neodevices.at(uint64_t(pNeoDeviceEx->neoDevice.Handle) << 32 | pNeoDeviceEx->neoDevice.SerialNumber); + } + catch (const std::out_of_range&) + { + return false; + } + + *hObject = device; + if(!icsneo_openDevice(device)) + return false; + + return icsneo_setPollingMessageLimit(device, 20000) && icsneo_enableMessagePolling(device) && icsneo_goOnline(device); +} + int LegacyDLLExport icsneoClosePort(void *hObject, int *pNumberOfErrors) { if (!icsneoValidateHObject(hObject)) diff --git a/include/icsneo/icsneolegacy.h b/include/icsneo/icsneolegacy.h index 78af46b..3988382 100644 --- a/include/icsneo/icsneolegacy.h +++ b/include/icsneo/icsneolegacy.h @@ -23,6 +23,7 @@ extern "C" { extern int LegacyDLLExport icsneoFindDevices(NeoDeviceEx* pNeoDeviceEx, int* pNumDevices, unsigned int* DeviceTypes, unsigned int numDeviceTypes,POptionsFindNeoEx* pOptionsNeoEx, unsigned int* reserved); extern int LegacyDLLExport icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice* pNeoDevice, int* pNumDevices); extern int LegacyDLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC); +extern int LegacyDLLExport icsneoOpenDevice(NeoDeviceEx* pNeoDeviceEx, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int iOptions, OptionsOpenNeoEx* stOptionsOpenNeoEx, unsigned long reserved); extern int LegacyDLLExport icsneoClosePort(void* hObject, int* pNumberOfErrors); extern void LegacyDLLExport icsneoFreeObject(void* hObject); extern int LegacyDLLExport icsneoOpenDevice(NeoDeviceEx* pNeoDeviceEx, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int iOptions, OptionsOpenNeoEx* stOptionsOpenNeoEx, unsigned long reserved);