INET Framework for OMNeT++/OMNEST
RadioState Class Reference

#include <RadioState.h>

List of all members.

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

Detailed Description

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

  • IDLE: channel is empty (radio is in receive mode)
  • RECV: channel is busy (radio is in receive mode)
  • TRANSMIT: the radio is transmitting
  • SLEEP: the radio is sleeping
Author:
Andreas Köpke, Andras Varga
See also:
NotificationBoard

Member Enumeration Documentation

Possible states of the radio

Enumerator:
IDLE 
RECV 
TRANSMIT 
SLEEP 

Constructor & Destructor Documentation

RadioState::RadioState ( int  radioModuleId) [inline]

Constructor

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

Member Function Documentation

double RadioState::getBitrate ( ) const [inline]
int RadioState::getChannelNumber ( ) const [inline]
int RadioState::getRadioId ( ) const [inline]

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

{ return radioId; }
std::string RadioState::info ( ) const [inline]

Enables inspection

Referenced by operator<<().

                           {
        std::stringstream out;
        out << stateName(state) << ", channel #" << channelNumber << ", " << (bitrate/1e6) << "Mbps ";
        return out.str();
    }
void RadioState::setBitrate ( double  d) [inline]

set the bitrate

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

{ bitrate = d; }
void RadioState::setChannelNumber ( int  chan) [inline]
static const char* RadioState::stateName ( State  state) [inline, static]

Returns the name of the radio state in a readable form

                                              {
        switch(state) {
            case IDLE: return "IDLE";
            case RECV: return "RECV";
            case TRANSMIT: return "TRANSMIT";
            case SLEEP: return "SLEEP";
            default: return "???";
        }
    }

Member Data Documentation

double RadioState::bitrate [private]
int RadioState::radioId [private]

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