Communication uses instantiated Packetizers and Decoders now

This commit is contained in:
Paul Hollinsky
2018-09-25 17:47:27 -04:00
parent 585abe7cbb
commit aa25ba1728
17 changed files with 161 additions and 107 deletions
+3 -1
View File
@@ -18,7 +18,7 @@ class Communication {
public:
static uint8_t ICSChecksum(const std::vector<uint8_t>& data);
Communication(std::shared_ptr<ICommunication> com) : impl(com) {}
Communication(std::shared_ptr<ICommunication> com, std::shared_ptr<Packetizer> p, std::shared_ptr<MessageDecoder> md) : impl(com), packetizer(p), decoder(md) {}
virtual ~Communication() { close(); }
bool open();
@@ -40,6 +40,8 @@ public:
void setAlign16Bit(bool enable) { align16bit = enable; }
std::shared_ptr<Packetizer> packetizer;
std::shared_ptr<MessageDecoder> decoder;
protected:
std::shared_ptr<ICommunication> impl;
@@ -9,7 +9,7 @@ namespace icsneo {
class MultiChannelCommunication : public Communication {
public:
MultiChannelCommunication(std::shared_ptr<ICommunication> com) : Communication(com) {}
MultiChannelCommunication(std::shared_ptr<ICommunication> com, std::shared_ptr<Packetizer> p, std::shared_ptr<MessageDecoder> md) : Communication(com, p, md) {}
void spawnThreads();
void joinThreads();
bool sendCommand(Command cmd, std::vector<uint8_t> arguments);