Basic introspection for device supported networks
parent
efd5547e5c
commit
7e9fbc4959
|
|
@ -203,6 +203,9 @@ bool Device::goOffline() {
|
|||
}
|
||||
|
||||
bool Device::transmit(std::shared_ptr<Message> message) {
|
||||
if(!isSupportedTXNetwork(message->network))
|
||||
return false;
|
||||
|
||||
std::vector<uint8_t> packet;
|
||||
if(!com->encoder->encode(packet, message))
|
||||
return false;
|
||||
|
|
@ -218,6 +221,27 @@ bool Device::transmit(std::vector<std::shared_ptr<Message>> messages) {
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t Device::getNetworkCountByType(Network::Type type) const {
|
||||
size_t count = 0;
|
||||
for(const auto& net : getSupportedRXNetworks())
|
||||
if(net.getType() == type)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
// Indexed starting at one
|
||||
Network Device::getNetworkByNumber(Network::Type type, size_t index) const {
|
||||
size_t count = 0;
|
||||
for(const auto& net : getSupportedRXNetworks()) {
|
||||
if(net.getType() == type) {
|
||||
count++;
|
||||
if(count == index)
|
||||
return net;
|
||||
}
|
||||
}
|
||||
return Network::NetID::Invalid;
|
||||
}
|
||||
|
||||
void Device::handleInternalMessage(std::shared_ptr<Message> message) {
|
||||
switch(message->network.getNetID()) {
|
||||
case Network::NetID::Reset_Status:
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ public:
|
|||
FlexRay = 4,
|
||||
MOST = 5,
|
||||
Ethernet = 6,
|
||||
LSFTCAN = 7,
|
||||
SWCAN = 8,
|
||||
Any = 0xFE, // Never actually set as type, but used as flag for filtering
|
||||
Other = 0xFF
|
||||
};
|
||||
|
|
@ -144,6 +146,10 @@ public:
|
|||
return "Internal";
|
||||
case Type::Ethernet:
|
||||
return "Ethernet";
|
||||
case Type::LSFTCAN:
|
||||
return "Low Speed Fault Tolerant CAN";
|
||||
case Type::SWCAN:
|
||||
return "Single Wire CAN";
|
||||
case Type::Invalid:
|
||||
default:
|
||||
return "Invalid Type";
|
||||
|
|
@ -153,16 +159,12 @@ public:
|
|||
switch(netid) {
|
||||
case NetID::HSCAN:
|
||||
case NetID::MSCAN:
|
||||
case NetID::SWCAN:
|
||||
case NetID::LSFTCAN:
|
||||
case NetID::HSCAN2:
|
||||
case NetID::HSCAN3:
|
||||
case NetID::HSCAN4:
|
||||
case NetID::HSCAN5:
|
||||
case NetID::SWCAN2:
|
||||
case NetID::HSCAN6:
|
||||
case NetID::HSCAN7:
|
||||
case NetID::LSFTCAN2:
|
||||
return Type::CAN;
|
||||
case NetID::LIN:
|
||||
case NetID::LIN2:
|
||||
|
|
@ -204,6 +206,12 @@ public:
|
|||
case NetID::OP_Ethernet11:
|
||||
case NetID::OP_Ethernet12:
|
||||
return Type::Ethernet;
|
||||
case NetID::LSFTCAN:
|
||||
case NetID::LSFTCAN2:
|
||||
return Type::LSFTCAN;
|
||||
case NetID::SWCAN:
|
||||
case NetID::SWCAN2:
|
||||
return Type::SWCAN;
|
||||
default:
|
||||
return Type::Other;
|
||||
}
|
||||
|
|
@ -419,6 +427,7 @@ public:
|
|||
os << GetNetIDString(network.getNetID());
|
||||
return os;
|
||||
}
|
||||
friend bool operator==(const Network& net1, const Network& net2) { return net1.getNetID() == net2.getNetID(); }
|
||||
|
||||
private:
|
||||
NetID value; // Always use setValue so that value and type stay in sync
|
||||
|
|
|
|||
|
|
@ -64,6 +64,19 @@ public:
|
|||
bool transmit(std::shared_ptr<Message> message);
|
||||
bool transmit(std::vector<std::shared_ptr<Message>> messages);
|
||||
|
||||
const std::vector<Network>& getSupportedRXNetworks() const { return supportedRXNetworks; }
|
||||
const std::vector<Network>& getSupportedTXNetworks() const { return supportedTXNetworks; }
|
||||
virtual bool isSupportedRXNetwork(const Network& net) const {
|
||||
return std::find(supportedRXNetworks.begin(), supportedRXNetworks.end(), net) != supportedRXNetworks.end();
|
||||
}
|
||||
virtual bool isSupportedTXNetwork(const Network& net) const {
|
||||
return std::find(supportedTXNetworks.begin(), supportedTXNetworks.end(), net) != supportedTXNetworks.end();
|
||||
}
|
||||
|
||||
virtual size_t getNetworkCountByType(Network::Type) const;
|
||||
virtual Network getNetworkByNumber(Network::Type, size_t) const;
|
||||
|
||||
std::shared_ptr<Communication> com;
|
||||
std::unique_ptr<IDeviceSettings> settings;
|
||||
|
||||
protected:
|
||||
|
|
@ -71,7 +84,6 @@ protected:
|
|||
bool online = false;
|
||||
int messagePollingCallbackID = 0;
|
||||
int internalHandlerCallbackID = 0;
|
||||
std::shared_ptr<Communication> com;
|
||||
device_errorhandler_t err;
|
||||
|
||||
// START Initialization Functions
|
||||
|
|
@ -84,17 +96,19 @@ protected:
|
|||
void initialize() {
|
||||
err = makeErrorHandler();
|
||||
auto transport = makeTransport<Transport>();
|
||||
setupTransport(transport.get());
|
||||
setupTransport(*transport);
|
||||
auto packetizer = makePacketizer();
|
||||
setupPacketizer(packetizer.get());
|
||||
setupPacketizer(*packetizer);
|
||||
auto encoder = makeEncoder(packetizer);
|
||||
setupEncoder(encoder.get());
|
||||
setupEncoder(*encoder);
|
||||
auto decoder = makeDecoder();
|
||||
setupDecoder(decoder.get());
|
||||
setupDecoder(*decoder);
|
||||
com = makeCommunication(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
|
||||
setupCommunication(com.get());
|
||||
setupCommunication(*com);
|
||||
settings = makeSettings<Settings>(com);
|
||||
setupSettings(settings.get());
|
||||
setupSettings(*settings);
|
||||
setupSupportedRXNetworks(supportedRXNetworks);
|
||||
setupSupportedTXNetworks(supportedTXNetworks);
|
||||
}
|
||||
|
||||
virtual device_errorhandler_t makeErrorHandler() {
|
||||
|
|
@ -103,29 +117,32 @@ protected:
|
|||
|
||||
template<typename Transport>
|
||||
std::unique_ptr<ICommunication> makeTransport() { return std::unique_ptr<ICommunication>(new Transport(err, getWritableNeoDevice())); }
|
||||
virtual void setupTransport(ICommunication* stransport) { (void)stransport; }
|
||||
virtual void setupTransport(ICommunication&) {}
|
||||
|
||||
virtual std::shared_ptr<Packetizer> makePacketizer() { return std::make_shared<Packetizer>(err); }
|
||||
virtual void setupPacketizer(Packetizer* spacketizer) { (void)spacketizer; }
|
||||
virtual void setupPacketizer(Packetizer&) {}
|
||||
|
||||
virtual std::unique_ptr<Encoder> makeEncoder(std::shared_ptr<Packetizer> p) { return std::unique_ptr<Encoder>(new Encoder(err, p)); }
|
||||
virtual void setupEncoder(Encoder* sencoder) { (void)sencoder; }
|
||||
virtual void setupEncoder(Encoder&) {}
|
||||
|
||||
virtual std::unique_ptr<Decoder> makeDecoder() { return std::unique_ptr<Decoder>(new Decoder(err)); }
|
||||
virtual void setupDecoder(Decoder* sdecoder) { (void)sdecoder; }
|
||||
virtual void setupDecoder(Decoder&) {}
|
||||
|
||||
virtual std::shared_ptr<Communication> makeCommunication(
|
||||
std::unique_ptr<ICommunication> t,
|
||||
std::shared_ptr<Packetizer> p,
|
||||
std::unique_ptr<Encoder> e,
|
||||
std::unique_ptr<Decoder> d) { return std::make_shared<Communication>(err, std::move(t), p, std::move(e), std::move(d)); }
|
||||
virtual void setupCommunication(Communication* scom) { (void)scom; }
|
||||
virtual void setupCommunication(Communication&) {}
|
||||
|
||||
template<typename Settings>
|
||||
std::unique_ptr<IDeviceSettings> makeSettings(std::shared_ptr<Communication> com) {
|
||||
return std::unique_ptr<IDeviceSettings>(new Settings(com));
|
||||
}
|
||||
virtual void setupSettings(IDeviceSettings* ssettings) { (void)ssettings; }
|
||||
virtual void setupSettings(IDeviceSettings&) {}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>&) {}
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>&) {}
|
||||
// END Initialization Functions
|
||||
|
||||
void handleInternalMessage(std::shared_ptr<Message> message);
|
||||
|
|
@ -136,6 +153,9 @@ private:
|
|||
neodevice_t data;
|
||||
std::shared_ptr<ResetStatusMessage> latestResetStatus;
|
||||
|
||||
std::vector<Network> supportedTXNetworks;
|
||||
std::vector<Network> supportedRXNetworks;
|
||||
|
||||
enum class LEDState : uint8_t {
|
||||
Offline = 0x04,
|
||||
CoreMiniRunning = 0x08, // This should override "offline" if the CoreMini is running
|
||||
|
|
|
|||
|
|
@ -21,12 +21,25 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2
|
||||
};
|
||||
|
||||
private:
|
||||
NeoOBD2PRO(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<STM32>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,25 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2
|
||||
};
|
||||
|
||||
private:
|
||||
NeoOBD2SIM(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<STM32>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,26 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4,
|
||||
Network::NetID::HSCAN5,
|
||||
|
||||
Network::NetID::LSFTCAN,
|
||||
Network::NetID::LSFTCAN2,
|
||||
|
||||
Network::NetID::SWCAN,
|
||||
Network::NetID::SWCAN2,
|
||||
|
||||
Network::NetID::LIN,
|
||||
Network::NetID::LIN2,
|
||||
Network::NetID::LIN3,
|
||||
Network::NetID::LIN4
|
||||
};
|
||||
|
||||
enum class Mode : char {
|
||||
Application = 'A',
|
||||
Bootloader = 'B'
|
||||
|
|
@ -57,6 +77,14 @@ private:
|
|||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,47 @@ public:
|
|||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::FIRE2;
|
||||
static constexpr const char* SERIAL_START = "CY";
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4,
|
||||
Network::NetID::HSCAN5,
|
||||
Network::NetID::HSCAN6,
|
||||
Network::NetID::HSCAN7,
|
||||
|
||||
Network::NetID::LSFTCAN,
|
||||
Network::NetID::LSFTCAN2,
|
||||
|
||||
Network::NetID::SWCAN,
|
||||
Network::NetID::SWCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::LIN,
|
||||
Network::NetID::LIN2,
|
||||
Network::NetID::LIN3,
|
||||
Network::NetID::LIN4
|
||||
};
|
||||
|
||||
protected:
|
||||
NeoVIFIRE2(neodevice_t neodevice) : Device(neodevice) {
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder* encoder) override {
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder->supportCANFD = true;
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ protected:
|
|||
std::unique_ptr<Decoder> decoder
|
||||
) override { return std::make_shared<MultiChannelCommunication>(err, std::move(transport), packetizer, std::move(encoder), std::move(decoder)); }
|
||||
|
||||
// TODO: This is done so that Plasion can still transmit it's basic networks, awaiting VLAN support
|
||||
virtual bool isSupportedRXNetwork(const Network&) const override { return true; }
|
||||
virtual bool isSupportedTXNetwork(const Network&) const override { return true; }
|
||||
|
||||
public:
|
||||
Plasion(neodevice_t neodevice) : Device(neodevice) {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,6 +47,35 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4,
|
||||
Network::NetID::HSCAN5,
|
||||
Network::NetID::HSCAN6,
|
||||
Network::NetID::HSCAN7,
|
||||
|
||||
Network::NetID::SWCAN,
|
||||
Network::NetID::SWCAN2,
|
||||
|
||||
Network::NetID::LIN,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2,
|
||||
Network::NetID::OP_Ethernet3,
|
||||
Network::NetID::OP_Ethernet4,
|
||||
Network::NetID::OP_Ethernet5,
|
||||
Network::NetID::OP_Ethernet6,
|
||||
Network::NetID::OP_Ethernet7,
|
||||
Network::NetID::OP_Ethernet8,
|
||||
Network::NetID::OP_Ethernet9,
|
||||
Network::NetID::OP_Ethernet10,
|
||||
Network::NetID::OP_Ethernet11,
|
||||
Network::NetID::OP_Ethernet12
|
||||
};
|
||||
|
||||
RADGalaxy(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<PCAP>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
|
|
@ -54,14 +83,29 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void setupPacketizer(Packetizer* packetizer) override {
|
||||
packetizer->disableChecksum = true;
|
||||
packetizer->align16bit = false;
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupDecoder(Decoder* decoder) override {
|
||||
decoder->timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
virtual void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,22 +14,41 @@ public:
|
|||
static constexpr const uint16_t PRODUCT_ID = 0x0005;
|
||||
static constexpr const char* SERIAL_START = "RS";
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
|
||||
Network::NetID::LIN,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setupPacketizer(Packetizer* packetizer) override {
|
||||
packetizer->disableChecksum = true;
|
||||
packetizer->align16bit = false;
|
||||
virtual void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder* encoder) override {
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder->supportCANFD = true;
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
virtual void setupDecoder(Decoder* decoder) override {
|
||||
virtual void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder->timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
decoder.timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
RADStar2(neodevice_t neodevice) : Device(neodevice) {
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual void setupDecoder(Decoder* decoder) override {
|
||||
decoder->timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
virtual void setupDecoder(Decoder& decoder) override {
|
||||
decoder.timestampMultiplier = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -21,12 +21,25 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN
|
||||
};
|
||||
|
||||
private:
|
||||
ValueCAN3(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<FTDI, ValueCAN3Settings>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,24 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN
|
||||
};
|
||||
|
||||
protected:
|
||||
void setupEncoder(Encoder* encoder) override {
|
||||
encoder->supportCANFD = false; // VCAN 4-1 does not support CAN FD
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
ValueCAN4::setupEncoder(encoder);
|
||||
encoder.supportCANFD = false; // VCAN 4-1 does not support CAN FD
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
private:
|
||||
ValueCAN4_1(neodevice_t neodevice) : ValueCAN4(neodevice) {
|
||||
initialize<STM32, ValueCAN4_1Settings>();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,20 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
private:
|
||||
ValueCAN4_2(neodevice_t neodevice) : ValueCAN4(neodevice) {
|
||||
initialize<STM32, ValueCAN4_2Settings>();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,22 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
private:
|
||||
ValueCAN4_2EL(neodevice_t neodevice) : ValueCAN4(neodevice) {
|
||||
initialize<STM32, ValueCAN4_2ELSettings>();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,22 @@ public:
|
|||
return found;
|
||||
}
|
||||
|
||||
static constexpr Network::NetID SUPPORTED_NETWORKS[] = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : SUPPORTED_NETWORKS)
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
private:
|
||||
ValueCAN4_4(neodevice_t neodevice) : ValueCAN4(neodevice) {
|
||||
initialize<STM32, ValueCAN4_4Settings>();
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ public:
|
|||
static constexpr const uint16_t PRODUCT_ID = 0x1101;
|
||||
|
||||
protected:
|
||||
virtual void setupEncoder(Encoder* encoder) override {
|
||||
encoder->supportCANFD = true;
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
ValueCAN4(neodevice_t neodevice) : Device(neodevice) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue