INET Framework for OMNeT++/OMNEST
inet::physicallayer::Ieee80211Radio Class Reference

#include <Ieee80211Radio.h>

Inheritance diagram for inet::physicallayer::Ieee80211Radio:
inet::physicallayer::FlatRadioBase inet::physicallayer::NarrowbandRadioBase inet::physicallayer::Radio inet::PhysicalLayerBase inet::physicallayer::IRadio inet::OperationalBase inet::IPhysicalLayer inet::IPhysicalLayer inet::physicallayer::IPrintableObject inet::ILifecycle

Public Member Functions

 Ieee80211Radio ()
 
virtual void setModeSet (const Ieee80211ModeSet *modeSet)
 
virtual void setMode (const IIeee80211Mode *mode)
 
virtual void setBand (const IIeee80211Band *band)
 
virtual void setChannel (const Ieee80211Channel *channel)
 
virtual void setChannelNumber (int newChannelNumber)
 
- Public Member Functions inherited from inet::physicallayer::FlatRadioBase
 FlatRadioBase ()
 
virtual void setPower (W newPower)
 
virtual void setBitrate (bps newBitrate)
 
- Public Member Functions inherited from inet::physicallayer::NarrowbandRadioBase
 NarrowbandRadioBase ()
 
virtual void setModulation (const IModulation *newModulation)
 
virtual void setCarrierFrequency (Hz newCarrierFrequency)
 
virtual void setBandwidth (Hz newBandwidth)
 
- Public Member Functions inherited from inet::physicallayer::Radio
 Radio ()
 
virtual ~Radio ()
 
virtual int getId () const override
 Returns an identifier for this radio which is globally unique for the whole lifetime of the simulation among all radios. More...
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual const IAntennagetAntenna () const override
 Returns the antenna used by the transceiver of this radio. More...
 
virtual const ITransmittergetTransmitter () const override
 Returns the transmitter part of this radio. More...
 
virtual const IReceivergetReceiver () const override
 Returns the receiver part of this radio. More...
 
virtual const IRadioMediumgetMedium () const override
 Returns the radio medium where this radio is transmitting and receiving radio signals. More...
 
virtual const cGate * getRadioGate () const override
 Returns the gate of the radio that receives incoming radio frames. More...
 
virtual RadioMode getRadioMode () const override
 Returns the current radio mode, This is the same mode as the one emitted with the last radioModeChangedSignal. More...
 
virtual void setRadioMode (RadioMode newRadioMode) override
 Changes the current radio mode. More...
 
virtual ReceptionState getReceptionState () const override
 Returns the current radio reception state. More...
 
virtual TransmissionState getTransmissionState () const override
 Returns the current radio transmission state. More...
 
virtual const ITransmissiongetTransmissionInProgress () const override
 Returns the ongoing transmission that the transmitter is currently transmitting or nullptr. More...
 
virtual const ITransmissiongetReceptionInProgress () const override
 Returns the ongoing reception that the receiver is currently receiving or nullptr. More...
 
virtual IRadioSignal::SignalPart getTransmittedSignalPart () const override
 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 override
 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::PhysicalLayerBase
 PhysicalLayerBase ()
 
- Public Member Functions inherited from inet::OperationalBase
 OperationalBase ()
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 
- Public Member Functions inherited from inet::IPhysicalLayer
virtual ~IPhysicalLayer ()
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
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 Attributes

static simsignal_t radioChannelChangedSignal = cComponent::registerSignal("radioChannelChanged")
 This signal is emitted every time the radio channel changes. More...
 
- Static Public Attributes inherited from inet::physicallayer::Radio
static simsignal_t minSNIRSignal = cComponent::registerSignal("minSNIR")
 
static simsignal_t packetErrorRateSignal = cComponent::registerSignal("packetErrorRate")
 
static simsignal_t bitErrorRateSignal = cComponent::registerSignal("bitErrorRate")
 
static simsignal_t symbolErrorRateSignal = cComponent::registerSignal("symbolErrorRate")
 
- Static Public Attributes inherited from inet::physicallayer::IRadio
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...
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleUpperCommand (cMessage *message) override
 
- Protected Member Functions inherited from inet::physicallayer::Radio
virtual void handleMessageWhenDown (cMessage *message) override
 
virtual void handleMessageWhenUp (cMessage *message) override
 
virtual void handleSelfMessage (cMessage *message)
 
virtual void handleSwitchTimer (cMessage *message)
 
virtual void handleTransmissionTimer (cMessage *message)
 
virtual void handleReceptionTimer (cMessage *message)
 
virtual void handleLowerCommand (cMessage *command)
 
virtual void handleUpperPacket (cPacket *packet)
 
virtual void handleLowerPacket (RadioFrame *packet)
 
virtual bool handleNodeStart (IDoneCallback *doneCallback) override
 
virtual bool handleNodeShutdown (IDoneCallback *doneCallback) override
 
virtual void handleNodeCrash () override
 
virtual void startTransmission (cPacket *macFrame, IRadioSignal::SignalPart part)
 
virtual void continueTransmission ()
 
virtual void endTransmission ()
 
virtual void abortTransmission ()
 
virtual RadioFramecreateRadioFrame (cPacket *packet) const
 
virtual void startReception (cMessage *timer, IRadioSignal::SignalPart part)
 
virtual void continueReception (cMessage *timer)
 
virtual void endReception (cMessage *timer)
 
virtual void abortReception (cMessage *timer)
 
virtual void captureReception (cMessage *timer)
 
virtual void sendUp (cPacket *macFrame)
 
virtual cMessage * createReceptionTimer (RadioFrame *radioFrame) const
 
virtual bool isReceptionTimer (const cMessage *message) const
 
virtual bool isReceiverMode (IRadio::RadioMode radioMode) const
 
virtual bool isTransmitterMode (IRadio::RadioMode radioMode) const
 
virtual bool isListeningPossible () const
 
virtual void updateTransceiverState ()
 
virtual void updateTransceiverPart ()
 
- Protected Member Functions inherited from inet::PhysicalLayerBase
virtual bool isInitializeStage (int stage) override
 
virtual bool isNodeStartStage (int stage) override
 
virtual bool isNodeShutdownStage (int stage) override
 
- Protected Member Functions inherited from inet::OperationalBase
virtual int numInitStages () const override
 
virtual void handleMessage (cMessage *msg) override
 
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
virtual void setOperational (bool isOperational)
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IRadio
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
}
 
- Static Public Member Functions inherited from inet::physicallayer::IRadio
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...
 
- Protected Attributes inherited from inet::physicallayer::Radio
const int id = nextId++
 An identifier which is globally unique for the whole lifetime of the simulation among all radios. More...
 
const IAntennaantenna = nullptr
 The radio antenna model is never nullptr. More...
 
const ITransmittertransmitter = nullptr
 The transmitter model is never nullptr. More...
 
const IReceiverreceiver = nullptr
 The receiver model is never nullptr. More...
 
IRadioMediummedium = nullptr
 The radio medium model is never nullptr. More...
 
int mediumModuleId = -1
 The module id of the medim model. More...
 
simtime_t switchingTimes [RADIO_MODE_SWITCHING][RADIO_MODE_SWITCHING]
 Simulation time required to switch from one radio mode to another. More...
 
bool separateTransmissionParts = false
 Determines whether the transmission of the preamble, header and data part are simulated separately or not. More...
 
bool separateReceptionParts = false
 Determines whether the reception of the preamble, header and data part are simulated separately or not. More...
 
cGate * upperLayerOut = nullptr
 Gates. More...
 
cGate * upperLayerIn = nullptr
 
cGate * radioIn = nullptr
 
RadioMode radioMode = RADIO_MODE_OFF
 State. More...
 
RadioMode nextRadioMode = RADIO_MODE_OFF
 The radio is switching to this radio radio mode if a switch is in progress, otherwise this is the same as the current radio mode. More...
 
RadioMode previousRadioMode = RADIO_MODE_OFF
 The radio is switching from this radio mode to another if a switch is in progress, otherwise this is the same as the current radio mode. More...
 
ReceptionState receptionState = RECEPTION_STATE_UNDEFINED
 The current reception state. More...
 
TransmissionState transmissionState = TRANSMISSION_STATE_UNDEFINED
 The current transmission state. More...
 
IRadioSignal::SignalPart receivedSignalPart = IRadioSignal::SIGNAL_PART_NONE
 The current received signal part. More...
 
IRadioSignal::SignalPart transmittedSignalPart = IRadioSignal::SIGNAL_PART_NONE
 The current transmitted signal part. More...
 
cMessage * transmissionTimer = nullptr
 The timer that is scheduled to the end of the current transmission. More...
 
cMessage * receptionTimer = nullptr
 The timer that is scheduled to the end of the current reception. More...
 
cMessage * switchTimer = nullptr
 The timer that is scheduled to the end of the radio mode switch. More...
 
- Protected Attributes inherited from inet::OperationalBase
bool isOperational
 
simtime_t lastChange
 
- Static Protected Attributes inherited from inet::physicallayer::IRadio
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...
 

Constructor & Destructor Documentation

inet::physicallayer::Ieee80211Radio::Ieee80211Radio ( )
31  :
33 {
34 }
FlatRadioBase()
Definition: FlatRadioBase.cc:29

Member Function Documentation

void inet::physicallayer::Ieee80211Radio::handleUpperCommand ( cMessage *  message)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::FlatRadioBase.

47 {
48  if (message->getKind() == RADIO_C_CONFIGURE) {
50  Ieee80211ConfigureRadioCommand *configureCommand = dynamic_cast<Ieee80211ConfigureRadioCommand *>(message->getControlInfo());
51  if (configureCommand != nullptr) {
52  const char *opMode = configureCommand->getOpMode();
53  if (*opMode)
55  const Ieee80211ModeSet *modeSet = configureCommand->getModeSet();
56  if (modeSet != nullptr)
57  setModeSet(modeSet);
58  const IIeee80211Mode *mode = configureCommand->getMode();
59  if (mode != nullptr)
60  setMode(mode);
61  IIeee80211Band *band = configureCommand->getBand();
62  if (band != nullptr)
63  setBand(band);
64  Ieee80211Channel *channel = configureCommand->getChannel();
65  if (channel != nullptr)
66  setChannel(channel);
67  int newChannelNumber = configureCommand->getChannelNumber();
68  if (newChannelNumber != -1)
69  setChannelNumber(newChannelNumber);
70  }
71  }
72  else
74 }
virtual void setChannelNumber(int newChannelNumber)
Definition: Ieee80211Radio.cc:119
virtual void setBand(const IIeee80211Band *band)
Definition: Ieee80211Radio.cc:96
static const Ieee80211ModeSet * getModeSet(const char *mode)
Definition: Ieee80211ModeSet.cc:285
virtual void setMode(const IIeee80211Mode *mode)
Definition: Ieee80211Radio.cc:87
virtual void setModeSet(const Ieee80211ModeSet *modeSet)
Definition: Ieee80211Radio.cc:76
virtual void setChannel(const Ieee80211Channel *channel)
Definition: Ieee80211Radio.cc:107
Definition: RadioControlInfo_m.h:56
void handleUpperCommand(cMessage *message) override
Definition: FlatRadioBase.cc:34
void inet::physicallayer::Ieee80211Radio::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::Radio.

37 {
39  if (stage == INITSTAGE_PHYSICAL_LAYER) {
40  int channelNumber = par("channelNumber");
41  if (channelNumber != -1)
42  setChannelNumber(channelNumber);
43  }
44 }
virtual void setChannelNumber(int newChannelNumber)
Definition: Ieee80211Radio.cc:119
Initialization of the physical layer of protocol stacks.
Definition: InitStages.h:53
virtual void initialize(int stage) override
Definition: Radio.cc:49
void inet::physicallayer::Ieee80211Radio::setBand ( const IIeee80211Band band)
virtual

Referenced by handleUpperCommand().

97 {
98  Ieee80211TransmitterBase *ieee80211Transmitter = const_cast<Ieee80211TransmitterBase *>(check_and_cast<const Ieee80211TransmitterBase *>(transmitter));
99  Ieee80211ReceiverBase *ieee80211Receiver = const_cast<Ieee80211ReceiverBase *>(check_and_cast<const Ieee80211ReceiverBase *>(receiver));
100  ieee80211Transmitter->setBand(band);
101  ieee80211Receiver->setBand(band);
102  EV << "Changing radio band to " << band << endl;
103  receptionTimer = nullptr;
104  emit(listeningChangedSignal, 0);
105 }
const IReceiver * receiver
The receiver model is never nullptr.
Definition: Radio.h:89
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:85
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:167
void inet::physicallayer::Ieee80211Radio::setChannel ( const Ieee80211Channel channel)
virtual

Referenced by handleUpperCommand().

108 {
109  Ieee80211TransmitterBase *ieee80211Transmitter = const_cast<Ieee80211TransmitterBase *>(check_and_cast<const Ieee80211TransmitterBase *>(transmitter));
110  Ieee80211ReceiverBase *ieee80211Receiver = const_cast<Ieee80211ReceiverBase *>(check_and_cast<const Ieee80211ReceiverBase *>(receiver));
111  ieee80211Transmitter->setChannel(channel);
112  ieee80211Receiver->setChannel(channel);
113  EV << "Changing radio channel to " << channel->getChannelNumber() << endl;
114  receptionTimer = nullptr;
115  emit(radioChannelChangedSignal, channel->getChannelNumber());
116  emit(listeningChangedSignal, 0);
117 }
const IReceiver * receiver
The receiver model is never nullptr.
Definition: Radio.h:89
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:85
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
static simsignal_t radioChannelChangedSignal
This signal is emitted every time the radio channel changes.
Definition: Ieee80211Radio.h:40
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:167
void inet::physicallayer::Ieee80211Radio::setChannelNumber ( int  newChannelNumber)
virtual

Referenced by handleUpperCommand(), and initialize().

120 {
121  Ieee80211TransmitterBase *ieee80211Transmitter = const_cast<Ieee80211TransmitterBase *>(check_and_cast<const Ieee80211TransmitterBase *>(transmitter));
122  Ieee80211ReceiverBase *ieee80211Receiver = const_cast<Ieee80211ReceiverBase *>(check_and_cast<const Ieee80211ReceiverBase *>(receiver));
123  ieee80211Transmitter->setChannelNumber(newChannelNumber);
124  ieee80211Receiver->setChannelNumber(newChannelNumber);
125  EV << "Changing radio channel to " << newChannelNumber << ".\n";
126  receptionTimer = nullptr;
127  emit(radioChannelChangedSignal, newChannelNumber);
128  emit(listeningChangedSignal, 0);
129 }
const IReceiver * receiver
The receiver model is never nullptr.
Definition: Radio.h:89
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:85
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
static simsignal_t radioChannelChangedSignal
This signal is emitted every time the radio channel changes.
Definition: Ieee80211Radio.h:40
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:167
void inet::physicallayer::Ieee80211Radio::setMode ( const IIeee80211Mode mode)
virtual

Referenced by handleUpperCommand().

88 {
89  Ieee80211TransmitterBase *ieee80211Transmitter = const_cast<Ieee80211TransmitterBase *>(check_and_cast<const Ieee80211TransmitterBase *>(transmitter));
90  ieee80211Transmitter->setMode(mode);
91  EV << "Changing radio mode to " << mode << endl;
92  receptionTimer = nullptr;
93  emit(listeningChangedSignal, 0);
94 }
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:85
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:167
void inet::physicallayer::Ieee80211Radio::setModeSet ( const Ieee80211ModeSet modeSet)
virtual

Referenced by handleUpperCommand().

77 {
78  Ieee80211TransmitterBase *ieee80211Transmitter = const_cast<Ieee80211TransmitterBase *>(check_and_cast<const Ieee80211TransmitterBase *>(transmitter));
79  Ieee80211ReceiverBase *ieee80211Receiver = const_cast<Ieee80211ReceiverBase *>(check_and_cast<const Ieee80211ReceiverBase *>(receiver));
80  ieee80211Transmitter->setModeSet(modeSet);
81  ieee80211Receiver->setModeSet(modeSet);
82  EV << "Changing radio mode set to " << modeSet << endl;
83  receptionTimer = nullptr;
84  emit(listeningChangedSignal, 0);
85 }
const IReceiver * receiver
The receiver model is never nullptr.
Definition: Radio.h:89
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:85
static simsignal_t listeningChangedSignal
This signal is emitted every time the radio listening changes.
Definition: IRadio.h:60
cMessage * receptionTimer
The timer that is scheduled to the end of the current reception.
Definition: Radio.h:167

Member Data Documentation

simsignal_t inet::physicallayer::Ieee80211Radio::radioChannelChangedSignal = cComponent::registerSignal("radioChannelChanged")
static

This signal is emitted every time the radio channel changes.

The signal value is the new radio channel.

Referenced by inet::ieee80211::Ieee80211MgmtAP::initialize(), inet::ieee80211::Ieee80211MgmtAP::receiveSignal(), setChannel(), and setChannelNumber().


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