Set mobility model for node instead of net device

This commit is contained in:
Tim Schubert 2020-07-15 22:18:30 +02:00
parent f34ca7fafd
commit 6c154b6d60
5 changed files with 11 additions and 28 deletions

View file

@ -117,8 +117,8 @@ MockChannel::GetDelay (Ptr<const MockNetDevice> src, Ptr<const MockNetDevice> ds
{
NS_LOG_DEBUG ("Get delay from " << src << " to " << dst);
Ptr<MobilityModel> modSrc = src->GetMobilityModel ();
Ptr<MobilityModel> modDst = dst->GetMobilityModel ();
Ptr<MobilityModel> modSrc = src->GetNode ()->GetObject<MobilityModel> ();
Ptr<MobilityModel> modDst = dst->GetNode ()->GetObject<MobilityModel> ();
Time propagationDelay = m_propagationDelay->GetDelay (modSrc, modDst);
@ -163,7 +163,7 @@ MockChannel::Deliver (
Time delay = GetDelay (src, dst, txTime);
/* Check if there is LOS between the source and destination */
if (GetPropagationLoss ()->CalcRxPower(1, src->GetMobilityModel(), dst->GetMobilityModel()) > 0)
if (GetPropagationLoss ()->CalcRxPower(1, src->GetNode ()->GetObject<MobilityModel> (), dst->GetNode ()->GetObject<MobilityModel> ()) > 0)
{
Simulator::ScheduleWithContext (dst->GetNode ()->GetId (),
delay,

View file

@ -78,11 +78,6 @@ MockNetDevice::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&MockNetDevice::m_queue),
MakePointerChecker<Queue<Packet> > ())
.AddAttribute ("MobilityModel", "The mobility model of the device",
PointerValue (),
MakePointerAccessor (&MockNetDevice::SetMobilityModel,
&MockNetDevice::GetMobilityModel),
MakePointerChecker<MobilityModel> ())
//
// Trace sources at the "top" of the net device, where packets transition
// to/from higher layers.
@ -713,19 +708,6 @@ MockNetDevice::EtherToPpp (uint16_t proto)
return 0;
}
Ptr<MobilityModel>
MockNetDevice::GetMobilityModel (void) const
{
return m_mobilityModel;
}
void
MockNetDevice::SetMobilityModel (Ptr<MobilityModel> model)
{
NS_LOG_FUNCTION (this);
m_mobilityModel = model;
}
bool
MockNetDevice::IsPointToPoint() const
{

View file

@ -195,8 +195,6 @@ public:
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
virtual bool SupportsSendFrom (void) const;
Ptr<MobilityModel> GetMobilityModel (void) const;
void SetMobilityModel (Ptr<MobilityModel> model);
void NotifyLinkDown (void);
protected:
@ -477,8 +475,6 @@ private:
Ptr<Packet> m_currentPkt; //!< Current packet processed
Ptr<MobilityModel> m_mobilityModel;
/**
* \brief PPP to Ethernet protocol number mapping
* \param protocol A PPP protocol number