SlottedMac Class Reference

A protocol which divides time into discrete slots during which packets can be transmitted. More...

#include <mac_protocol.hpp>

Inheritance diagram for SlottedMac:

MacProtocol SimulationEndListener RfidReaderMac RfidTagMac List of all members.

Public Types

typedef boost::shared_ptr<
SlottedMac
SlottedMacPtr
 Smart pointer that clients should use.

Public Member Functions

virtual ~SlottedMac ()
 A destructor.

Protected Member Functions

 SlottedMac (NodePtr node)
 A constructor.
virtual void beginSlotEvent ()=0
 This function is called whenever a slot begins.
void setSlotTime (const SimTime &slotTime)
 Set the time per slot.
SimTime getSlotTime () const
 Get the time per slot.
bool inContentionCycle () const
 Determine whether the node is currently engaged in a contention cycle.
void stopContentionCycle ()
 Stops a contention cycle by reseting the appropriate state variables to zero.

Protected Attributes

TimerPtr m_slotTimer
 A timer for when each slot begins.
t_uint m_currentSlotNumber
 The current slot number in the cycle.
t_uint m_txSlotNumber
 This object's chosen transmission slot.
t_uint m_numberOfSlots
 The number of slots in the current contention cycle.
PacketPtr m_packetToTransmit
 A pointer to the packet to transmit in the chosen slot.

Static Protected Attributes

static const double m_DEFAULT_SLOT_TIME = 2.0e-3
 The default time per slot.

Friends

class SlottedMacSlotEvent

Detailed Description

A protocol which divides time into discrete slots during which packets can be transmitted.

Definition at line 182 of file mac_protocol.hpp.


Member Function Documentation

SimTime SlottedMac::getSlotTime (  )  const [inline, protected]

Get the time per slot.

Returns:
the current time per slot.

Definition at line 237 of file mac_protocol.hpp.

Referenced by RfidTagMac::beginSlotEvent(), and RfidReaderMac::beginSlotEvent().

bool SlottedMac::inContentionCycle (  )  const [inline, protected]

Determine whether the node is currently engaged in a contention cycle.

Returns:
true if the node is in a contention cycle.

Definition at line 247 of file mac_protocol.hpp.

References m_currentSlotNumber, and m_numberOfSlots.

Referenced by RfidReaderMac::endRequestCycleEvent(), RfidTagMac::handleRecvdUpperLayerPacket(), and RfidTagMac::handleRequestPacket().

void SlottedMac::setSlotTime ( const SimTime slotTime  )  [inline, protected]

Set the time per slot.

Parameters:
slotTime the new time per slot.

Definition at line 228 of file mac_protocol.hpp.

Referenced by RfidReaderMac::RfidReaderMac(), and RfidTagMac::RfidTagMac().


Member Data Documentation

t_uint SlottedMac::m_numberOfSlots [protected]

The number of slots in the current contention cycle.

If m_currentSlotNumber < m_numberOfSlots, then the node is not currently engaged in a contention cycle.

Definition at line 208 of file mac_protocol.hpp.

Referenced by RfidTagMac::beginSlotEvent(), RfidReaderMac::beginSlotEvent(), RfidReaderMac::handlePacketSent(), RfidTagMac::handleRecvdUpperLayerPacket(), RfidTagMac::handleRequestPacket(), inContentionCycle(), RfidReaderMac::startNextContentionCycle(), and stopContentionCycle().


The documentation for this class was generated from the following files:
Generated on Tue Dec 12 17:04:42 2006 for rfidsim by  doxygen 1.4.7