Device: Refactor supportsNetworkMutex
parent
9abd9389f4
commit
a68b64c641
|
|
@ -560,7 +560,7 @@ bool Device::goOnline() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(supportsNetworkMutex()) {
|
if(supportsNetworkMutex) {
|
||||||
assignedClientId = com->getClientIDSync();
|
assignedClientId = com->getClientIDSync();
|
||||||
if(assignedClientId) {
|
if(assignedClientId) {
|
||||||
std::set<Network::NetID> nets;
|
std::set<Network::NetID> nets;
|
||||||
|
|
@ -3927,7 +3927,7 @@ std::shared_ptr<DiskDetails> Device::getDiskDetails(std::chrono::milliseconds ti
|
||||||
|
|
||||||
[[nodiscard]] std::optional<int> Device::lockNetworks(const std::set<Network::NetID>& networks, uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function<void(std::shared_ptr<Message>)>&& on_event)
|
[[nodiscard]] std::optional<int> Device::lockNetworks(const std::set<Network::NetID>& networks, uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function<void(std::shared_ptr<Message>)>&& on_event)
|
||||||
{
|
{
|
||||||
if(!supportsNetworkMutex()) {
|
if(!supportsNetworkMutex) {
|
||||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
@ -3977,7 +3977,7 @@ std::shared_ptr<DiskDetails> Device::getDiskDetails(std::chrono::milliseconds ti
|
||||||
|
|
||||||
bool Device::unlockNetworks(const std::set<Network::NetID>& networks)
|
bool Device::unlockNetworks(const std::set<Network::NetID>& networks)
|
||||||
{
|
{
|
||||||
if(!supportsNetworkMutex()) {
|
if(!supportsNetworkMutex) {
|
||||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -4017,7 +4017,7 @@ bool Device::unlockNetworks(const std::set<Network::NetID>& networks)
|
||||||
|
|
||||||
std::shared_ptr<NetworkMutexMessage> Device::getNetworkMutexStatus(Network::NetID network)
|
std::shared_ptr<NetworkMutexMessage> Device::getNetworkMutexStatus(Network::NetID network)
|
||||||
{
|
{
|
||||||
if(!supportsNetworkMutex()) {
|
if(!supportsNetworkMutex) {
|
||||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -4039,7 +4039,7 @@ std::shared_ptr<NetworkMutexMessage> Device::getNetworkMutexStatus(Network::NetI
|
||||||
|
|
||||||
[[nodiscard]] std::optional<int> Device::lockAllNetworks(uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function<void(std::shared_ptr<Message>)>&& on_event)
|
[[nodiscard]] std::optional<int> Device::lockAllNetworks(uint32_t priority, uint32_t ttlMs, NetworkMutexType type, std::function<void(std::shared_ptr<Message>)>&& on_event)
|
||||||
{
|
{
|
||||||
if(!supportsNetworkMutex()) {
|
if(!supportsNetworkMutex) {
|
||||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
@ -4086,7 +4086,7 @@ std::shared_ptr<NetworkMutexMessage> Device::getNetworkMutexStatus(Network::NetI
|
||||||
|
|
||||||
bool Device::unlockAllNetworks()
|
bool Device::unlockAllNetworks()
|
||||||
{
|
{
|
||||||
if(!supportsNetworkMutex()) {
|
if(!supportsNetworkMutex) {
|
||||||
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
report(APIEvent::Type::NotSupported, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -879,8 +879,6 @@ public:
|
||||||
bool unlockAllNetworks();
|
bool unlockAllNetworks();
|
||||||
std::shared_ptr<NetworkMutexMessage> getNetworkMutexStatus(Network::NetID network);
|
std::shared_ptr<NetworkMutexMessage> getNetworkMutexStatus(Network::NetID network);
|
||||||
|
|
||||||
virtual bool supportsNetworkMutex() const { return false; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool online = false;
|
bool online = false;
|
||||||
int messagePollingCallbackID = 0;
|
int messagePollingCallbackID = 0;
|
||||||
|
|
@ -998,6 +996,8 @@ protected:
|
||||||
|
|
||||||
std::optional<HardwareInfo::Version> bootloaderVersion = std::nullopt;
|
std::optional<HardwareInfo::Version> bootloaderVersion = std::nullopt;
|
||||||
|
|
||||||
|
bool supportsNetworkMutex = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
neodevice_t data;
|
neodevice_t data;
|
||||||
std::shared_ptr<ResetStatusMessage> latestResetStatus;
|
std::shared_ptr<ResetStatusMessage> latestResetStatus;
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ public:
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
|
supportsNetworkMutex = true;
|
||||||
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,8 +124,6 @@ protected:
|
||||||
size_t getDiskCount() const override {
|
size_t getDiskCount() const override {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsNetworkMutex() const override { return true; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ public:
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
|
supportsNetworkMutex = true;
|
||||||
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,8 +151,6 @@ protected:
|
||||||
size_t getDiskCount() const override {
|
size_t getDiskCount() const override {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsNetworkMutex() const override { return true; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ public:
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
NeoVIFIRE3T1SLIN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3T1SLIN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
|
supportsNetworkMutex = true;
|
||||||
initialize<NeoVIFIRE3T1SLINSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3T1SLINSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,10 +133,6 @@ protected:
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsNetworkMutex() const override {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ public:
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
|
supportsNetworkMutex = true;
|
||||||
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,8 +105,6 @@ protected:
|
||||||
size_t getDiskCount() const override {
|
size_t getDiskCount() const override {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsNetworkMutex() const override { return true; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue