diff -r ff532caf9e15 src/wave/examples/vanet-routing-compare.cc --- a/src/wave/examples/vanet-routing-compare.cc Sun Feb 28 22:50:25 2016 +0100 +++ b/src/wave/examples/vanet-routing-compare.cc Mon Feb 29 16:21:43 2016 +0800 @@ -818,13 +818,13 @@ void WifiPhyStats::PhyTxDrop (std::string context, Ptr packet) { - NS_LOG_UNCOND ("PHY Tx Drop"); + //NS_LOG_UNCOND ("PHY Tx Drop"); } void WifiPhyStats::PhyRxDrop (std::string context, Ptr packet) { - NS_LOG_UNCOND ("PHY Rx Drop"); + //NS_LOG_UNCOND ("PHY Rx Drop"); } uint32_t @@ -1605,10 +1605,13 @@ // which is used to determine the total amount of // data transmitted, and then used to calculate // the MAC/PHY overhead beyond the app-data - Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/Tx", MakeCallback (&WifiPhyStats::PhyTxTrace, m_wifiPhyStats)); - // TxDrop, RxDrop not working yet. Not sure what I'm doing wrong. - Config::Connect ("/NodeList/*/DeviceList/*/ns3::WifiNetDevice/Phy/PhyTxDrop", MakeCallback (&WifiPhyStats::PhyTxDrop, m_wifiPhyStats)); - Config::Connect ("/NodeList/*/DeviceList/*/ns3::WifiNetDevice/Phy/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats)); + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/State/Tx", MakeCallback (&WifiPhyStats::PhyTxTrace, m_wifiPhyStats)); + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop", MakeCallback (&WifiPhyStats::PhyTxDrop, m_wifiPhyStats)); + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats)); + + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/State/Tx", MakeCallback (&WifiPhyStats::PhyTxTrace, m_wifiPhyStats)); + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats)); + Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WaveNetDevice/PhyEntities/*/PhyRxDrop", MakeCallback (&WifiPhyStats::PhyRxDrop, m_wifiPhyStats)); } void diff -r ff532caf9e15 src/wave/model/bsm-application.cc --- a/src/wave/model/bsm-application.cc Sun Feb 28 22:50:25 2016 +0100 +++ b/src/wave/model/bsm-application.cc Mon Feb 29 16:21:43 2016 +0800 @@ -217,6 +217,32 @@ m_adhocTxInterfaces = &i; m_nodeId = nodeId; m_txMaxDelay = txMaxDelay; + + // check whether current device is a WAVE device, + // so alternating channel access assignment will be support. + Ptr node = Application::GetNode(); + Ptr device = node->GetDevice(0); + Ptr waveDevice = DynamicCast(device); + if (waveDevice == 0) + return; + + // assign channel access and register txprofile for sending packets + if (m_chAccessMode == 1) + { + // assign alternating channel access for SCH1 and CCH + SchInfo info = SchInfo (SCH1, false, EXTENDED_ALTERNATING); + Simulator::Schedule (Seconds (0), &WaveNetDevice::StartSch, waveDevice, info); + } + else + { + // assign continuous channel access for SCH1 + SchInfo info = SchInfo (SCH1, false, EXTENDED_CONTINUOUS); + Simulator::Schedule (Seconds (0), &WaveNetDevice::StartSch, waveDevice, info); + } + + // register a tx profile for IP-based packets + const TxProfile txProfile = TxProfile (SCH1); + Simulator::Schedule (Seconds (0), &WaveNetDevice::RegisterTxProfile, waveDevice, txProfile); } void diff -r ff532caf9e15 src/wave/model/wave-net-device.cc --- a/src/wave/model/wave-net-device.cc Sun Feb 28 22:50:25 2016 +0100 +++ b/src/wave/model/wave-net-device.cc Mon Feb 29 16:21:43 2016 +0800 @@ -412,7 +412,7 @@ txVector.SetTxPowerLevel (txInfo.txPowerLevel); txVector.SetMode (txInfo.dataRate); HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, false); - packet->AddPacketTag (tag); + packet->ReplacePacketTag (tag); } LlcSnapHeader llc; @@ -422,7 +422,7 @@ // according to channel number and priority, // route the packet to a proper queue. QosTag qos = QosTag (txInfo.priority); - packet->AddPacketTag (qos); + packet->ReplacePacketTag (qos); Ptr mac = GetMac (txInfo.channelNumber); Mac48Address realTo = Mac48Address::ConvertFrom (dest); mac->NotifyTx (packet); @@ -618,7 +618,7 @@ txVector.SetTxPowerLevel (m_txProfile->txPowerLevel); txVector.SetMode (m_txProfile->dataRate); HigherLayerTxVectorTag tag = HigherLayerTxVectorTag (txVector, m_txProfile->adaptable); - packet->AddPacketTag (tag); + packet->ReplacePacketTag (tag); } LlcSnapHeader llc; diff -r ff532caf9e15 src/wifi/model/dcf-manager.cc --- a/src/wifi/model/dcf-manager.cc Sun Feb 28 22:50:25 2016 +0100 +++ b/src/wifi/model/dcf-manager.cc Mon Feb 29 16:21:43 2016 +0800 @@ -474,6 +474,12 @@ { return true; } + // CCA busy + Time lastBusyEnd = m_lastBusyStart + m_lastBusyDuration; + if (lastBusyEnd >= Simulator::Now ()) + { + return true; + } // NAV busy Time lastNavEnd = m_lastNavStart + m_lastNavDuration; if (lastNavEnd > Simulator::Now ())