Esempio n. 1
0
        /// <summary>
        /// Write the sensor value to the database
        /// </summary>
        /// <param name="SensorValue">Tinkerforge Sensor plugin value</param>
        /// <param name="MType">Used measurement type - the sensor name</param>
        /// <param name="MUnit">used measurement unit</param>
        /// <param name="MLocation">used measurement location</param>
        private void WriteSensorData(MeasurementValue SensorValue, MType MType, MUnit MUnit, MLocation MLocation)
        {
            var MValue = new MValue
            {
                Type       = MType,
                Unit       = MUnit,
                Location   = MLocation,
                RecordTime = SensorValue.Timestamp,
                Value      = SensorValue.Value
            };

            DBInstance.Add(MValue);
            DBInstance.SaveChanges();
        }