DiscoverNodes() 공개 메소드

public DiscoverNodes ( ) : Task
리턴 Task
예제 #1
0
        static private async Task Run(ZWaveController controller)
        {
            LogMessage($"Version: {await controller.GetVersion()}");
            LogMessage($"HomeID: {await controller.GetHomeID():X}");

            var controllerNodeID = await controller.GetNodeID();

            LogMessage($"ControllerID: {controllerNodeID:D3}");


            await controller.DiscoverNodes();

            var nodes = await controller.GetNodes();

            await Task.Delay(2000);

            foreach (var node in nodes)
            {
                var protocolInfo = await node.GetProtocolInfo();

                LogMessage($"Node: {node}, Generic = {protocolInfo.GenericType}, Basic = {protocolInfo.BasicType}, Listening = {protocolInfo.IsListening} ");

                var neighbours = await node.GetNeighbours();

                LogMessage($"Node: {node}, Neighbours = {string.Join(", ", neighbours.Cast<object>().ToArray())}");

                // subcribe to changes
                Subscribe(node);
            }
            //var command =nodes[2].GetCommandClass<SwitchBinary>();
            var command = nodes[5].GetCommandClass <MultiChannel>();
            //await Task.Delay(2000);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, false);

            //await InitializeWallPlug(nodes[2]);
            //await InitializeWallPlug(nodes[3]);
            //await InitializeShockSensor(nodes[4]);
            //await InitializeGarageDoorSensor(nodes[5]);
            //await InitializeThermostat(nodes[6]);
            //await InitializeMultiSensor(nodes[18]);
            //await InitializeDoorSensor(nodes[10]);
            //await InitializePowerSwitch(nodes[19]);
            //await InitializePowerSwitch(nodes[20]);
            //await InitializePowerSwitch(nodes[24]);
            //await InitializePowerSwitch(nodes[25]);
            //await InitializePowerSwitch(nodes[2]);
            //var neighborUpdateStatus = await nodes[19].RequestNeighborUpdate((status) => LogMessage($"RequestNeighborUpdate: {status} "));

            Console.ReadLine();
        }