Exemple #1
0
        public override Device RemoveDevice()
        {
            OpenZWaveDevice device = null;

            using (var watcher = new ControllerNotificationWatcher(this))
            {
                Manager.RemoveNode(HomeId.Value);

                watcher.ProcessChanges(notification =>
                {
                    if (notification.Type == ZWNotification.Type.NodeRemoved)
                    {
                        device = notification.Device;
                        return(ControllerNotificationWatcher.ProcessAction.Quit);
                    }

                    return(ControllerNotificationWatcher.ProcessAction.Continue);
                });
            }

            return(device);
        }
Exemple #2
0
        public override Device AddDevice()
        {
            OpenZWaveDevice device = null;

            using (var watcher = new ControllerNotificationWatcher(this))
            {
                Manager.AddNode(HomeId.Value, true);

                watcher.ProcessChanges(notification =>
                {
                    if (notification.Type == ZWNotification.Type.NodeAdded)
                    {
                        device = notification.Device;
                        return ControllerNotificationWatcher.ProcessAction.Quit;
                    }

                    return ControllerNotificationWatcher.ProcessAction.Continue;
                });
            }

            return device;
        }