Example #1
0
        /// <summary>
        /// Queries all temperature sensors associated with MooseBox and creates instances (i.e. static construction).
        /// </summary>
        /// <returns>[1...N] MooseBox Temperature Sensors.</returns>
        internal async static Task <List <TemperatureSensor> > GetTemperatureSensors()
        {
            List <TemperatureSensor> temperatureSensors = new List <TemperatureSensor>();
            IMooseBoxRESTAPI         mooseBoxRESTAPI    = MooseBoxRESTAPIFactory.Instance.Create();

            //Query all available serial numbers.
            List <string> serialNumbers = await mooseBoxRESTAPI.QueryTemperatureSensorSerialNumbers();

            //Convert to TemperatureSensor instances.
            foreach (string serialNumber in serialNumbers)
            {
                temperatureSensors.Add(new TemperatureSensor(serialNumber, mooseBoxRESTAPI));
            }

            return(temperatureSensors);
        }