Device: Add isOnlineSupported()

This commit is contained in:
Kyle Schwarz
2024-02-13 21:24:51 +00:00
committed by Kyle Johannes
parent 3264a1ecbe
commit 4782e26bed
8 changed files with 59 additions and 11 deletions
+8 -1
View File
@@ -740,4 +740,11 @@ int icsneo_getDeviceStatus(const neodevice_t* device, void* status, size_t* size
*size = rawMessage->data.size();
return true;
}
}
bool icsneo_isOnlineSupported(const neodevice_t* device) {
if(!icsneo_isValidNeoDevice(device))
return false;
return device->device->isOnlineSupported();
}
+25 -3
View File
@@ -417,8 +417,19 @@ int LegacyDLLExport icsneoOpenNeoDevice(NeoDevice* pNeoDevice, void** hObject, u
*hObject = device;
if (!icsneo_openDevice(device))
return false;
return icsneo_setPollingMessageLimit(device, 20000) && icsneo_enableMessagePolling(device) && icsneo_goOnline(device);
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(
@@ -447,7 +458,18 @@ int LegacyDLLExport icsneoOpenDevice(
if(!icsneo_openDevice(device))
return false;
return icsneo_setPollingMessageLimit(device, 20000) && icsneo_enableMessagePolling(device) && icsneo_goOnline(device);
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 icsneoClosePort(void* hObject, int* pNumberOfErrors)