Refactor GenericSensor: rename IntializeSensor to Initialize

This commit is contained in:
Denis-Cosmin Nutiu 2019-12-17 21:44:15 +02:00
parent e7e4997020
commit 2f34f16a09
5 changed files with 6 additions and 5 deletions

View file

@ -1,5 +1,6 @@
namespace NucuCar.Domain.Sensors
{
// TODO Make generic, reuse nucucarsensor response or modify this.
public class Bme680MeasurementData
{
public double Temperature { get; set; }

View file

@ -10,7 +10,7 @@ namespace NucuCar.Domain.Sensors
protected ILogger Logger;
protected SensorStateEnum SensorStateEnum;
public abstract void InitializeSensor();
public abstract void Initialize();
public abstract Task TakeMeasurementAsync();
public abstract Bme680MeasurementData GetMeasurement();
public abstract SensorStateEnum GetState();

View file

@ -57,7 +57,7 @@ namespace NucuCar.Sensors.EnvironmentSensor
_bme680?.Dispose();
}
public override void InitializeSensor()
public override void Initialize()
{
if (SensorStateEnum == SensorStateEnum.Initialized || SensorStateEnum == SensorStateEnum.Disabled)
{

View file

@ -33,7 +33,7 @@ namespace NucuCar.Sensors.EnvironmentSensor
_logger.LogInformation("Starting sensor worker");
_telemetryPublisher?.RegisterTelemeter(_bme680Sensor.Object);
_bme680Sensor.Object.InitializeSensor();
_bme680Sensor.Object.Initialize();
while (!stoppingToken.IsCancellationRequested)
{
/* If sensor is ok attempt to read. */
@ -46,7 +46,7 @@ namespace NucuCar.Sensors.EnvironmentSensor
_bme680Sensor.Object.GetState() == SensorStateEnum.Error)
{
await Task.Delay(10000, stoppingToken);
_bme680Sensor.Object.InitializeSensor();
_bme680Sensor.Object.Initialize();
}
await Task.Delay(_measurementInterval, stoppingToken);

View file

@ -13,7 +13,7 @@ namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor.Tests
return Task.CompletedTask;
}
public override void InitializeSensor()
public override void Initialize()
{
}