diff --git a/NucuCar.Sensors/Modules/Environment/Bme680Config.cs b/NucuCar.Sensors/Modules/BME680/Bme680Config.cs similarity index 72% rename from NucuCar.Sensors/Modules/Environment/Bme680Config.cs rename to NucuCar.Sensors/Modules/BME680/Bme680Config.cs index f6c24c1..8f0e608 100644 --- a/NucuCar.Sensors/Modules/Environment/Bme680Config.cs +++ b/NucuCar.Sensors/Modules/BME680/Bme680Config.cs @@ -1,6 +1,6 @@ // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace NucuCar.Sensors.Modules.Environment +namespace NucuCar.Sensors.Modules.BME680 { public class Bme680Config : BaseSensorConfig { diff --git a/NucuCar.Sensors/Modules/Environment/Bme680Sensor.cs b/NucuCar.Sensors/Modules/BME680/Bme680Sensor.cs similarity index 99% rename from NucuCar.Sensors/Modules/Environment/Bme680Sensor.cs rename to NucuCar.Sensors/Modules/BME680/Bme680Sensor.cs index d1a6eca..9667f08 100644 --- a/NucuCar.Sensors/Modules/Environment/Bme680Sensor.cs +++ b/NucuCar.Sensors/Modules/BME680/Bme680Sensor.cs @@ -2,16 +2,16 @@ using System; using System.Collections.Generic; using System.Device.I2c; using System.Threading.Tasks; +using Iot.Device.Bmxx80; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NucuCar.Sensors.Abstractions; -using Iot.Device.Bmxx80; using UnitsNet; using Bme680 = Iot.Device.Bmxx80.Bme680; using Bme680PowerMode = Iot.Device.Bmxx80.PowerMode.Bme680PowerMode; using Sampling = Iot.Device.Bmxx80.Sampling; -namespace NucuCar.Sensors.Modules.Environment +namespace NucuCar.Sensors.Modules.BME680 { internal class Bme680MeasurementData { diff --git a/NucuCar.Sensors/Modules/Environment/Bme680Worker.cs b/NucuCar.Sensors/Modules/BME680/Bme680Worker.cs similarity index 92% rename from NucuCar.Sensors/Modules/Environment/Bme680Worker.cs rename to NucuCar.Sensors/Modules/BME680/Bme680Worker.cs index dc0aa7b..712511c 100644 --- a/NucuCar.Sensors/Modules/Environment/Bme680Worker.cs +++ b/NucuCar.Sensors/Modules/BME680/Bme680Worker.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NucuCar.Sensors.Abstractions; -namespace NucuCar.Sensors.Modules.Environment +namespace NucuCar.Sensors.Modules.BME680 { public class Bme680Worker : SensorWorker { diff --git a/NucuCar.Sensors/Modules/Health/CpuTempConfig.cs b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempConfig.cs similarity index 71% rename from NucuCar.Sensors/Modules/Health/CpuTempConfig.cs rename to NucuCar.Sensors/Modules/CpuTemperature/CpuTempConfig.cs index b218977..320aff9 100644 --- a/NucuCar.Sensors/Modules/Health/CpuTempConfig.cs +++ b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempConfig.cs @@ -1,5 +1,5 @@ // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace NucuCar.Sensors.Modules.Health +namespace NucuCar.Sensors.Modules.CpuTemperature { public class CpuTempConfig : BaseSensorConfig { diff --git a/NucuCar.Sensors/Modules/Health/CpuTempSensor.cs b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempSensor.cs similarity index 93% rename from NucuCar.Sensors/Modules/Health/CpuTempSensor.cs rename to NucuCar.Sensors/Modules/CpuTemperature/CpuTempSensor.cs index a877501..63a1f57 100644 --- a/NucuCar.Sensors/Modules/Health/CpuTempSensor.cs +++ b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempSensor.cs @@ -4,13 +4,12 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NucuCar.Sensors.Abstractions; -using Iot.Device.CpuTemperature; -namespace NucuCar.Sensors.Modules.Health +namespace NucuCar.Sensors.Modules.CpuTemperature { public class CpuTempSensor : GenericTelemeterSensor, ISensor { - private readonly CpuTemperature _cpuTemperature; + private readonly Iot.Device.CpuTemperature.CpuTemperature _cpuTemperature; private double _lastTemperatureCelsius; public CpuTempSensor() @@ -23,7 +22,7 @@ namespace NucuCar.Sensors.Modules.Health if (options.Value.Enabled) { CurrentState = SensorStateEnum.Uninitialized; - _cpuTemperature = new CpuTemperature(); + _cpuTemperature = new Iot.Device.CpuTemperature.CpuTemperature(); Object = this; TelemetryEnabled = options.Value.Telemetry; } diff --git a/NucuCar.Sensors/Modules/Health/CpuTempWorker.cs b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempWorker.cs similarity index 91% rename from NucuCar.Sensors/Modules/Health/CpuTempWorker.cs rename to NucuCar.Sensors/Modules/CpuTemperature/CpuTempWorker.cs index 7038871..4ccedc4 100644 --- a/NucuCar.Sensors/Modules/Health/CpuTempWorker.cs +++ b/NucuCar.Sensors/Modules/CpuTemperature/CpuTempWorker.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NucuCar.Sensors.Abstractions; -namespace NucuCar.Sensors.Modules.Health +namespace NucuCar.Sensors.Modules.CpuTemperature { public class CpuTempWorker : SensorWorker { diff --git a/NucuCar.Sensors/Program.cs b/NucuCar.Sensors/Program.cs index 71c2394..9dcc242 100644 --- a/NucuCar.Sensors/Program.cs +++ b/NucuCar.Sensors/Program.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using NucuCar.Sensors.Abstractions; -using NucuCar.Sensors.Modules.Environment; -using NucuCar.Sensors.Modules.Health; +using NucuCar.Sensors.Modules.BME680; +using NucuCar.Sensors.Modules.CpuTemperature; using NucuCar.Sensors.Modules.Heartbeat; using NucuCar.Sensors.Modules.PMS5003; using NucuCar.Telemetry; @@ -21,8 +21,8 @@ namespace NucuCar.Sensors .ConfigureServices((hostContext, services) => { services.Configure(hostContext.Configuration.GetSection("Telemetry")); - services.Configure(hostContext.Configuration.GetSection("EnvironmentSensor")); - services.Configure(hostContext.Configuration.GetSection("HealthSensor")); + services.Configure(hostContext.Configuration.GetSection("Bme680Sensor")); + services.Configure(hostContext.Configuration.GetSection("CpuTemperatureSensor")); services.Configure(hostContext.Configuration.GetSection("HeartbeatSensor")); services.Configure(hostContext.Configuration.GetSection("Pms5003Sensor")); diff --git a/NucuCar.Sensors/appsettings.json b/NucuCar.Sensors/appsettings.json index 35b9c42..f018d1b 100644 --- a/NucuCar.Sensors/appsettings.json +++ b/NucuCar.Sensors/appsettings.json @@ -5,11 +5,11 @@ "PublishInterval": 3000, "ConnectionString": "FileName=nucucar.telemetry;FileExtension=txt;Separator=\n" }, - "EnvironmentSensor": { + "Bme680Sensor": { "Enabled": true, "Telemetry": true }, - "HealthSensor": { + "CpuTemperatureSensor": { "Enabled": true, "Telemetry": true }, diff --git a/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs b/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs index e50a477..37c0f19 100644 --- a/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs +++ b/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Moq; using NucuCar.Sensors.Abstractions; -using NucuCar.Sensors.Modules.Environment; +using NucuCar.Sensors.Modules.BME680; using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor; using Xunit; diff --git a/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs b/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs index 09e86d8..cb1cadf 100644 --- a/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs +++ b/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; using NucuCar.Sensors.Abstractions; -using NucuCar.Sensors.Modules.Environment; +using NucuCar.Sensors.Modules.BME680; namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor {