Esempio n. 1
0
        public ControllerCommandDlg(ZWManager _manager, UInt32 homeId, ZWControllerCommand _op, Byte nodeId)
        {
            m_manager             = _manager;
            _homeid               = homeId;
            _zwcontrollercommand  = _op;
            _nodeid               = nodeId;
            _controllercommanddlg = this;

            InitializeComponent();

            switch (_zwcontrollercommand)
            {
            case ZWControllerCommand.AddDevice:
            {
                Text        = " - Add Device";
                label1.Text = "Press the program button on the Z-Wave device to add it to the network.\nFor security reasons, the PC Z-Wave Controller must be close to the device being added.";
                break;
            }

            case ZWControllerCommand.CreateNewPrimary:
            {
                Text        = " - Create New Primary Controller";
                label1.Text = "Put the target controller into receive configuration mode.\nThe PC Z-Wave Controller must be within 2m of the controller that is being made the primary.";
                break;
            }

            case ZWControllerCommand.ReceiveConfiguration:
            {
                Text        = " - Receive Configuration";
                label1.Text = "Transfering the network configuration\nfrom another controller.\n\nPlease bring the other controller within 2m of the PC controller and set it to send its network configuration.";
                break;
            }

            case ZWControllerCommand.RemoveDevice:
            {
                Text        = " - Remove Device";
                label1.Text = "Press the program button on the Z-Wave device to remove it from the network.\nFor security reasons, the PC Z-Wave Controller must be close to the device being removed.";
                break;
            }

            case ZWControllerCommand.TransferPrimaryRole:
            {
                Text        = " - Transfer Primary Role";
                label1.Text = "Transfering the primary role\nto another controller.\n\nPlease bring the new controller within 2m of the PC controller and set it to receive the network configuration.";
                break;
            }

            case ZWControllerCommand.HasNodeFailed:
            {
                ButtonCancel.Enabled = false;
                Text        = " - Has Node Failed";
                label1.Text = "Testing whether the node has failed.\nThis command cannot be cancelled.";
                break;
            }

            case ZWControllerCommand.RemoveFailedNode:
            {
                ButtonCancel.Enabled = false;
                Text        = " - Remove Failed Node";
                label1.Text = "Removing the failed node from the controller's list.\nThis command cannot be cancelled.";
                break;
            }

            case ZWControllerCommand.ReplaceFailedNode:
            {
                ButtonCancel.Enabled = false;
                Text        = " - Replacing Failed Node";
                label1.Text = "Testing the failed node.\nThis command cannot be cancelled.";
                break;
            }
            }

            m_manager.OnControllerStateChanged += m_controllerStateChangedHandler;
            if (!m_manager.BeginControllerCommand(_homeid, _zwcontrollercommand, false, _nodeid))
            {
                m_manager.OnControllerStateChanged -= m_controllerStateChangedHandler;
            }
        }
        public ControllerCommandDlg(MainForm _mainDlg, ZWManager _manager, UInt32 homeId, ZWControllerCommand _op, Byte nodeId)
        {
            m_mainDlg = _mainDlg;
            m_manager = _manager;
            m_homeId = homeId;
            m_op = _op;
            m_nodeId = nodeId;
            m_dlg = this;

            InitializeComponent();

            switch (m_op)
            {
                case ZWControllerCommand.RequestNodeNeighborUpdate:
                    {
                        this.Text = "Node Neighbor Update";
                        this.label1.Text = "Request that a node update its list of neighbors.";
                        break;
                    }

                case ZWControllerCommand.AddController:
                {
                    this.Text = "Add Controller";
                    this.label1.Text = "Put the target controller into receive configuration mode.\nThe PC Z-Wave Controller must be within 2m of the controller being added.";
                    break;
                }
                case ZWControllerCommand.AddDevice:
                {
                    this.Text = "Add Device";
                    this.label1.Text = "Press the program button on the Z-Wave device to add it to the network.\nFor security reasons, the PC Z-Wave Controller must be close to the device being added.";
                    break;
                }
                case ZWControllerCommand.CreateNewPrimary:
                {
                    this.Text = "Create New Primary Controller";
                    this.label1.Text = "Put the target controller into receive configuration mode.\nThe PC Z-Wave Controller must be within 2m of the controller that is being made the primary.";
                    break;
                }
                case ZWControllerCommand.ReceiveConfiguration:
                {
                    this.Text = "Receive Configuration";
                    this.label1.Text = "Transfering the network configuration\nfrom another controller.\n\nPlease bring the other controller within 2m of the PC controller and set it to send its network configuration.";
                    break;
                }
                case ZWControllerCommand.RemoveController:
                {
                    this.Text = "RemoveController";
                    this.label1.Text = "Put the target controller into receive configuration mode.\nThe PC Z-Wave Controller must be within 2m of the controller being added.";
                    break;
                }
                case ZWControllerCommand.RemoveDevice:
                {
                    this.Text = "Remove Device";
                    this.label1.Text = "Press the program button on the Z-Wave device to remove it from the network.\nFor security reasons, the PC Z-Wave Controller must be close to the device being removed.";
                    break;
                }
                case ZWControllerCommand.TransferPrimaryRole:
                {
                    this.Text = "Transfer Primary Role";
                    this.label1.Text = "Transfering the primary role\nto another controller.\n\nPlease bring the new controller within 2m of the PC controller and set it to receive the network configuration.";
                    break;
                }
                case ZWControllerCommand.HasNodeFailed:
                {
                    this.ButtonCancel.Enabled = false;
                    this.Text = "Has Node Failed";
                    this.label1.Text = "Testing whether the node has failed.\nThis command cannot be cancelled.";
                    break;
                }
                case ZWControllerCommand.RemoveFailedNode:
                {
                    this.ButtonCancel.Enabled = false;
                    this.Text = "Remove Failed Node";
                    this.label1.Text = "Removing the failed node from the controller's list.\nThis command cannot be cancelled.";
                    break;
                }
                case ZWControllerCommand.ReplaceFailedNode:
                {
                    this.ButtonCancel.Enabled = false;
                    this.Text = "Replacing Failed Node";
                    this.label1.Text = "Testing the failed node.\nThis command cannot be cancelled.";
                    break;
                }
            }

            m_manager.OnControllerStateChanged += m_controllerStateChangedHandler;
            if (!m_manager.BeginControllerCommand(m_homeId, m_op, false, m_nodeId))
            {
                m_manager.OnControllerStateChanged -= m_controllerStateChangedHandler;
            }
        }
Esempio n. 3
0
 public bool BeginControllerCommand(uint homeId, ZWControllerCommand command, bool highPower, byte nodeId)
 {
     return(_manager.BeginControllerCommand(homeId, command, highPower, nodeId));
 }