Communication: MultiChannel: Properly mask out communication from non-main VNETs

This also makes it possible for Communication to create more instances of Packetizer
This is necessary because Packetizer is not thread safe,
so when we support more VNETs we will need to create more Packetizers.
This commit is contained in:
Paul Hollinsky
2020-03-09 13:56:18 -04:00
parent 42780dc610
commit d8798acaa7
11 changed files with 123 additions and 52 deletions
+6 -5
View File
@@ -15,14 +15,15 @@ namespace icsneo {
class Encoder {
public:
Encoder(device_eventhandler_t report, std::shared_ptr<Packetizer> p) : packetizer(p), report(report) {}
bool encode(std::vector<uint8_t>& result, const std::shared_ptr<Message>& message);
bool encode(std::vector<uint8_t>& result, Command cmd, bool boolean) { return encode(result, cmd, std::vector<uint8_t>({ (uint8_t)boolean })); }
bool encode(std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments = {});
Encoder(device_eventhandler_t report) : report(report) {}
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, const std::shared_ptr<Message>& message);
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, Command cmd, bool boolean) {
return encode(packetizer, result, cmd, std::vector<uint8_t>({ (uint8_t)boolean }));
}
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments = {});
bool supportCANFD = false;
private:
std::shared_ptr<Packetizer> packetizer;
device_eventhandler_t report;
};