Exemplo n.º 1
0
        public void write_state(string hostId, int gpioId, string state)
        {
            if (state is null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            state = state.ToUpperInvariant();

            GpioState stateValue;

            switch (state)
            {
            case "LOW":
            case "0":
                stateValue = GpioState.Low;
                break;

            case "HIGH":
            case "1":
                stateValue = GpioState.High;
                break;

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

            _gpioRegistryService.WriteState(hostId, gpioId, stateValue);
        }
Exemplo n.º 2
0
        public void write_state(string hostId, int gpioId, string state)
        {
            state = state.ToLowerInvariant();

            GpioState stateValue;

            switch (state)
            {
            case "low":
            case "0":
                stateValue = GpioState.Low;
                break;

            case "high":
            case "1":
                stateValue = GpioState.High;
                break;

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

            _gpioRegistryService.WriteState(hostId, gpioId, stateValue);
        }