Caution! Article for developers

Information on this page is intended particularly for users with advanced technical knowledge.

Combining burst fragments into complete bursts

Mar 28, 2022 · 2 minutes to read

Treon Gateway Industrial Node

This article describes how to merge burst fragments into complete bursts.

Introduction

Each burst will have unique1 measurement id e.g: "MeasurementId":225 and burst id e.g: "BurstId":133. You should identify your burst with this information along with SensorNodeId.

After you have your burst fragments you can start combining them into complete bursts with their "Values", "Valuemapping", "BurstDataOffset" and "DataSize"-fields where:

FieldMeaning
"Values"Contains byte-values from burst. Format will be specified by "Valuemapping".
"Valuemapping"Defines format of "Values"-field
"BurstDataOffset"Fragments starting bytes position in bytearray with size of "DataSize"
"DataSize"Size of the burst in bytes

How bursts are split into fragments

Bursts are split into smaller fragments and sent via wirepas to gateway which sends them to cloud. Each fragment contains partial array of the data-bytes from the complete burst. Because these fragments cannot be guaranteed to come in correct order and some might be missing they have field "BurstDataOffset" which tells to whoever processes nodes messages that this bursts fragment starts at at this byte-offset.

Below figure should illustrate how burst offset works:

Gcomplete_burstMeasurement IdBurst IdNodeIdValuemappingValuesbytes 0..95bytes 96..191bytes 192..281...bytes n-a..n-1frag0Measurement IdBurst IdNodeIdBurstDataOffset=0...Valuesbyte 0byte 1byte 2...byte 95complete_burst:burst0->frag0frag1Measurement IdBurst IdNodeIdBurstDataOffset=96...Valuesbyte 96byte 97byte 98...byte 191complete_burst:burst1->frag1frag2Measurement IdBurst IdNodeIdBurstDataOffset=192...Valuesbyte 192byte 193byte 194...byte 281complete_burst:burst2->frag2fragnMeasurement IdBurst IdNodeIdBurstDataOffset=n-a...Valuesbyte n-an-a+1n-a+2...byte n-1complete_burst:burstn->fragn

In addition to all of this data sent there is also field "FragCount" which should never be used when reconstructing the complete burst. Field "FragCount" is added by the gateway and is just incrementing counter of how many fragments have arrived to the gateway. This means that if a fragment with "BurstDataOffset" of 96 would come before fragment with "BurstDataOffset" of 0 it would get smaller "FragCount" than the fragment with offset of 0.


  1. Ids are not exactly unique but they cycle from 0..n depending on node. ↩︎


Was this article helpful? Let us know.
Previous