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

#include <Ieee80211OFDMDecoder.h>

Inheritance diagram for inet::physicallayer::Ieee80211OFDMDecoder:
inet::physicallayer::IDecoder inet::physicallayer::IPrintableObject

Public Member Functions

 Ieee80211OFDMDecoder (const IScrambler *descrambler, const IFECCoder *fecDecoder, const IInterleaver *deinterleaver)
 
 Ieee80211OFDMDecoder (const Ieee80211OFDMCode *code)
 
virtual ~Ieee80211OFDMDecoder ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
const IReceptionPacketModeldecode (const IReceptionBitModel *bitModel) const override
 
const Ieee80211OFDMCodegetCode () const
 
- 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

const IReceptionPacketModelcreatePacketModel (const BitVector *decodedBits, const IScrambling *scrambling, const IForwardErrorCorrection *fec, const IInterleaving *interleaving) const
 
ShortBitVector getSignalFieldRate (const BitVector &signalField) const
 
unsigned int getSignalFieldLength (const BitVector &signalField) const
 
unsigned int calculatePadding (unsigned int dataFieldLengthInBits, const IModulation *modulationScheme, const Ieee80211ConvolutionalCode *fec) const
 

Protected Attributes

const Ieee80211OFDMCodecode = nullptr
 
const IScramblerdescrambler = nullptr
 
const IFECCoderfecDecoder = nullptr
 
const IInterleaverdeinterleaver = nullptr
 

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::Ieee80211OFDMDecoder::Ieee80211OFDMDecoder ( const IScrambler descrambler,
const IFECCoder fecDecoder,
const IInterleaver deinterleaver 
)
inet::physicallayer::Ieee80211OFDMDecoder::Ieee80211OFDMDecoder ( const Ieee80211OFDMCode code)
32  :
33  code(code),
34  descrambler(nullptr),
35  fecDecoder(nullptr),
36  deinterleaver(nullptr)
37 {
38  if (code->getScrambling())
39  descrambler = new AdditiveScrambler(code->getScrambling());
41  fecDecoder = new ConvolutionalCoder(code->getConvolutionalCode());
42  if (code->getInterleaving())
43  deinterleaver = new Ieee80211OFDMInterleaver(code->getInterleaving());
44 }
const IInterleaver * deinterleaver
Definition: Ieee80211OFDMDecoder.h:42
const IFECCoder * fecDecoder
Definition: Ieee80211OFDMDecoder.h:41
const IScrambler * descrambler
Definition: Ieee80211OFDMDecoder.h:40
const AdditiveScrambling * getScrambling() const
Definition: Ieee80211OFDMCode.h:43
const Ieee80211OFDMCode * code
Definition: Ieee80211OFDMDecoder.h:39
const Ieee80211OFDMInterleaving * getInterleaving() const
Definition: Ieee80211OFDMCode.h:42
const ConvolutionalCode * getConvolutionalCode() const
Definition: Ieee80211OFDMCode.h:41
inet::physicallayer::Ieee80211OFDMDecoder::~Ieee80211OFDMDecoder ( )
virtual
115 {
116  delete deinterleaver;
117  delete descrambler;
118  delete fecDecoder;
119 }
const IInterleaver * deinterleaver
Definition: Ieee80211OFDMDecoder.h:42
const IFECCoder * fecDecoder
Definition: Ieee80211OFDMDecoder.h:41
const IScrambler * descrambler
Definition: Ieee80211OFDMDecoder.h:40

Member Function Documentation

unsigned int inet::physicallayer::Ieee80211OFDMDecoder::calculatePadding ( unsigned int  dataFieldLengthInBits,
const IModulation modulationScheme,
const Ieee80211ConvolutionalCode fec 
) const
protected
106 {
107  const IAPSKModulation *dataModulationScheme = dynamic_cast<const IAPSKModulation *>(modulationScheme);
108  ASSERT(dataModulationScheme != nullptr);
109  unsigned int codedBitsPerOFDMSymbol = dataModulationScheme->getCodeWordSize() * NUMBER_OF_OFDM_DATA_SUBCARRIERS;
110  unsigned int dataBitsPerOFDMSymbol = codedBitsPerOFDMSymbol * fec->getCodeRatePuncturingK() / fec->getCodeRatePuncturingN();
111  return dataBitsPerOFDMSymbol - dataFieldLengthInBits % dataBitsPerOFDMSymbol;
112 }
#define NUMBER_OF_OFDM_DATA_SUBCARRIERS
Definition: Ieee80211OFDMDefs.h:25
const IReceptionPacketModel * inet::physicallayer::Ieee80211OFDMDecoder::createPacketModel ( const BitVector decodedBits,
const IScrambling scrambling,
const IForwardErrorCorrection fec,
const IInterleaving interleaving 
) const
protected

Referenced by decode().

83 {
84  double per = -1;
85  bool packetErrorless = true; // TODO: compute packet error rate, packetErrorLess
86  return new ReceptionPacketModel(nullptr, decodedBits, bps(NaN), per, packetErrorless);
87 }
compose< b, pow< s,-1 > > bps
Definition: Units.h:985
#define NaN
Definition: INETMath.h:103
const IReceptionPacketModel * inet::physicallayer::Ieee80211OFDMDecoder::decode ( const IReceptionBitModel bitModel) const
overridevirtual

Implements inet::physicallayer::IDecoder.

Referenced by inet::physicallayer::Ieee80211LayeredOFDMReceiver::createDataFieldPacketModel(), inet::physicallayer::Ieee80211LayeredOFDMReceiver::createSignalFieldPacketModel(), and inet::physicallayer::Ieee80211OFDMDecoderModule::decode().

58 {
59  BitVector *decodedBits = new BitVector(*bitModel->getBits());
60  const IInterleaving *interleaving = nullptr;
61  if (deinterleaver) {
62  *decodedBits = deinterleaver->deinterleave(*decodedBits);
63  interleaving = deinterleaver->getInterleaving();
64  }
65  const IForwardErrorCorrection *forwardErrorCorrection = nullptr;
66  if (fecDecoder) {
67  std::pair<BitVector, bool> fecDecodedDataField = fecDecoder->decode(*decodedBits);
68  bool isDecodedSuccessfully = fecDecodedDataField.second;
69  if (!isDecodedSuccessfully)
70  throw cRuntimeError("FEC error"); // TODO: implement correct error handling
71  *decodedBits = fecDecodedDataField.first;
72  forwardErrorCorrection = fecDecoder->getForwardErrorCorrection();
73  }
74  const IScrambling *scrambling = nullptr;
75  if (descrambler) {
76  scrambling = descrambler->getScrambling();
77  *decodedBits = descrambler->descramble(*decodedBits);
78  }
79  return createPacketModel(decodedBits, scrambling, forwardErrorCorrection, interleaving);
80 }
const IInterleaver * deinterleaver
Definition: Ieee80211OFDMDecoder.h:42
const IReceptionPacketModel * createPacketModel(const BitVector *decodedBits, const IScrambling *scrambling, const IForwardErrorCorrection *fec, const IInterleaving *interleaving) const
Definition: Ieee80211OFDMDecoder.cc:82
virtual const IInterleaving * getInterleaving() const =0
const IFECCoder * fecDecoder
Definition: Ieee80211OFDMDecoder.h:41
const IScrambler * descrambler
Definition: Ieee80211OFDMDecoder.h:40
virtual const IScrambling * getScrambling() const =0
virtual const IForwardErrorCorrection * getForwardErrorCorrection() const =0
virtual std::pair< BitVector, bool > decode(const BitVector &encodedBits) const =0
virtual BitVector deinterleave(const BitVector &bits) const =0
virtual BitVector descramble(const BitVector &bits) const =0
const Ieee80211OFDMCode* inet::physicallayer::Ieee80211OFDMDecoder::getCode ( ) const
inline
57 { return code; }
const Ieee80211OFDMCode * code
Definition: Ieee80211OFDMDecoder.h:39
unsigned int inet::physicallayer::Ieee80211OFDMDecoder::getSignalFieldLength ( const BitVector signalField) const
protected
98 {
99  ShortBitVector length;
100  for (int i = SIGNAL_LENGTH_FIELD_START; i <= SIGNAL_LENGTH_FIELD_END; i++)
101  length.appendBit(signalField.getBit(i));
102  return length.toDecimal();
103 }
#define SIGNAL_LENGTH_FIELD_END
Definition: Ieee80211OFDMDefs.h:31
#define SIGNAL_LENGTH_FIELD_START
Definition: Ieee80211OFDMDefs.h:30
ShortBitVector inet::physicallayer::Ieee80211OFDMDecoder::getSignalFieldRate ( const BitVector signalField) const
protected
90 {
91  ShortBitVector rate;
92  for (int i = SIGNAL_RATE_FIELD_START; i <= SIGNAL_RATE_FIELD_END; i++)
93  rate.appendBit(signalField.getBit(i));
94  return rate;
95 }
#define SIGNAL_RATE_FIELD_START
Definition: Ieee80211OFDMDefs.h:28
#define SIGNAL_RATE_FIELD_END
Definition: Ieee80211OFDMDefs.h:29
std::ostream & inet::physicallayer::Ieee80211OFDMDecoder::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::IPrintableObject.

Referenced by inet::physicallayer::Ieee80211OFDMDecoderModule::printToStream().

47 {
48  stream << "Ieee80211OFDMDecoder";
49  if (level <= PRINT_LEVEL_TRACE)
50  stream << ", code = " << printObjectToString(code, level + 1)
51  << ", descrambler = " << printObjectToString(descrambler, level + 1)
52  << ", fecDecoder = " << printObjectToString(fecDecoder, level + 1)
53  << ", deinterleaver = " << printObjectToString(deinterleaver, level + 1);
54  return stream;
55 }
const IInterleaver * deinterleaver
Definition: Ieee80211OFDMDecoder.h:42
std::string printObjectToString(const IPrintableObject *object, int level)
Definition: IPrintableObject.h:73
const IFECCoder * fecDecoder
Definition: Ieee80211OFDMDecoder.h:41
const IScrambler * descrambler
Definition: Ieee80211OFDMDecoder.h:40
const Ieee80211OFDMCode * code
Definition: Ieee80211OFDMDecoder.h:39

Member Data Documentation

const Ieee80211OFDMCode* inet::physicallayer::Ieee80211OFDMDecoder::code = nullptr
protected

Referenced by printToStream().

const IInterleaver* inet::physicallayer::Ieee80211OFDMDecoder::deinterleaver = nullptr
protected
const IScrambler* inet::physicallayer::Ieee80211OFDMDecoder::descrambler = nullptr
protected
const IFECCoder* inet::physicallayer::Ieee80211OFDMDecoder::fecDecoder = nullptr
protected

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