Apply utils/check-style.py script on lr-wpan source code again
This commit is contained in:
@@ -74,7 +74,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
// Enable calculation of FCS in the trailers. Only necessary when interacting with real devices or wireshark.
|
||||
// GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
|
||||
|
||||
|
||||
// Create 2 nodes, and a NetDevice for each one
|
||||
Ptr<Node> n0 = CreateObject <Node> ();
|
||||
Ptr<Node> n1 = CreateObject <Node> ();
|
||||
@@ -146,15 +146,15 @@ int main (int argc, char *argv[])
|
||||
params.m_txOptions = TX_OPTION_ACK;
|
||||
// dev0->GetMac ()->McpsDataRequest (params, p0);
|
||||
Simulator::ScheduleWithContext (1, Seconds (0.0),
|
||||
&LrWpanMac::McpsDataRequest,
|
||||
dev0->GetMac (), params, p0);
|
||||
&LrWpanMac::McpsDataRequest,
|
||||
dev0->GetMac (), params, p0);
|
||||
|
||||
// Send a packet back at time 2 seconds
|
||||
Ptr<Packet> p2 = Create<Packet> (60); // 60 bytes of dummy data
|
||||
params.m_dstAddr = Mac16Address ("00:01");
|
||||
Simulator::ScheduleWithContext (2, Seconds (2.0),
|
||||
&LrWpanMac::McpsDataRequest,
|
||||
dev1->GetMac (), params, p2);
|
||||
&LrWpanMac::McpsDataRequest,
|
||||
dev1->GetMac (), params, p2);
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
/**
|
||||
* Assign a fixed random variable stream number to the random variables
|
||||
* used by this model. Return the number of streams that have been
|
||||
* used by this model. Return the number of streams that have been
|
||||
* assigned. The Install() method should have previously been
|
||||
* called by the user.
|
||||
*
|
||||
|
||||
@@ -27,8 +27,9 @@ NS_LOG_COMPONENT_DEFINE ("LrWpanInterferenceHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
LrWpanInterferenceHelper::LrWpanInterferenceHelper (Ptr<const SpectrumModel> spectrumModel) :
|
||||
m_spectrumModel (spectrumModel), m_dirty (false)
|
||||
LrWpanInterferenceHelper::LrWpanInterferenceHelper (Ptr<const SpectrumModel> spectrumModel)
|
||||
: m_spectrumModel (spectrumModel),
|
||||
m_dirty (false)
|
||||
{
|
||||
m_signal = Create<SpectrumValue> (m_spectrumModel);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ public:
|
||||
*/
|
||||
Ptr<const SpectrumModel> GetSpectrumModel (void) const;
|
||||
private:
|
||||
|
||||
/**
|
||||
* The helpers SpectrumModel.
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
*/
|
||||
uint8_t Get (void) const;
|
||||
private:
|
||||
|
||||
/**
|
||||
* The current LQI value of the tag.
|
||||
*/
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* \ingroup lr-wpan
|
||||
* Represent the Mac Header with the Frame Control and Sequence Number fields
|
||||
* Represent the Mac Header with the Frame Control and Sequence Number fields
|
||||
*/
|
||||
class LrWpanMacHeader : public Header
|
||||
{
|
||||
|
||||
@@ -30,7 +30,8 @@ NS_OBJECT_ENSURE_REGISTERED (LrWpanMacTrailer);
|
||||
const uint16_t LrWpanMacTrailer::LR_WPAN_MAC_FCS_LENGTH = 2;
|
||||
|
||||
LrWpanMacTrailer::LrWpanMacTrailer (void)
|
||||
: m_fcs (0), m_calcFcs (false)
|
||||
: m_fcs (0),
|
||||
m_calcFcs (false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -92,9 +93,9 @@ LrWpanMacTrailer::SetFcs (Ptr<const Packet> p)
|
||||
uint16_t size = p->GetSize ();
|
||||
uint8_t *serial_packet = new uint8_t[size];
|
||||
|
||||
p->CopyData(serial_packet, size);
|
||||
p->CopyData (serial_packet, size);
|
||||
|
||||
m_fcs = GenerateCrc16(serial_packet, size);
|
||||
m_fcs = GenerateCrc16 (serial_packet, size);
|
||||
delete[] serial_packet;
|
||||
}
|
||||
}
|
||||
@@ -114,9 +115,9 @@ LrWpanMacTrailer::CheckFcs (Ptr<const Packet> p)
|
||||
uint16_t size = p->GetSize ();
|
||||
uint8_t *serial_packet = new uint8_t[size];
|
||||
|
||||
p->CopyData(serial_packet, size);
|
||||
p->CopyData (serial_packet, size);
|
||||
|
||||
checkFcs = GenerateCrc16(serial_packet, size);
|
||||
checkFcs = GenerateCrc16 (serial_packet, size);
|
||||
delete[] serial_packet;
|
||||
return (checkFcs == GetFcs ());
|
||||
}
|
||||
@@ -144,7 +145,7 @@ LrWpanMacTrailer::GenerateCrc16 (uint8_t *data, int length)
|
||||
int i;
|
||||
uint16_t accumulator = 0;
|
||||
|
||||
for(i = 0; i < length; ++i)
|
||||
for (i = 0; i < length; ++i)
|
||||
{
|
||||
accumulator ^= *data;
|
||||
accumulator = (accumulator >> 8) | (accumulator << 8);
|
||||
|
||||
@@ -291,7 +291,7 @@ LrWpanMac::McpsDataRequest (McpsDataRequestParams params, Ptr<Packet> p)
|
||||
if (b0 == TX_OPTION_ACK)
|
||||
{
|
||||
// Set AckReq bit only if the destination is not the broadcast address.
|
||||
if (!(macHdr.GetDstAddrMode () == SHORT_ADDR && macHdr.GetShortDstAddr() == "ff:ff"))
|
||||
if (!(macHdr.GetDstAddrMode () == SHORT_ADDR && macHdr.GetShortDstAddr () == "ff:ff"))
|
||||
{
|
||||
macHdr.SetAckReq ();
|
||||
}
|
||||
@@ -465,7 +465,7 @@ LrWpanMac::PdDataIndication (uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
|
||||
}
|
||||
|
||||
// level 1 filtering
|
||||
if(!receivedMacTrailer.CheckFcs (p))
|
||||
if (!receivedMacTrailer.CheckFcs (p))
|
||||
{
|
||||
m_macRxDropTrace (originalPkt);
|
||||
}
|
||||
@@ -601,7 +601,7 @@ LrWpanMac::PdDataIndication (uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
|
||||
}
|
||||
else if (receivedMacHdr.IsAcknowledgment () && m_txPkt && m_lrWpanMacState == MAC_ACK_PENDING)
|
||||
{
|
||||
LrWpanMacHeader macHdr;;
|
||||
LrWpanMacHeader macHdr;
|
||||
m_txPkt->PeekHeader (macHdr);
|
||||
if (receivedMacHdr.GetSeqNum () == macHdr.GetSeqNum ())
|
||||
{
|
||||
@@ -687,7 +687,7 @@ LrWpanMac::RemoveFirstTxQElement (void)
|
||||
pkt->RemoveHeader (hdr);
|
||||
if (hdr.GetShortDstAddr () != Mac16Address ("ff:ff"))
|
||||
{
|
||||
m_sentPktTrace (p, m_retransmission+1, m_numCsmacaRetry);
|
||||
m_sentPktTrace (p, m_retransmission + 1, m_numCsmacaRetry);
|
||||
}
|
||||
|
||||
txQElement->txQPkt = 0;
|
||||
@@ -741,7 +741,7 @@ LrWpanMac::PrepareRetransmission (void)
|
||||
else
|
||||
{
|
||||
m_retransmission++;
|
||||
m_numCsmacaRetry += m_csmaCa->GetNB () +1;
|
||||
m_numCsmacaRetry += m_csmaCa->GetNB () + 1;
|
||||
// Start next CCA process for this packet.
|
||||
return true;
|
||||
}
|
||||
@@ -767,7 +767,7 @@ LrWpanMac::PdDataConfirm (LrWpanPhyEnumeration status)
|
||||
// wait for the ack or the next retransmission timeout
|
||||
// start retransmission timer
|
||||
Time waitTime = MicroSeconds (GetMacAckWaitDuration () * 1000 * 1000 / m_phy->GetDataOrSymbolRate (false));
|
||||
NS_ASSERT (m_ackWaitTimeout.IsExpired());
|
||||
NS_ASSERT (m_ackWaitTimeout.IsExpired ());
|
||||
m_ackWaitTimeout = Simulator::Schedule (waitTime, &LrWpanMac::AckWaitTimeout, this);
|
||||
m_setMacState.Cancel ();
|
||||
m_setMacState = Simulator::ScheduleNow (&LrWpanMac::SetLrWpanMacState, this, MAC_ACK_PENDING);
|
||||
@@ -994,7 +994,7 @@ uint64_t
|
||||
LrWpanMac::GetMacAckWaitDuration (void) const
|
||||
{
|
||||
return m_csmaCa->GetUnitBackoffPeriod () + m_phy->aTurnaroundTime + m_phy->GetPhySHRDuration ()
|
||||
+ ceil (6 * m_phy->GetPhySymbolsPerOctet ());
|
||||
+ ceil (6 * m_phy->GetPhySymbolsPerOctet ());
|
||||
}
|
||||
|
||||
uint8_t
|
||||
|
||||
@@ -107,10 +107,15 @@ typedef enum
|
||||
|
||||
struct McpsDataRequestParams
|
||||
{
|
||||
McpsDataRequestParams () :
|
||||
m_srcAddrMode (SHORT_ADDR), m_dstAddrMode (SHORT_ADDR), m_dstPanId (0),
|
||||
m_dstAddr (), m_msduHandle (0), m_txOptions (0)
|
||||
{ };
|
||||
McpsDataRequestParams ()
|
||||
: m_srcAddrMode (SHORT_ADDR),
|
||||
m_dstAddrMode (SHORT_ADDR),
|
||||
m_dstPanId (0),
|
||||
m_dstAddr (),
|
||||
m_msduHandle (0),
|
||||
m_txOptions (0)
|
||||
{
|
||||
}
|
||||
LrWpanAddressMode m_srcAddrMode;
|
||||
LrWpanAddressMode m_dstAddrMode;
|
||||
uint16_t m_dstPanId;
|
||||
@@ -388,7 +393,7 @@ public:
|
||||
* See IEEE 802.15.4-2006, section 7.4.1, Table 85.
|
||||
*/
|
||||
uint64_t m_aBaseSuperframeDuration;
|
||||
|
||||
|
||||
//MAC PIB attributes
|
||||
/**
|
||||
* The time that the device transmitted its last beacon frame, in symbol
|
||||
@@ -443,7 +448,7 @@ public:
|
||||
* See IEEE 802.15.4-2006, section 7.4.2, Table 86.
|
||||
*/
|
||||
uint8_t m_macMaxFrameRetries;
|
||||
|
||||
|
||||
/**
|
||||
* Indication of whether the MAC sublayer is to enable its receiver during
|
||||
* idle periods.
|
||||
|
||||
@@ -61,9 +61,9 @@ LrWpanNetDevice::GetTypeId (void)
|
||||
&LrWpanNetDevice::SetMac),
|
||||
MakePointerChecker<LrWpanMac> ())
|
||||
.AddAttribute ("UseAcks", "Request acknowledgments for data frames.",
|
||||
BooleanValue (true),
|
||||
MakeBooleanAccessor (&LrWpanNetDevice::m_useAcks),
|
||||
MakeBooleanChecker ())
|
||||
BooleanValue (true),
|
||||
MakeBooleanAccessor (&LrWpanNetDevice::m_useAcks),
|
||||
MakeBooleanChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ LrWpanPhy::PdDataRequest (const uint32_t psduLength, Ptr<Packet> p)
|
||||
}
|
||||
|
||||
// Prevent PHY from sending a packet while switching the transceiver state.
|
||||
if (!m_setTRXState.IsRunning())
|
||||
if (!m_setTRXState.IsRunning ())
|
||||
{
|
||||
if (m_trxState == IEEE_802_15_4_PHY_TX_ON)
|
||||
{
|
||||
@@ -657,7 +657,7 @@ LrWpanPhy::PlmeSetTRXStateRequest (LrWpanPhyEnumeration state)
|
||||
{
|
||||
NS_LOG_DEBUG ("Cancel m_setTRXState");
|
||||
// Keep the transceiver state as the old state before the switching attempt.
|
||||
m_setTRXState.Cancel();
|
||||
m_setTRXState.Cancel ();
|
||||
}
|
||||
}
|
||||
if (m_trxStatePending != IEEE_802_15_4_PHY_IDLE)
|
||||
@@ -1352,7 +1352,7 @@ LrWpanPhy::GetPhySHRDuration (void) const
|
||||
NS_ASSERT (m_phyOption < IEEE_802_15_4_INVALID_PHY_OPTION);
|
||||
|
||||
return ppduHeaderSymbolNumbers[m_phyOption].shrPreamble
|
||||
+ ppduHeaderSymbolNumbers[m_phyOption].shrSfd;
|
||||
+ ppduHeaderSymbolNumbers[m_phyOption].shrSfd;
|
||||
}
|
||||
|
||||
double
|
||||
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
* @return pointer to LrWpanErrorModel in use
|
||||
*/
|
||||
Ptr<LrWpanErrorModel> GetErrorModel (void) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get the duration of the SHR (preamble and SFD) in symbols, depending on
|
||||
* the currently selected channel.
|
||||
@@ -423,7 +423,7 @@ public:
|
||||
* \return the number of symbols per octet
|
||||
*/
|
||||
double GetPhySymbolsPerOctet (void) const;
|
||||
|
||||
|
||||
/**
|
||||
* Assign a fixed random variable stream number to the random variables
|
||||
* used by this model. Return the number of streams that have been assigned.
|
||||
|
||||
@@ -90,7 +90,7 @@ LrWpanSpectrumValueHelper::CreateTxPowerSpectralDensity (double txPower, uint32_
|
||||
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2 ] = txPowerDensity * 0.005;
|
||||
|
||||
// If more power is allocated to more subbands in future revisions of
|
||||
// this model, make sure to renormalize so that the integral of the
|
||||
// this model, make sure to renormalize so that the integral of the
|
||||
// txPsd still equals txPower
|
||||
|
||||
return txPsd;
|
||||
|
||||
@@ -114,7 +114,7 @@ LrWpanAckTestCase::DoRun (void)
|
||||
|
||||
// Enable calculation of FCS in the trailers. Only necessary when interacting with real devices or wireshark.
|
||||
// GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
|
||||
|
||||
|
||||
// Set the random seed and run number for this test
|
||||
RngSeedManager::SetSeed (1);
|
||||
RngSeedManager::SetRun (6);
|
||||
|
||||
@@ -59,7 +59,7 @@ LrWpanCollisionTestCase::~LrWpanCollisionTestCase ()
|
||||
|
||||
void LrWpanCollisionTestCase::DataIndication (McpsDataIndicationParams params, Ptr<Packet> p)
|
||||
{
|
||||
m_rxPackets ++;
|
||||
m_rxPackets++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ LrWpanEdTestCase::LrWpanEdTestCase ()
|
||||
void
|
||||
LrWpanEdTestCase::PlmeEdConfirm (LrWpanPhyEnumeration status, uint8_t level)
|
||||
{
|
||||
NS_LOG_UNCOND ("Energy Detection completed with status " << LrWpanHelper::LrWpanPhyEnumerationPrinter(status) << " and energy level " << static_cast<uint32_t> (level));
|
||||
NS_LOG_UNCOND ("Energy Detection completed with status " << LrWpanHelper::LrWpanPhyEnumerationPrinter (status) << " and energy level " << static_cast<uint32_t> (level));
|
||||
m_status = status;
|
||||
m_level = level;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ LrWpanEdTestCase::DoRun (void)
|
||||
// Set the random seed and run number for this test
|
||||
RngSeedManager::SetSeed (1);
|
||||
RngSeedManager::SetRun (6);
|
||||
|
||||
|
||||
// Create 2 nodes, and a NetDevice for each one
|
||||
Ptr<Node> n0 = CreateObject <Node> ();
|
||||
Ptr<Node> n1 = CreateObject <Node> ();
|
||||
|
||||
Reference in New Issue
Block a user