To start a ZigBee network, you need to create a serial port connection, wrap it in a hardware-specific dongle implementation, and then initialize the ZigBeeNetworkManager.
This example demonstrates setting up a ZigBeeSerialPort on COM4 using a ZigBeeDongleTiCc2531 and starting the network manager.
using System;
namespace ZigBeeNet.PlayGround
{
class Program
{
static void Main(string[] args)
{
try
{
ZigBeeSerialPort zigbeePort = new ZigBeeSerialPort("COM4");
IZigBeeTransportTransmit dongle = new ZigBeeDongleTiCc2531(zigbeePort);
ZigBeeNetworkManager networkManager = new ZigBeeNetworkManager(dongle);
// Initialise the network
networkManager.Initialize();
networkManager.AddSupportedCluster(0x06);
ZigBeeStatus startupSucceded = networkManager.Startup(false);
if (startupSucceded == ZigBeeStatus.SUCCESS)
{
Log.Logger.Information("ZigBee console starting up ... [OK]");
}
else
{
Log.Logger.Information("ZigBee console starting up ... [FAIL]");
return;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.ReadLine();
}
}
}