This project has moved. For the latest updates, please go here.

DiscoverNodes with handler

Oct 6, 2014 at 9:58 PM
Hi to all can you give me an example to use DiscoverNodes using xbee series 1 with handler ?
i want understand how retrive response without blocking request.
Thanks a million
Coordinator
Oct 7, 2014 at 10:10 AM
There are two methods for discovering nodes:
public void DiscoverNodes(DiscoverResultHandler handler);
public DiscoverResult[] DiscoverNodes();
The first one is the one you need. You can find usage example in the samples source code. If you have all nodes running with in the same PAN then you should be able to find them. You can also set the NO option so that the discovery process also reports the local node (this way you are sure the handler fires). To do that sent a AtCommand request with Wpan.AtCmd.NetworkDiscoveryOptions and argument 0x01 (see comments in source code). You need to be running firmware >= v1xC5 to do that.
Oct 7, 2014 at 9:33 PM
Thanks for fast replay.
In the source samples code i find this:
xbee.Api.DiscoverNodes(OnNodeDiscovered);
private static void OnNodeDiscovered(DiscoverResult node)
    {
        Debug.Print("Node discovered: " + node.NodeInfo);
    }
in my code i use:
xbee.DiscoverNodes(OnNodeDiscovered);

but i have some error when write the handler:
private NETMF.OpenSource.XBee.Api.XBee.DiscoverResultHandler OnNodeDiscovered(NETMF.OpenSource.XBee.Api.Wpan.DiscoverResult node)
    {
        Debug.Print("Node discovered: " + node.NodeInfo);
    }
Can u help me to write this part?
Oct 9, 2014 at 12:07 PM
Visual studio Give me syntax error i don't know how write handler metod can u Help me to understand how make this part?