public async Task <SensorDataValue> ProvideAsync() { var randomData = SensorDataValue.RandomValue(); var lastSensorDataValue = await _lastSensorDataValue.ProvideAsync(); while (randomData.Equals(lastSensorDataValue)) { randomData = SensorDataValue.RandomValue(); } return(randomData); }
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); }