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

#include <UnitDiskRadio.h>

Inheritance diagram for inet::physicallayer::UnitDiskRadio:
inet::physicallayer::Radio inet::physicallayer::PhysicalLayerBase inet::physicallayer::IRadio inet::LayeredProtocolBase inet::IPhysicalLayer inet::IPhysicalLayer inet::IPrintableObject inet::OperationalBase inet::OperationalMixin< cSimpleModule > inet::ILifecycle

Public Member Functions

 UnitDiskRadio ()
 
- 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, int evFlags=0) 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 signals. 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::OperationalMixin< cSimpleModule >
virtual ~OperationalMixin ()
 }@ More...
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 
- Public Member Functions inherited from inet::IPhysicalLayer
virtual ~IPhysicalLayer ()
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Member Functions

virtual void encapsulate (Packet *packet) const override
 
virtual void decapsulate (Packet *packet) const override
 
- Protected Member Functions inherited from inet::physicallayer::Radio
virtual void initialize (int stage) override
 
virtual void initializeRadioMode ()
 
virtual void handleMessageWhenDown (cMessage *message) override
 
virtual void handleSelfMessage (cMessage *message) override
 
virtual void handleSwitchTimer (cMessage *message)
 
virtual void handleTransmissionTimer (cMessage *message)
 
virtual void handleReceptionTimer (cMessage *message)
 
virtual void handleUpperCommand (cMessage *command) override
 
virtual void handleLowerCommand (cMessage *command) override
 
virtual void handleUpperPacket (Packet *packet) override
 
virtual void handleSignal (WirelessSignal *signal) override
 
virtual void handleStartOperation (LifecycleOperation *operation) override
 
virtual void handleStopOperation (LifecycleOperation *operation) override
 
virtual void handleCrashOperation (LifecycleOperation *operation) override
 
virtual void startTransmission (Packet *macFrame, IRadioSignal::SignalPart part)
 
virtual void continueTransmission ()
 
virtual void endTransmission ()
 
virtual void abortTransmission ()
 
virtual WirelessSignalcreateSignal (Packet *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 (Packet *macFrame)
 
virtual cMessage * createReceptionTimer (WirelessSignal *signal) 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::physicallayer::PhysicalLayerBase
virtual void handleLowerMessage (cMessage *message) override
 
virtual void sendUp (cMessage *message)
 
virtual bool isUpperMessage (cMessage *message) const override
 
virtual bool isLowerMessage (cMessage *message) const override
 
virtual bool isInitializeStage (int stage) const override
 
virtual bool isModuleStartStage (int stage) const override
 
virtual bool isModuleStopStage (int stage) const override
 
- Protected Member Functions inherited from inet::LayeredProtocolBase
virtual void handleMessageWhenUp (cMessage *message) override
 
virtual void handleUpperMessage (cMessage *message)
 
virtual void handleLowerPacket (Packet *packet)
 
- Protected Member Functions inherited from inet::OperationalMixin< cSimpleModule >
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handleMessage (cMessage *msg) override
 
virtual bool handleOperationStage (LifecycleOperation *operation, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
virtual State getInitialOperationalState () const
 Returns initial operational state: OPERATING or NOT_OPERATING. More...
 
virtual void handleActiveOperationTimeout (cMessage *message)
 
virtual bool isUp () const
 utility functions More...
 
virtual bool isDown () const
 
virtual void setOperationalState (State newState)
 
virtual void scheduleOperationTimeout (simtime_t timeout)
 
virtual void setupActiveOperation (LifecycleOperation *operation, IDoneCallback *doneCallback, State)
 
virtual void delayActiveOperationFinish (simtime_t timeout)
 
virtual void startActiveOperationExtraTime (simtime_t delay=SIMTIME_ZERO)
 
virtual void startActiveOperationExtraTimeOrFinish (simtime_t extraTime)
 
virtual void finishActiveOperation ()
 

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::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 
- 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 Public Attributes inherited from inet::physicallayer::IRadio
static simsignal_t radioModeChangedSignal = cComponent::registerSignal("radioModeChanged")
 This signal is emitted when the radio mode of the radio is changed. More...
 
static simsignal_t listeningChangedSignal = cComponent::registerSignal("listeningChanged")
 This signal is emitted when the radio listening of the radio is changed. More...
 
static simsignal_t receptionStateChangedSignal = cComponent::registerSignal("receptionStateChanged")
 This signal is emitted when the radio reception state of the radio is changed. More...
 
static simsignal_t transmissionStateChangedSignal = cComponent::registerSignal("transmissionStateChanged")
 This signal is emitted when the radio transmission state of the radio is changed. More...
 
static simsignal_t receivedSignalPartChangedSignal = cComponent::registerSignal("receivedSignalPartChanged")
 This signal is emitted when the received part is changed by the radio. More...
 
static simsignal_t transmittedSignalPartChangedSignal = cComponent::registerSignal("transmittedSignalPartChanged")
 This signal is emitted when the transmitted part is changed by the radio. More...
 
- Protected Types inherited from inet::OperationalMixin< cSimpleModule >
enum  State
 
- 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...
 
ModuleRefByPar< IRadioMediummedium
 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 sendRawBytes = false
 When true packets are serialized into a sequence of bytes before sending out. 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::physicallayer::PhysicalLayerBase
int upperLayerInGateId = -1
 
int upperLayerOutGateId = -1
 
int radioInGateId = -1
 
- Protected Attributes inherited from inet::OperationalMixin< cSimpleModule >
State operationalState
 
simtime_t lastChange
 
Operation activeOperation
 
cMessage * activeOperationTimeout
 
cMessage * activeOperationExtraTimer
 
- 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

◆ UnitDiskRadio()

inet::physicallayer::UnitDiskRadio::UnitDiskRadio ( )
22  :
23  Radio()
24 {
25 }

Member Function Documentation

◆ decapsulate()

void inet::physicallayer::UnitDiskRadio::decapsulate ( Packet packet) const
overrideprotectedvirtual

Reimplemented from inet::physicallayer::Radio.

38 {
39  const auto& phyHeader = packet->popAtFront<UnitDiskPhyHeader>();
40  packet->addTagIfAbsent<PacketProtocolTag>()->setProtocol(phyHeader->getPayloadProtocol());
41 }

◆ encapsulate()

void inet::physicallayer::UnitDiskRadio::encapsulate ( Packet packet) const
overrideprotectedvirtual

Reimplemented from inet::physicallayer::Radio.

28 {
29  auto idealTransmitter = check_and_cast<const UnitDiskTransmitter *>(transmitter);
30  auto phyHeader = makeShared<UnitDiskPhyHeader>();
31  phyHeader->setChunkLength(idealTransmitter->getHeaderLength());
32  phyHeader->setPayloadProtocol(packet->getTag<PacketProtocolTag>()->getProtocol());
33  packet->insertAtFront(phyHeader);
34  packet->getTagForUpdate<PacketProtocolTag>()->setProtocol(&Protocol::unitDisk);
35 }

The documentation for this class was generated from the following files:
inet::physicallayer::Radio::Radio
Radio()
Definition: Radio.h:206
PacketProtocolTag
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
inet::physicallayer::Radio::transmitter
const ITransmitter * transmitter
The transmitter model is never nullptr.
Definition: Radio.h:66
inet::Protocol::unitDisk
static const Protocol unitDisk
Definition: Protocol.h:132