Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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

enum RadioState::State
 

Possible states of the radio

Enumeration values:
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

double RadioState::getBitrate  )  const [inline]
 

function to get the bitrate

00090 { return bitrate; }

int RadioState::getChannelNumber  )  const [inline]
 

function to get the channel number (frequency)

00084 { return channelNumber; }

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]
 

Returns radio state

00078 { return state; }

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

Enables inspection

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

void RadioState::setBitrate double  d  )  [inline]
 

set the bitrate

00093 { bitrate = d; }

void RadioState::setChannelNumber int  chan  )  [inline]
 

set the channel number (frequency)

00087 { channelNumber = chan; }

void RadioState::setState State  s  )  [inline]
 

Sets the radio state

00081 { state = s; }

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     }


Member Data Documentation

double RadioState::bitrate [private]
 

int RadioState::channelNumber [private]
 

int RadioState::radioId [private]
 

State RadioState::state [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Oct 19 18:22:27 2006 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.0