mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-08 02:48:36 +02:00
Device: Refactor heartbeat
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#ifndef __HEARTBEAT_H__
|
||||
#define __HEARTBEAT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Device;
|
||||
|
||||
class Heartbeat {
|
||||
public:
|
||||
Heartbeat(Device& device);
|
||||
~Heartbeat();
|
||||
|
||||
private:
|
||||
enum class Mode {
|
||||
Passive, // ResetStatus messages arrive without requesting
|
||||
Active, // RequestStatusUpdate needs to be sent
|
||||
};
|
||||
Device& device;
|
||||
const Mode mode;
|
||||
bool stop = false;
|
||||
std::mutex mutex;
|
||||
std::condition_variable cv;
|
||||
std::thread thread;
|
||||
|
||||
void run();
|
||||
};
|
||||
|
||||
} // icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __HEARTBEAT_H__
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "icsneo/communication/message/extendedresponsemessage.h"
|
||||
#include "icsneo/device/deviceversion.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/api/heartbeat.h"
|
||||
#include "icsneo/communication/packetizer.h"
|
||||
#include "icsneo/communication/encoder.h"
|
||||
#include "icsneo/communication/decoder.h"
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
virtual driver_finder_t getFinder() = 0;
|
||||
|
||||
inline bool isDisconnected() const { return disconnected; };
|
||||
inline void setIsDisconnected(bool isDisconnected) { disconnected = isDisconnected; }
|
||||
inline bool isClosing() const { return closing; }
|
||||
|
||||
bool waitForRx(size_t limit, std::chrono::milliseconds timeout);
|
||||
@@ -62,7 +63,6 @@ protected:
|
||||
};
|
||||
|
||||
inline void setIsClosing(bool isClosing) { closing = isClosing; }
|
||||
inline void setIsDisconnected(bool isDisconnected) { disconnected = isDisconnected; }
|
||||
|
||||
// Overridable in case the driver doesn't want to use writeTask and writeQueue
|
||||
virtual bool writeQueueFull() { return writeQueue.size_approx() > writeQueueSize; }
|
||||
|
||||
@@ -743,6 +743,7 @@ public:
|
||||
*/
|
||||
std::optional<bool> SetRootDirectoryEntryFlags(uint8_t mask, uint8_t values, uint32_t collectionEntryByteAddress);
|
||||
|
||||
device_eventhandler_t report;
|
||||
std::shared_ptr<Communication> com;
|
||||
std::shared_ptr<IDeviceSettings> settings;
|
||||
|
||||
@@ -900,11 +901,14 @@ public:
|
||||
bool unlockAllNetworks();
|
||||
std::shared_ptr<NetworkMutexMessage> getNetworkMutexStatus(Network::NetID network);
|
||||
|
||||
void startHeartbeat();
|
||||
void stopHeartbeat();
|
||||
void restartHeartbeat();
|
||||
|
||||
protected:
|
||||
bool online = false;
|
||||
int messagePollingCallbackID = 0;
|
||||
int internalHandlerCallbackID = 0;
|
||||
device_eventhandler_t report;
|
||||
|
||||
std::mutex ioMutex;
|
||||
std::optional<bool> ethActivationStatus;
|
||||
@@ -937,7 +941,7 @@ protected:
|
||||
std::move(decoder)
|
||||
);
|
||||
setupCommunication(*com);
|
||||
settings = makeSettings<Settings>(com);
|
||||
settings = makeSettings<Settings>(this);
|
||||
setupSettings(*settings);
|
||||
diskReadDriver = std::unique_ptr<DiskRead>(new DiskRead());
|
||||
diskWriteDriver = std::unique_ptr<DiskWrite>(new DiskWrite());
|
||||
@@ -973,8 +977,8 @@ protected:
|
||||
}
|
||||
|
||||
template<typename Settings>
|
||||
std::shared_ptr<IDeviceSettings> makeSettings(std::shared_ptr<Communication> comm) {
|
||||
return std::make_shared<Settings>(comm);
|
||||
std::shared_ptr<IDeviceSettings> makeSettings(Device* device) {
|
||||
return std::make_shared<Settings>(device);
|
||||
}
|
||||
virtual void setupSettings(IDeviceSettings&) {}
|
||||
|
||||
@@ -1039,10 +1043,6 @@ private:
|
||||
|
||||
APIEvent::Type attemptToBeginCommunication();
|
||||
|
||||
// Use heartbeatSuppressed instead when reading
|
||||
std::atomic<int> heartbeatSuppressedByUser{0};
|
||||
bool heartbeatSuppressed() const { return heartbeatSuppressedByUser > 0 || (settings && settings->applyingSettings); }
|
||||
|
||||
void handleNeoVIMessage(std::shared_ptr<CANMessage> message);
|
||||
|
||||
bool firmwareUpdateSupported();
|
||||
@@ -1053,10 +1053,6 @@ private:
|
||||
moodycamel::BlockingConcurrentQueue<std::shared_ptr<Message>> pollingContainer;
|
||||
void enforcePollingMessageLimit();
|
||||
|
||||
std::atomic<bool> stopHeartbeatThread{false};
|
||||
std::mutex heartbeatMutex;
|
||||
std::thread heartbeatThread;
|
||||
|
||||
std::mutex diskMutex;
|
||||
|
||||
// Wireless neoVI Stack
|
||||
@@ -1179,6 +1175,7 @@ private:
|
||||
|
||||
// Keeponline (keepalive for online)
|
||||
std::unique_ptr<Periodic> keeponline;
|
||||
std::unique_ptr<Heartbeat> heartbeat;
|
||||
|
||||
std::optional<uint32_t> assignedClientId;
|
||||
std::unordered_set<icsneo::Network::NetID> lockedNetworks;
|
||||
|
||||
@@ -811,13 +811,17 @@ typedef struct
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "icsneo/communication/communication.h"
|
||||
#include "icsneo/communication/network.h"
|
||||
#include "icsneo/api/event.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include <optional>
|
||||
#include <iostream>
|
||||
#include <atomic>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Device;
|
||||
|
||||
enum class MiscIOAnalogVoltage : uint8_t
|
||||
{
|
||||
V0 = icsneoc2_misc_io_analog_voltage_v0,
|
||||
@@ -845,7 +849,7 @@ public:
|
||||
static int64_t GetBaudrateValueForEnum(CANBaudrate enumValue);
|
||||
static bool ValidateLINBaudrate(int64_t baudrate);
|
||||
|
||||
IDeviceSettings(std::shared_ptr<Communication> com, size_t size) : com(com), report(com->report), structSize(size) {}
|
||||
IDeviceSettings(Device* device, size_t size);
|
||||
virtual ~IDeviceSettings() {}
|
||||
bool ok() const { return !disabled && settingsLoaded; }
|
||||
|
||||
@@ -1392,10 +1396,8 @@ public:
|
||||
bool disabled = false;
|
||||
|
||||
bool readonly = false;
|
||||
|
||||
std::atomic<bool> applyingSettings{false};
|
||||
protected:
|
||||
std::shared_ptr<Communication> com;
|
||||
Device* device;
|
||||
device_eventhandler_t report;
|
||||
size_t structSize;
|
||||
|
||||
@@ -1407,8 +1409,7 @@ protected:
|
||||
|
||||
// Parameter createInoperableSettings exists because it is serving as a warning that you probably don't want to do this
|
||||
typedef void* warn_t;
|
||||
IDeviceSettings(warn_t createInoperableSettings, std::shared_ptr<Communication> com)
|
||||
: disabled(true), readonly(true), report(com->report), structSize(0) { (void)createInoperableSettings; }
|
||||
IDeviceSettings(warn_t createInoperableSettings, Device* device);
|
||||
|
||||
// Devices that embed a Fire3LinuxSettings block in their settings structure override these to
|
||||
// expose it; all other devices report not-available (nullptr / nullopt) and the Linux accessors
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace icsneo {
|
||||
class NullSettings : public IDeviceSettings {
|
||||
public:
|
||||
// Calls the protected base constructor with "createInoperableSettings"
|
||||
NullSettings(std::shared_ptr<Communication> com) : IDeviceSettings(nullptr, com) {}
|
||||
NullSettings(Device* device) : IDeviceSettings(nullptr, device) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ static_assert(sizeof(etherbadge_settings_t) == 316, "EtherBadge settings size mi
|
||||
|
||||
class EtherBADGESettings : public IDeviceSettings {
|
||||
public:
|
||||
EtherBADGESettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(etherbadge_settings_t)) {}
|
||||
EtherBADGESettings(Device* device) : IDeviceSettings(device, sizeof(etherbadge_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<etherbadge_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -88,7 +88,7 @@ static_assert(sizeof(neoviconnect_settings_t) == 628, "NeoVIConnect settings siz
|
||||
|
||||
class NeoVIConnectSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIConnectSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neoviconnect_settings_t)) {}
|
||||
NeoVIConnectSettings(Device* device) : IDeviceSettings(device, sizeof(neoviconnect_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neoviconnect_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
|
||||
@@ -101,7 +101,7 @@ static_assert(sizeof(neovifire_settings_t) == 744, "NeoVIFire settings size mism
|
||||
|
||||
class NeoVIFIRESettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRESettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire_settings_t)) {}
|
||||
NeoVIFIRESettings(Device* device) : IDeviceSettings(device, sizeof(neovifire_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -125,7 +125,7 @@ static_assert(sizeof(neovifire2_settings_t) == 936, "NeoVIFire2 settings size mi
|
||||
|
||||
class NeoVIFIRE2Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire2_settings_t)) {}
|
||||
NeoVIFIRE2Settings(Device* device) : IDeviceSettings(device, sizeof(neovifire2_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -166,7 +166,7 @@ static_assert(sizeof(neovifire3_settings_t) == 1722, "NeoVIFire3 settings size m
|
||||
|
||||
class NeoVIFIRE3Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3_settings_t)) {}
|
||||
NeoVIFIRE3Settings(Device* device) : IDeviceSettings(device, sizeof(neovifire3_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
|
||||
@@ -149,7 +149,7 @@ static_assert(sizeof(neovifire3flexray_settings_t) == 1372, "NeoVIFire3Flexray s
|
||||
|
||||
class NeoVIFIRE3FlexRaySettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3FlexRaySettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3flexray_settings_t)) {}
|
||||
NeoVIFIRE3FlexRaySettings(Device* device) : IDeviceSettings(device, sizeof(neovifire3flexray_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3flexray_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
|
||||
@@ -158,7 +158,7 @@ static_assert(sizeof(neovifire3t1slin_settings_t) == 1594, "NeoVIFire3T1SLIN set
|
||||
|
||||
class NeoVIFIRE3T1SLINSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3T1SLINSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3t1slin_settings_t)) {}
|
||||
NeoVIFIRE3T1SLINSettings(Device* device) : IDeviceSettings(device, sizeof(neovifire3t1slin_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
|
||||
@@ -111,7 +111,7 @@ static_assert(sizeof(neovired2_settings_t) == 918, "NeoVIRED2 settings size mism
|
||||
|
||||
class NeoVIRED2Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIRED2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovired2_settings_t)) {}
|
||||
NeoVIRED2Settings(Device* device) : IDeviceSettings(device, sizeof(neovired2_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovired2_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
Node
|
||||
};
|
||||
|
||||
RADA2BSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(rada2b_settings_t)) {}
|
||||
RADA2BSettings(Device* device) : IDeviceSettings(device, sizeof(rada2b_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<rada2b_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
@@ -141,27 +141,27 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
TDMMode getTDMMode(RADA2BDevice device) const {
|
||||
TDMMode getTDMMode(RADA2BDevice a2bDevice) const {
|
||||
auto cfg = getStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
return static_cast<TDMMode>(deviceSettings.tdmMode);
|
||||
}
|
||||
|
||||
uint8_t getNumChannels(RADA2BDevice device) const {
|
||||
return tdmModeToChannelNum(getTDMMode(device));
|
||||
uint8_t getNumChannels(RADA2BDevice a2bDevice) const {
|
||||
return tdmModeToChannelNum(getTDMMode(a2bDevice));
|
||||
}
|
||||
|
||||
ChannelSize getChannelSize(RADA2BDevice device) const {
|
||||
ChannelSize getChannelSize(RADA2BDevice a2bDevice) const {
|
||||
auto cfg = getStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
return static_cast<ChannelSize>(deviceSettings.flags & a2bSettingsFlag16bit);
|
||||
}
|
||||
|
||||
uint8_t getChannelOffset(RADA2BDevice device, A2BMessage::Direction dir) const {
|
||||
uint8_t getChannelOffset(RADA2BDevice a2bDevice, A2BMessage::Direction dir) const {
|
||||
auto cfg = getStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
if(dir == A2BMessage::Direction::Upstream) {
|
||||
return deviceSettings.upstreamChannelOffset;
|
||||
@@ -170,30 +170,30 @@ public:
|
||||
return deviceSettings.downstreamChannelOffset;
|
||||
}
|
||||
|
||||
NodeType getNodeType(RADA2BDevice device) const {
|
||||
NodeType getNodeType(RADA2BDevice a2bDevice) const {
|
||||
auto cfg = getStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
return static_cast<NodeType>(deviceSettings.nodeType);
|
||||
}
|
||||
|
||||
void setNodeType(RADA2BDevice device, NodeType newType) {
|
||||
void setNodeType(RADA2BDevice a2bDevice, NodeType newType) {
|
||||
auto cfg = getMutableStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
deviceSettings.nodeType = static_cast<uint8_t>(newType);
|
||||
}
|
||||
|
||||
void setTDMMode(RADA2BDevice device, TDMMode newMode) {
|
||||
void setTDMMode(RADA2BDevice a2bDevice, TDMMode newMode) {
|
||||
auto cfg = getMutableStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
deviceSettings.tdmMode = static_cast<uint8_t>(newMode);
|
||||
}
|
||||
|
||||
void setChannelOffset(RADA2BDevice device, A2BMessage::Direction dir, uint8_t newOffset) {
|
||||
void setChannelOffset(RADA2BDevice a2bDevice, A2BMessage::Direction dir, uint8_t newOffset) {
|
||||
auto cfg = getMutableStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
if(dir == A2BMessage::Direction::Upstream) {
|
||||
deviceSettings.upstreamChannelOffset = newOffset;
|
||||
@@ -203,9 +203,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void setChannelSize(RADA2BDevice device, ChannelSize newChannelSize) {
|
||||
void setChannelSize(RADA2BDevice a2bDevice, ChannelSize newChannelSize) {
|
||||
auto cfg = getMutableStructurePointer<rada2b_settings_t>();
|
||||
auto &deviceSettings = device == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
auto &deviceSettings = a2bDevice == RADA2BDevice::Monitor ? cfg->a2b_monitor : cfg->a2b_node;
|
||||
|
||||
if(newChannelSize == ChannelSize::chSize16) {
|
||||
deviceSettings.flags |= a2bSettingsFlag16bit;
|
||||
|
||||
@@ -89,7 +89,7 @@ static_assert(sizeof(radcomet2_settings_t) == 498, "RADComet2 settings size mism
|
||||
|
||||
class RADComet2Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADComet2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radcomet2_settings_t)) {}
|
||||
RADComet2Settings(Device* device) : IDeviceSettings(device, sizeof(radcomet2_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -86,7 +86,7 @@ static_assert(sizeof(radcomet3_settings_t) == 674, "RADComet3 settings size mism
|
||||
|
||||
class RADComet3Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADComet3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radcomet3_settings_t)) {}
|
||||
RADComet3Settings(Device* device) : IDeviceSettings(device, sizeof(radcomet3_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -86,7 +86,7 @@ static_assert(sizeof(radepsilon_settings_t) == 400, "RADEpsilon settings size mi
|
||||
|
||||
class RADEpsilonSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADEpsilonSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radepsilon_settings_t)) {}
|
||||
RADEpsilonSettings(Device* device) : IDeviceSettings(device, sizeof(radepsilon_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radepsilon_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -109,7 +109,7 @@ static_assert(sizeof(radgalaxy_settings_t) == 776, "RADGalaxy settings size mism
|
||||
|
||||
class RADGalaxySettings : public IDeviceSettings {
|
||||
public:
|
||||
RADGalaxySettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgalaxy_settings_t)) {}
|
||||
RADGalaxySettings(Device* device) : IDeviceSettings(device, sizeof(radgalaxy_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgalaxy_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -125,7 +125,7 @@ static_assert(sizeof(radgalaxy2_settings_t) == 960, "RADGalaxy2 settings size mi
|
||||
|
||||
class RADGalaxy2Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADGalaxy2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgalaxy2_settings_t)) {}
|
||||
RADGalaxy2Settings(Device* device) : IDeviceSettings(device, sizeof(radgalaxy2_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgalaxy2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -42,7 +42,7 @@ static_assert(sizeof(radgemini_settings_t) == 86, "RADGemini settings size misma
|
||||
|
||||
class RADGeminiSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADGeminiSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgemini_settings_t)) {}
|
||||
RADGeminiSettings(Device* device) : IDeviceSettings(device, sizeof(radgemini_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ static_assert(sizeof(radgigastar_settings_t) == 1026, "RADGigastar settings size
|
||||
|
||||
class RADGigastarSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADGigastarSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgigastar_settings_t)) {}
|
||||
RADGigastarSettings(Device* device) : IDeviceSettings(device, sizeof(radgigastar_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgigastar_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace icsneo
|
||||
class RADGigastar2Settings : public IDeviceSettings
|
||||
{
|
||||
public:
|
||||
RADGigastar2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgigastar2_settings_t)) {}
|
||||
RADGigastar2Settings(Device* device) : IDeviceSettings(device, sizeof(radgigastar2_settings_t)) {}
|
||||
const CAN_SETTINGS *getCANSettingsFor(Network net) const override
|
||||
{
|
||||
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
||||
|
||||
@@ -90,7 +90,7 @@ static_assert(sizeof(radjupiter_settings_t) == 348, "RAD-Jupiter Settings are no
|
||||
|
||||
class RADJupiterSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADJupiterSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radjupiter_settings_t)) {}
|
||||
RADJupiterSettings(Device* device) : IDeviceSettings(device, sizeof(radjupiter_settings_t)) {}
|
||||
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radjupiter_settings_t>();
|
||||
|
||||
@@ -101,7 +101,7 @@ static_assert(sizeof(radmars_settings_t) == 666, "RAD-Mars settings size mismatc
|
||||
|
||||
class RADMarsSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADMarsSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmars_settings_t)) {}
|
||||
RADMarsSettings(Device* device) : IDeviceSettings(device, sizeof(radmars_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radmars_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -42,7 +42,7 @@ static_assert(sizeof(radmoon2_settings_t) == 170, "RADMoon2 settings size mismat
|
||||
|
||||
class RADMoon2Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoon2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoon2_settings_t)) {}
|
||||
RADMoon2Settings(Device* device) : IDeviceSettings(device, sizeof(radmoon2_settings_t)) {}
|
||||
|
||||
const RAD_GPTP_SETTINGS* getGPTPSettings() const override {
|
||||
auto cfg = getStructurePointer<radmoon2_settings_t>();
|
||||
|
||||
@@ -39,7 +39,7 @@ static_assert(sizeof(radmoon3_settings_t) == 68, "RADMoon3 settings size mismatc
|
||||
|
||||
class RADMoon3Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoon3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoon3_settings_t)) {}
|
||||
RADMoon3Settings(Device* device) : IDeviceSettings(device, sizeof(radmoon3_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ static_assert(sizeof(radmoonduo_settings_t) == 38, "RAD-Moon Duo settings size e
|
||||
|
||||
class RADMoonDuoSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoonDuoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoonduo_settings_t)) {}
|
||||
RADMoonDuoSettings(Device* device) : IDeviceSettings(device, sizeof(radmoonduo_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ static_assert(sizeof(radmoont1s_settings_t) == 160, "RADMoonT1S settings size mi
|
||||
|
||||
class RADMoonT1SSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoonT1SSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoont1s_settings_t)) {}
|
||||
RADMoonT1SSettings(Device* device) : IDeviceSettings(device, sizeof(radmoont1s_settings_t)) {}
|
||||
|
||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
|
||||
@@ -74,7 +74,7 @@ static_assert(sizeof(radpluto_settings_t) == 322, "RAD-Pluto Settings are not pa
|
||||
|
||||
class RADPlutoSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADPlutoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radpluto_settings_t)) {
|
||||
RADPlutoSettings(Device* device) : IDeviceSettings(device, sizeof(radpluto_settings_t)) {
|
||||
}
|
||||
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
|
||||
@@ -75,7 +75,7 @@ static_assert(sizeof(radstar2_settings_t) == 422, "RADStar2 settings size mismat
|
||||
|
||||
class RADStar2Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADStar2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radstar2_settings_t)) {
|
||||
RADStar2Settings(Device* device) : IDeviceSettings(device, sizeof(radstar2_settings_t)) {
|
||||
}
|
||||
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct {
|
||||
|
||||
class RADSupermoonSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADSupermoonSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radsupermoon_settings_t)) {}
|
||||
RADSupermoonSettings(Device* device) : IDeviceSettings(device, sizeof(radsupermoon_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ static_assert(sizeof(radwbms_settings_t) == 156, "RAD-wBMS settings size mismatc
|
||||
|
||||
class RADwBMSSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADwBMSSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radwbms_settings_t)) {}
|
||||
RADwBMSSettings(Device* device) : IDeviceSettings(device, sizeof(radwbms_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static_assert(sizeof(valuecan3_settings_t) == 40, "ValueCAN3 settings size misma
|
||||
|
||||
class ValueCAN3Settings : public IDeviceSettings {
|
||||
public:
|
||||
ValueCAN3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan3_settings_t)) {}
|
||||
ValueCAN3Settings(Device* device) : IDeviceSettings(device, sizeof(valuecan3_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_1_2Settings : public IDeviceSettings {
|
||||
public:
|
||||
ValueCAN4_1_2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_1_2_settings_t)) {}
|
||||
ValueCAN4_1_2Settings(Device* device) : IDeviceSettings(device, sizeof(valuecan4_1_2_settings_t)) {}
|
||||
// We do not override getCANSettingsFor or getCANFDSettingsFor here because they will be device specific
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_1Settings : public ValueCAN4_1_2Settings {
|
||||
public:
|
||||
ValueCAN4_1Settings(std::shared_ptr<Communication> com) : ValueCAN4_1_2Settings(com) {}
|
||||
ValueCAN4_1Settings(Device* device) : ValueCAN4_1_2Settings(device) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_1_2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_2ELSettings : public ValueCAN4_4_2ELSettings {
|
||||
public:
|
||||
ValueCAN4_2ELSettings(std::shared_ptr<Communication> com) : ValueCAN4_4_2ELSettings(com) {}
|
||||
ValueCAN4_2ELSettings(Device* device) : ValueCAN4_4_2ELSettings(device) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_4_2el_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_2Settings : public ValueCAN4_1_2Settings {
|
||||
public:
|
||||
ValueCAN4_2Settings(std::shared_ptr<Communication> com) : ValueCAN4_1_2Settings(com) {}
|
||||
ValueCAN4_2Settings(Device* device) : ValueCAN4_1_2Settings(device) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_1_2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_4_2ELSettings : public IDeviceSettings {
|
||||
public:
|
||||
ValueCAN4_4_2ELSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_4_2el_settings_t)) {}
|
||||
ValueCAN4_4_2ELSettings(Device* device) : IDeviceSettings(device, sizeof(valuecan4_4_2el_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_4_2el_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4_4Settings : public ValueCAN4_4_2ELSettings {
|
||||
public:
|
||||
ValueCAN4_4Settings(std::shared_ptr<Communication> com) : ValueCAN4_4_2ELSettings(com) {}
|
||||
ValueCAN4_4Settings(Device* device) : ValueCAN4_4_2ELSettings(device) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_4_2el_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace icsneo {
|
||||
|
||||
class ValueCAN4IndustrialSettings : public IDeviceSettings {
|
||||
public:
|
||||
ValueCAN4IndustrialSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_industrial_settings_t)) {}
|
||||
ValueCAN4IndustrialSettings(Device* device) : IDeviceSettings(device, sizeof(valuecan4_industrial_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<valuecan4_industrial_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -48,7 +48,7 @@ static_assert(sizeof(vividcan_settings_t) == 64, "VividCAN settings size mismatc
|
||||
|
||||
class VividCANSettings : public IDeviceSettings {
|
||||
public:
|
||||
VividCANSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(vividcan_settings_t)) {}
|
||||
VividCANSettings(Device* device) : IDeviceSettings(device, sizeof(vividcan_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<vividcan_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user