ValueCAN 4-2EL: Allow the Ethernet network while communicating over it

All frames except for the CAB1/CAB2 communication are reported
pull/35/head
Paul Hollinsky 2021-05-04 23:08:34 -04:00
parent b104b34919
commit eca1110305
3 changed files with 18 additions and 38 deletions

View File

@ -48,11 +48,29 @@ public:
return Device::getProductName(); return Device::getProductName();
} }
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::HSCAN2,
Network::NetID::Ethernet
};
return supportedNetworks;
}
protected: protected:
ValueCAN4_2EL(neodevice_t neodevice) : ValueCAN4(neodevice) { ValueCAN4_2EL(neodevice_t neodevice) : ValueCAN4(neodevice) {
getWritableNeoDevice().type = DEVICE_TYPE; getWritableNeoDevice().type = DEVICE_TYPE;
} }
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
for(auto& netid : GetSupportedNetworks())
rxNetworks.emplace_back(netid);
}
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
size_t getEthernetActivationLineCount() const override { return 1; } size_t getEthernetActivationLineCount() const override { return 1; }
void handleDeviceStatus(const std::shared_ptr<Message>& message) override { void handleDeviceStatus(const std::shared_ptr<Message>& message) override {

View File

@ -46,27 +46,8 @@ public:
return found; return found;
} }
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::HSCAN2,
// No Network::NetID::Ethernet, since we're communicating over it instead
};
return supportedNetworks;
}
bool currentDriverSupportsDFU() const override { return false; } bool currentDriverSupportsDFU() const override { return false; }
protected:
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
for(auto& netid : GetSupportedNetworks())
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: private:
ValueCAN4_2EL_ETH(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) { ValueCAN4_2EL_ETH(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) {
initialize<PCAP, ValueCAN4_2ELSettings>(); initialize<PCAP, ValueCAN4_2ELSettings>();

View File

@ -22,25 +22,6 @@ public:
return found; return found;
} }
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::HSCAN2,
Network::NetID::Ethernet
};
return supportedNetworks;
}
protected:
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
for(auto& netid : GetSupportedNetworks())
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: private:
ValueCAN4_2EL_USB(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) { ValueCAN4_2EL_USB(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) {
initialize<CDCACM, ValueCAN4_2ELSettings>(); initialize<CDCACM, ValueCAN4_2ELSettings>();