spectrum: Fix Config::Connect path for trace source in example

This commit is contained in:
Tom Henderson
2020-05-05 21:26:05 -07:00
parent 9a186f9b0a
commit aaa7074833

View File

@@ -80,7 +80,7 @@ public:
* \param rxPhy the receiving PHY
* \param lossDb the loss in dB
*/
void UpdatePathloss (std::string context, Ptr<SpectrumPhy> txPhy, Ptr<SpectrumPhy> rxPhy, double lossDb);
void UpdatePathloss (std::string context, Ptr<const SpectrumPhy> txPhy, Ptr<const SpectrumPhy> rxPhy, double lossDb);
/**
* print the stored pathloss values to standard output
@@ -94,10 +94,12 @@ private:
void
GlobalPathlossDatabase::UpdatePathloss (std::string context,
Ptr<SpectrumPhy> txPhy,
Ptr<SpectrumPhy> rxPhy,
Ptr<const SpectrumPhy> txPhyConst,
Ptr<const SpectrumPhy> rxPhyConst,
double lossDb)
{
Ptr<SpectrumPhy> txPhy = ConstCast<SpectrumPhy> (txPhyConst);
Ptr<SpectrumPhy> rxPhy = ConstCast<SpectrumPhy> (rxPhyConst);
uint32_t txNodeId = txPhy->GetMobility ()->GetObject<Node> ()->GetId ();
uint32_t rxNodeId = rxPhy->GetMobility ()->GetObject<Node> ()->GetId ();
m_pathlossMap[txNodeId][rxNodeId] = lossDb;
@@ -195,7 +197,7 @@ int main (int argc, char** argv)
Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxEndOk", MakeCallback (&PhyRxEndOkTrace));
GlobalPathlossDatabase globalPathlossDatabase;
Config::Connect ("/ChannelList/*/PropagationLoss",
Config::Connect ("/ChannelList/*/$ns3::SpectrumChannel/PathLoss",
MakeCallback (&GlobalPathlossDatabase::UpdatePathloss, &globalPathlossDatabase));
g_rxBytes = 0;