Improve sensors module names.

This commit is contained in:
Denis-Cosmin Nutiu 2021-08-02 21:13:59 +03:00
parent d174c69111
commit 8749b6d23a
10 changed files with 17 additions and 18 deletions

View file

@ -1,6 +1,6 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedAutoPropertyAccessor.Global
namespace NucuCar.Sensors.Modules.Environment namespace NucuCar.Sensors.Modules.BME680
{ {
public class Bme680Config : BaseSensorConfig public class Bme680Config : BaseSensorConfig
{ {

View file

@ -2,16 +2,16 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Device.I2c; using System.Device.I2c;
using System.Threading.Tasks; using System.Threading.Tasks;
using Iot.Device.Bmxx80;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
using Iot.Device.Bmxx80;
using UnitsNet; using UnitsNet;
using Bme680 = Iot.Device.Bmxx80.Bme680; using Bme680 = Iot.Device.Bmxx80.Bme680;
using Bme680PowerMode = Iot.Device.Bmxx80.PowerMode.Bme680PowerMode; using Bme680PowerMode = Iot.Device.Bmxx80.PowerMode.Bme680PowerMode;
using Sampling = Iot.Device.Bmxx80.Sampling; using Sampling = Iot.Device.Bmxx80.Sampling;
namespace NucuCar.Sensors.Modules.Environment namespace NucuCar.Sensors.Modules.BME680
{ {
internal class Bme680MeasurementData internal class Bme680MeasurementData
{ {

View file

@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
namespace NucuCar.Sensors.Modules.Environment namespace NucuCar.Sensors.Modules.BME680
{ {
public class Bme680Worker : SensorWorker public class Bme680Worker : SensorWorker
{ {

View file

@ -1,5 +1,5 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedAutoPropertyAccessor.Global
namespace NucuCar.Sensors.Modules.Health namespace NucuCar.Sensors.Modules.CpuTemperature
{ {
public class CpuTempConfig : BaseSensorConfig public class CpuTempConfig : BaseSensorConfig
{ {

View file

@ -4,13 +4,12 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
using Iot.Device.CpuTemperature;
namespace NucuCar.Sensors.Modules.Health namespace NucuCar.Sensors.Modules.CpuTemperature
{ {
public class CpuTempSensor : GenericTelemeterSensor, ISensor<CpuTempSensor> public class CpuTempSensor : GenericTelemeterSensor, ISensor<CpuTempSensor>
{ {
private readonly CpuTemperature _cpuTemperature; private readonly Iot.Device.CpuTemperature.CpuTemperature _cpuTemperature;
private double _lastTemperatureCelsius; private double _lastTemperatureCelsius;
public CpuTempSensor() public CpuTempSensor()
@ -23,7 +22,7 @@ namespace NucuCar.Sensors.Modules.Health
if (options.Value.Enabled) if (options.Value.Enabled)
{ {
CurrentState = SensorStateEnum.Uninitialized; CurrentState = SensorStateEnum.Uninitialized;
_cpuTemperature = new CpuTemperature(); _cpuTemperature = new Iot.Device.CpuTemperature.CpuTemperature();
Object = this; Object = this;
TelemetryEnabled = options.Value.Telemetry; TelemetryEnabled = options.Value.Telemetry;
} }

View file

@ -2,7 +2,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
namespace NucuCar.Sensors.Modules.Health namespace NucuCar.Sensors.Modules.CpuTemperature
{ {
public class CpuTempWorker : SensorWorker public class CpuTempWorker : SensorWorker
{ {

View file

@ -1,8 +1,8 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
using NucuCar.Sensors.Modules.Environment; using NucuCar.Sensors.Modules.BME680;
using NucuCar.Sensors.Modules.Health; using NucuCar.Sensors.Modules.CpuTemperature;
using NucuCar.Sensors.Modules.Heartbeat; using NucuCar.Sensors.Modules.Heartbeat;
using NucuCar.Sensors.Modules.PMS5003; using NucuCar.Sensors.Modules.PMS5003;
using NucuCar.Telemetry; using NucuCar.Telemetry;
@ -21,8 +21,8 @@ namespace NucuCar.Sensors
.ConfigureServices((hostContext, services) => .ConfigureServices((hostContext, services) =>
{ {
services.Configure<TelemetryConfig>(hostContext.Configuration.GetSection("Telemetry")); services.Configure<TelemetryConfig>(hostContext.Configuration.GetSection("Telemetry"));
services.Configure<Bme680Config>(hostContext.Configuration.GetSection("EnvironmentSensor")); services.Configure<Bme680Config>(hostContext.Configuration.GetSection("Bme680Sensor"));
services.Configure<CpuTempConfig>(hostContext.Configuration.GetSection("HealthSensor")); services.Configure<CpuTempConfig>(hostContext.Configuration.GetSection("CpuTemperatureSensor"));
services.Configure<HeartbeatConfig>(hostContext.Configuration.GetSection("HeartbeatSensor")); services.Configure<HeartbeatConfig>(hostContext.Configuration.GetSection("HeartbeatSensor"));
services.Configure<Pms5003Config>(hostContext.Configuration.GetSection("Pms5003Sensor")); services.Configure<Pms5003Config>(hostContext.Configuration.GetSection("Pms5003Sensor"));

View file

@ -5,11 +5,11 @@
"PublishInterval": 3000, "PublishInterval": 3000,
"ConnectionString": "FileName=nucucar.telemetry;FileExtension=txt;Separator=\n" "ConnectionString": "FileName=nucucar.telemetry;FileExtension=txt;Separator=\n"
}, },
"EnvironmentSensor": { "Bme680Sensor": {
"Enabled": true, "Enabled": true,
"Telemetry": true "Telemetry": true
}, },
"HealthSensor": { "CpuTemperatureSensor": {
"Enabled": true, "Enabled": true,
"Telemetry": true "Telemetry": true
}, },

View file

@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Moq; using Moq;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
using NucuCar.Sensors.Modules.Environment; using NucuCar.Sensors.Modules.BME680;
using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor; using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor;
using Xunit; using Xunit;

View file

@ -1,6 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Abstractions;
using NucuCar.Sensors.Modules.Environment; using NucuCar.Sensors.Modules.BME680;
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor
{ {