DUNE: Uniform Navigational Environment  2020.01.0
DUNE::Network::TDMA Class Reference

Detailed Description

Time division multiple access (TDMA) is a channel access method for shared medium networks.

This class allows to setup a TDMA scheme and to signal when to establish communication.

Author
José Braga.

Public Member Functions

 TDMA (void)
 
 TDMA (unsigned slot_count, std::vector< unsigned > &slot_number, unsigned duration)
 
bool check (const IMC::GpsFix *msg)
 
bool check (float utc_time)
 
void setTotalSlots (unsigned number)
 
void setSlotNumber (std::vector< unsigned > &number)
 
void setDuration (unsigned number)
 
void reset (void)
 
void reset (unsigned slot_count, std::vector< unsigned > &slot_number, unsigned duration)
 

Constructor & Destructor Documentation

DUNE::Network::TDMA::TDMA ( void  )
inline

Empty Constructor.

DUNE::Network::TDMA::TDMA ( unsigned  slot_count,
std::vector< unsigned > &  slot_number,
unsigned  duration 
)
inline

Constructor.

Parameters
[in]slot_counttotal number of slots.
[in]slot_numberslots.
[in]durationslots duration in seconds.

References reset().

Member Function Documentation

bool DUNE::Network::TDMA::check ( const IMC::GpsFix msg)
inline

Check if we reached TDMA slot.

Parameters
[in]msgGPS fix.
Returns
true if we are in slot, false otherwise.

References DUNE::IMC::GpsFix::utc_time.

bool DUNE::Network::TDMA::check ( float  utc_time)
inline

Check if we reached TDMA slot.

Parameters
[in]utc_timeUTC Time.
Returns
true if we are in slot, false otherwise.

References DUNE::Math::round().

void DUNE::Network::TDMA::reset ( void  )
inline

Reset TDMA slots.

Referenced by TDMA().

void DUNE::Network::TDMA::reset ( unsigned  slot_count,
std::vector< unsigned > &  slot_number,
unsigned  duration 
)
inline

Reset TDMA slots with given parameters.

Parameters
[in]slot_counttotal number of slots.
[in]slot_numberslots.
[in]durationslots duration in seconds.

References setDuration(), setSlotNumber(), and setTotalSlots().

void DUNE::Network::TDMA::setDuration ( unsigned  number)
inline

Set slot duration.

Parameters
[in]numberslot duration.

Referenced by reset().

void DUNE::Network::TDMA::setSlotNumber ( std::vector< unsigned > &  number)
inline

Set slot number.

Parameters
[in]numberslot number.

Referenced by reset().

void DUNE::Network::TDMA::setTotalSlots ( unsigned  number)
inline

Set number of total slots.

Parameters
[in]numbertotal number of slots.

Referenced by reset().

Collaboration diagram for DUNE::Network::TDMA:
Collaboration graph