INET Framework for OMNeT++/OMNEST
inet::physicallayer::IRadio Class Referenceabstract

This interface represents a physical device that is capable of transmitting and receiving radio signals. More...

#include <IRadio.h>

Inheritance diagram for inet::physicallayer::IRadio:
inet::IPhysicalLayer inet::physicallayer::IPrintableObject inet::physicallayer::Radio inet::physicallayer::NarrowbandRadioBase inet::physicallayer::FlatRadioBase inet::physicallayer::APSKRadio inet::physicallayer::Ieee80211Radio

Public Types

enum  RadioMode {
  RADIO_MODE_OFF, RADIO_MODE_SLEEP, RADIO_MODE_RECEIVER, RADIO_MODE_TRANSMITTER,
  RADIO_MODE_TRANSCEIVER, RADIO_MODE_SWITCHING
}
 This enumeration specifies the requested operational mode of the radio. More...
 
enum  ReceptionState { RECEPTION_STATE_UNDEFINED, RECEPTION_STATE_IDLE, RECEPTION_STATE_BUSY, RECEPTION_STATE_RECEIVING }
 This enumeration specifies the reception state of the radio. More...
 
enum  TransmissionState { TRANSMISSION_STATE_UNDEFINED, TRANSMISSION_STATE_IDLE, TRANSMISSION_STATE_TRANSMITTING }
 This enumeration specifies the transmission state of the radio. More...
 
- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Public Member Functions

virtual const cGate * getRadioGate () const =0
 Returns the gate of the radio that receives incoming radio frames. More...
 
virtual RadioMode getRadioMode () const =0
 Returns the current radio mode, This is the same mode as the one emitted with the last radioModeChangedSignal. More...
 
virtual void setRadioMode (RadioMode radioMode)=0
 Changes the current radio mode. More...
 
virtual ReceptionState getReceptionState () const =0
 Returns the current radio reception state. More...
 
virtual TransmissionState getTransmissionState () const =0
 Returns the current radio transmission state. More...
 
virtual int getId () const =0
 Returns an identifier for this radio which is globally unique for the whole lifetime of the simulation among all radios. More...
 
virtual const IAntennagetAntenna () const =0
 Returns the antenna used by the transceiver of this radio. More...
 
virtual const ITransmittergetTransmitter () const =0
 Returns the transmitter part of this radio. More...
 
virtual const IReceivergetReceiver () const =0
 Returns the receiver part of this radio. More...
 
virtual const IRadioMediumgetMedium () const =0
 Returns the radio medium where this radio is transmitting and receiving radio signals. More...
 
virtual const ITransmissiongetTransmissionInProgress () const =0
 Returns the ongoing transmission that the transmitter is currently transmitting or nullptr. More...
 
virtual const ITransmissiongetReceptionInProgress () const =0
 Returns the ongoing reception that the receiver is currently receiving or nullptr. More...
 
virtual IRadioSignal::SignalPart getTransmittedSignalPart () const =0
 Returns the signal part of the ongoing transmission that the transmitter is currently transmitting or -1 if no transmission is in progress. More...
 
virtual IRadioSignal::SignalPart getReceivedSignalPart () const =0
 Returns the signal part of the ongoing reception that the receiver is currently receiving or -1 if no reception is in progress. More...
 
- Public Member Functions inherited from inet::IPhysicalLayer
virtual ~IPhysicalLayer ()
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const
 Prints this object to the provided output stream. More...
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Static Public Member Functions

static const char * getRadioModeName (RadioMode radioMode)
 Returns the name of the provided radio mode. More...
 
static const char * getRadioReceptionStateName (ReceptionState receptionState)
 Returns the name of the provided radio reception state. More...
 
static const char * getRadioTransmissionStateName (TransmissionState transmissionState)
 Returns the name of the provided radio transmission state. More...
 

Static Public Attributes

static simsignal_t radioModeChangedSignal = cComponent::registerSignal("radioModeChanged")
 This signal is emitted every time the radio mode changes. More...
 
static simsignal_t listeningChangedSignal = cComponent::registerSignal("listeningChanged")
 This signal is emitted every time the radio listening changes. More...
 
static simsignal_t receptionStateChangedSignal = cComponent::registerSignal("receptionStateChanged")
 This signal is emitted every time the radio reception state changes. More...
 
static simsignal_t transmissionStateChangedSignal = cComponent::registerSignal("transmissionStateChanged")
 This signal is emitted every time the radio transmission state changes. More...
 
static simsignal_t receivedSignalPartChangedSignal = cComponent::registerSignal("receivedSignalPartChanged")
 This signal is emitted every time the received part changes. More...
 
static simsignal_t transmittedSignalPartChangedSignal = cComponent::registerSignal("transmittedSignalPartChanged")
 This signal is emitted every time the transmitted part changes. More...
 

Static Protected Attributes

static int nextId = 0
 
static cEnum * radioModeEnum = nullptr
 The enumeration registered for radio mode. More...
 
static cEnum * receptionStateEnum = nullptr
 The enumeration registered for radio reception state. More...
 
static cEnum * transmissionStateEnum = nullptr
 The enumeration registered for radio transmission state. More...
 

Detailed Description

This interface represents a physical device that is capable of transmitting and receiving radio signals.

Simultaneous reception and transmission is also supported. The radio has an operation mode and it provides the state of the radio medium at its position.

Author
Levente Meszaros

Member Enumeration Documentation

This enumeration specifies the requested operational mode of the radio.

NOTE: Some parts of the code base may be sensitive to the order of the enum items because they may be used as an array index.

Enumerator
RADIO_MODE_OFF 

The radio is turned off, frame reception or transmission is not possible, power consumption is zero, radio mode switching is slow.

RADIO_MODE_SLEEP 

The radio is sleeping, frame reception or transmission is not possible, power consumption is minimal, radio mode switching is fast.

RADIO_MODE_RECEIVER 

The radio is prepared for frame reception, frame transmission is not possible, power consumption is low when receiver is idle and medium when receiving.

RADIO_MODE_TRANSMITTER 

The radio is prepared for frame transmission, frame reception is not possible, power consumption is low when transmitter is idle and high when transmitting.

RADIO_MODE_TRANSCEIVER 

The radio is prepared for simultaneous frame reception and transmission, power consumption is low when transceiver is idle, medium when receiving and high when transmitting.

RADIO_MODE_SWITCHING 

The radio is switching from one mode to another, frame reception or transmission is not possible, power consumption is minimal.

91  {
97 
103 
110 
117 
124 
129  RADIO_MODE_SWITCHING // this radio mode must be the very last
130  };
The radio is prepared for frame transmission, frame reception is not possible, power consumption is l...
Definition: IRadio.h:116
The radio is sleeping, frame reception or transmission is not possible, power consumption is minimal...
Definition: IRadio.h:102
The radio is prepared for frame reception, frame transmission is not possible, power consumption is l...
Definition: IRadio.h:109
The radio is prepared for simultaneous frame reception and transmission, power consumption is low whe...
Definition: IRadio.h:123
The radio is turned off, frame reception or transmission is not possible, power consumption is zero...
Definition: IRadio.h:96
The radio is switching from one mode to another, frame reception or transmission is not possible...
Definition: IRadio.h:129

This enumeration specifies the reception state of the radio.

This also determines the state of the radio medium.

Enumerator
RECEPTION_STATE_UNDEFINED 

The radio medium state is unknown, reception state is meaningless, signal detection is not possible.

(e.g. the radio mode is off, sleep or transmitter)

RECEPTION_STATE_IDLE 

The radio medium is free, no signal is detected.

(e.g. the RSSI is below the energy detection threshold)

RECEPTION_STATE_BUSY 

The radio medium is busy, a signal is detected but it is not strong enough to receive.

(e.g. the RSSI is above the energy detection threshold but below the reception threshold)

RECEPTION_STATE_RECEIVING 

The radio medium is busy, a signal strong enough to receive is detected.

(e.g. the SNIR was above the reception threshold)

136  {
143 
149 
156 
162  };
The radio medium is busy, a signal strong enough to receive is detected.
Definition: IRadio.h:161
The radio medium state is unknown, reception state is meaningless, signal detection is not possible...
Definition: IRadio.h:142
The radio medium is busy, a signal is detected but it is not strong enough to receive.
Definition: IRadio.h:155
The radio medium is free, no signal is detected.
Definition: IRadio.h:148

This enumeration specifies the transmission state of the radio.

Enumerator
TRANSMISSION_STATE_UNDEFINED 

The transmission state is undefined or meaningless.

(e.g. the radio mode is off, sleep or receiver)

TRANSMISSION_STATE_IDLE 

The radio is not transmitting a signal on the radio medium.

(e.g. the last transmission has been completed)

TRANSMISSION_STATE_TRANSMITTING 

The radio medium is busy, the radio is currently transmitting a signal.

167  {
173 
179 
184  };
The radio is not transmitting a signal on the radio medium.
Definition: IRadio.h:178
The radio medium is busy, the radio is currently transmitting a signal.
Definition: IRadio.h:183
The transmission state is undefined or meaningless.
Definition: IRadio.h:172

Member Function Documentation

virtual const IAntenna* inet::physicallayer::IRadio::getAntenna ( ) const
pure virtual
virtual const cGate* inet::physicallayer::IRadio::getRadioGate ( ) const
pure virtual

Returns the gate of the radio that receives incoming radio frames.

Implemented in inet::physicallayer::Radio.

virtual RadioMode inet::physicallayer::IRadio::getRadioMode ( ) const
pure virtual
const char * inet::physicallayer::IRadio::getRadioModeName ( RadioMode  radioMode)
static

Returns the name of the provided radio mode.

Referenced by inet::physicallayer::Radio::completeRadioModeSwitch(), and inet::physicallayer::Radio::startRadioModeSwitch().

57 {
58  if (!radioModeEnum)
59  radioModeEnum = cEnum::get(opp_typename(typeid(IRadio::RadioMode)));
60  return radioModeEnum->getStringFor(radioMode) + 11;
61 }
static cEnum * radioModeEnum
The enumeration registered for radio mode.
Definition: IRadio.h:190
RadioMode
This enumeration specifies the requested operational mode of the radio.
Definition: IRadio.h:91
const char * inet::physicallayer::IRadio::getRadioReceptionStateName ( ReceptionState  receptionState)
static

Returns the name of the provided radio reception state.

Referenced by inet::physicallayer::Radio::updateTransceiverState().

64 {
65  if (!receptionStateEnum)
66  receptionStateEnum = cEnum::get(opp_typename(typeid(IRadio::ReceptionState)));
67  return receptionStateEnum->getStringFor(receptionState) + 16;
68 }
ReceptionState
This enumeration specifies the reception state of the radio.
Definition: IRadio.h:136
static cEnum * receptionStateEnum
The enumeration registered for radio reception state.
Definition: IRadio.h:195
const char * inet::physicallayer::IRadio::getRadioTransmissionStateName ( TransmissionState  transmissionState)
static

Returns the name of the provided radio transmission state.

Referenced by inet::physicallayer::Radio::updateTransceiverState().

71 {
73  transmissionStateEnum = cEnum::get(opp_typename(typeid(IRadio::TransmissionState)));
74  return transmissionStateEnum->getStringFor(transmissionState) + 19;
75 }
TransmissionState
This enumeration specifies the transmission state of the radio.
Definition: IRadio.h:167
static cEnum * transmissionStateEnum
The enumeration registered for radio transmission state.
Definition: IRadio.h:200
virtual IRadioSignal::SignalPart inet::physicallayer::IRadio::getReceivedSignalPart ( ) const
pure virtual

Returns the signal part of the ongoing reception that the receiver is currently receiving or -1 if no reception is in progress.

This is the same part as the one emitted with the last receivedPartChangedSignal.

Implemented in inet::physicallayer::Radio.

Referenced by inet::physicallayer::StateBasedCcEnergyConsumer::computeCurrentConsumption(), and inet::physicallayer::StateBasedEpEnergyConsumer::computePowerConsumption().

virtual const ITransmission* inet::physicallayer::IRadio::getReceptionInProgress ( ) const
pure virtual

Returns the ongoing reception that the receiver is currently receiving or nullptr.

Implemented in inet::physicallayer::Radio.

Referenced by inet::physicallayer::ReceiverBase::computeIsReceptionAttempted().

virtual ReceptionState inet::physicallayer::IRadio::getReceptionState ( ) const
pure virtual
virtual const ITransmission* inet::physicallayer::IRadio::getTransmissionInProgress ( ) const
pure virtual

Returns the ongoing transmission that the transmitter is currently transmitting or nullptr.

Implemented in inet::physicallayer::Radio.

virtual TransmissionState inet::physicallayer::IRadio::getTransmissionState ( ) const
pure virtual

Returns the current radio transmission state.

This is the same state as the one emitted with the last transmissionStateChangedSignal.

Implemented in inet::physicallayer::Radio.

Referenced by inet::physicallayer::StateBasedCcEnergyConsumer::computeCurrentConsumption(), inet::physicallayer::StateBasedEpEnergyConsumer::computePowerConsumption(), inet::BMacLayer::handleSelfMessage(), and inet::IdealMac::handleUpperPacket().

virtual IRadioSignal::SignalPart inet::physicallayer::IRadio::getTransmittedSignalPart ( ) const
pure virtual

Returns the signal part of the ongoing transmission that the transmitter is currently transmitting or -1 if no transmission is in progress.

This is the same part as the one emitted with the last transmittedPartChangedSignal.

Implemented in inet::physicallayer::Radio.

Referenced by inet::physicallayer::StateBasedCcEnergyConsumer::computeCurrentConsumption(), and inet::physicallayer::StateBasedEpEnergyConsumer::computePowerConsumption().

virtual const ITransmitter* inet::physicallayer::IRadio::getTransmitter ( ) const
pure virtual

Member Data Documentation

simsignal_t inet::physicallayer::IRadio::listeningChangedSignal = cComponent::registerSignal("listeningChanged")
static
int inet::physicallayer::IRadio::nextId = 0
staticprotected
cEnum * inet::physicallayer::IRadio::radioModeEnum = nullptr
staticprotected

The enumeration registered for radio mode.

Referenced by getRadioModeName().

simsignal_t inet::physicallayer::IRadio::receivedSignalPartChangedSignal = cComponent::registerSignal("receivedSignalPartChanged")
static
cEnum * inet::physicallayer::IRadio::receptionStateEnum = nullptr
staticprotected

The enumeration registered for radio reception state.

Referenced by getRadioReceptionStateName().

cEnum * inet::physicallayer::IRadio::transmissionStateEnum = nullptr
staticprotected

The enumeration registered for radio transmission state.

Referenced by getRadioTransmissionStateName().

simsignal_t inet::physicallayer::IRadio::transmittedSignalPartChangedSignal = cComponent::registerSignal("transmittedSignalPartChanged")
static

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