--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.
You can insert the following code sniplet in the mesh.cc anywhere
__after__ line meshDevices = mesh.Install (wifiPhy, nodes) to
re-assign channel numbers:
// loop over all mesh points
for (NetDeviceContainer::Iterator i = meshDevices.Begin(); i !=
meshDevices.End(); ++i)
{
Ptr<MeshPointDevice> mp = DynamicCast<MeshPointDevice>(*i);
NS_ASSERT (mp != 0);
// loop over all interfaces
std::vector<Ptr<NetDevice> > meshInterfaces = mp->GetInterfaces ();
for (std::vector<Ptr<NetDevice> >::iterator j =
meshInterfaces.begin(); j != meshInterfaces.end(); ++j)
{
Ptr<WifiNetDevice> ifdevice = DynamicCast<WifiNetDevice>(*j);
NS_ASSERT (ifdevice != 0);
// access MAC
Ptr<MeshWifiInterfaceMac> ifmac =
DynamicCast<MeshWifiInterfaceMac>(ifdevice->GetMac());
NS_ASSERT (ifmac != 0);
// Access channel number
NS_LOG_UNCOND ("Old channel: " << ifmac->GetFrequencyChannel ());
// Change channel number
uint16_t newChannel = ... // Add your custom channel
assignment here
ifmac->SwitchFrequencyChannel (newChannel);
NS_LOG_UNCOND ("New channel: " << ifmac->GetFrequencyChannel ());
}
}
Good luck with mesh code,
Pavel