从 NS3 中接收的回调访问 WiFiPhy
Accessing WiFiPhy from a recevied callback in NS3
我想使用签名访问NetDevice接收回调中的WiFiPhy。
typedef Callback< bool, Ptr<NetDevice>, Ptr<const Packet>, uint16_t, const Address & > ReceiveCallback;
在回调中,我是将NetDevice转换为WiFiDevice的转换,就像WiFiPhy函数一样。
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(device);
Ptr<WifiPhy> wifiPhyDev = wifiNetDevice->GetPhy();
但是我在运行过程中遇到分段错误?我到底在这里做错了什么?
谢谢
好的,
我找到了。 当您创建NetDeviceContainer时,对象是NetDevice类型,它没有任何WifiPhy。解决方案是将其动态投射到WifiNetDevice中并发送帧。
Ptr<WifiNetDevice> wifiNetDevice = DynamicCast<WifiNetDevice>(netDevice);
相关文章:
- 访问类C++ C 样式回调
- 为什么可以在没有实例变量的情况下访问静态回调方法中的静态成员变量?
- 使用参数的 C# 委托回调会导致从 DLL 调用时C++访问冲突
- 从触摸回调访问向量元素的方法时,不良访问错误
- 访问回调函数中的 QPushButton
- 如何从qmlregistersingletontype的回调中访问QML加载项目
- 从 NS3 中接收的回调访问 WiFiPhy
- 读取 Lambda 回调后的访问冲突
- 如何从回调方法访问自定义类成员
- 如何访问成员变量 sqlite 回调
- 如何访问带有静态回调的对象属性
- C到C#(从C#访问C DLL回调函数)
- 无法访问在 std 回调中传递的对象变量
- 访问作为WiFi侦听器回调成员函数一部分的类的成员
- C++如何通过回调方法访问成员变量
- 从 ctypes 中的回调访问值
- C++ 无法从回调函数中的"this"访问对象指针
- Qt 应用程序在从 <QUrl>NetworkAccessManager->get() 回调访问 QList<QLlnkedList* >时冻结
- 回调方法无法访问成员变量或实例
- 如何在第三方库调用的回调函数中传递/使对象/变量可访问