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

Definition at line 39 of file RadioState.h.


Member Enumeration Documentation

Possible states of the radio

Enumerator:
IDLE 
RECV 
TRANSMIT 
SLEEP 

Definition at line 43 of file RadioState.h.


Constructor & Destructor Documentation

RadioState::RadioState ( int  radioModuleId) [inline]

Constructor

Definition at line 70 of file RadioState.h.

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

Member Function Documentation

double RadioState::getBitrate ( ) const [inline]

function to get the bitrate

Definition at line 90 of file RadioState.h.

Referenced by AbstractRadio::encapsulatePacket(), AbstractRadio::handleCommand(), SnrEval::handleCommand(), and AbstractRadio::setBitrate().

{ return bitrate; }
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

Definition at line 75 of file RadioState.h.

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

Enables inspection

Definition at line 107 of file RadioState.h.

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

Definition at line 93 of file RadioState.h.

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

{ bitrate = d; }
void RadioState::setChannelNumber ( int  chan) [inline]

set the channel number (frequency)

Definition at line 87 of file RadioState.h.

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

{ channelNumber = chan; }
static const char* RadioState::stateName ( State  state) [inline, static]

Returns the name of the radio state in a readable form

Definition at line 96 of file RadioState.h.

                                              {
        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]

Definition at line 66 of file RadioState.h.

Definition at line 65 of file RadioState.h.

int RadioState::radioId [private]

Definition at line 63 of file RadioState.h.

Definition at line 64 of file RadioState.h.


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