Пример #1
0
        public void set_direction(string hostId, int gpioId, string direction)
        {
            direction = direction.ToLowerInvariant();

            GpioDirection directionValue;

            switch (direction)
            {
            case "o":
            case "out":
            case "output":
                directionValue = GpioDirection.Output;
                break;

            case "i":
            case "in":
            case "input":
                directionValue = GpioDirection.Input;
                break;

            default:
                throw new PythonProxyException($"Unable to parse '{direction}' to a valid GPIO direction.");
            }

            _gpioRegistryService.SetDirection(hostId, gpioId, directionValue);
        }
Пример #2
0
        public void set_direction(string hostId, int gpioId, string direction)
        {
            if (direction is null)
            {
                throw new ArgumentNullException(nameof(direction));
            }

            direction = direction.ToUpperInvariant();

            GpioDirection directionValue;

            switch (direction)
            {
            case "O":
            case "OUT":
            case "OUTPUT":
                directionValue = GpioDirection.Output;
                break;

            case "I":
            case "IN":
            case "INPUT":
                directionValue = GpioDirection.Input;
                break;

            default:
                throw new PythonProxyException($"Unable to parse '{direction}' to a valid GPIO direction.");
            }

            _gpioRegistryService.SetDirection(hostId, gpioId, directionValue);
        }