Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Static Public Member Functions | Static Public Attributes
PacketStamper Class Reference

Detailed Description

Supplies functionality for timestamping data packets.

This class can analyze a data packet and create a proper packet id for it.

Definition at line 16 of file packetstamper.h.

#include <xSens_MT4/xcommunication/include/xsens/packetstamper.h>

Static Public Member Functions

static int64_t calculateLargePacketCounter8 (int64_t frameCounter, int64_t lastCounter)
 Calculate the new large packet counter value based on frameCounter and the lastCounter. More...
 
static int64_t calculateLargePacketCounter (int64_t frameCounter, int64_t lastCounter)
 Calculate the new large sample counter value based on frameCounter and the lastCounter. More...
 
static int64_t calculateLargeSampleTime (int64_t frameTime, int64_t lastTime)
 Calculate the new large sample time value based on frameTime and the lastTime. More...
 
static int64_t stampPacket (XsDataPacket &pack, XsDataPacket &highest)
 Create 64 bit counter for a packet. More...
 

Static Public Attributes

static const int64_t MTSCBOUNDARY = 0x00010000LL
 16 bit MT Sample Counter boundary More...
 
static const int64_t MTSCBOUNDARY_LOWMASK = (MTSCBOUNDARY - 1)
 16 bit MT Sample Counter boundary inclusive mask More...
 
static const int64_t MTSCBOUNDARY_HIGHMASK = (~MTSCBOUNDARY_LOWMASK)
 16 bit MT Sample Counter boundary exclusive mask More...
 
static const int64_t MTSCBOUNDARY_HALF = (MTSCBOUNDARY / 2)
 16 bit MT Sample Counter boundary/2, used for determining SC wrapping More...
 
static const int64_t SC8BOUNDARY = 0x00000100LL
 8 bit Sample Counter boundary More...
 
static const int64_t SC8BOUNDARY_LOWMASK = (SC8BOUNDARY - 1)
 8 bit Sample Counter boundary inclusive mask More...
 
static const int64_t SC8BOUNDARY_HIGHMASK = (~SC8BOUNDARY_LOWMASK)
 8 bit Sample Counter boundary exclusive mask More...
 
static const int64_t SC8BOUNDARY_HALF = (SC8BOUNDARY / 2)
 8 bit Sample Counter boundary/2, used for determining SC wrapping More...
 

Member Function Documentation

◆ calculateLargePacketCounter()

int64_t PacketStamper::calculateLargePacketCounter ( int64_t  frameCounter,
int64_t  lastCounter 
)
static

Calculate the new large sample counter value based on frameCounter and the lastCounter.

Wraparound is at the 16-bit boundary

Parameters
[in]frameCounterThe frame counter
[in]lastCounterThe last counter
Returns
The computed packet counter value
Note
If lastCounter < 0, returns frameCounter

Definition at line 127 of file packetstamper.cpp.

References MTSCBOUNDARY, MTSCBOUNDARY_HALF, and MTSCBOUNDARY_LOWMASK.

Referenced by stampPacket().

Here is the caller graph for this function:

◆ calculateLargePacketCounter8()

int64_t PacketStamper::calculateLargePacketCounter8 ( int64_t  frameCounter,
int64_t  lastCounter 
)
static

Calculate the new large packet counter value based on frameCounter and the lastCounter.

Wraparound is at the 8-bit boundary

Parameters
[in]frameCounterThe frame counter
[in]lastCounterThe last counter
Returns
The computed packet counter value
Note
If lastCounter < 0, returns frameCounter

Definition at line 102 of file packetstamper.cpp.

References SC8BOUNDARY, SC8BOUNDARY_HALF, and SC8BOUNDARY_LOWMASK.

Referenced by stampPacket().

Here is the caller graph for this function:

◆ calculateLargeSampleTime()

int64_t PacketStamper::calculateLargeSampleTime ( int64_t  frameTime,
int64_t  lastTime 
)
static

Calculate the new large sample time value based on frameTime and the lastTime.

Wraparound is at 864000000 (1 day @ 10kHz)

Parameters
[in]frameTimeThe frame time
[in]lastTimeThe last time
Returns
The computed packet counter value
Note
If lastTime < 0, returns frameTime

Definition at line 152 of file packetstamper.cpp.

Referenced by stampPacket().

Here is the caller graph for this function:

◆ stampPacket()

int64_t PacketStamper::stampPacket ( XsDataPacket pack,
XsDataPacket highestPacket 
)
static

Create 64 bit counter for a packet.

Wrap when new XsDataPacket is too far away from the previous XsDataPacket in time. Use half cache size as reasonable time difference When infinite cache, simply wrap when new is lower than old

Parameters
packThe XsDataPacket that needs its 64-bit sample counter updated
highestPacketThe highest packet available for the current device, it will be updated if the new counter is higher than the stored value.
Returns
The computed counter for the packet.
Todo:
This could be a (couple of) milliseconds too late, this should be set as soon as the source message arrives: mantis 7157

Definition at line 47 of file packetstamper.cpp.

References calculateLargePacketCounter(), calculateLargePacketCounter8(), calculateLargeSampleTime(), and mrpt::system::now().

Here is the call graph for this function:

Member Data Documentation

◆ MTSCBOUNDARY

const int64_t PacketStamper::MTSCBOUNDARY = 0x00010000LL
static

16 bit MT Sample Counter boundary

Definition at line 19 of file packetstamper.h.

Referenced by calculateLargePacketCounter().

◆ MTSCBOUNDARY_HALF

const int64_t PacketStamper::MTSCBOUNDARY_HALF = (MTSCBOUNDARY / 2)
static

16 bit MT Sample Counter boundary/2, used for determining SC wrapping

Definition at line 22 of file packetstamper.h.

Referenced by calculateLargePacketCounter().

◆ MTSCBOUNDARY_HIGHMASK

const int64_t PacketStamper::MTSCBOUNDARY_HIGHMASK = (~MTSCBOUNDARY_LOWMASK)
static

16 bit MT Sample Counter boundary exclusive mask

Definition at line 21 of file packetstamper.h.

◆ MTSCBOUNDARY_LOWMASK

const int64_t PacketStamper::MTSCBOUNDARY_LOWMASK = (MTSCBOUNDARY - 1)
static

16 bit MT Sample Counter boundary inclusive mask

Definition at line 20 of file packetstamper.h.

Referenced by calculateLargePacketCounter().

◆ SC8BOUNDARY

const int64_t PacketStamper::SC8BOUNDARY = 0x00000100LL
static

8 bit Sample Counter boundary

Definition at line 24 of file packetstamper.h.

Referenced by calculateLargePacketCounter8().

◆ SC8BOUNDARY_HALF

const int64_t PacketStamper::SC8BOUNDARY_HALF = (SC8BOUNDARY / 2)
static

8 bit Sample Counter boundary/2, used for determining SC wrapping

Definition at line 27 of file packetstamper.h.

Referenced by calculateLargePacketCounter8().

◆ SC8BOUNDARY_HIGHMASK

const int64_t PacketStamper::SC8BOUNDARY_HIGHMASK = (~SC8BOUNDARY_LOWMASK)
static

8 bit Sample Counter boundary exclusive mask

Definition at line 26 of file packetstamper.h.

◆ SC8BOUNDARY_LOWMASK

const int64_t PacketStamper::SC8BOUNDARY_LOWMASK = (SC8BOUNDARY - 1)
static

8 bit Sample Counter boundary inclusive mask

Definition at line 25 of file packetstamper.h.

Referenced by calculateLargePacketCounter8().




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019