On Wed, Jun 9, 2010 at 7:42 AM, Yusnaidi Md Yusof <[email protected]> wrote:
> Hi All,
>
> I have no idea how to use the getNeighborAddr() of the CtpInfo interface in
> CTP. From the definition given in the online tinyos's nesdoc, I understand
> this method used to get the neighbors' addresses of a node.
>
> I got a strange which I don't understand to interpret after running the
> simulation.
>
>
> This is what I code in the application file:
>
> dbg("AppC","Neighbor address: %hhu\n", call CtpInfo.getNeighborAddr(3));
> <- here, I am hoping to get what are the neighbor addresses for node 3
>
>
> and this is what I got in simulation:
>
> Neighbor address: 255.
>
>
> I also made other attempt such as:
>
> dbg("AppC","Neighbor address: %hhu  %hhu\n", call
> CtpInfo.getNeighborAddr(2));    <- here, I tried to read two addresses for
> node 2
>
> and this is what I got in simulation:
>
> Neighbor address: 255  133
>
>
> Both of them I guess wrong because node 3 and node 2 are connected to other
> nodes and I don't have node 133 set in the topology.

This is because you forgot to pass the second variable you are tring
to print to the dbg function.




> I look into the CtpRoutingEngineP.nc, and it defines if the neighbor >
> routingTableActive, it will return AM_BROADCAST_ADDR.
>
>
> From the definition: command am_addr_t getNeighborAddr(uint8_t neighbor), I
> guess the 'neighbor' parameter here refer either to 1. How many neighbors
> users want to know, or 2. Which node the user wan't to know it's neighbors.
>
>
> But still, I am confuse what the 'neighbor' parameter refers to/means here?,
> and how I can use this method correctly?

It should return the link layer address of the node that is in the
routing table. What did numNeighbors() call return in your experiment?

- om_p

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to