Beispiel #1
0
        public void Post([FromBody] GPIOModel model)
        {
            if (GPIOPool == null)
            {
                GPIOPool = new Dictionary <string, GPIO>();
            }

            if (!GPIOPool.ContainsKey(model.Number))
            {
                GPIOPool[model.Number] = new GPIO(model.Number, model.Direction);
            }
        }
Beispiel #2
0
        public IEnumerable <GPIOModel> Get()
        {
            var result = new List <GPIOModel>();

            if (GPIOPool != null)
            {
                foreach (var gpio in GPIOPool.Values)
                {
                    var gpioModel = new GPIOModel(gpio);
                    result.Add(gpioModel);
                }
            }

            return(result);
        }