Bugfix in sending of measurement data

This commit is contained in:
Martin Bauer 2020-05-17 15:38:14 +02:00
parent e057d97a70
commit 210c7b9cdc
1 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,10 @@ private:
"serializeChunk: invalid startIdx" );
if( startIdx >= currentChunk->getStartIndex() ) {
encoder.sendArrayPartialContents( currentChunk->getDataPointer(), currentChunk->numMeasurements() );
const auto localStartIdx = startIdx - currentChunk->getStartIndex();
const auto numElements = currentChunk->numMeasurements() - localStartIdx;
assert(numElements <= currentChunk->numMeasurements(), "Internal problem in serializeChunk");
encoder.sendArrayPartialContents( currentChunk->getDataPointer() + localStartIdx, numElements );
return currentChunk->getStartIndex() + currentChunk->numMeasurements();
} else if( startIdx >= otherChunk->getStartIndex() && otherChunkFilled() ) {
encoder.sendArrayPartialContents( otherChunk->getDataPointer(), otherChunk->numMeasurements() );