Beispiel #1
0
        /*
         * class USBDeviceInfo
         * {
         *  public USBDeviceInfo(string deviceID, string pnpDeviceID, string description)
         *  {
         *      this.DeviceID = deviceID;
         *      this.PnpDeviceID = pnpDeviceID;
         *      this.Description = description;
         *  }
         *  public string DeviceID { get; private set; }
         *  public string PnpDeviceID { get; private set; }
         *  public string Description { get; private set; }
         * }
         */


        private void Controller_ControllerStatusChanged(object sender, ControllerStatusEventArgs args)
        {
            var controller = (sender as ZWaveController);

            switch (args.Status)
            {
            case ControllerStatus.Connected:
                // Initialize the controller and get the node list
                controller.Initialize();
                break;

            case ControllerStatus.Disconnected:
                break;

            case ControllerStatus.Initializing:
                break;

            case ControllerStatus.Ready:
                // Query all nodes (Basic Classes, Node Information Frame, Manufacturer Specific[, Command Class version])
                // Enabled by default
                if (this.GetOption("StartupDiscovery") == null || this.GetOption("StartupDiscovery").Value != "0")
                {
                    controller.Discovery();
                }
                break;

            case ControllerStatus.Error:
                controller.Connect();
                break;
            }
        }
Beispiel #2
0
        static void Controller_ControllerStatusChanged(object sender, ControllerStatusEventArgs args)
        {
            Console.WriteLine("ControllerStatusChange {0}", args.Status);
            ToggleDebug(true);
            var controller = (sender as ZWaveController);

            controllerStatus = args.Status;
            switch (controllerStatus)
            {
            case ControllerStatus.Connected:
                // Initialize the controller and get the node list
                controller.Initialize();
                break;

            case ControllerStatus.Disconnected:
                ShowMenu();
                break;

            case ControllerStatus.Initializing:
                break;

            case ControllerStatus.Ready:
                // Query all nodes (Supported Classes, Routing Info, Node Information Frame, Manufacturer Specific)
                controller.Discovery();
                ShowMenu();
                break;

            case ControllerStatus.Error:
                Console.WriteLine("\nEnter [+] to try reconnect\n");
                ShowMenu();
                break;
            }
            ToggleDebug(false);
        }
Beispiel #3
0
        private static void Controller_ControllerStatusChanged(object sender, ControllerStatusEventArgs args)
        {
            Console.WriteLine("ControllerStatusChange {0}", args.Status);
            var controller = (sender as ZWaveController);

            controllerStatus = args.Status;
            switch (controllerStatus)
            {
            case ControllerStatus.Connected:
                // Initialize the controller and get the node list
                controller.GetControllerInfo();
                controller.GetControllerCapabilities();
                controller.GetHomeId();
                controller.GetSucNodeId();
                controller.Initialize();
                break;

            case ControllerStatus.Disconnected:
                //ShowMenu();
                break;

            case ControllerStatus.Initializing:
                break;

            case ControllerStatus.Ready:
                break;

            case ControllerStatus.Error:
                Console.WriteLine("\nEnter [+] to try reconnect\n");
                break;
            }
            //ToggleDebug(false);
        }
Beispiel #4
0
        /// <summary>
        /// Delegate to be called whenever the Z-Wave controller's status changes - prepares the library.
        /// </summary>
        /// <param name="sender">The Z-Wave controller which sent the change.</param>
        /// <param name="args"></param>
        protected void OnControllerStatusChanged(object sender, ControllerStatusEventArgs args)
        {
            switch (args.Status)
            {
            case ControllerStatus.Connected:
                Controller.Initialize();
                break;

            case ControllerStatus.Disconnected:
                if (_stoppingSemaphor != null)
                {
                    _stoppingSemaphor.Release();
                    _stoppingSemaphor = null;
                }
                OnDisconnected?.Invoke(this);
                break;

            case ControllerStatus.Error:
                OnError?.Invoke(this);
                break;

            case ControllerStatus.Ready:
                Controller.Discovery();
                break;

            case ControllerStatus.Initializing:
            default:
                break;
            }
        }