Device component initialization done more intelligently

This commit is contained in:
Paul Hollinsky
2018-10-26 19:28:09 -04:00
parent 7e6282a7ad
commit a331a2afa8
24 changed files with 255 additions and 213 deletions
@@ -11,17 +11,15 @@ class NeoVIFIRE2 : public Device {
public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::FIRE2;
static constexpr const char* SERIAL_START = "CY";
protected:
NeoVIFIRE2(neodevice_t neodevice) : Device(neodevice) {
getWritableNeoDevice().type = DEVICE_TYPE;
}
protected:
static std::shared_ptr<Communication> MakeCommunication(std::unique_ptr<ICommunication> transport) {
auto packetizer = std::make_shared<Packetizer>();
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
virtual void setupEncoder(Encoder* encoder) override {
Device::setupEncoder(encoder);
encoder->supportCANFD = true;
auto decoder = std::unique_ptr<Decoder>(new Decoder());
return std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
}
};