Fix Hel'er's install and add ping6/6LoWPAN example

This commit is contained in:
Tommaso Pecorella
2014-03-16 20:46:00 +01:00
parent 90dc67f344
commit ff799f5cbd
4 changed files with 151 additions and 23 deletions

View File

@@ -160,28 +160,13 @@ LrWpanHelper::Install (NodeContainer c)
{
Ptr<Node> node = *i;
Ptr<LrWpanMac> mac = CreateObject<LrWpanMac> ();
Ptr<LrWpanPhy> phy = CreateObject<LrWpanPhy> ();
Ptr<LrWpanCsmaCa> csmaca = CreateObject<LrWpanCsmaCa> ();
// Set MAC-PHY SAPs
phy->SetPdDataIndicationCallback (MakeCallback (&LrWpanMac::PdDataIndication, mac));
phy->SetPdDataConfirmCallback (MakeCallback (&LrWpanMac::PdDataConfirm, mac));
phy->SetPlmeEdConfirmCallback (MakeCallback (&LrWpanMac::PlmeEdConfirm, mac));
phy->SetPlmeGetAttributeConfirmCallback (MakeCallback (&LrWpanMac::PlmeGetAttributeConfirm, mac));
phy->SetPlmeSetTRXStateConfirmCallback (MakeCallback (&LrWpanMac::PlmeSetTRXStateConfirm, mac));
phy->SetPlmeSetAttributeConfirmCallback (MakeCallback (&LrWpanMac::PlmeSetAttributeConfirm, mac));
Ptr<LrWpanErrorModel> errorModel = CreateObject <LrWpanErrorModel> ();
phy->SetErrorModel (errorModel);
mac->SetCsmaCa (csmaca);
csmaca->SetMac (mac);
csmaca->SetLrWpanMacStateCallback (MakeCallback (&LrWpanMac::SetLrWpanMacState, mac));
phy->SetPlmeCcaConfirmCallback (MakeCallback (&LrWpanCsmaCa::PlmeCcaConfirm, csmaca));
// Set Channel
phy->SetChannel (m_channel);
m_channel->AddRx (phy);
Ptr<LrWpanNetDevice> netDevice = CreateObject<LrWpanNetDevice> ();
netDevice->SetChannel (m_channel);
node->AddDevice (netDevice);
netDevice->SetNode (node);
// \todo add the capability to change short address, extended
// address and panId. Right now they are hardcoded in LrWpanMac::LrWpanMac ()
devices.Add (netDevice);
}
return devices;
}

View File

@@ -106,7 +106,7 @@ LrWpanMac::LrWpanMac ()
UniformVariable uniformVar;
uniformVar = UniformVariable (0, 255);
m_macDsn = SequenceNumber16 (uniformVar.GetValue ());
m_shortAddress = Mac16Address ("00:00");
m_shortAddress = Mac16Address::Allocate ();
}
LrWpanMac::~LrWpanMac ()