#ifndef __VALUECAN4_2EL_USB_H_ #define __VALUECAN4_2EL_USB_H_ #ifdef __cplusplus #include "icsneo/device/tree/valuecan4/valuecan4-2el.h" #include "icsneo/platform/stm32.h" #include namespace icsneo { class ValueCAN4_2EL_USB : public ValueCAN4_2EL { public: static std::vector> Find() { std::vector> found; for(auto neodevice : STM32::FindByProduct(USB_PRODUCT_ID)) { if(std::string(neodevice.serial).substr(0, 2) == SERIAL_START) found.emplace_back(new ValueCAN4_2EL_USB(neodevice)); } return found; } static const std::vector& GetSupportedNetworks() { static std::vector supportedNetworks = { Network::NetID::HSCAN, Network::NetID::HSCAN2, Network::NetID::Ethernet }; return supportedNetworks; } protected: virtual void setupSupportedRXNetworks(std::vector& 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& txNetworks) override { setupSupportedRXNetworks(txNetworks); } private: ValueCAN4_2EL_USB(neodevice_t neodevice) : ValueCAN4_2EL(neodevice) { initialize(); productId = USB_PRODUCT_ID; } }; } #endif // __cplusplus #endif