INET Framework for OMNeT++/OMNEST
|
This class is the default implementation of the IRadio interface. More...
#include <Radio.h>
Public Member Functions | |
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 IAntenna * | getAntenna () const override |
Returns the antenna used by the transceiver of this radio. More... | |
virtual const ITransmitter * | getTransmitter () const override |
Returns the transmitter part of this radio. More... | |
virtual const IReceiver * | getReceiver () const override |
Returns the receiver part of this radio. More... | |
virtual const IRadioMedium * | getMedium () 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 ITransmission * | getTransmissionInProgress () const override |
Returns the ongoing transmission that the transmitter is currently transmitting or nullptr. More... | |
virtual const ITransmission * | getReceptionInProgress () 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 | 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 | 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 | handleUpperCommand (cMessage *command) |
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 RadioFrame * | createRadioFrame (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) |
Protected Attributes | |
const int | id = nextId++ |
An identifier which is globally unique for the whole lifetime of the simulation among all radios. More... | |
Parameters that determine the behavior of the radio. | |
const IAntenna * | antenna = nullptr |
The radio antenna model is never nullptr. More... | |
const ITransmitter * | transmitter = nullptr |
The transmitter model is never nullptr. More... | |
const IReceiver * | receiver = nullptr |
The receiver model is never nullptr. More... | |
IRadioMedium * | medium = 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... | |
Timer | |
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 |
Private Member Functions | |
void | parseRadioModeSwitchingTimes () |
void | startRadioModeSwitch (RadioMode newRadioMode, simtime_t switchingTime) |
void | completeRadioModeSwitch (RadioMode newRadioMode) |
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... | |
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... | |
This class is the default implementation of the IRadio interface.
The transmission process starts when the radio module receives a packet from the higher layer. The received packet can have a TransmissionRequest attached as a control info object. The radio must be in transmitter or transceiver mode before receiving a packet, otherwise it throws an exception. The radio changes its transmitter state to transmitting, and emits a transmitter state changed signal. Finally, it schedules a timer to the end of the transmission.
The transmission process ends when the above timer expires. The radio changes its transmitter state back to idle, and emits a transmitter state changed signal.
The reception process starts when the radio module receives a radio frame. The radio must be in receiver or transceiver mode before the message arrives, otherwise it just ignores the message. The radio changes its receiver state to the appropriate value, and emits a receiver state changed signal. Finally, it schedules a timer to the end of the reception.
The reception process ends when one of the above timer expires. If the timer corresponds to an attempted reception, then the radio determines the reception decision. Independently of whether the reception is successful or not, the encapsulated packet is sent up to the higher layer. The radio also attaches a ReceptionIndication as a control info object. Finally, the radio changes its receiver state to the appropriate value, and emits a receiver state changed signal.
|
virtual |
|
protectedvirtual |
Referenced by completeRadioModeSwitch().
|
protectedvirtual |
Referenced by completeRadioModeSwitch(), handleNodeCrash(), and handleNodeShutdown().
|
protectedvirtual |
|
private |
Referenced by handleNodeCrash(), handleNodeShutdown(), handleNodeStart(), handleSwitchTimer(), and setRadioMode().
|
protectedvirtual |
Referenced by handleReceptionTimer().
|
protectedvirtual |
Referenced by handleTransmissionTimer().
|
protectedvirtual |
Referenced by startTransmission().
|
protectedvirtual |
Referenced by handleLowerPacket().
|
protectedvirtual |
Referenced by handleReceptionTimer().
|
protectedvirtual |
Referenced by handleTransmissionTimer().
|
inlineoverridevirtual |
Returns the antenna used by the transceiver of this radio.
This function never returns nullptr.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns an identifier for this radio which is globally unique for the whole lifetime of the simulation among all radios.
Implements inet::physicallayer::IRadio.
Referenced by initialize(), startTransmission(), and inet::physicallayer::CommunicationLog::writeTransmission().
|
inlineoverridevirtual |
Returns the radio medium where this radio is transmitting and receiving radio signals.
This function never returns nullptr.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns the gate of the radio that receives incoming radio frames.
Implements inet::physicallayer::IRadio.
Referenced by inet::physicallayer::RadioMedium::receiveSignal().
|
inlineoverridevirtual |
Returns the current radio mode, This is the same mode as the one emitted with the last radioModeChangedSignal.
Implements inet::physicallayer::IRadio.
Referenced by inet::physicallayer::RadioMedium::isPotentialReceiver().
|
overridevirtual |
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.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns the receiver part of this radio.
This function never returns nullptr.
Implements inet::physicallayer::IRadio.
Referenced by inet::physicallayer::RadioMedium::receiveSignal().
|
overridevirtual |
Returns the ongoing reception that the receiver is currently receiving or nullptr.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns the current radio reception state.
This is the same state as the one emitted with the last receptionStateChangedSignal.
Implements inet::physicallayer::IRadio.
|
overridevirtual |
Returns the ongoing transmission that the transmitter is currently transmitting or nullptr.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns the current radio transmission state.
This is the same state as the one emitted with the last transmissionStateChangedSignal.
Implements inet::physicallayer::IRadio.
|
overridevirtual |
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.
Implements inet::physicallayer::IRadio.
|
inlineoverridevirtual |
Returns the transmitter part of this radio.
This function never returns nullptr.
Implements inet::physicallayer::IRadio.
|
protectedvirtual |
Referenced by handleMessageWhenUp().
|
protectedvirtual |
Referenced by handleMessageWhenUp().
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
|
overrideprotectedvirtual |
Implements inet::OperationalBase.
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
|
protectedvirtual |
Referenced by handleSelfMessage().
|
protectedvirtual |
Referenced by handleMessageWhenUp().
|
protectedvirtual |
Referenced by handleSelfMessage().
|
protectedvirtual |
Referenced by handleSelfMessage().
|
protectedvirtual |
Reimplemented in inet::physicallayer::Ieee80211Radio, inet::physicallayer::NarrowbandRadioBase, and inet::physicallayer::FlatRadioBase.
Referenced by handleMessageWhenUp(), and inet::physicallayer::NarrowbandRadioBase::handleUpperCommand().
|
protectedvirtual |
Referenced by handleMessageWhenUp().
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
Reimplemented in inet::physicallayer::Ieee80211Radio.
Referenced by inet::physicallayer::Ieee80211Radio::initialize().
|
protectedvirtual |
Referenced by updateTransceiverState().
|
protectedvirtual |
Referenced by completeRadioModeSwitch(), continueReception(), endReception(), and startReception().
|
protectedvirtual |
Referenced by handleMessageWhenDown(), and handleSelfMessage().
|
protectedvirtual |
Referenced by completeRadioModeSwitch(), and handleUpperPacket().
|
private |
Referenced by initialize().
|
overridevirtual |
Prints this object to the provided output stream.
Function calls to operator<< with pointers or references either const or not are all forwarded to this function.
Reimplemented from inet::physicallayer::IPrintableObject.
|
protectedvirtual |
Referenced by endReception().
|
overridevirtual |
Changes the current radio mode.
The actual change may take zero or more time. The new radio mode will be emitted with a radioModeChangedSignal.
Implements inet::physicallayer::IRadio.
Referenced by handleUpperCommand().
|
private |
Referenced by setRadioMode().
|
protectedvirtual |
Referenced by handleLowerPacket().
|
protectedvirtual |
Referenced by handleUpperPacket().
|
protectedvirtual |
Referenced by abortReception(), abortTransmission(), completeRadioModeSwitch(), continueReception(), continueTransmission(), endReception(), endTransmission(), startReception(), and startTransmission().
|
protectedvirtual |
Referenced by abortReception(), abortTransmission(), completeRadioModeSwitch(), continueReception(), continueTransmission(), endReception(), endTransmission(), startReception(), and startTransmission().
|
protected |
The radio antenna model is never nullptr.
Referenced by initialize(), isListeningPossible(), and printToStream().
|
static |
Referenced by sendUp().
|
protected |
An identifier which is globally unique for the whole lifetime of the simulation among all radios.
|
protected |
The radio medium model is never nullptr.
Referenced by continueReception(), createRadioFrame(), endReception(), endTransmission(), initialize(), isListeningPossible(), startReception(), startTransmission(), and ~Radio().
|
protected |
The module id of the medim model.
Referenced by initialize(), and ~Radio().
|
static |
Referenced by sendUp().
|
protected |
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.
Referenced by completeRadioModeSwitch(), handleSwitchTimer(), setRadioMode(), and startRadioModeSwitch().
|
static |
Referenced by sendUp().
|
protected |
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.
Referenced by completeRadioModeSwitch(), and startRadioModeSwitch().
|
protected |
Referenced by handleMessageWhenDown(), handleMessageWhenUp(), and initialize().
|
protected |
State.
The current radio mode.
Referenced by completeRadioModeSwitch(), continueReception(), endReception(), handleUpperPacket(), initialize(), setRadioMode(), startRadioModeSwitch(), startReception(), and updateTransceiverState().
|
protected |
The current received signal part.
Referenced by getReceivedSignalPart(), initialize(), and updateTransceiverPart().
|
protected |
The receiver model is never nullptr.
Referenced by initialize(), isListeningPossible(), printToStream(), inet::physicallayer::Ieee80211Radio::setBand(), inet::physicallayer::NarrowbandRadioBase::setBandwidth(), inet::physicallayer::NarrowbandRadioBase::setCarrierFrequency(), inet::physicallayer::Ieee80211Radio::setChannel(), inet::physicallayer::Ieee80211Radio::setChannelNumber(), inet::physicallayer::Ieee80211Radio::setModeSet(), and inet::physicallayer::NarrowbandRadioBase::setModulation().
|
protected |
The current reception state.
Referenced by initialize(), and updateTransceiverState().
|
protected |
The timer that is scheduled to the end of the current reception.
If this timer is nullptr then no attempted reception is in progress but there still may be incoming receptions which are not attempted.
Referenced by abortReception(), completeRadioModeSwitch(), continueReception(), endReception(), getReceptionInProgress(), handleLowerPacket(), inet::physicallayer::Ieee80211Radio::setBand(), inet::physicallayer::NarrowbandRadioBase::setBandwidth(), inet::physicallayer::FlatRadioBase::setBitrate(), inet::physicallayer::Ieee80211Radio::setChannel(), inet::physicallayer::Ieee80211Radio::setChannelNumber(), inet::physicallayer::Ieee80211Radio::setMode(), inet::physicallayer::Ieee80211Radio::setModeSet(), startReception(), updateTransceiverPart(), and updateTransceiverState().
|
protected |
Determines whether the reception of the preamble, header and data part are simulated separately or not.
Referenced by handleLowerPacket(), and initialize().
|
protected |
Determines whether the transmission of the preamble, header and data part are simulated separately or not.
Referenced by handleUpperPacket(), and initialize().
|
protected |
Simulation time required to switch from one radio mode to another.
Referenced by parseRadioModeSwitchingTimes(), and setRadioMode().
|
protected |
The timer that is scheduled to the end of the radio mode switch.
Referenced by handleNodeCrash(), handleNodeShutdown(), handleSelfMessage(), initialize(), setRadioMode(), startRadioModeSwitch(), and ~Radio().
|
static |
Referenced by sendUp().
|
protected |
The current transmission state.
Referenced by initialize(), and updateTransceiverState().
|
protected |
The timer that is scheduled to the end of the current transmission.
If this timer is not scheduled then no transmission is in progress.
Referenced by abortTransmission(), completeRadioModeSwitch(), continueTransmission(), endTransmission(), getTransmissionInProgress(), handleNodeCrash(), handleNodeShutdown(), handleSelfMessage(), handleUpperPacket(), initialize(), startTransmission(), updateTransceiverPart(), updateTransceiverState(), and ~Radio().
|
protected |
The current transmitted signal part.
Referenced by getTransmittedSignalPart(), initialize(), and updateTransceiverPart().
|
protected |
The transmitter model is never nullptr.
Referenced by initialize(), printToStream(), inet::physicallayer::Ieee80211Radio::setBand(), inet::physicallayer::NarrowbandRadioBase::setBandwidth(), inet::physicallayer::FlatRadioBase::setBitrate(), inet::physicallayer::NarrowbandRadioBase::setCarrierFrequency(), inet::physicallayer::Ieee80211Radio::setChannel(), inet::physicallayer::Ieee80211Radio::setChannelNumber(), inet::physicallayer::Ieee80211Radio::setMode(), inet::physicallayer::Ieee80211Radio::setModeSet(), inet::physicallayer::NarrowbandRadioBase::setModulation(), and inet::physicallayer::FlatRadioBase::setPower().
|
protected |
Referenced by handleMessageWhenUp(), and initialize().
|
protected |
Gates.
Referenced by initialize(), and sendUp().