DESERT 4.0.0
packer_uwRangingTDOA Class Reference

#include <packer-uwranging-tdoa.h>

Inheritance diagram for packer_uwRangingTDOA:
Inheritance graph
Collaboration diagram for packer_uwRangingTDOA:
Collaboration graph

Public Member Functions

 packer_uwRangingTDOA ()
 
virtual ~packer_uwRangingTDOA ()=default
 
- Public Member Functions inherited from packer
 packer (bool)
 
 ~packer ()
 
int command (int, const char *const *)
 
size_t getPayloadBytesLength ()
 
size_t getHdrBytesLength ()
 
size_t getPayloadBinLength ()
 
size_t getHdrBinLength ()
 
std::string packPayload (Packet *)
 
std::string packHdr (Packet *)
 
Packet * unpackPayload (Packet *)
 
Packet * unpackHdr (Packet *)
 
void printMap ()
 

Private Types

enum  nbits_index { SOURCE_PKT_ID_FIELD = 0 , SOURCE_NODE_ID_FIELD , TIMES_SIZE_FIELD , LAST_ELEM }
 

Private Member Functions

virtual void init () override
 
virtual size_t packMyHdr (Packet *p, unsigned char *buffer, size_t offset) override
 
virtual size_t unpackMyHdr (unsigned char *buffer, size_t offset, Packet *p) override
 
virtual void printMyHdrMap () override
 
virtual void printMyHdrFields (Packet *) override
 

Private Attributes

size_t source_pkt_id_Bits
 
size_t source_node_id_Bits
 
size_t times_size_Bits
 

Additional Inherited Members

- Static Public Member Functions inherited from packer
template<typename T >
static T restoreSignedValue (T _header_field, const uint32_t &_num_compressed_bits)
 
static std::string hexdump_nice (std::string)
 
static std::string hexdump_nice (const char *, size_t)
 
static std::string hexdump (std::string)
 
static std::string hex_bytes (float)
 
static std::string hex_bytes (double)
 
static std::string hex_bytes (const char &, const uint32_t &)
 
static std::string hex_bytes (const int8_t &, const uint32_t &)
 
static std::string hex_bytes (const int16_t &, const uint32_t &)
 
static std::string hex_bytes (const int32_t &, const uint32_t &)
 
static std::string hex_bytes (const int64_t &, const uint32_t &)
 
static std::string hex_bytes (const uint8_t &, const uint32_t &)
 
static std::string hex_bytes (const uint16_t &, const uint32_t &)
 
static std::string hex_bytes (const uint32_t &, const uint32_t &)
 
static std::string hex_bytes (const uint64_t &, const uint32_t &)
 
static std::string hexdump (const char *, size_t)
 
static std::string bindump (std::string)
 
static std::string bindump (const char *, size_t)
 
- Protected Member Functions inherited from packer
virtual void printMyHdrField (Packet *, int)
 
size_t getMyHdrBinLength ()
 
size_t get (unsigned char *buffer, size_t offset, void *val, size_t h)
 
size_t put (unsigned char *buffer, size_t offset, void *val, size_t h)
 
- Protected Attributes inherited from packer
std::vector< size_t > n_bits
 
int debug_
 

Detailed Description

Class to map a ns2 uwRangingTDOA header into a bit stream, and vice-versa.

Member Enumeration Documentation

◆ nbits_index

Index bits

Enumerator
SOURCE_PKT_ID_FIELD 

ID of the ranging packet.

SOURCE_NODE_ID_FIELD 

ID of the node.

TIMES_SIZE_FIELD 

Size of the payload.

LAST_ELEM 

Constructor & Destructor Documentation

◆ packer_uwRangingTDOA()

packer_uwRangingTDOA::packer_uwRangingTDOA ( )

Constructor packer_uwRangingTDOA class

References init(), source_node_id_Bits, source_pkt_id_Bits, and times_size_Bits.

Here is the call graph for this function:

◆ ~packer_uwRangingTDOA()

virtual packer_uwRangingTDOA::~packer_uwRangingTDOA ( )
virtualdefault

Destructor packer_uwRangingTDOA class

Member Function Documentation

◆ init()

void packer_uwRangingTDOA::init ( )
overrideprivatevirtual

Init the packer for uwRangingTDOA prototocol

Reimplemented from packer.

References packer::debug_, LAST_ELEM, packer::n_bits, source_node_id_Bits, SOURCE_NODE_ID_FIELD, source_pkt_id_Bits, SOURCE_PKT_ID_FIELD, times_size_Bits, and TIMES_SIZE_FIELD.

Referenced by packer_uwRangingTDOA().

◆ packMyHdr()

size_t packer_uwRangingTDOA::packMyHdr ( Packet *  p,
unsigned char *  buffer,
size_t  offset 
)
overrideprivatevirtual

Method to transform the headers of uwRangingTDOA protocol into a stream of bits

Parameters
Pointerto the packet to serialize
Pointerto the buffer
Offsetfrom the begin of the buffer
Returns
size_t New offset after packing the headers of the packets

Reimplemented from packer.

References packer::debug_, packer::n_bits, printMyHdrFields(), PT_UWRANGING_TDOA, packer::put(), hdr_ranging_tdoa::source_node_id, SOURCE_NODE_ID_FIELD, hdr_ranging_tdoa::source_pkt_id, SOURCE_PKT_ID_FIELD, hdr_ranging_tdoa::times_, hdr_ranging_tdoa::times_size(), hdr_ranging_tdoa::times_size_, and TIMES_SIZE_FIELD.

Here is the call graph for this function:

◆ printMyHdrFields()

void packer_uwRangingTDOA::printMyHdrFields ( Packet *  p)
overrideprivatevirtual

Method used for debug purposes. It prints the value of the headers of a packet

Parameters
Pointerof the packet

Reimplemented from packer.

References tdoa_entry::id, tdoa_entry::node, PT_UWRANGING_TDOA, hdr_ranging_tdoa::source_node_id, hdr_ranging_tdoa::source_pkt_id, tdoa_entry::time, hdr_ranging_tdoa::times_, hdr_ranging_tdoa::times_size(), and hdr_ranging_tdoa::times_size_.

Referenced by packMyHdr(), and unpackMyHdr().

Here is the call graph for this function:

◆ printMyHdrMap()

void packer_uwRangingTDOA::printMyHdrMap ( )
overrideprivatevirtual

Method used for debug purposes. It prints the number of bits for each header serialized

Reimplemented from packer.

References packer::n_bits, SOURCE_NODE_ID_FIELD, SOURCE_PKT_ID_FIELD, and TIMES_SIZE_FIELD.

◆ unpackMyHdr()

size_t packer_uwRangingTDOA::unpackMyHdr ( unsigned char *  buffer,
size_t  offset,
Packet *  p 
)
overrideprivatevirtual

Method responsible to take the informations from the received buffer and store it into the headers of the packet

Parameters
Pointerto the buffer received
Offsetfrom the begin of the buffer
Pointerto the new packet
Returns
size_t New offset after unpacking the headers

Reimplemented from packer.

References packer::debug_, packer::get(), packer::n_bits, printMyHdrFields(), PT_UWRANGING_TDOA, hdr_ranging_tdoa::source_node_id, SOURCE_NODE_ID_FIELD, hdr_ranging_tdoa::source_pkt_id, SOURCE_PKT_ID_FIELD, hdr_ranging_tdoa::times_, hdr_ranging_tdoa::times_size(), hdr_ranging_tdoa::times_size_, and TIMES_SIZE_FIELD.

Here is the call graph for this function:

Member Data Documentation

◆ source_node_id_Bits

size_t packer_uwRangingTDOA::source_node_id_Bits
private

Bit length of the source_node_id to be put in the header stream of bits.

Referenced by init(), and packer_uwRangingTDOA().

◆ source_pkt_id_Bits

size_t packer_uwRangingTDOA::source_pkt_id_Bits
private

Bit length of the source_pkt_id field to be put in the header stream of bits.

Referenced by init(), and packer_uwRangingTDOA().

◆ times_size_Bits

size_t packer_uwRangingTDOA::times_size_Bits
private

Bit length of the times_size_field to be put in the header stream of bits.

Referenced by init(), and packer_uwRangingTDOA().


The documentation for this class was generated from the following files: