Beispiel #1
0
        public async Task <SensorDataValue> ProvideAsync()
        {
            var randomData          = SensorDataValue.RandomValue();
            var lastSensorDataValue = await _lastSensorDataValue.ProvideAsync();

            while (randomData.Equals(lastSensorDataValue))
            {
                randomData = SensorDataValue.RandomValue();
            }
            return(randomData);
        }
Beispiel #2
0
        public async Task GenerateAsync(SensorDataValue sensorDataValue)
        {
            var lastSensorDataValue = await _lastSensorDataValue.ProvideAsync();

            if (sensorDataValue.Equals(lastSensorDataValue))
            {
                return;
            }
            var sensorData = new SensorData
            {
                SensorDataValue   = sensorDataValue,
                SensorDataCreated = DateTime.UtcNow
            };

            await _generateSensorData.GenerateAsync(sensorData);
        }