Esempio n. 1
0
 public SensorHub(SensorsDBContext sensorsDBContext, IOptions <RaspberryPiSettings> raspberryPiSettings, ISensorService sensorService, ILedService ledService)
 {
     context  = sensorsDBContext;
     settings = raspberryPiSettings.Value;
     sensor   = sensorService;
     led      = ledService;
 }
        public string GetReadings([FromServices] SensorsDBContext context)
        {
            var readings = new StringBuilder();

            foreach (var reading in context.Readings)
            {
                readings.Append($"{reading.Temperature},{reading.Luminosity},{reading.Infrared},{reading.Distance},{reading.Source}\r\n");
            }
            return(readings.ToString());
        }