[英]Accessing WiFiPhy from a recevied callback in NS3
I want to access the WiFiPhy inside the reception callback of NetDevice with signature. 我想使用签名访问NetDevice的接收回调中的WiFiPhy。
typedef Callback< bool, Ptr<NetDevice>, Ptr<const Packet>, uint16_t, const Address & > ReceiveCallback;
Inside the callback, i'm the the casting the NetDevice to WiFiDevice like to WiFiPhy functions. 在回调内部,我正在将NetDevice投射到WiFiDevice,就像WiFiPhy函数一样。
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(device);
Ptr<WifiPhy> wifiPhyDev = wifiNetDevice->GetPhy();
But I am getting a segmentation fault during the run ? 但是我在运行过程中遇到了细分错误? What actually im doing wrong here? 我在这里实际上在做什么错?
Thanks 谢谢
Ok i found it.. when you create a NetDeviceContainer the object is of type NetDevice which does not have any WifiPhy . 好的,我找到了..当您创建一个NetDeviceContainer时,该对象的类型为NetDevice ,它没有任何WifiPhy 。 The solution is to DynamicCast it into WifiNetDevice and send the frame. 解决方案是将其动态投射到WifiNetDevice并发送帧。
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(netDevice);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.