This is a follow up of the post:
I am trying to access the IsStateBusy() of the YansWifiPhy class of nodes in a vehicular scenario. The important extracts of my code for this issue are:
int main (int argc, char *argv[])
{
......
NetDeviceContainer devices = wifi80211p.Install (wifiPhy, wifi80211pMac, cars);
......
Simulator::Schedule (Tm, &CalculateCL, devices, Tm);
}
void CalculateCL (NetDeviceContainer devices, Time pktInterval)
{
Ptr<NetDevice> dev = devices.Get(0);
Ptr<WifiNetDevice> wifiDev = DynamicCast<WifiNetDevice> (dev);
Ptr<WifiPhy> phy = dev->GetPhy ();
Ptr <YansWifiPhy> phyobj =phy->GetObject<YansWifiPhy> ();
}
The problem comes at the line:
Ptr<WifiNetDevice> wifiDev = DynamicCast<WifiNetDevice> (dev);
I am getting the following error that has to do with the DynamicCast to WifiNetDevice":
In file included from ./ns3/attribute.h:25:0,
from ./ns3/vector.h:23,
from ../scratch/80211p_simple_v3.cc:32:
./ns3/ptr.h: In instantiation of ‘ns3::Ptr<T> ns3::DynamicCast(const ns3::Ptr<T2>&) [with T1 = ns3::WifiNetDevice; T2 = ns3::NetDevice]’:
../scratch/80211p_simple_v3.cc:109:63: required from here
./ns3/ptr.h:667:55: error: cannot dynamic_cast ‘ns3::PeekPointer<ns3::NetDevice>((* & p))’ (of type ‘class ns3::NetDevice*’) to type ‘class ns3::WifiNetDevice*’ (target is not pointer or reference to complete type)
return Ptr<T1> (dynamic_cast<T1 *> (PeekPointer (p)));
^
I will appreciate any comments. Thanks.