From 4ae0e85c4d07284318b559f0d7d773c4ae9b341f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 23 Dec 2017 13:21:47 +0100 Subject: [PATCH] wifi: fix wrong uint types --- src/wifi/examples/test-interference-helper.cc | 4 ++-- src/wifi/model/wifi-phy.cc | 4 ++-- src/wifi/model/wifi-phy.h | 6 +++--- src/wifi/test/block-ack-test-suite.cc | 4 ++-- src/wifi/test/tx-duration-test.cc | 20 +++++++++---------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/wifi/examples/test-interference-helper.cc b/src/wifi/examples/test-interference-helper.cc index 7f34476ff..7559bb3d4 100644 --- a/src/wifi/examples/test-interference-helper.cc +++ b/src/wifi/examples/test-interference-helper.cc @@ -118,7 +118,7 @@ InterferenceExperiment::SendA (void) const { Ptr p = Create (m_input.packetSizeA); WifiTxVector txVector; - txVector.SetTxPowerLevel (m_input.txPowerLevelA); + txVector.SetTxPowerLevel (0); //only one TX power level txVector.SetMode (WifiMode (m_input.txModeA)); txVector.SetPreambleType (m_input.preamble); m_txA->SendPacket (p, txVector); @@ -129,7 +129,7 @@ InterferenceExperiment::SendB (void) const { Ptr p = Create (m_input.packetSizeB); WifiTxVector txVector; - txVector.SetTxPowerLevel (m_input.txPowerLevelB); + txVector.SetTxPowerLevel (0); //only one TX power level txVector.SetMode (WifiMode (m_input.txModeB)); txVector.SetPreambleType (m_input.preamble); m_txB->SendPacket (p, txVector); diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index a70c02722..b74ef6a1c 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -373,8 +373,8 @@ WifiPhy::GetTypeId (void) WifiPhy::WifiPhy () : m_mpdusNum (0), m_plcpSuccess (false), - m_txMpduReferenceNumber (0xffffffffffffffff), - m_rxMpduReferenceNumber (0xffffffffffffffff), + m_txMpduReferenceNumber (0xffffffff), + m_rxMpduReferenceNumber (0xffffffff), m_endRxEvent (), m_endPlcpRxEvent (), m_standard (WIFI_PHY_STANDARD_UNSPECIFIED), diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 22277c16a..d7df8a136 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -74,7 +74,7 @@ struct SignalNoiseDbm struct MpduInfo { MpduType type; ///< type - uint64_t mpduRefNumber; ///< MPDU ref number + uint32_t mpduRefNumber; ///< MPDU ref number }; /** @@ -1677,8 +1677,8 @@ protected: uint16_t m_mpdusNum; //!< carries the number of expected mpdus that are part of an A-MPDU bool m_plcpSuccess; //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received - uint64_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU - uint64_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU + uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU + uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU EventId m_endRxEvent; //!< the end reeive event EventId m_endPlcpRxEvent; //!< the end PLCP receive event diff --git a/src/wifi/test/block-ack-test-suite.cc b/src/wifi/test/block-ack-test-suite.cc index ef66c242b..99d606de4 100644 --- a/src/wifi/test/block-ack-test-suite.cc +++ b/src/wifi/test/block-ack-test-suite.cc @@ -271,7 +271,7 @@ CtrlBAckResponseHeaderTest::DoRun (void) //Case 1: startSeq < endSeq // 179 242 m_blockAckHdr.SetStartingSequence (179); - for (uint8_t i = 179; i < 220; i++) + for (uint16_t i = 179; i < 220; i++) { m_blockAckHdr.SetReceivedPacket (i); } @@ -295,7 +295,7 @@ CtrlBAckResponseHeaderTest::DoRun (void) { m_blockAckHdr.SetReceivedPacket (i); } - for (uint8_t i = 22; i < 25; i++) + for (uint16_t i = 22; i < 25; i++) { m_blockAckHdr.SetReceivedPacket (i); } diff --git a/src/wifi/test/tx-duration-test.cc b/src/wifi/test/tx-duration-test.cc index a741e9f0c..b16bf428d 100644 --- a/src/wifi/test/tx-duration-test.cc +++ b/src/wifi/test/tx-duration-test.cc @@ -27,8 +27,8 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("InterferenceHelperTxDurationTest"); -static const double CHANNEL_1_MHZ = 2412.0; // a 2.4 GHz center frequency (MHz) -static const double CHANNEL_36_MHZ = 5180.0; // a 5 GHz center frequency (MHz) +static const uint16_t CHANNEL_1_MHZ = 2412; // a 2.4 GHz center frequency (MHz) +static const uint16_t CHANNEL_36_MHZ = 5180; // a 5 GHz center frequency (MHz) /** * \ingroup wifi-test @@ -58,7 +58,7 @@ private: * * @return true if values correspond, false otherwise */ - bool CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration); + bool CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint8_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration); /** * Check if the overall tx duration returned by InterferenceHelper @@ -73,7 +73,7 @@ private: * * @return true if values correspond, false otherwise */ - bool CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration); + bool CheckTxDuration (uint32_t size, WifiMode payloadMode, uint8_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration); }; @@ -87,7 +87,7 @@ TxDurationTest::~TxDurationTest () } bool -TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration) +TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint8_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration) { WifiTxVector txVector; txVector.SetMode (payloadMode); @@ -97,7 +97,7 @@ TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint3 txVector.SetNss (1); txVector.SetStbc (0); txVector.SetNess (0); - double testedFrequency = CHANNEL_1_MHZ; + uint16_t testedFrequency = CHANNEL_1_MHZ; Ptr phy = CreateObject (); if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT @@ -129,7 +129,7 @@ TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint3 { std::cerr << "size=" << size << " mode=" << payloadMode - << " channelWidth=" << channelWidth + << " channelWidth=" << static_cast (channelWidth) << " guardInterval=" << guardInterval << " datarate=" << payloadMode.GetDataRate (channelWidth, guardInterval, 1) << " known=" << knownDuration @@ -142,7 +142,7 @@ TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint3 } bool -TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration) +TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, uint8_t channelWidth, uint16_t guardInterval, WifiPreamble preamble, Time knownDuration) { WifiTxVector txVector; txVector.SetMode (payloadMode); @@ -152,7 +152,7 @@ TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t c txVector.SetNss (1); txVector.SetStbc (0); txVector.SetNess (0); - double testedFrequency = CHANNEL_1_MHZ; + uint16_t testedFrequency = CHANNEL_1_MHZ; Ptr phy = CreateObject (); if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_OFDM || payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT @@ -166,7 +166,7 @@ TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, uint32_t c { std::cerr << "size=" << size << " mode=" << payloadMode - << " channelWidth=" << channelWidth + << " channelWidth=" << static_cast (channelWidth) << " guardInterval=" << guardInterval << " datarate=" << payloadMode.GetDataRate (channelWidth, guardInterval, 1) << " preamble=" << preamble