DESERT 4.0.0
UwTDMA Class Reference

#include <uwtdma.h>

Inheritance diagram for UwTDMA:
Inheritance graph
Collaboration diagram for UwTDMA:
Collaboration graph

Public Member Functions

 UwTDMA ()
 
virtual ~UwTDMA ()
 
virtual int recvSyncClMsg (ClMessage *m)
 

Protected Types

enum  UWTDMA_STATUS { IDLE , TRANSMITTING , RECEIVING }
 

Protected Member Functions

virtual void txData ()
 
virtual void stateTxData ()
 
virtual void changeStatus ()
 
virtual void start (double delay)
 
virtual void stop ()
 
virtual void recvFromUpperLayers (Packet *p)
 
virtual void Phy2MacEndRx (Packet *p)
 
virtual void Phy2MacStartRx (const Packet *p)
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p)
 
virtual void rxPacketNotForMe (Packet *p)
 
virtual void initPkt (Packet *p)
 
unsigned long int getEpoch ()
 
virtual int command (int argc, const char *const *argv)
 

Protected Attributes

UWTDMA_STATUS transceiver_status
 
int slot_status
 
int debug_
 
int sea_trial_
 
int fair_mode
 
int tot_slots
 
int slot_number
 
int HDR_size
 
double frame_duration
 
double guard_time
 
double slot_duration
 
double start_time
 
UwTDMATimer tdma_timer
 
std::deque< Packet * > buffer
 
std::ofstream out_file_stats
 
bool enable
 
int max_queue_size
 
int max_packet_per_slot
 
int packet_sent_curr_slot_
 
int drop_old_
 
std::string name_label_
 
int checkPriority
 

Friends

class UwTDMATimer
 

Detailed Description

Class that represents a TDMA Node

Member Enumeration Documentation

◆ UWTDMA_STATUS

enum UwTDMA::UWTDMA_STATUS
protected

Enumeration class of UWTDMA status.

Enumerator
IDLE 
TRANSMITTING 
RECEIVING 

Constructor & Destructor Documentation

◆ UwTDMA()

UwTDMA::UwTDMA ( )

◆ ~UwTDMA()

UwTDMA::~UwTDMA ( )
virtual

Destructor of the TDMA class

Member Function Documentation

◆ changeStatus()

void UwTDMA::changeStatus ( )
protectedvirtual

Alternate TDMA status between MY_STATUS and NOT_MY_STATUS

Reimplemented in UwTDMA_frame.

References debug_, frame_duration, getEpoch(), guard_time, out_file_stats, packet_sent_curr_slot_, sea_trial_, slot_duration, slot_status, stateTxData(), and tdma_timer.

Referenced by UwTDMA_frame::changeStatus().

Here is the call graph for this function:

◆ command()

int UwTDMA::command ( int  argc,
const char *const *  argv 
)
protectedvirtual

TCL command interpreter. It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

Reimplemented in UwTDMA_frame, and UwRangingTDMA.

References buffer, debug_, fair_mode, frame_duration, guard_time, name_label_, slot_duration, slot_number, start(), start_time, stop(), and tot_slots.

Referenced by UwTDMA_frame::command(), UwRangingTDMA::command(), and recvSyncClMsg().

Here is the call graph for this function:

◆ getEpoch()

unsigned long int UwTDMA::getEpoch ( )
inlineprotected

Calculate the epoch of the event. Used in sea-trial mode

Returns
the epoch of the system

Referenced by UwTDMA_frame::changeStatus(), changeStatus(), Mac2PhyStartTx(), Phy2MacEndRx(), Phy2MacEndTx(), start(), stop(), and txData().

◆ initPkt()

void UwTDMA::initPkt ( Packet *  p)
protectedvirtual

Method called to add the MAC header size

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References HDR_size.

Referenced by recvFromUpperLayers().

◆ Mac2PhyStartTx()

void UwTDMA::Mac2PhyStartTx ( Packet *  p)
protectedvirtual

Method called when the Mac Layer start to transmit a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

Reimplemented in UwRangingTDMA.

References debug_, getEpoch(), IDLE, max_packet_per_slot, out_file_stats, packet_sent_curr_slot_, sea_trial_, transceiver_status, and TRANSMITTING.

Referenced by txData().

Here is the call graph for this function:

◆ Phy2MacEndRx()

void UwTDMA::Phy2MacEndRx ( Packet *  p)
protectedvirtual

Method called when the Phy Layer finish to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

Reimplemented in UwRangingTDMA.

References debug_, getEpoch(), IDLE, out_file_stats, rxPacketNotForMe(), sea_trial_, slot_status, transceiver_status, TRANSMITTING, and txData().

Referenced by UwRangingTDMA::Phy2MacEndRx().

Here is the call graph for this function:

◆ Phy2MacEndTx()

void UwTDMA::Phy2MacEndTx ( const Packet *  p)
protectedvirtual

Method called when the Mac Layer finish to transmit a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in transmission

References getEpoch(), IDLE, out_file_stats, packet_sent_curr_slot_, sea_trial_, transceiver_status, and txData().

Here is the call graph for this function:

◆ Phy2MacStartRx()

void UwTDMA::Phy2MacStartRx ( const Packet *  p)
protectedvirtual

Method called when the Phy Layer start to receive a Packet

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

Reimplemented in UwRangingTDMA.

References IDLE, RECEIVING, sea_trial_, and transceiver_status.

◆ recvFromUpperLayers()

void UwTDMA::recvFromUpperLayers ( Packet *  p)
protectedvirtual

Receive the packet from the upper layer (e.g. IP)

Parameters
Packet*pointer to the packet received

References buffer, checkPriority, debug_, drop_old_, initPkt(), max_queue_size, hdr_uwcbr::priority(), and txData().

Here is the call graph for this function:

◆ recvSyncClMsg()

int UwTDMA::recvSyncClMsg ( ClMessage *  m)
virtual

Cross-Layer messages synchronous interpreter.

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

References CLMSG_UWMMAC_ENABLE, command(), ClMsgUwMmac::SET_REPLY, ClMsgUwMmac::SET_REQ, start(), start_time, and stop().

Here is the call graph for this function:

◆ rxPacketNotForMe()

void UwTDMA::rxPacketNotForMe ( Packet *  p)
protectedvirtual

Method called when the Packet received is determined to be not for me

Parameters
constPacket* Pointer to an Packet object that rapresent the Packet in reception

Referenced by Phy2MacEndRx().

◆ start()

void UwTDMA::start ( double  delay)
protectedvirtual

Schedule the beginning of each TDMA cycle, each one after delay

Parameters
delayto await before starting the TDMA

References debug_, enable, getEpoch(), name_label_, out_file_stats, sea_trial_, slot_status, and tdma_timer.

Referenced by UwTDMA_frame::command(), command(), and recvSyncClMsg().

Here is the call graph for this function:

◆ stateTxData()

void UwTDMA::stateTxData ( )
protectedvirtual

Change transceiver status and and start to transmit if in my slot Used when there's spare time, useful for transmitting other packtes.

Reimplemented in UwRangingTDMA.

References txData().

Referenced by changeStatus().

Here is the call graph for this function:

◆ stop()

void UwTDMA::stop ( )
protectedvirtual

Terminate a TDMA cycle, essentially cancel the TDMA timer

References enable, getEpoch(), out_file_stats, sea_trial_, and tdma_timer.

Referenced by UwTDMA_frame::command(), command(), and recvSyncClMsg().

Here is the call graph for this function:

◆ txData()

void UwTDMA::txData ( )
protectedvirtual

Transmit a data packet if in my slot

References buffer, debug_, getEpoch(), IDLE, Mac2PhyStartTx(), max_packet_per_slot, out_file_stats, packet_sent_curr_slot_, sea_trial_, slot_status, and transceiver_status.

Referenced by Phy2MacEndRx(), Phy2MacEndTx(), recvFromUpperLayers(), and stateTxData().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ UwTDMATimer

friend class UwTDMATimer
friend

Member Data Documentation

◆ buffer

std::deque<Packet *> UwTDMA::buffer
protected

Buffer of the MAC node

Referenced by command(), recvFromUpperLayers(), and txData().

◆ checkPriority

int UwTDMA::checkPriority
protected

flag to set to 1 if UWCBR module uses packets with priority, set to 0 otherwise. Priority can be used only with UWCBR module

Referenced by recvFromUpperLayers(), and UwTDMA().

◆ debug_

◆ drop_old_

int UwTDMA::drop_old_
protected

flag to set the drop packet policy in case of buffer overflow: if 0 (default) drops the new packet, if 1 the oldest

Referenced by recvFromUpperLayers(), and UwTDMA().

◆ enable

bool UwTDMA::enable
protected

Referenced by start(), and stop().

◆ fair_mode

int UwTDMA::fair_mode
protected

Fair modality on if 1: then only set tot_slots and common guard_time

Referenced by UwTDMA_frame::command(), command(), UwTDMA(), and UwTDMA_frame::UwTDMA_frame().

◆ frame_duration

double UwTDMA::frame_duration
protected

Frame duration

Referenced by changeStatus(), UwTDMA_frame::command(), command(), and UwTDMA().

◆ guard_time

double UwTDMA::guard_time
protected

◆ HDR_size

int UwTDMA::HDR_size
protected

Size of the HDR if any

Referenced by initPkt(), and UwTDMA().

◆ max_packet_per_slot

int UwTDMA::max_packet_per_slot
protected

max numer of packet it can transmit per slot

Referenced by Mac2PhyStartTx(), txData(), and UwTDMA().

◆ max_queue_size

int UwTDMA::max_queue_size
protected

Maximum dimension of Queue

Referenced by recvFromUpperLayers(), and UwTDMA().

◆ name_label_

std::string UwTDMA::name_label_
protected

label added in the log file, empty string by default

Referenced by command(), and start().

◆ out_file_stats

std::ofstream UwTDMA::out_file_stats
protected

◆ packet_sent_curr_slot_

int UwTDMA::packet_sent_curr_slot_
protected

counter of packet has been sent in the current slot

Referenced by changeStatus(), Mac2PhyStartTx(), Phy2MacEndTx(), and txData().

◆ sea_trial_

◆ slot_duration

double UwTDMA::slot_duration
protected

◆ slot_number

int UwTDMA::slot_number
protected

set the position of the node in the frame (fair_mode) (starting from 0 to tot_slots-1)

Referenced by command(), UwTDMA_frame::initializeTopologyS(), and UwRangingTDMA::UwRangingTDMA().

◆ slot_status

int UwTDMA::slot_status
protected

Is it my turn to transmit data?

Referenced by UwTDMA_frame::changeStatus(), changeStatus(), Phy2MacEndRx(), start(), and txData().

◆ start_time

double UwTDMA::start_time
protected

Time to wait before starting the protocol

Referenced by UwTDMA_frame::command(), command(), and recvSyncClMsg().

◆ tdma_timer

UwTDMATimer UwTDMA::tdma_timer
protected

TDMA timer handler

Referenced by UwTDMA_frame::changeStatus(), changeStatus(), start(), and stop().

◆ tot_slots

◆ transceiver_status


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