ValueCAN 4-2EL: Add communication over Ethernet

The device can communicate with the PC over its Ethernet if the
enablePcEthernetComm setting is set within the structure.

This stops the Ethernet port from being used for vehicle data.
This commit is contained in:
Paul Hollinsky
2020-09-14 12:35:43 -04:00
parent d2676afa11
commit 8843ace87e
10 changed files with 172 additions and 47 deletions
@@ -13,39 +13,10 @@ class ValueCAN4_2EL : public ValueCAN4 {
public:
// Serial numbers start with VE for 4-2EL
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::VCAN4_2EL;
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID)) {
if(std::string(neodevice.serial).substr(0, 2) == "VE")
found.emplace_back(new ValueCAN4_2EL(neodevice));
}
return found;
}
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::HSCAN2,
Network::NetID::Ethernet
};
return supportedNetworks;
}
static constexpr const char* SERIAL_START = "VE";
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:
ValueCAN4_2EL(neodevice_t neodevice) : ValueCAN4(neodevice) {
initialize<STM32, ValueCAN4_2ELSettings>();
getWritableNeoDevice().type = DEVICE_TYPE;
}
};