RadioState Class Reference

#include <RadioState.h>

List of all members.


Detailed Description

Holds the current state and other properties of the radio. Possible states are:

Author:
Andreas Köpke, Andras Varga
See also:
NotificationBoard

Public Types

enum  State { IDLE, RECV, TRANSMIT, SLEEP }

Public Member Functions

 RadioState (int radioModuleId)
int getRadioId () const
State getState () const
void setState (State s)
int getChannelNumber () const
void setChannelNumber (int chan)
double getBitrate () const
void setBitrate (double d)
std::string info () const

Static Public Member Functions

static const char * stateName (State state)

Private Attributes

int radioId
State state
int channelNumber
double bitrate

Member Enumeration Documentation

Possible states of the radio

Enumerator:
IDLE 
RECV 
TRANSMIT 
SLEEP 
00044     {
00045       IDLE,
00046       RECV,
00047       TRANSMIT,
00048       SLEEP
00049     };


Constructor & Destructor Documentation

RadioState::RadioState ( int  radioModuleId  )  [inline]

Constructor

00070                                   : cPolymorphic() {
00071         radioId = radioModuleId; state = IDLE; channelNumber = -1; bitrate = -1;
00072     }


Member Function Documentation

int RadioState::getRadioId (  )  const [inline]

id of the radio/snrEval module -- identifies the radio in case there're more than one in the host

00075 { return radioId; }

State RadioState::getState (  )  const [inline]

void RadioState::setState ( State  s  )  [inline]

int RadioState::getChannelNumber (  )  const [inline]

void RadioState::setChannelNumber ( int  chan  )  [inline]

set the channel number (frequency)

Referenced by SnrEval::changeChannel(), AbstractRadio::changeChannel(), SnrEval::initialize(), and AbstractRadio::initialize().

00087 { channelNumber = chan; }

double RadioState::getBitrate (  )  const [inline]

void RadioState::setBitrate ( double  d  )  [inline]

set the bitrate

Referenced by AbstractRadio::initialize(), and AbstractRadio::setBitrate().

00093 { bitrate = d; }

static const char* RadioState::stateName ( State  state  )  [inline, static]

Returns the name of the radio state in a readable form

00096                                               {
00097         switch(state) {
00098             case IDLE: return "IDLE";
00099             case RECV: return "RECV";
00100             case TRANSMIT: return "TRANSMIT";
00101             case SLEEP: return "SLEEP";
00102             default: return "???";
00103         }
00104     }

std::string RadioState::info (  )  const [inline]

Enables inspection

Referenced by operator<<().

00107                            {
00108         std::stringstream out;
00109         out << stateName(state) << ", channel #" << channelNumber << ", " << (bitrate/1e6) << "Mbps ";
00110         return out.str();
00111     }


Member Data Documentation

int RadioState::radioId [private]

double RadioState::bitrate [private]


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

Generated on Fri Mar 20 18:51:20 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5