View | Details | Raw Unified | Return to bug 2190
Collapse All | Expand All

(-)a/src/lr-wpan/model/lr-wpan-phy.cc (-3 / +4 lines)
 Lines 546-551    Link Here 
546
          LrWpanLqiTag lqiTag;
546
          LrWpanLqiTag lqiTag;
547
          p->RemovePacketTag (lqiTag);
547
          p->RemovePacketTag (lqiTag);
548
548
549
          m_phyTxBeginTrace (p);
550
          m_currentTxPacket.first = p;
551
          m_currentTxPacket.second = false;
552
549
          Ptr<LrWpanSpectrumSignalParameters> txParams = Create<LrWpanSpectrumSignalParameters> ();
553
          Ptr<LrWpanSpectrumSignalParameters> txParams = Create<LrWpanSpectrumSignalParameters> ();
550
          txParams->duration = CalculateTxTime (p);
554
          txParams->duration = CalculateTxTime (p);
551
          txParams->txPhy = GetObject<SpectrumPhy> ();
555
          txParams->txPhy = GetObject<SpectrumPhy> ();
 Lines 557-565    Link Here 
557
          m_channel->StartTx (txParams);
561
          m_channel->StartTx (txParams);
558
          m_pdDataRequest = Simulator::Schedule (txParams->duration, &LrWpanPhy::EndTx, this);
562
          m_pdDataRequest = Simulator::Schedule (txParams->duration, &LrWpanPhy::EndTx, this);
559
          ChangeTrxState (IEEE_802_15_4_PHY_BUSY_TX);
563
          ChangeTrxState (IEEE_802_15_4_PHY_BUSY_TX);
560
          m_phyTxBeginTrace (p);
561
          m_currentTxPacket.first = p;
562
          m_currentTxPacket.second = false;
563
          return;
564
          return;
564
        }
565
        }
565
      else if ((m_trxState == IEEE_802_15_4_PHY_RX_ON)
566
      else if ((m_trxState == IEEE_802_15_4_PHY_RX_ON)
(-)a/src/netanim/model/animation-interface.cc (+136 lines)
 Lines 44-49    Link Here 
44
#include "ns3/wimax-mac-header.h"
44
#include "ns3/wimax-mac-header.h"
45
#include "ns3/wifi-net-device.h"
45
#include "ns3/wifi-net-device.h"
46
#include "ns3/wifi-mac.h"
46
#include "ns3/wifi-mac.h"
47
#include "ns3/lr-wpan-mac-header.h"
48
#include "ns3/lr-wpan-net-device.h"
47
#include "ns3/constant-position-mobility-model.h"
49
#include "ns3/constant-position-mobility-model.h"
48
#include "ns3/lte-ue-phy.h"
50
#include "ns3/lte-ue-phy.h"
49
#include "ns3/lte-enb-phy.h"
51
#include "ns3/lte-enb-phy.h"
 Lines 454-459    Link Here 
454
      PurgePendingPackets (AnimationInterface::WIMAX);
456
      PurgePendingPackets (AnimationInterface::WIMAX);
455
      PurgePendingPackets (AnimationInterface::LTE);
457
      PurgePendingPackets (AnimationInterface::LTE);
456
      PurgePendingPackets (AnimationInterface::CSMA);
458
      PurgePendingPackets (AnimationInterface::CSMA);
459
      PurgePendingPackets (AnimationInterface::LRWPAN);
457
      Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this);
460
      Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this);
458
    }
461
    }
459
}
462
}
 Lines 691-696    Link Here 
691
}
694
}
692
695
693
void
696
void
697
AnimationInterface::LrWpanMacTxTrace (std::string context, Ptr<const Packet> p)
698
{
699
  const Ptr <const Node> node = GetNodeFromContext (context);
700
  ++m_nodeLrWpanMacTx[node->GetId ()];
701
}
702
703
void
704
AnimationInterface::LrWpanMacTxDropTrace (std::string context, Ptr<const Packet> p)
705
{
706
  const Ptr <const Node> node = GetNodeFromContext (context);
707
  ++m_nodeLrWpanMacTxDrop[node->GetId ()];
708
}
709
710
void
711
AnimationInterface::LrWpanMacRxTrace (std::string context, Ptr<const Packet> p)
712
{
713
  const Ptr <const Node> node = GetNodeFromContext (context);
714
  ++m_nodeLrWpanMacRx[node->GetId ()];
715
}
716
717
void
718
AnimationInterface::LrWpanMacRxDropTrace (std::string context, Ptr<const Packet> p)
719
{
720
  const Ptr <const Node> node = GetNodeFromContext (context);
721
  ++m_nodeLrWpanMacRxDrop[node->GetId ()];
722
}
723
724
void
694
AnimationInterface::Ipv4TxTrace (std::string context, Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interfaceIndex)
725
AnimationInterface::Ipv4TxTrace (std::string context, Ptr<const Packet> p, Ptr<Ipv4> ipv4, uint32_t interfaceIndex)
695
{
726
{
696
  const Ptr <const Node> node = GetNodeFromContext (context);
727
  const Ptr <const Node> node = GetNodeFromContext (context);
 Lines 878-883    Link Here 
878
}
909
}
879
910
880
void 
911
void 
912
AnimationInterface::LrWpanPhyTxBeginTrace (std::string context,
913
                                           Ptr<const Packet> p)
914
{
915
  if (!m_started || !IsInTimeWindow () || !m_trackPackets)
916
    return;
917
918
  Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
919
  NS_ASSERT (ndev);
920
  Ptr<LrWpanNetDevice> netDevice = DynamicCast<LrWpanNetDevice> (ndev);
921
922
  Ptr <Node> n = ndev->GetNode ();
923
  NS_ASSERT (n);
924
925
  UpdatePosition (n);
926
927
  LrWpanMacHeader hdr;
928
  if (!p->PeekHeader (hdr))
929
  {
930
    NS_LOG_WARN ("LrWpanMacHeader not present");
931
    return;
932
  }
933
934
  std::ostringstream oss;
935
  if (hdr.GetSrcAddrMode () == 2)
936
    {
937
      Mac16Address nodeAddr = netDevice->GetMac ()->GetShortAddress ();
938
      oss << nodeAddr;
939
    }
940
  else if (hdr.GetSrcAddrMode () == 3)
941
    {
942
      Mac64Address nodeAddr = netDevice->GetMac ()->GetExtendedAddress ();
943
      oss << nodeAddr;
944
    }
945
  else
946
    {
947
      NS_LOG_WARN ("LrWpanMacHeader without source address");
948
      return;
949
    }
950
  m_macToNodeIdMap[oss.str ()] = n->GetId ();
951
  NS_LOG_INFO ("Added Mac" << oss.str () << " node:" <<m_macToNodeIdMap[oss.str ()]);
952
953
  ++gAnimUid;
954
  NS_LOG_INFO ("LrWpan TxBeginTrace for packet:" << gAnimUid);
955
  AddByteTag (gAnimUid, p);
956
957
  AnimPacketInfo pktInfo (ndev, Simulator::Now ());
958
  AddPendingPacket (AnimationInterface::LRWPAN, gAnimUid, pktInfo);
959
960
  OutputWirelessPacketTxInfo (p, m_pendingLrWpanPackets[gAnimUid], gAnimUid);
961
}
962
963
void
964
AnimationInterface::LrWpanPhyRxBeginTrace (std::string context,
965
                                           Ptr<const Packet> p)
966
{
967
  if (!m_started || !IsInTimeWindow () || !m_trackPackets)
968
    return;
969
  Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
970
  NS_ASSERT (ndev);
971
  Ptr <Node> n = ndev->GetNode ();
972
  NS_ASSERT (n);
973
974
  AnimByteTag tag;
975
  if (!p->FindFirstMatchingByteTag (tag))
976
    {
977
      return;
978
    }
979
980
  uint64_t animUid = GetAnimUidFromPacket (p);
981
  NS_LOG_INFO ("LrWpan RxBeginTrace for packet:" << animUid);
982
  if (!IsPacketPending (animUid, AnimationInterface::LRWPAN))
983
    {
984
      NS_LOG_WARN ("LrWpanPhyRxBeginTrace: unknown Uid - most probably it's an ACK.");
985
    }
986
987
  UpdatePosition (n);
988
  m_pendingLrWpanPackets[animUid].ProcessRxBegin (ndev, Simulator::Now ().GetSeconds ());
989
  OutputWirelessPacketRxInfo (p, m_pendingLrWpanPackets[animUid], animUid);
990
}
991
992
void
881
AnimationInterface::WimaxTxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m)
993
AnimationInterface::WimaxTxTrace (std::string context, Ptr<const Packet> p, const Mac48Address & m)
882
{
994
{
883
  NS_LOG_FUNCTION (this);
995
  NS_LOG_FUNCTION (this);
 Lines 1172-1177    Link Here 
1172
          pendingPackets = &m_pendingLtePackets;
1284
          pendingPackets = &m_pendingLtePackets;
1173
          break;
1285
          break;
1174
        }
1286
        }
1287
      case AnimationInterface::LRWPAN:
1288
        {
1289
          pendingPackets = &m_pendingLrWpanPackets;
1290
          break;
1291
        }
1175
    }
1292
    }
1176
  return pendingPackets;
1293
  return pendingPackets;
1177
1294
 Lines 1208-1213    Link Here 
1208
          result = "LTE";
1325
          result = "LTE";
1209
          break;
1326
          break;
1210
        }
1327
        }
1328
      case AnimationInterface::LRWPAN:
1329
        {
1330
          result = "LRWPAN";
1331
          break;
1332
        }
1211
    }
1333
    }
1212
  return result;
1334
  return result;
1213
}
1335
}
 Lines 1494-1499    Link Here 
1494
                   MakeCallback (&AnimationInterface::WifiPhyTxDropTrace, this));
1616
                   MakeCallback (&AnimationInterface::WifiPhyTxDropTrace, this));
1495
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1617
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1496
                   MakeCallback (&AnimationInterface::WifiPhyRxDropTrace, this));
1618
                   MakeCallback (&AnimationInterface::WifiPhyRxDropTrace, this));
1619
1620
  // LrWpan
1621
  Config::Connect ("NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Phy/PhyTxBegin",
1622
                   MakeCallback (&AnimationInterface::LrWpanPhyTxBeginTrace, this));
1623
  Config::Connect ("NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Phy/PhyRxBegin",
1624
                   MakeCallback (&AnimationInterface::LrWpanPhyRxBeginTrace, this));
1625
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacTx",
1626
                   MakeCallback (&AnimationInterface::LrWpanMacTxTrace, this));
1627
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacTxDrop",
1628
                   MakeCallback (&AnimationInterface::LrWpanMacTxDropTrace, this));
1629
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacRx",
1630
                   MakeCallback (&AnimationInterface::LrWpanMacRxTrace, this));
1631
  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::LrWpanNetDevice/Mac/MacRxDrop",
1632
                   MakeCallback (&AnimationInterface::LrWpanMacRxDropTrace, this));
1497
}
1633
}
1498
1634
1499
Vector 
1635
Vector 
(-)a/src/netanim/model/animation-interface.h (-4 / +22 lines)
 Lines 497-503    Link Here 
497
      LTE,
497
      LTE,
498
      WIFI,
498
      WIFI,
499
      WIMAX,
499
      WIMAX,
500
      CSMA
500
      CSMA,
501
      LRWPAN
501
    } ProtocolType;
502
    } ProtocolType;
502
503
503
  typedef struct
504
  typedef struct
 Lines 590-595    Link Here 
590
  
591
  
591
  AnimUidPacketInfoMap m_pendingWifiPackets;
592
  AnimUidPacketInfoMap m_pendingWifiPackets;
592
  AnimUidPacketInfoMap m_pendingWimaxPackets;
593
  AnimUidPacketInfoMap m_pendingWimaxPackets;
594
  AnimUidPacketInfoMap m_pendingLrWpanPackets;
593
  AnimUidPacketInfoMap m_pendingLtePackets;
595
  AnimUidPacketInfoMap m_pendingLtePackets;
594
  AnimUidPacketInfoMap m_pendingCsmaPackets;
596
  AnimUidPacketInfoMap m_pendingCsmaPackets;
595
  AnimUidPacketInfoMap m_pendingUanPackets;
597
  AnimUidPacketInfoMap m_pendingUanPackets;
 Lines 623-628    Link Here 
623
  NodeCounterMap64 m_nodeWifiMacRxDrop;
625
  NodeCounterMap64 m_nodeWifiMacRxDrop;
624
  NodeCounterMap64 m_nodeWifiPhyTxDrop;
626
  NodeCounterMap64 m_nodeWifiPhyTxDrop;
625
  NodeCounterMap64 m_nodeWifiPhyRxDrop;
627
  NodeCounterMap64 m_nodeWifiPhyRxDrop;
628
  NodeCounterMap64 m_nodeLrWpanMacTx;
629
  NodeCounterMap64 m_nodeLrWpanMacTxDrop;
630
  NodeCounterMap64 m_nodeLrWpanMacRx;
631
  NodeCounterMap64 m_nodeLrWpanMacRxDrop;
626
632
627
  const std::vector<std::string> GetElementsFromContext (const std::string& context) const;
633
  const std::vector<std::string> GetElementsFromContext (const std::string& context) const;
628
  Ptr <Node> GetNodeFromContext (const std::string& context) const;
634
  Ptr <Node> GetNodeFromContext (const std::string& context) const;
 Lines 698-706    Link Here 
698
  void WifiMacRxDropTrace (std::string context,
704
  void WifiMacRxDropTrace (std::string context,
699
                           Ptr<const Packet>);
705
                           Ptr<const Packet>);
700
  void WifiPhyTxDropTrace (std::string context,
706
  void WifiPhyTxDropTrace (std::string context,
701
                       Ptr<const Packet>);
707
                           Ptr<const Packet>);
702
  void WifiPhyRxDropTrace (std::string context,
708
  void WifiPhyRxDropTrace (std::string context,
703
                       Ptr<const Packet>);
709
                           Ptr<const Packet>);
710
  void LrWpanMacTxTrace (std::string context,
711
                         Ptr<const Packet>);
712
  void LrWpanMacTxDropTrace (std::string context,
713
                             Ptr<const Packet>);
714
  void LrWpanMacRxTrace (std::string context,
715
                         Ptr<const Packet>);
716
  void LrWpanMacRxDropTrace (std::string context,
717
                             Ptr<const Packet>);
704
  void DevTxTrace (std::string context,
718
  void DevTxTrace (std::string context,
705
                   Ptr<const Packet> p,
719
                   Ptr<const Packet> p,
706
                   Ptr<NetDevice> tx,
720
                   Ptr<NetDevice> tx,
 Lines 711-719    Link Here 
711
                            Ptr<const Packet> p);
725
                            Ptr<const Packet> p);
712
  void WifiPhyRxBeginTrace (std::string context,
726
  void WifiPhyRxBeginTrace (std::string context,
713
                            Ptr<const Packet> p);
727
                            Ptr<const Packet> p);
728
  void LrWpanPhyTxBeginTrace (std::string context,
729
                              Ptr<const Packet> p);
730
  void LrWpanPhyRxBeginTrace (std::string context,
731
                              Ptr<const Packet> p);
714
  void WimaxTxTrace (std::string context,
732
  void WimaxTxTrace (std::string context,
715
                     Ptr<const Packet> p,
733
                     Ptr<const Packet> p,
716
		     const Mac48Address &);
734
                     const Mac48Address &);
717
  void WimaxRxTrace (std::string context,
735
  void WimaxRxTrace (std::string context,
718
                     Ptr<const Packet> p,
736
                     Ptr<const Packet> p,
719
                     const Mac48Address &);
737
                     const Mac48Address &);
(-)a/src/netanim/wscript (-1 / +1 lines)
 Lines 6-12    Link Here 
6
NETANIM_RELEASE_NAME = "netanim-3.108"
6
NETANIM_RELEASE_NAME = "netanim-3.108"
7
7
8
def build (bld) :
8
def build (bld) :
9
    module = bld.create_ns3_module ('netanim', ['internet', 'mobility', 'wimax', 'wifi', 'csma', 'lte', 'uan', 'energy'])
9
    module = bld.create_ns3_module ('netanim', ['internet', 'mobility', 'wimax', 'wifi', 'csma', 'lte', 'uan', 'lr-wpan', 'energy'])
10
    module.includes = '.'
10
    module.includes = '.'
11
    module.source = [ 'model/animation-interface.cc', ]
11
    module.source = [ 'model/animation-interface.cc', ]
12
    netanim_test = bld.create_ns3_module_test_library('netanim')
12
    netanim_test = bld.create_ns3_module_test_library('netanim')

Return to bug 2190