getposition

31 views
Skip to first unread message

dbaez...@gmail.com

unread,
May 5, 2016, 7:33:52 PM5/5/16
to ns-3-users
Hi. I need help in my project, I want to order call the following method in my code attached. I hope and can help me with my project.
method
GetPosition(Ipv4Address adr)
{
 uint32_t n = NodeList().GetNNodes ();
 uint32_t i;
 Ptr<Node> node;
 
 //NS_LOG_UNCOND("Position of " << adr);
 
 for(i = 0; i < n; i++)
   {
     node = NodeList().GetNode (i);
     Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();

     //NS_LOG_UNCOND("Have " << ipv4->GetAddress (1, 0).GetLocal ());    
     if(ipv4->GetAddress (1, 0).GetLocal () == adr)
{
 return (*node->GetObject<MobilityModel>()).GetPosition ();
}
   }
 Vector v;
 return v;
}

wifi-simple-adhoc(1).cc

Konstantinos

unread,
May 6, 2016, 4:09:15 AM5/6/16
to ns-3-users
Hi,

and rephrase your question.

I do not understand what is the problem. You have your scenario (basically the example from NS-3) and you have a method to get the position of a node based on its IPv4.
What is your question?

Regards,
K.

dbaez...@gmail.com

unread,
May 6, 2016, 1:55:10 PM5/6/16
to ns-3-users

I am sorry. My question is. How  can call the method in my example ns3?.
Yes, and I put it in my example ns3, but. How  can see  the position of each node in my terminal?, which is what makes this method. thank you

Konstantinos

unread,
May 7, 2016, 12:13:38 PM5/7/16
to ns-3-users
Sorry but this question shows that you have no programming skills. 
You have the method and you do not know how to call it? Study any programming primer.
Reply all
Reply to author
Forward
0 new messages