예제 #1
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            await Meadow.NshDisableAsync(cancellationToken).ConfigureAwait(false);
        }
예제 #2
0
        /// <summary>
        /// Remove an entity from the forest.
        /// </summary>
        /// <param name="entity"></param>
        public void RemoveEntity(ForestEntity entity)
        {
            // Replace the existing entity with an empty one.
            Meadow m = new Meadow();

            m.Location = entity.Location;
            _entities[entity.Location.X, entity.Location.Y] = m;
        }
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            _logger.LogInformation("Verifying flash");
            await Meadow.VerifyErasedFlashAsync(cancellationToken).ConfigureAwait(false);
        }
예제 #4
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            await console.Output.WriteLineAsync("Renewing file system on the Meadow.");

            await Meadow.RenewFileSystemAsync(cancellationToken : cancellationToken).ConfigureAwait(false);
        }
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            var deviceInfo = await Meadow.GetDeviceInfoAsync(TimeSpan.FromSeconds(60), cancellationToken).ConfigureAwait(false);

            _logger.LogInformation(deviceInfo.ToString());
        }
예제 #6
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            await Meadow.MonoFlashAsync(cancellationToken)
            .ConfigureAwait(false);

            _logger.LogInformation($"Mono Flashed Successfully");
        }
예제 #7
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            var runState = await Meadow.GetMonoRunStateAsync(cancellationToken)
                           .ConfigureAwait(false);

            _logger.LogInformation($"Mono Run State: {(runState ? "Enabled" : "Disabled")}");
        }
예제 #8
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            var macAddress = await Meadow.GetDeviceMacAddressAsync(cancellationToken).ConfigureAwait(false);

            if (macAddress == null)
            {
                _logger.LogInformation("Unable to retrieve device mac address");
            }
            else
            {
                _logger.LogInformation("Device MAC: {macAddress}", macAddress);
            }
        }
예제 #9
0
 /// <summary>
 /// Create a forest of specified width and height.
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 public Forest(int width, int height)
 {
     _entities = new ForestEntity[width, height];
     // Fill the array with empty entities.
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             Meadow m = new Meadow();
             m.Location      = new System.Drawing.Point(x, y);
             _entities[x, y] = m;
         }
     }
     _rules  = new List <SimulationRule>();
     _width  = width;
     _height = height;
 }
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            var task = Developer switch
            {
                1 => Meadow.SetDeveloper1(Value, cancellationToken).ConfigureAwait(false),
                2 => Meadow.SetDeveloper2(Value, cancellationToken).ConfigureAwait(false),
                3 => Meadow.SetDeveloper3(Value, cancellationToken).ConfigureAwait(false),
                4 => Meadow.SetDeveloper4(Value, cancellationToken).ConfigureAwait(false),
                _ => throw new ArgumentOutOfRangeException(nameof(Developer), Developer, "Valid values are 1 - 4")
            };

            await task;
        }
    }
예제 #11
0
        public override async ValueTask ExecuteAsync(IConsole console)
        {
            await base.ExecuteAsync(console);

            var cancellationToken = console.RegisterCancellationHandler();

            if (Enable)
            {
                await Meadow.Uart1Trace(cancellationToken)
                .ConfigureAwait(false);

                _logger.LogInformation("Sending trace output to UART");
            }
            else
            {
                await Meadow.Uart1Apps(cancellationToken)
                .ConfigureAwait(false);

                _logger.LogInformation("Sending App output to UART");
            }
        }