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
+9 -7
View File
@@ -8,14 +8,16 @@
namespace icsneo {
class Plasion : public Device {
protected:
virtual std::shared_ptr<Communication> makeCommunication(
std::unique_ptr<ICommunication> transport,
std::shared_ptr<Packetizer> packetizer,
std::unique_ptr<Encoder> encoder,
std::unique_ptr<Decoder> decoder
) override { return std::make_shared<MultiChannelCommunication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); }
public:
Plasion(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::unique_ptr<ICommunication>(new FTDI(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<MultiChannelCommunication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
}
Plasion(neodevice_t neodevice) : Device(neodevice) {}
};
}