diff --git a/device/device.cpp b/device/device.cpp index f133b6c..9edc1f3 100644 --- a/device/device.cpp +++ b/device/device.cpp @@ -560,7 +560,7 @@ bool Device::goOnline() { return false; } - if(supportsNetworkMutex()) { + if(supportsNetworkMutex) { assignedClientId = com->getClientIDSync(); if(assignedClientId) { std::set nets; @@ -3927,7 +3927,7 @@ std::shared_ptr Device::getDiskDetails(std::chrono::milliseconds ti [[nodiscard]] std::optional Device::lockNetworks(const std::set& networks, uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function)>&& on_event) { - if(!supportsNetworkMutex()) { + if(!supportsNetworkMutex) { report(APIEvent::Type::NotSupported, APIEvent::Severity::Error); return std::nullopt; } @@ -3977,7 +3977,7 @@ std::shared_ptr Device::getDiskDetails(std::chrono::milliseconds ti bool Device::unlockNetworks(const std::set& networks) { - if(!supportsNetworkMutex()) { + if(!supportsNetworkMutex) { report(APIEvent::Type::NotSupported, APIEvent::Severity::Error); return false; } @@ -4017,7 +4017,7 @@ bool Device::unlockNetworks(const std::set& networks) std::shared_ptr Device::getNetworkMutexStatus(Network::NetID network) { - if(!supportsNetworkMutex()) { + if(!supportsNetworkMutex) { report(APIEvent::Type::NotSupported, APIEvent::Severity::Error); return nullptr; } @@ -4039,7 +4039,7 @@ std::shared_ptr Device::getNetworkMutexStatus(Network::NetI [[nodiscard]] std::optional Device::lockAllNetworks(uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function)>&& on_event) { - if(!supportsNetworkMutex()) { + if(!supportsNetworkMutex) { report(APIEvent::Type::NotSupported, APIEvent::Severity::Error); return std::nullopt; } @@ -4086,7 +4086,7 @@ std::shared_ptr Device::getNetworkMutexStatus(Network::NetI bool Device::unlockAllNetworks() { - if(!supportsNetworkMutex()) { + if(!supportsNetworkMutex) { report(APIEvent::Type::NotSupported, APIEvent::Severity::Error); return false; } diff --git a/include/icsneo/device/device.h b/include/icsneo/device/device.h index eea797f..02ebdc2 100644 --- a/include/icsneo/device/device.h +++ b/include/icsneo/device/device.h @@ -878,8 +878,6 @@ public: bool unlockNetworks(const std::set& networks); bool unlockAllNetworks(); std::shared_ptr getNetworkMutexStatus(Network::NetID network); - - virtual bool supportsNetworkMutex() const { return false; } protected: bool online = false; @@ -998,6 +996,8 @@ protected: std::optional bootloaderVersion = std::nullopt; + bool supportsNetworkMutex = false; + private: neodevice_t data; std::shared_ptr latestResetStatus; diff --git a/include/icsneo/device/tree/neovifire3/neovifire3.h b/include/icsneo/device/tree/neovifire3/neovifire3.h index cefb6d8..da48786 100644 --- a/include/icsneo/device/tree/neovifire3/neovifire3.h +++ b/include/icsneo/device/tree/neovifire3/neovifire3.h @@ -81,6 +81,7 @@ public: } protected: NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + supportsNetworkMutex = true; initialize(makeDriver); } @@ -123,8 +124,6 @@ protected: size_t getDiskCount() const override { return 2; } - - bool supportsNetworkMutex() const override { return true; } }; } diff --git a/include/icsneo/device/tree/neovifire3flexray/neovifire3flexray.h b/include/icsneo/device/tree/neovifire3flexray/neovifire3flexray.h index 79028f9..ef830ee 100644 --- a/include/icsneo/device/tree/neovifire3flexray/neovifire3flexray.h +++ b/include/icsneo/device/tree/neovifire3flexray/neovifire3flexray.h @@ -86,6 +86,7 @@ public: } protected: NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + supportsNetworkMutex = true; initialize(makeDriver); } @@ -150,8 +151,6 @@ protected: size_t getDiskCount() const override { return 2; } - - bool supportsNetworkMutex() const override { return true; } }; } diff --git a/include/icsneo/device/tree/neovifire3t1slin/neovifire3t1slin.h b/include/icsneo/device/tree/neovifire3t1slin/neovifire3t1slin.h index 671cea4..7ee5c7d 100644 --- a/include/icsneo/device/tree/neovifire3t1slin/neovifire3t1slin.h +++ b/include/icsneo/device/tree/neovifire3t1slin/neovifire3t1slin.h @@ -89,6 +89,7 @@ public: } protected: NeoVIFIRE3T1SLIN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + supportsNetworkMutex = true; initialize(makeDriver); } @@ -132,10 +133,6 @@ protected: return 2; } - bool supportsNetworkMutex() const override { - return true; - } - }; } diff --git a/include/icsneo/device/tree/neovired2/neovired2.h b/include/icsneo/device/tree/neovired2/neovired2.h index bc0a9be..bbd5972 100644 --- a/include/icsneo/device/tree/neovired2/neovired2.h +++ b/include/icsneo/device/tree/neovired2/neovired2.h @@ -64,6 +64,7 @@ public: } protected: NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + supportsNetworkMutex = true; initialize(makeDriver); } @@ -104,8 +105,6 @@ protected: size_t getDiskCount() const override { return 2; } - - bool supportsNetworkMutex() const override { return true; } }; }