Device: Add isOnlineSupported()
parent
3264a1ecbe
commit
4782e26bed
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -685,6 +685,8 @@ public:
|
|||
uint64_t pos, uint8_t* into, uint64_t amount, std::optional<VSAMetadata> metadata = std::nullopt
|
||||
);
|
||||
|
||||
virtual bool isOnlineSupported() const { return true; }
|
||||
|
||||
protected:
|
||||
bool online = false;
|
||||
int messagePollingCallbackID = 0;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public:
|
|||
|
||||
virtual uint8_t getPhyAddrOrPort() const = 0;
|
||||
|
||||
bool isOnlineSupported() const override { return false; }
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
bool isOnlineSupported() const override { return false; }
|
||||
|
||||
protected:
|
||||
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon3Settings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool isOnlineSupported() const override { return false; }
|
||||
|
||||
protected:
|
||||
VividCAN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<VividCANSettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -817,25 +817,33 @@ extern bool DLLExport icsneo_setTerminationFor(const neodevice_t* device, neonet
|
|||
*
|
||||
* This function populates the device status structures and sub members.
|
||||
*/
|
||||
extern int icsneo_getDeviceStatus(const neodevice_t* device, void* status, size_t* size);
|
||||
extern int DLLExport icsneo_getDeviceStatus(const neodevice_t* device, void* status, size_t* size);
|
||||
|
||||
/**
|
||||
* \brief Get the real-time clock for the given device.
|
||||
* \param[out] device A pointer to the neodevice_t structure specifying the device to read the RTC from.
|
||||
* \param[in] device A pointer to the neodevice_t structure specifying the device to read the RTC from.
|
||||
* \param[out] output A pointer to a uint64_t where the RTC will be stored. This value is in seconds.
|
||||
|
||||
* \returns True if the RTC was successfully retrieved.
|
||||
*/
|
||||
extern bool icsneo_getRTC(const neodevice_t* device, uint64_t* output);
|
||||
extern bool DLLExport icsneo_getRTC(const neodevice_t* device, uint64_t* output);
|
||||
|
||||
/**
|
||||
* \brief Set the real-time clock for the given device.
|
||||
* \param[out] device A pointer to the neodevice_t structure specifying the device to write the RTC to.
|
||||
* \param[in] device A pointer to the neodevice_t structure specifying the device to write the RTC to.
|
||||
* \param[in] input A uint64_t object holding the RTC value. This value is in seconds.
|
||||
|
||||
* \returns True if the RTC was successfully set.
|
||||
*/
|
||||
extern bool icsneo_setRTC(const neodevice_t* device, uint64_t input);
|
||||
extern bool DLLExport icsneo_setRTC(const neodevice_t* device, uint64_t input);
|
||||
|
||||
/**
|
||||
* \brief Check if the device supports the ability to go online
|
||||
* \param[in] device A pointer to the neodevice_t structure specifying the device to operate on.
|
||||
|
||||
* \returns True if the device supports the ability to go online
|
||||
*/
|
||||
extern bool DLLExport icsneo_isOnlineSupported(const neodevice_t* device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
@ -1017,6 +1025,9 @@ fn_icsneo_getRTC icsneo_getRTC;
|
|||
typedef bool (*fn_icsneo_setRTC)(const neodevice_t* device, uint64_t input);
|
||||
fn_icsneo_setRTC icsneo_setRTC;
|
||||
|
||||
typedef bool(*fn_icsneo_isOnlineSupported)(const neodevice_t* device);
|
||||
fn_icsneo_isOnlineSupported icsneo_isOnlineSupported;
|
||||
|
||||
#define ICSNEO_IMPORT(func) func = (fn_##func)icsneo_dynamicLibraryGetFunction(icsneo_libraryHandle, #func)
|
||||
#define ICSNEO_IMPORTASSERT(func) if((ICSNEO_IMPORT(func)) == NULL) return 3
|
||||
void* icsneo_libraryHandle = NULL;
|
||||
|
|
@ -1089,6 +1100,7 @@ int icsneo_init() {
|
|||
ICSNEO_IMPORTASSERT(icsneo_getDeviceStatus);
|
||||
ICSNEO_IMPORTASSERT(icsneo_getRTC);
|
||||
ICSNEO_IMPORTASSERT(icsneo_setRTC);
|
||||
ICSNEO_IMPORTASSERT(icsneo_isOnlineSupported);
|
||||
|
||||
icsneo_initialized = true;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,9 @@ 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 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);
|
||||
|
||||
//Message Functions
|
||||
extern int LegacyDLLExport icsneoGetMessages(void* hObject, icsSpyMessage* pMsg, int* pNumberOfMessages, int* pNumberOfErrors);
|
||||
|
|
|
|||
Loading…
Reference in New Issue