Exemple #1
0
        /// <inheritdoc />
        public async Task StartCleaningAsync(StartCleaningParameters parameters, CancellationToken cancellationToken = default)
        {
            var state = await GetRobotStateAsync(cancellationToken).ConfigureAwait(false);

            if ((parameters.Category == CleaningCategory.HouseCleaning || parameters.Category == CleaningCategory.PersistentMap) &&
                state.AvailableServices.HouseCleaning == null)
            {
                throw new Exception("Robot does not support service houseCleaning");
            }

            if (parameters.Category == CleaningCategory.SpotCleaning && state.AvailableServices.SpotCleaning == null)
            {
                throw new Exception("Robot does not support service spotCleaning");
            }

            if (state.AvailableCommands.Start)
            {
                switch (state.AvailableServices.HouseCleaning)
                {
                case "basic-1":
                case "minimal-2":
                case "minimal-3":
                case "basic-3":
                case "basic-4":
                default:
                    await _nucleoClient.StartCleaningAsync(parameters, cancellationToken).ConfigureAwait(false);

                    break;
                }
            }
        }
Exemple #2
0
 /// <inheritdoc />
 public Task <StateResponse <EmptyResponse> > StartCleaningAsync(StartCleaningParameters parameters, CancellationToken cancellationToken = default) => SendCommandAsync <StateResponse <EmptyResponse> >(CommandType.StartCleaning, parameters, cancellationToken);