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

#include <Ieee80211TransmitterBase.h>

Inheritance diagram for inet::physicallayer::Ieee80211TransmitterBase:
inet::physicallayer::FlatTransmitterBase inet::physicallayer::NarrowbandTransmitterBase inet::physicallayer::TransmitterBase inet::physicallayer::ITransmitter inet::physicallayer::IPrintableObject inet::physicallayer::Ieee80211DimensionalTransmitter inet::physicallayer::Ieee80211IdealTransmitter inet::physicallayer::Ieee80211ScalarTransmitter

Public Member Functions

 Ieee80211TransmitterBase ()
 
virtual ~Ieee80211TransmitterBase ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
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 channelNumber)
 
- Public Member Functions inherited from inet::physicallayer::FlatTransmitterBase
 FlatTransmitterBase ()
 
virtual int getHeaderBitLength () const
 
virtual void setHeaderBitLength (int headerBitLength)
 
virtual bps getBitrate () const
 
virtual void setBitrate (bps bitrate)
 
virtual W getMaxPower () const override
 Returns the maximum transmission power above which no transmission is ever transmitted. More...
 
virtual W getPower () const
 
virtual void setPower (W power)
 
- Public Member Functions inherited from inet::physicallayer::NarrowbandTransmitterBase
 NarrowbandTransmitterBase ()
 
virtual const IModulationgetModulation () const
 
virtual void setModulation (const IModulation *modulation)
 
virtual Hz getCarrierFrequency () const
 
virtual void setCarrierFrequency (Hz carrierFrequency)
 
virtual Hz getBandwidth () const
 
virtual void setBandwidth (Hz bandwidth)
 
- Public Member Functions inherited from inet::physicallayer::TransmitterBase
virtual m getMaxCommunicationRange () const override
 Returns the maximum transmission range. More...
 
virtual m getMaxInterferenceRange () const override
 Returns the maximum interference range. More...
 
- Public Member Functions inherited from inet::physicallayer::ITransmitter
virtual const ITransmissioncreateTransmission (const IRadio *transmitter, const cPacket *macFrame, const simtime_t startTime) const =0
 Returns a transmission which describes the radio signal corresponding to the provided mac frame. More...
 
- 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
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual const IIeee80211ModecomputeTransmissionMode (const TransmissionRequest *transmissionRequest) const
 
virtual const Ieee80211ChannelcomputeTransmissionChannel (const TransmissionRequest *transmissionRequest) const
 
virtual W computeTransmissionPower (const TransmissionRequest *transmissionRequest) const
 
- Protected Member Functions inherited from inet::physicallayer::TransmitterBase
virtual int numInitStages () const override
 

Protected Attributes

const Ieee80211ModeSetmodeSet
 
const IIeee80211Modemode
 
const IIeee80211Bandband
 
const Ieee80211Channelchannel
 
- Protected Attributes inherited from inet::physicallayer::FlatTransmitterBase
simtime_t preambleDuration
 
int headerBitLength
 
bps bitrate
 
W power
 
- Protected Attributes inherited from inet::physicallayer::NarrowbandTransmitterBase
const IModulationmodulation
 
Hz carrierFrequency
 
Hz bandwidth
 

Additional Inherited Members

- 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
}
 

Constructor & Destructor Documentation

inet::physicallayer::Ieee80211TransmitterBase::Ieee80211TransmitterBase ( )
24  :
25  modeSet(nullptr),
26  mode(nullptr),
27  band(nullptr),
28  channel(nullptr)
29 {
30 }
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
const IIeee80211Mode * mode
Definition: Ieee80211TransmitterBase.h:36
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
const IIeee80211Band * band
Definition: Ieee80211TransmitterBase.h:37
inet::physicallayer::Ieee80211TransmitterBase::~Ieee80211TransmitterBase ( )
virtual
33 {
34  delete channel;
35 }
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38

Member Function Documentation

const Ieee80211Channel * inet::physicallayer::Ieee80211TransmitterBase::computeTransmissionChannel ( const TransmissionRequest transmissionRequest) const
protectedvirtual

Referenced by inet::physicallayer::Ieee80211ScalarTransmitter::createTransmission(), and inet::physicallayer::Ieee80211DimensionalTransmitter::createTransmission().

82 {
83  const Ieee80211Channel *transmissionChannel;
84  const Ieee80211TransmissionRequest *ieee80211TransmissionRequest = dynamic_cast<const Ieee80211TransmissionRequest *>(transmissionRequest);
85  if (ieee80211TransmissionRequest != nullptr && ieee80211TransmissionRequest->getChannel() != nullptr)
86  transmissionChannel = ieee80211TransmissionRequest->getChannel();
87  else
88  transmissionChannel = channel;
89  if (transmissionChannel == nullptr)
90  throw cRuntimeError("Transmission channel is undefined");
91  return transmissionChannel;
92 }
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
const IIeee80211Mode * inet::physicallayer::Ieee80211TransmitterBase::computeTransmissionMode ( const TransmissionRequest transmissionRequest) const
protectedvirtual

Referenced by inet::physicallayer::Ieee80211ScalarTransmitter::createTransmission(), inet::physicallayer::Ieee80211DimensionalTransmitter::createTransmission(), and inet::physicallayer::Ieee80211IdealTransmitter::createTransmission().

64 {
65  const IIeee80211Mode *transmissionMode;
66  const Ieee80211TransmissionRequest *ieee80211TransmissionRequest = dynamic_cast<const Ieee80211TransmissionRequest *>(transmissionRequest);
67  if (ieee80211TransmissionRequest != nullptr && ieee80211TransmissionRequest->getMode() != nullptr) {
68  if (modeSet != nullptr && !modeSet->containsMode(ieee80211TransmissionRequest->getMode()))
69  throw cRuntimeError("Unsupported mode requested");
70  transmissionMode = ieee80211TransmissionRequest->getMode();
71  }
72  else if (modeSet != nullptr && transmissionRequest != nullptr && !std::isnan(transmissionRequest->getBitrate().get()))
73  transmissionMode = modeSet->getMode(transmissionRequest->getBitrate());
74  else
75  transmissionMode = mode;
76  if (transmissionMode == nullptr)
77  throw cRuntimeError("Transmission mode is undefined");
78  return transmissionMode;
79 }
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
const IIeee80211Mode * mode
Definition: Ieee80211TransmitterBase.h:36
const IIeee80211Mode * getMode(bps bitrate) const
Definition: Ieee80211ModeSet.cc:202
bool containsMode(const IIeee80211Mode *mode) const
Definition: Ieee80211ModeSet.h:60
W inet::physicallayer::Ieee80211TransmitterBase::computeTransmissionPower ( const TransmissionRequest transmissionRequest) const
protectedvirtual

Referenced by inet::physicallayer::Ieee80211ScalarTransmitter::createTransmission(), and inet::physicallayer::Ieee80211DimensionalTransmitter::createTransmission().

95 {
96  if (transmissionRequest != nullptr && !std::isnan(transmissionRequest->getPower().get()))
97  return transmissionRequest->getPower();
98  else
99  return power;
100 }
W power
Definition: FlatTransmitterBase.h:33
void inet::physicallayer::Ieee80211TransmitterBase::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::FlatTransmitterBase.

Reimplemented in inet::physicallayer::Ieee80211IdealTransmitter, and inet::physicallayer::Ieee80211DimensionalTransmitter.

Referenced by inet::physicallayer::Ieee80211DimensionalTransmitter::initialize().

38 {
40  if (stage == INITSTAGE_LOCAL) {
41  const char *opMode = par("opMode");
42  setModeSet(*opMode ? Ieee80211ModeSet::getModeSet(opMode) : nullptr);
43  setMode(modeSet != nullptr ? (bitrate != bps(-1) ? modeSet->getMode(bitrate) : nullptr) : nullptr);
44  const char *bandName = par("bandName");
45  setBand(*bandName != '\0' ? Ieee80211CompliantBands::getBand(bandName) : nullptr);
46  int channelNumber = par("channelNumber");
47  if (channelNumber != -1)
48  setChannelNumber(channelNumber);
49  }
50 }
virtual void setModeSet(const Ieee80211ModeSet *modeSet)
Definition: Ieee80211TransmitterBase.cc:102
bps bitrate
Definition: FlatTransmitterBase.h:32
virtual void setBand(const IIeee80211Band *band)
Definition: Ieee80211TransmitterBase.cc:120
virtual void setChannelNumber(int channelNumber)
Definition: Ieee80211TransmitterBase.cc:138
static const Ieee80211ModeSet * getModeSet(const char *mode)
Definition: Ieee80211ModeSet.cc:285
compose< b, pow< s,-1 > > bps
Definition: Units.h:985
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
virtual void initialize(int stage) override
Definition: FlatTransmitterBase.cc:33
Local initializations.
Definition: InitStages.h:35
const IIeee80211Mode * getMode(bps bitrate) const
Definition: Ieee80211ModeSet.cc:202
virtual void setMode(const IIeee80211Mode *mode)
Definition: Ieee80211TransmitterBase.cc:111
static const IIeee80211Band * getBand(const char *name)
Definition: Ieee80211Band.cc:89
std::ostream & inet::physicallayer::Ieee80211TransmitterBase::printToStream ( std::ostream &  stream,
int  level 
) const
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::FlatTransmitterBase.

Reimplemented in inet::physicallayer::Ieee80211IdealTransmitter, inet::physicallayer::Ieee80211DimensionalTransmitter, and inet::physicallayer::Ieee80211ScalarTransmitter.

Referenced by inet::physicallayer::Ieee80211ScalarTransmitter::printToStream(), inet::physicallayer::Ieee80211DimensionalTransmitter::printToStream(), and inet::physicallayer::Ieee80211IdealTransmitter::printToStream().

53 {
54  if (level <= PRINT_LEVEL_TRACE)
55  stream << ", modeSet = " << printObjectToString(modeSet, level + 1)
56  << ", band = " << printObjectToString(band, level + 1);
57  if (level <= PRINT_LEVEL_INFO)
58  stream << ", mode = " << printObjectToString(mode, level + 1)
59  << ", channel = " << printObjectToString(channel, level + 1);
60  return FlatTransmitterBase::printToStream(stream, level);
61 }
std::string printObjectToString(const IPrintableObject *object, int level)
Definition: IPrintableObject.h:73
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: FlatTransmitterBase.cc:44
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
const IIeee80211Mode * mode
Definition: Ieee80211TransmitterBase.h:36
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
const IIeee80211Band * band
Definition: Ieee80211TransmitterBase.h:37
void inet::physicallayer::Ieee80211TransmitterBase::setBand ( const IIeee80211Band band)
virtual

Referenced by initialize(), and inet::physicallayer::Ieee80211Radio::setBand().

121 {
122  if (this->band != band) {
123  this->band = band;
124  if (channel != nullptr)
125  setChannel(new Ieee80211Channel(band, channel->getChannelNumber()));
126  }
127 }
virtual void setChannel(const Ieee80211Channel *channel)
Definition: Ieee80211TransmitterBase.cc:129
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
virtual int getChannelNumber() const
Definition: Ieee80211Channel.h:39
const IIeee80211Band * band
Definition: Ieee80211TransmitterBase.h:37
void inet::physicallayer::Ieee80211TransmitterBase::setChannel ( const Ieee80211Channel channel)
virtual

Referenced by setBand(), inet::physicallayer::Ieee80211Radio::setChannel(), and setChannelNumber().

130 {
131  if (this->channel != channel) {
132  delete this->channel;
133  this->channel = channel;
135  }
136 }
virtual Hz getCenterFrequency() const
Definition: Ieee80211Channel.h:40
virtual void setCarrierFrequency(Hz carrierFrequency)
Definition: NarrowbandTransmitterBase.h:47
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
void inet::physicallayer::Ieee80211TransmitterBase::setChannelNumber ( int  channelNumber)
virtual

Referenced by initialize(), and inet::physicallayer::Ieee80211Radio::setChannelNumber().

139 {
140  if (channel == nullptr || channelNumber != channel->getChannelNumber())
141  setChannel(new Ieee80211Channel(band, channelNumber));
142 }
virtual void setChannel(const Ieee80211Channel *channel)
Definition: Ieee80211TransmitterBase.cc:129
const Ieee80211Channel * channel
Definition: Ieee80211TransmitterBase.h:38
virtual int getChannelNumber() const
Definition: Ieee80211Channel.h:39
const IIeee80211Band * band
Definition: Ieee80211TransmitterBase.h:37
void inet::physicallayer::Ieee80211TransmitterBase::setMode ( const IIeee80211Mode mode)
virtual

Referenced by initialize(), and inet::physicallayer::Ieee80211Radio::setMode().

112 {
113  if (this->mode != mode) {
114  if (modeSet->findMode(mode->getDataMode()->getNetBitrate()) == nullptr)
115  throw cRuntimeError("Invalid mode");
116  this->mode = mode;
117  }
118 }
const IIeee80211Mode * findMode(bps bitrate) const
Definition: Ieee80211ModeSet.cc:192
virtual const IIeee80211DataMode * getDataMode() const =0
virtual bps getNetBitrate() const =0
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
const IIeee80211Mode * mode
Definition: Ieee80211TransmitterBase.h:36
void inet::physicallayer::Ieee80211TransmitterBase::setModeSet ( const Ieee80211ModeSet modeSet)
virtual

Referenced by initialize(), and inet::physicallayer::Ieee80211Radio::setModeSet().

103 {
104  if (this->modeSet != modeSet) {
105  this->modeSet = modeSet;
106  if (mode != nullptr)
107  mode = modeSet != nullptr ? modeSet->getMode(mode->getDataMode()->getNetBitrate()) : nullptr;
108  }
109 }
virtual const IIeee80211DataMode * getDataMode() const =0
virtual bps getNetBitrate() const =0
const Ieee80211ModeSet * modeSet
Definition: Ieee80211TransmitterBase.h:35
const IIeee80211Mode * mode
Definition: Ieee80211TransmitterBase.h:36
const IIeee80211Mode * getMode(bps bitrate) const
Definition: Ieee80211ModeSet.cc:202

Member Data Documentation

const IIeee80211Band* inet::physicallayer::Ieee80211TransmitterBase::band
protected
const IIeee80211Mode* inet::physicallayer::Ieee80211TransmitterBase::mode
protected
const Ieee80211ModeSet* inet::physicallayer::Ieee80211TransmitterBase::modeSet
protected

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