big merge

This commit is contained in:
Philippe G
2021-12-18 21:04:23 -08:00
parent 955692f8ad
commit 898998efb0
583 changed files with 84472 additions and 1965 deletions
@@ -0,0 +1,33 @@
#include "MercuryResponse.h"
MercuryResponse::MercuryResponse(std::vector<uint8_t> &data)
{
// this->mercuryHeader = std::make_unique<Header>();
this->parts = mercuryParts(0);
this->parseResponse(data);
}
void MercuryResponse::parseResponse(std::vector<uint8_t> &data)
{
auto sequenceLength = ntohs(extract<uint16_t>(data, 0));
this->sequenceId = hton64(extract<uint64_t>(data, 2));
auto partsNumber = ntohs(extract<uint16_t>(data, 11));
auto headerSize = ntohs(extract<uint16_t>(data, 13));
auto headerBytes = std::vector<uint8_t>(data.begin() + 15, data.begin() + 15 + headerSize);
auto pos = 15 + headerSize;
while (pos < data.size())
{
auto partSize = ntohs(extract<uint16_t>(data, pos));
this->parts.push_back(
std::vector<uint8_t>(
data.begin() + pos + 2,
data.begin() + pos + 2 + partSize));
pos += 2 + partSize;
}
this->mercuryHeader = decodePb<Header>(headerBytes);
}