public static void Main(string[] cargs)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("\nZWaveLib Test Program\n");
            Console.ForegroundColor = ConsoleColor.White;

            var controller = new ZWaveController(serialPortName);
            // Register controller event handlers
            controller.ControllerStatusChanged += Controller_ControllerStatusChanged;;
            controller.DiscoveryProgress += Controller_DiscoveryProgress;
            controller.NodeOperationProgress += Controller_NodeOperationProgress;
            controller.NodeUpdated += Controller_NodeUpdated;

            // Main program loop
            string command = "";
            while (command != "!")
            {
                ShowMenu();
                // TODO: Allow issuing CommandClass commands on nodes from the console input
                // TODO: Add "Associate node to controller" option
                // TODO: Add "Query node parameters" based on implemented classes
                command = Console.ReadLine();
                switch (command)
                {
                case "0":
                    ToggleDebug(!showDebugOutput);
                    break;
                case "1":
                    ListNodes(controller);
                    break;
                case "2":
                    StartNodeAdd(controller);
                    break;
                case "3":
                    StopNodeAdd(controller);
                    break;
                case "4":
                    StartNodeRemove(controller);
                    break;
                case "5":
                    StopNodeRemove(controller);
                    break;
                case "6":
                    HealNetwork(controller);
                    break;
                case "7":
                    RunStressTest(controller);
                    break;
                case "8":
                    ShowZWaveLibApi();
                    break;
                case "9":
                    Discovery(controller);
                    break;
                case "?":
                    SetSerialPortName(controller);
                    break;
                case "+":
                    controller.Connect();
                    break;
                }
            }
            Console.WriteLine("\nCiao!\n");
            controller.Dispose();
        }
 private static void SetSerialPortName(ZWaveController controller)
 {
     Console.WriteLine("Enter the serial port name (eg. COM7 or /dev/ttyUSB0):");
     string port = Console.ReadLine().Trim();
     if (!String.IsNullOrWhiteSpace(port))
     {
         serialPortName = port;
         controller.PortName = serialPortName;
         controller.Connect();
     }
 }