Legacy: Drop deprecated APIs
Drop icsneoFindNeoDevices() and icsneoOpenNeoDevice() in favor of icsneoFindDevices() and icsneoOpenDevice(), respectively. Also fixes: - Failure to re-open a device after it has been closed with the C/legacy APIs - NumberOfClients not being updated - FIRE3 settings missing in icsneoGetDeviceSettingsType()pull/64/head
parent
219a5edbd8
commit
06f6861130
|
|
@ -144,8 +144,17 @@ bool icsneo_closeDevice(const neodevice_t* device) {
|
||||||
if((*it).get() == device->device)
|
if((*it).get() == device->device)
|
||||||
itemsToDelete.push_back(it);
|
itemsToDelete.push_back(it);
|
||||||
}
|
}
|
||||||
for(auto it : itemsToDelete)
|
for(auto it : itemsToDelete) {
|
||||||
|
// Move it back into connectable devices so we can open it again.
|
||||||
|
// Without this we will be unable to use/reopen the device due to
|
||||||
|
// icsneo_isValidNeoDevice / icsneo_openDevice checks against this
|
||||||
|
// container. Since its closed we are in a connectable state again.
|
||||||
|
// Notice: When we search again this will be cleaned up by
|
||||||
|
// icsneo_freeUnconnectedDevices()
|
||||||
|
connectableFoundDevices.push_back(*it);
|
||||||
|
// Remove it from the connected devices as we are no longer connected.
|
||||||
connectedDevices.erase(it);
|
connectedDevices.erase(it);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
#include <Tchar.h>
|
#include <Tchar.h>
|
||||||
|
|
||||||
//Basic Functions
|
//Basic Functions
|
||||||
FINDNEODEVICES icsneoFindNeoDevices;
|
|
||||||
OPENNEODEVICE icsneoOpenNeoDevice;
|
|
||||||
OPENDEVICE icsneoOpenDevice;
|
OPENDEVICE icsneoOpenDevice;
|
||||||
CLOSEPORT icsneoClosePort;
|
CLOSEPORT icsneoClosePort;
|
||||||
FREEOBJECT icsneoFreeObject;
|
FREEOBJECT icsneoFreeObject;
|
||||||
|
|
@ -134,10 +132,6 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL)
|
||||||
if((hAPIDLL = LoadLibrary(_T("icsneo40.dll"))) == NULL)
|
if((hAPIDLL = LoadLibrary(_T("icsneo40.dll"))) == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
icsneoFindNeoDevices = (FINDNEODEVICES) GetProcAddress(hAPIDLL, "icsneoFindNeoDevices");
|
|
||||||
icsneoOpenNeoDevice = (OPENNEODEVICE) GetProcAddress(hAPIDLL, "icsneoOpenNeoDevice");
|
|
||||||
icsneoOpenDevice = (OPENDEVICE) GetProcAddress(hAPIDLL, "icsneoOpenDevice");
|
icsneoOpenDevice = (OPENDEVICE) GetProcAddress(hAPIDLL, "icsneoOpenDevice");
|
||||||
icsneoClosePort = (CLOSEPORT) GetProcAddress(hAPIDLL, "icsneoClosePort");
|
icsneoClosePort = (CLOSEPORT) GetProcAddress(hAPIDLL, "icsneoClosePort");
|
||||||
icsneoFreeObject = (FREEOBJECT) GetProcAddress(hAPIDLL, "icsneoFreeObject");
|
icsneoFreeObject = (FREEOBJECT) GetProcAddress(hAPIDLL, "icsneoFreeObject");
|
||||||
|
|
@ -206,7 +200,7 @@ bool LoadDLLAPI(HINSTANCE &hAPIDLL)
|
||||||
|
|
||||||
icsneoEnableDOIPLine = (ENABLEDOIPACTIVATIONLINE)GetProcAddress(hAPIDLL, "icsneoEnableDOIPLine");
|
icsneoEnableDOIPLine = (ENABLEDOIPACTIVATIONLINE)GetProcAddress(hAPIDLL, "icsneoEnableDOIPLine");
|
||||||
|
|
||||||
if(!icsneoFindNeoDevices || !icsneoOpenNeoDevice || !icsneoOpenDevice || !icsneoClosePort || !icsneoFreeObject ||
|
if(!icsneoOpenDevice || !icsneoClosePort || !icsneoFreeObject ||
|
||||||
!icsneoTxMessages || !icsneoGetMessages || !icsneoWaitForRxMessagesWithTimeOut ||
|
!icsneoTxMessages || !icsneoGetMessages || !icsneoWaitForRxMessagesWithTimeOut ||
|
||||||
!icsneoGetTimeStampForMsg || !icsneoEnableNetworkRXQueue || !icsneoGetISO15765Status || !icsneoTxMessagesEx ||
|
!icsneoGetTimeStampForMsg || !icsneoEnableNetworkRXQueue || !icsneoGetISO15765Status || !icsneoTxMessagesEx ||
|
||||||
!icsneoSetISO15765RxParameters || !icsneoGetConfiguration || !icsneoSendConfiguration ||
|
!icsneoSetISO15765RxParameters || !icsneoGetConfiguration || !icsneoSendConfiguration ||
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,6 @@ typedef int (__stdcall *SCRIPTWRITEISO15765TXMESSAGE)(void * hObject, unsigned
|
||||||
|
|
||||||
|
|
||||||
//Basic Functions
|
//Basic Functions
|
||||||
extern FINDNEODEVICES icsneoFindNeoDevices;
|
|
||||||
extern OPENNEODEVICE icsneoOpenNeoDevice;
|
|
||||||
extern OPENDEVICE icsneoOpenDevice;
|
extern OPENDEVICE icsneoOpenDevice;
|
||||||
extern CLOSEPORT icsneoClosePort;
|
extern CLOSEPORT icsneoClosePort;
|
||||||
extern FREEOBJECT icsneoFreeObject;
|
extern FREEOBJECT icsneoFreeObject;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
#include "icsneo/communication/network.h"
|
#include "icsneo/communication/network.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
|
|
@ -27,6 +26,7 @@ using namespace icsneo;
|
||||||
|
|
||||||
typedef uint64_t legacymaphandle_t;
|
typedef uint64_t legacymaphandle_t;
|
||||||
static std::map<legacymaphandle_t, neodevice_t> neodevices;
|
static std::map<legacymaphandle_t, neodevice_t> neodevices;
|
||||||
|
static std::map<neodevice_t*, NeoDeviceEx*> openneodevices;
|
||||||
|
|
||||||
static const std::map<size_t, size_t> mp_netIDToVnetOffSet = {
|
static const std::map<size_t, size_t> mp_netIDToVnetOffSet = {
|
||||||
{NETID_HSCAN, 1},
|
{NETID_HSCAN, 1},
|
||||||
|
|
@ -52,18 +52,6 @@ static const std::map<size_t, size_t> mp_HWnetIDToCMnetID = {
|
||||||
|
|
||||||
static unsigned long vnet_table[] = {0, PLASMA_SLAVE1_OFFSET, PLASMA_SLAVE2_OFFSET};
|
static unsigned long vnet_table[] = {0, PLASMA_SLAVE1_OFFSET, PLASMA_SLAVE2_OFFSET};
|
||||||
|
|
||||||
static NeoDevice OldNeoDeviceFromNew(const neodevice_t* newnd)
|
|
||||||
{
|
|
||||||
NeoDevice oldnd = {0};
|
|
||||||
oldnd.DeviceType = newnd->type;
|
|
||||||
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 sizeof(int) for compatibility reasons");
|
|
||||||
oldnd.Handle = newnd->handle;
|
|
||||||
return oldnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool NeoMessageToSpyMessage(const neodevice_t* device, const neomessage_t& newmsg, icsSpyMessage& oldmsg)
|
static bool NeoMessageToSpyMessage(const neodevice_t* device, const neomessage_t& newmsg, icsSpyMessage& oldmsg)
|
||||||
{
|
{
|
||||||
|
|
@ -318,120 +306,81 @@ static inline size_t GetVnetAgnosticNetid(size_t fullNetid)
|
||||||
int LegacyDLLExport icsneoFindDevices(NeoDeviceEx* devs, int* devCount, unsigned int* devTypes, unsigned int devTypeCount,
|
int LegacyDLLExport icsneoFindDevices(NeoDeviceEx* devs, int* devCount, unsigned int* devTypes, unsigned int devTypeCount,
|
||||||
POptionsFindNeoEx* POptionsFindNeoEx, unsigned int* zero)
|
POptionsFindNeoEx* POptionsFindNeoEx, unsigned int* zero)
|
||||||
{
|
{
|
||||||
if (!devs || !devCount)
|
// Match the legacy API maximum, this derives from the maximum COM Port on old windows versions.
|
||||||
|
constexpr int MAX_NEO_DEVICES = 255;
|
||||||
|
|
||||||
|
// Validate arguments
|
||||||
|
if (!devCount && *devCount < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (*devCount < 0 || *devCount > 255)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Find the devices without filtering by the device type
|
|
||||||
// We allow this to find more than the requested number,
|
|
||||||
// as we may filter out some devices.
|
|
||||||
constexpr const size_t MAX_DEVICES = 255;
|
|
||||||
NeoDevice foundDevices[MAX_DEVICES];
|
|
||||||
int NumDevices = MAX_DEVICES;
|
|
||||||
|
|
||||||
int filteredDeviceCount = 0;
|
|
||||||
|
|
||||||
if (!icsneoFindNeoDevices(0, foundDevices, &NumDevices))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (auto i = 0; i < NumDevices; i++)
|
|
||||||
{
|
|
||||||
// Check if the next device would overrun the user's buffer
|
|
||||||
// We check this up here since the documentation allows zero
|
|
||||||
// to be specified.
|
|
||||||
if (filteredDeviceCount >= *devCount)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (devTypes && devTypeCount)
|
|
||||||
{
|
|
||||||
for (unsigned int j = 0; j < devTypeCount; j++)
|
|
||||||
{
|
|
||||||
if (foundDevices[i].DeviceType == devTypes[j])
|
|
||||||
{
|
|
||||||
devs[filteredDeviceCount++].neoDevice = foundDevices[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
devs[filteredDeviceCount++].neoDevice = foundDevices[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// return the size only if devs is NULL.
|
||||||
*devCount = filteredDeviceCount;
|
if (!devs)
|
||||||
return 1; // If the function succeeds but no devices are found 1 will still be returned and devCount will equal 0
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport 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);
|
icsneo_findAllDevices(nullptr, (size_t*)devCount);
|
||||||
*pNumDevices = (int)count;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
// shrink the number of devices allowed to find
|
||||||
size_t bufferSize = (size_t)*pNumDevices;
|
if (*devCount > MAX_NEO_DEVICES) {
|
||||||
if (*pNumDevices < 0 || bufferSize > MAX_DEVICES)
|
*devCount = MAX_NEO_DEVICES;
|
||||||
return 0;
|
|
||||||
|
|
||||||
neodevice_t devices[MAX_DEVICES];
|
|
||||||
icsneo_findAllDevices(devices, &count);
|
|
||||||
if (bufferSize < count)
|
|
||||||
count = bufferSize;
|
|
||||||
*pNumDevices = (int)count;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
pNeoDevice[i] = OldNeoDeviceFromNew(&devices[i]); // Write out into user memory
|
|
||||||
neodevices[uint64_t(devices[i].handle) << 32 | icsneo_serialStringToNum(devices[i].serial)] = devices[i]; // Fill the look up table
|
|
||||||
}
|
}
|
||||||
|
// Find all the neodevice_t devices
|
||||||
|
std::vector<neodevice_t> neoDevices(*devCount);
|
||||||
|
auto neoDevicesSize = neoDevices.size();
|
||||||
|
icsneo_findAllDevices(neoDevices.data(), &neoDevicesSize);
|
||||||
|
neoDevices.resize(neoDevicesSize);
|
||||||
|
// Filter out the devices if needed
|
||||||
|
// No filtering needed
|
||||||
|
if (devTypes && devTypeCount > 0) {
|
||||||
|
neoDevices.erase(
|
||||||
|
std::remove_if(
|
||||||
|
neoDevices.begin(),
|
||||||
|
neoDevices.end(),
|
||||||
|
[&](const auto& iter) {
|
||||||
|
for (unsigned int i=0; i < devTypeCount; ++i) {
|
||||||
|
if (iter.type == devTypes[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
neoDevices.end()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Create a NeoDeviceEx From a neodevice_t
|
||||||
|
auto _createNeoDeviceExFrom = [](const neodevice_t* neoDevice) -> NeoDeviceEx {
|
||||||
|
NeoDeviceEx nde = {};
|
||||||
|
nde.neoDevice.DeviceType = neoDevice->type;
|
||||||
|
nde.neoDevice.SerialNumber = icsneo_serialStringToNum(neoDevice->serial);
|
||||||
|
nde.neoDevice.NumberOfClients = 0;
|
||||||
|
nde.neoDevice.MaxAllowedClients = 1;
|
||||||
|
static_assert(sizeof(neodevice_handle_t) == sizeof(nde.neoDevice.Handle),
|
||||||
|
"neodevice_handle_t size must be sizeof(int) for compatibility reasons");
|
||||||
|
nde.neoDevice.Handle = neoDevice->handle;
|
||||||
|
return nde;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create the NeoDeviceEx from the neodevice_t
|
||||||
|
auto i = 0;
|
||||||
|
for (const auto& neoDevice : neoDevices) {
|
||||||
|
// Fill the look up table
|
||||||
|
neodevices[uint64_t(neoDevice.handle) << 32 | icsneo_serialStringToNum(neoDevice.serial)] = neoDevice;
|
||||||
|
// Create the NeoDeviceEx
|
||||||
|
devs[i] = _createNeoDeviceExFrom(&neoDevice);
|
||||||
|
NeoDeviceEx* nde = &devs[i];
|
||||||
|
++i;
|
||||||
|
// Lookup the open NeoDeviceEx devices and match the NumberOfClients value if available.
|
||||||
|
for (auto& [neo_device, open_nde]: openneodevices) {
|
||||||
|
// SerialNumber should always be unique so lets compare against that.
|
||||||
|
if (nde->neoDevice.SerialNumber == open_nde->neoDevice.SerialNumber) {
|
||||||
|
nde->neoDevice.NumberOfClients = open_nde->neoDevice.NumberOfClients;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*devCount = (int)neoDevices.size();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LegacyDLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC)
|
|
||||||
{
|
|
||||||
if (pNeoDevice == nullptr || hObject == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
neodevice_t *device;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
device = &neodevices.at(uint64_t(pNeoDevice->Handle) << 32 | pNeoDevice->SerialNumber);
|
|
||||||
}
|
|
||||||
catch (const std::out_of_range&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*hObject = device;
|
|
||||||
if (!icsneo_openDevice(device))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (icsneo_isOnlineSupported(device)) {
|
|
||||||
if (!icsneo_setPollingMessageLimit(device, 20000))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!icsneo_enableMessagePolling(device))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!icsneo_goOnline(device))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport icsneoOpenDevice(
|
int LegacyDLLExport icsneoOpenDevice(
|
||||||
NeoDeviceEx* pNeoDeviceEx,
|
NeoDeviceEx* pNeoDeviceEx,
|
||||||
void** hObject,
|
void** hObject,
|
||||||
|
|
@ -454,20 +403,34 @@ int LegacyDLLExport icsneoOpenDevice(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*hObject = device;
|
if (pNeoDeviceEx->neoDevice.NumberOfClients >= pNeoDeviceEx->neoDevice.MaxAllowedClients) {
|
||||||
if(!icsneo_openDevice(device))
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*hObject = device;
|
||||||
|
if(!icsneo_openDevice(device)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (icsneo_isOnlineSupported(device)) {
|
if (icsneo_isOnlineSupported(device)) {
|
||||||
if (!icsneo_setPollingMessageLimit(device, 20000))
|
if (!icsneo_setPollingMessageLimit(device, 20000)) {
|
||||||
|
icsneo_closeDevice(device);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!icsneo_enableMessagePolling(device))
|
if (!icsneo_enableMessagePolling(device)) {
|
||||||
|
icsneo_closeDevice(device);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!icsneo_goOnline(device))
|
if (!icsneo_goOnline(device)) {
|
||||||
|
icsneo_closeDevice(device);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pNeoDeviceEx->neoDevice.NumberOfClients = 1;
|
||||||
|
// Add the open NeoDevice to the container so we can decrement NumberOfClients on close
|
||||||
|
openneodevices[device] = pNeoDeviceEx;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -476,8 +439,14 @@ int LegacyDLLExport icsneoClosePort(void* hObject, int* pNumberOfErrors)
|
||||||
{
|
{
|
||||||
if (!icsneoValidateHObject(hObject))
|
if (!icsneoValidateHObject(hObject))
|
||||||
return false;
|
return false;
|
||||||
|
if (pNumberOfErrors) {
|
||||||
|
*pNumberOfErrors = 0;
|
||||||
|
}
|
||||||
neodevice_t* device = reinterpret_cast<neodevice_t*>(hObject);
|
neodevice_t* device = reinterpret_cast<neodevice_t*>(hObject);
|
||||||
|
if (openneodevices.find(device) != openneodevices.end()) {
|
||||||
|
openneodevices[device]->neoDevice.NumberOfClients -= 1;
|
||||||
|
openneodevices.erase(device);
|
||||||
|
}
|
||||||
return icsneo_closeDevice(device);
|
return icsneo_closeDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1013,20 +982,7 @@ int LegacyDLLExport icsneoScriptWriteAppSignal(void* hObject, unsigned int iInde
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deprecated (but still suppored in the DLL)
|
|
||||||
int LegacyDLLExport icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB,
|
|
||||||
int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject)
|
|
||||||
{
|
|
||||||
// TODO Implement
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char *bNetworkID,
|
|
||||||
unsigned char* bSCPIDs, int* hObject)
|
|
||||||
{
|
|
||||||
// TODO Implement
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport icsneoEnableNetworkCom(void* hObject, int Enable)
|
int LegacyDLLExport icsneoEnableNetworkCom(void* hObject, int Enable)
|
||||||
{
|
{
|
||||||
|
|
@ -1040,19 +996,6 @@ int LegacyDLLExport icsneoEnableNetworkCom(void* hObject, int Enable)
|
||||||
return icsneo_goOffline(device);
|
return icsneo_goOffline(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LegacyDLLExport icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly,
|
|
||||||
int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int* lNumDevices)
|
|
||||||
{
|
|
||||||
// TODO Implement
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport icsneoOpenNeoDeviceByChannels(NeoDevice* pNeoDevice, void** hObject, unsigned char* uChannels, int iSize,
|
|
||||||
int bConfigRead, int iOptions)
|
|
||||||
{
|
|
||||||
// TODO Implement
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LegacyDLLExport icsneoGetVCAN4Settings(void* hObject, SVCAN4Settings* pSettings, int iNumBytes)
|
int LegacyDLLExport icsneoGetVCAN4Settings(void* hObject, SVCAN4Settings* pSettings, int iNumBytes)
|
||||||
{
|
{
|
||||||
|
|
@ -1137,6 +1080,12 @@ int LegacyDLLExport icsneoGetDeviceSettingsType(void* hObject, EPlasmaIonVnetCha
|
||||||
case NEODEVICE_RED2:
|
case NEODEVICE_RED2:
|
||||||
*pDeviceSettingsType = DeviceRed2SettingsType;
|
*pDeviceSettingsType = DeviceRed2SettingsType;
|
||||||
break;
|
break;
|
||||||
|
case NEODEVICE_FIRE3:
|
||||||
|
*pDeviceSettingsType = DeviceFire3SettingsType;
|
||||||
|
break;
|
||||||
|
case NEODEVICE_FIRE3_FLEXRAY:
|
||||||
|
*pDeviceSettingsType = DeviceFire3FlexraySettingsType;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -356,6 +356,10 @@ bool Device::close() {
|
||||||
|
|
||||||
stopHeartbeatThread = true;
|
stopHeartbeatThread = true;
|
||||||
|
|
||||||
|
if (isMessagePollingEnabled()) {
|
||||||
|
disableMessagePolling();
|
||||||
|
}
|
||||||
|
|
||||||
if(isOnline())
|
if(isOnline())
|
||||||
goOffline();
|
goOffline();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,18 +37,17 @@ int main() {
|
||||||
printf("ICS icsneolegacy.dll version %u\n\n", ver);
|
printf("ICS icsneolegacy.dll version %u\n\n", ver);
|
||||||
// Find and attempt to open device
|
// Find and attempt to open device
|
||||||
//legacy open device
|
//legacy open device
|
||||||
int numDevices = 10;
|
int numDevices = 255;
|
||||||
NeoDevice devices[10];
|
NeoDeviceEx devices[255] = {0};
|
||||||
void* hObject; // holds a handle to the neoVI object
|
void* hObject = NULL; // holds a handle to the neoVI object
|
||||||
int iRetVal = 0;
|
int iRetVal = 0;
|
||||||
int deviceTypes = 0;
|
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
SDeviceSettings pSettings;
|
SDeviceSettings pSettings = {0};
|
||||||
|
|
||||||
iRetVal = icsneoFindNeoDevices(deviceTypes, devices, &numDevices);
|
iRetVal = icsneoFindDevices(devices, &numDevices, NULL, 0, NULL, 0);
|
||||||
if(iRetVal) {
|
if(iRetVal && numDevices > 0) {
|
||||||
// Attempt to open the selected device, enable message polling, and go online
|
// Attempt to open the selected device, enable message polling, and go online
|
||||||
iRetVal = icsneoOpenNeoDevice(&devices[0], &hObject, NULL, 1, 0);
|
iRetVal = icsneoOpenDevice(&devices[0], &hObject, NULL, 1, 0, NULL, 0);
|
||||||
if(iRetVal) {
|
if(iRetVal) {
|
||||||
puts("Device found and opened!\n");
|
puts("Device found and opened!\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,16 @@ int main() {
|
||||||
printf("ICS icsneolegacy.dll version %u\n\n", ver);
|
printf("ICS icsneolegacy.dll version %u\n\n", ver);
|
||||||
// Find and attempt to open device
|
// Find and attempt to open device
|
||||||
//legacy open device
|
//legacy open device
|
||||||
int numDevices = 10;
|
int numDevices = 255;
|
||||||
NeoDevice devices[10];
|
NeoDeviceEx devices[255] = {0};
|
||||||
void* hObject; // holds a handle to the neoVI object
|
void* hObject = NULL; // holds a handle to the neoVI object
|
||||||
int iRetVal = 0;
|
int iRetVal = 0;
|
||||||
int deviceTypes = 0;
|
|
||||||
int iResult = 0;
|
int iResult = 0;
|
||||||
|
|
||||||
iRetVal = icsneoFindNeoDevices(deviceTypes, devices, &numDevices);
|
iRetVal = icsneoFindDevices(devices, &numDevices, NULL, 0, NULL, 0);
|
||||||
if(iRetVal) {
|
if(iRetVal && numDevices < 0) {
|
||||||
// Attempt to open the selected device, enable message polling, and go online
|
// Attempt to open the selected device, enable message polling, and go online
|
||||||
iRetVal = icsneoOpenNeoDevice(&devices[0], &hObject, NULL, 1, 0);
|
iRetVal = icsneoOpenDevice(&devices[0], &hObject, NULL, 1, 0, NULL, 0);
|
||||||
if(iRetVal) {
|
if(iRetVal) {
|
||||||
printf("Device found and opened!\n");
|
printf("Device found and opened!\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,10 @@ extern "C" {
|
||||||
|
|
||||||
//Basic Functions
|
//Basic Functions
|
||||||
extern int LegacyDLLExport icsneoFindDevices(NeoDeviceEx* pNeoDeviceEx, int* pNumDevices, unsigned int* DeviceTypes, unsigned int numDeviceTypes,POptionsFindNeoEx* pOptionsNeoEx, unsigned int* reserved);
|
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);
|
// icsneoFindNeoDevices was marked as obsolete in icsneo40 in 2016, Please move to icsneoFindDevices
|
||||||
extern int LegacyDLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, unsigned char* bNetworkIDs, int bConfigRead, int bSyncToPC);
|
// extern int LegacyDLLExport icsneoFindNeoDevices(unsigned long DeviceTypes, NeoDevice* pNeoDevice, int* pNumDevices);
|
||||||
|
// icsneoOpenNeoDevice was marked as obsolete in icsneo40 in 2016, Please move to icsneoOpenNeoDevice
|
||||||
|
// 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 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 int LegacyDLLExport icsneoClosePort(void* hObject, int* pNumberOfErrors);
|
||||||
extern void LegacyDLLExport icsneoFreeObject(void* hObject);
|
extern void LegacyDLLExport icsneoFreeObject(void* hObject);
|
||||||
|
|
@ -133,13 +135,17 @@ extern int LegacyDLLExport icsneoScriptReadAppSignal(void* hObject, unsigned int
|
||||||
extern int LegacyDLLExport icsneoScriptWriteAppSignal(void* hObject, unsigned int iIndex, double dValue);
|
extern int LegacyDLLExport icsneoScriptWriteAppSignal(void* hObject, unsigned int iIndex, double dValue);
|
||||||
|
|
||||||
//Deprecated (but still supported in the DLL)
|
//Deprecated (but still supported in the DLL)
|
||||||
extern int LegacyDLLExport icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject);
|
// icsneoOpenPortEx was marked as obsolete in icsneo40 in 2016, Please move to icsneoOpenNeoDevice
|
||||||
extern int LegacyDLLExport icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char* bNetworkID, unsigned char* bSCPIDs, int* hObject);
|
// extern int LegacyDLLExport icsneoOpenPortEx(void* lPortNumber, int lPortType, int lDriverType, int lIPAddressMSB, int lIPAddressLSBOrBaudRate, int bConfigRead, unsigned char* bNetworkID, int* hObject);
|
||||||
extern int LegacyDLLExport icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int*lNumDevices);
|
// icsneoOpenPort was marked as obsolete in icsneo40 in 2016, Please move to icsneoOpenNeoDevice
|
||||||
extern int LegacyDLLExport icsneoOpenNeoDeviceByChannels(NeoDevice* pNeoDevice,void** hObject,unsigned char* uChannels,int iSize,int bConfigRead,int iOptions);
|
// extern int LegacyDLLExport icsneoOpenPort(int lPortNumber, int lPortType, int lDriverType, unsigned char* bNetworkID, unsigned char* bSCPIDs, int* hObject);
|
||||||
extern int LegacyDLLExport icsneoLockChannels(void* hObject, unsigned char* uChannels, int iSize);
|
// icsneoFindAllCOMDevices was marked as obsolete in icsneo40 in 2016, Please move to icsneoOpenNeoDevice
|
||||||
extern int LegacyDLLExport icsneoUnlockChannels(void* hObject, unsigned char* uChannels, int iSize);
|
// extern int LegacyDLLExport icsneoFindAllCOMDevices(int lDriverType, int lGetSerialNumbers, int lStopAtFirst, int lUSBCommOnly, int* p_lDeviceTypes, int* p_lComPorts, int* p_lSerialNumbers, int*lNumDevices);
|
||||||
extern int LegacyDLLExport icsneoGetChannelLockStatus(void* hObject, unsigned char* uChannels, int iSize);
|
// icsneoOpenNeoDeviceByChannels was marked as obsolete in icsneo40 in 2016, Please move to icsneoOpenNeoDevice
|
||||||
|
// extern int LegacyDLLExport icsneoOpenNeoDeviceByChannels(NeoDevice* pNeoDevice,void** hObject,unsigned char* uChannels,int iSize,int bConfigRead,int iOptions);
|
||||||
|
// extern int LegacyDLLExport icsneoLockChannels(void* hObject, unsigned char* uChannels, int iSize);
|
||||||
|
// extern int LegacyDLLExport icsneoUnlockChannels(void* hObject, unsigned char* uChannels, int iSize);
|
||||||
|
// extern int LegacyDLLExport icsneoGetChannelLockStatus(void* hObject, unsigned char* uChannels, int iSize);
|
||||||
|
|
||||||
//Enable Network Com Functions
|
//Enable Network Com Functions
|
||||||
extern int LegacyDLLExport icsneoEnableNetworkComEx(void* hObject, int iEnable, int iNetId);
|
extern int LegacyDLLExport icsneoEnableNetworkComEx(void* hObject, int iEnable, int iNetId);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
LIBRARY icsneolegacy
|
LIBRARY icsneolegacy
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
icsneoOpenPort @21
|
; icsneoOpenPort @21
|
||||||
icsneoClosePort @22
|
icsneoClosePort @22
|
||||||
icsneoGetMessages @23
|
icsneoGetMessages @23
|
||||||
icsneoTxMessages @24
|
icsneoTxMessages @24
|
||||||
|
|
@ -12,12 +12,12 @@ EXPORTS
|
||||||
icsneoSendConfiguration @30
|
icsneoSendConfiguration @30
|
||||||
icsneoGetSerialNumber @32
|
icsneoGetSerialNumber @32
|
||||||
; icsneoFindAllUSBDevices @33
|
; icsneoFindAllUSBDevices @33
|
||||||
icsneoOpenPortEx @34
|
; icsneoOpenPortEx @34
|
||||||
icsneoStopSockServer @35
|
icsneoStopSockServer @35
|
||||||
icsneoGetErrorInfo @36
|
icsneoGetErrorInfo @36
|
||||||
icsneoGetDLLVersion @37
|
icsneoGetDLLVersion @37
|
||||||
icsneoGetConfiguration @38
|
icsneoGetConfiguration @38
|
||||||
icsneoFindAllCOMDevices @39
|
; icsneoFindAllCOMDevices @39
|
||||||
icsneoGetISO15765Status @40
|
icsneoGetISO15765Status @40
|
||||||
icsneoSetISO15765RxParameters @41
|
icsneoSetISO15765RxParameters @41
|
||||||
; icsneoSetPerformanceParameters @42
|
; icsneoSetPerformanceParameters @42
|
||||||
|
|
@ -39,8 +39,8 @@ EXPORTS
|
||||||
icsneoScriptStart @ 57
|
icsneoScriptStart @ 57
|
||||||
icsneoScriptStop @ 58
|
icsneoScriptStop @ 58
|
||||||
|
|
||||||
icsneoFindNeoDevices @ 62
|
; icsneoFindNeoDevices @ 62
|
||||||
icsneoOpenNeoDevice @ 63
|
; icsneoOpenNeoDevice @ 63
|
||||||
; icsneoOpenNeoDeviceBySerialNumber @ 64
|
; icsneoOpenNeoDeviceBySerialNumber @ 64
|
||||||
|
|
||||||
icsneoForceFirmwareUpdate @ 65
|
icsneoForceFirmwareUpdate @ 65
|
||||||
|
|
@ -132,7 +132,7 @@ EXPORTS
|
||||||
; icsneoGetAllChipVersions @149
|
; icsneoGetAllChipVersions @149
|
||||||
icsneoSetBitRateEx @ 150
|
icsneoSetBitRateEx @ 150
|
||||||
; icsneoScriptGetScriptStatusEx @ 151
|
; icsneoScriptGetScriptStatusEx @ 151
|
||||||
icsneoOpenNeoDeviceByChannels @ 152
|
; icsneoOpenNeoDeviceByChannels @ 152
|
||||||
; icsneoGetChannelLockStatus @ 153
|
; icsneoGetChannelLockStatus @ 153
|
||||||
; icsneoRequestEnterSleepMode @ 154
|
; icsneoRequestEnterSleepMode @ 154
|
||||||
icsneoEnableNetworkComEx @ 155
|
icsneoEnableNetworkComEx @ 155
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue