Skip to content

NodeListener

Markus edited this page Mar 4, 2019 · 1 revision

You are able to implement an own class which receives events when a new node is added to the network, updated or removed from the network by impelementing the IZigBeeNetworkNodeListener interface:

public class ConsoleNetworkNodeListener : IZigBeeNetworkNodeListener
{
   public void NodeAdded(ZigBeeNode node)
   {
       Console.WriteLine("Node " + node.IeeeAddress + " added " + node);
       if (node.NetworkAddress != 0)
       {
           Console.WriteLine("Node added " + node);
       }
   }

   public void NodeRemoved(ZigBeeNode node)
   {
       Console.WriteLine("Node removed " + node);
   }

   public void NodeUpdated(ZigBeeNode node)
   {
       Console.WriteLine("Node updated " + node);
   }
}

This class have to be added to the ZigBeeNetworkManager object in your application:

networkManager.AddNetworkNodeListener(new ConsoleNetworkNodeListener());

Clone this wiki locally