Refactor NucuCar.Sensors project structure
This commit is contained in:
parent
937ea25a2c
commit
058b8ffa88
42 changed files with 80 additions and 140 deletions
|
@ -1,42 +0,0 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
|
||||||
<EnableDefaultItems>false</EnableDefaultItems>
|
|
||||||
<LangVersion>8.0</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Bme280.cs" />
|
|
||||||
<Compile Include="Bme680.cs" />
|
|
||||||
<Compile Include="Bme680HeaterProfile.cs" />
|
|
||||||
<Compile Include="Bme680HeaterProfileConfig.cs" />
|
|
||||||
<Compile Include="Bme680Mask.cs" />
|
|
||||||
<Compile Include="Bmp280.cs" />
|
|
||||||
<Compile Include="Bmx280Base.cs" />
|
|
||||||
<Compile Include="Bmxx80Base.cs" />
|
|
||||||
<Compile Include="CalibrationData\Bme680CalibrationData.cs" />
|
|
||||||
<Compile Include="CalibrationData\Bme280CalibrationData.cs" />
|
|
||||||
<Compile Include="CalibrationData\Bmp280CalibrationData.cs" />
|
|
||||||
<Compile Include="CalibrationData\Bmxx80CalibrationData.cs" />
|
|
||||||
<Compile Include="DeviceStatus.cs" />
|
|
||||||
<Compile Include="FilteringMode\Bme680FilteringMode.cs" />
|
|
||||||
<Compile Include="FilteringMode\Bmx280FilteringMode.cs" />
|
|
||||||
<Compile Include="PowerMode\Bme680PowerMode.cs" />
|
|
||||||
<Compile Include="PowerMode\Bmx280PowerMode.cs" />
|
|
||||||
<Compile Include="Register\Bme680Register.cs" />
|
|
||||||
<Compile Include="Register\Bmx280Register.cs" />
|
|
||||||
<Compile Include="Register\Bmxx80Register.cs" />
|
|
||||||
<Compile Include="Register\Bme280Register.cs" />
|
|
||||||
<Compile Include="Sampling.cs" />
|
|
||||||
<Compile Include="StandbyTime.cs" />
|
|
||||||
<ProjectReference Include="$(MainLibraryPath)System.Device.Gpio.csproj">
|
|
||||||
<AdditionalProperties>$(AdditionalProperties);RuntimeIdentifier=linux</AdditionalProperties>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Units\Units.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="README.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -3,8 +3,8 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using NucuCar.Sensors.Environment;
|
using NucuCar.Sensors.Modules.Environment;
|
||||||
using NucuCar.Sensors.Health;
|
using NucuCar.Sensors.Modules.Health;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Grpc
|
namespace NucuCar.Sensors.Grpc
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment
|
namespace NucuCar.Sensors.Modules.Environment
|
||||||
{
|
{
|
||||||
public class Bme680Config
|
public class Bme680Config
|
||||||
{
|
{
|
|
@ -7,7 +7,7 @@ using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Grpc;
|
using NucuCar.Sensors.Grpc;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment
|
namespace NucuCar.Sensors.Modules.Environment
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EnvironmentSensor's gRPC service.
|
/// EnvironmentSensor's gRPC service.
|
|
@ -6,13 +6,13 @@ using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
using Bme680 = NucuCar.Sensors.Environment.Bmxx80.Bme680;
|
using Bme680 = NucuCar.Sensors.Modules.Environment.Bmxx80.Bme680;
|
||||||
using Bme680PowerMode = NucuCar.Sensors.Environment.Bmxx80.PowerMode.Bme680PowerMode;
|
using Bme680PowerMode = NucuCar.Sensors.Modules.Environment.Bmxx80.PowerMode.Bme680PowerMode;
|
||||||
using Sampling = NucuCar.Sensors.Environment.Bmxx80.Sampling;
|
using Sampling = NucuCar.Sensors.Modules.Environment.Bmxx80.Sampling;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment
|
namespace NucuCar.Sensors.Modules.Environment
|
||||||
{
|
{
|
||||||
internal class Bme680MeasurementData
|
internal class Bme680MeasurementData
|
||||||
{
|
{
|
|
@ -1,8 +1,7 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Telemetry;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment
|
namespace NucuCar.Sensors.Modules.Environment
|
||||||
{
|
{
|
||||||
public class Bme680Worker : SensorWorker
|
public class Bme680Worker : SensorWorker
|
||||||
{
|
{
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Device.I2c;
|
using System.Device.I2c;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.CalibrationData;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a BME280 temperature, barometric pressure and humidity sensor.
|
/// Represents a BME280 temperature, barometric pressure and humidity sensor.
|
|
@ -6,13 +6,13 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Device.I2c;
|
using System.Device.I2c;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.CalibrationData;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.FilteringMode;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.FilteringMode;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.PowerMode;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.PowerMode;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Units;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Units;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a BME680 temperature, pressure, relative humidity and VOC gas sensor.
|
/// Represents a BME680 temperature, pressure, relative humidity and VOC gas sensor.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 10 addressable heater profiles stored on the Bme680.
|
/// 10 addressable heater profiles stored on the Bme680.
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The heater profile configuration saved on the device.
|
/// The heater profile configuration saved on the device.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
internal enum Bme680Mask : byte
|
internal enum Bme680Mask : byte
|
||||||
{
|
{
|
|
@ -3,9 +3,8 @@
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Device.I2c;
|
using System.Device.I2c;
|
||||||
using Iot.Device.Bmxx80;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a BME280 temperature and barometric pressure sensor.
|
/// Represents a BME280 temperature and barometric pressure sensor.
|
|
@ -8,17 +8,17 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Device.I2c;
|
using System.Device.I2c;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.FilteringMode;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.FilteringMode;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Units;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Units;
|
||||||
using Bmx280PowerMode = NucuCar.Sensors.Environment.Bmxx80.PowerMode.Bmx280PowerMode;
|
using Bmx280PowerMode = NucuCar.Sensors.Modules.Environment.Bmxx80.PowerMode.Bmx280PowerMode;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the core functionality of the Bmx280 family.
|
/// Represents the core functionality of the Bmx280 family.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Bmx280Base : NucuCar.Sensors.Environment.Bmxx80.Bmxx80Base
|
public abstract class Bmx280Base : Bmxx80Base
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default I2C bus address.
|
/// Default I2C bus address.
|
||||||
|
@ -36,7 +36,7 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
protected static readonly int[] s_osToMeasCycles = { 0, 7, 9, 14, 23, 44 };
|
protected static readonly int[] s_osToMeasCycles = { 0, 7, 9, 14, 23, 44 };
|
||||||
|
|
||||||
private Bmx280FilteringMode _filteringMode;
|
private Bmx280FilteringMode _filteringMode;
|
||||||
private NucuCar.Sensors.Environment.Bmxx80.StandbyTime _standbyTime;
|
private StandbyTime _standbyTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Bmx280Base"/> class.
|
/// Initializes a new instance of the <see cref="Bmx280Base"/> class.
|
||||||
|
@ -72,8 +72,8 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the standby time between two consecutive measurements.
|
/// Gets or sets the standby time between two consecutive measurements.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <see cref="NucuCar.Sensors.Environment.Bmxx80.StandbyTime"/> is set to an undefined mode.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <see cref="Bmxx80.StandbyTime"/> is set to an undefined mode.</exception>
|
||||||
public NucuCar.Sensors.Environment.Bmxx80.StandbyTime StandbyTime
|
public StandbyTime StandbyTime
|
||||||
{
|
{
|
||||||
get => _standbyTime;
|
get => _standbyTime;
|
||||||
set
|
set
|
||||||
|
@ -94,13 +94,13 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// Reads the temperature. A return value indicates whether the reading succeeded.
|
/// Reads the temperature. A return value indicates whether the reading succeeded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="temperature">
|
/// <param name="temperature">
|
||||||
/// Contains the measured temperature if the <see cref="NucuCar.Sensors.Environment.Bmxx80.Bmxx80Base.TemperatureSampling"/> was not set to <see cref="NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped"/>.
|
/// Contains the measured temperature if the <see cref="Bmxx80Base.TemperatureSampling"/> was not set to <see cref="Sampling.Skipped"/>.
|
||||||
/// Contains <see cref="double.NaN"/> otherwise.
|
/// Contains <see cref="double.NaN"/> otherwise.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><code>true</code> if measurement was not skipped, otherwise <code>false</code>.</returns>
|
/// <returns><code>true</code> if measurement was not skipped, otherwise <code>false</code>.</returns>
|
||||||
public override bool TryReadTemperature(out Temperature temperature)
|
public override bool TryReadTemperature(out Temperature temperature)
|
||||||
{
|
{
|
||||||
if (TemperatureSampling == NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped)
|
if (TemperatureSampling == Sampling.Skipped)
|
||||||
{
|
{
|
||||||
temperature = Temperature.FromCelsius(double.NaN);
|
temperature = Temperature.FromCelsius(double.NaN);
|
||||||
return false;
|
return false;
|
||||||
|
@ -142,13 +142,13 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// Reads the pressure. A return value indicates whether the reading succeeded.
|
/// Reads the pressure. A return value indicates whether the reading succeeded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pressure">
|
/// <param name="pressure">
|
||||||
/// Contains the measured pressure in Pa if the <see cref="NucuCar.Sensors.Environment.Bmxx80.Bmxx80Base.PressureSampling"/> was not set to <see cref="NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped"/>.
|
/// Contains the measured pressure in Pa if the <see cref="Bmxx80Base.PressureSampling"/> was not set to <see cref="Sampling.Skipped"/>.
|
||||||
/// Contains <see cref="double.NaN"/> otherwise.
|
/// Contains <see cref="double.NaN"/> otherwise.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><code>true</code> if measurement was not skipped, otherwise <code>false</code>.</returns>
|
/// <returns><code>true</code> if measurement was not skipped, otherwise <code>false</code>.</returns>
|
||||||
public override bool TryReadPressure(out Pressure pressure)
|
public override bool TryReadPressure(out Pressure pressure)
|
||||||
{
|
{
|
||||||
if (PressureSampling == NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped)
|
if (PressureSampling == Sampling.Skipped)
|
||||||
{
|
{
|
||||||
pressure = Pressure.FromPascal(double.NaN);
|
pressure = Pressure.FromPascal(double.NaN);
|
||||||
return false;
|
return false;
|
||||||
|
@ -173,7 +173,7 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="seaLevelPressure">Sea-level pressure</param>
|
/// <param name="seaLevelPressure">Sea-level pressure</param>
|
||||||
/// <param name="altitude">
|
/// <param name="altitude">
|
||||||
/// Contains the calculated metres above sea-level if the <see cref="NucuCar.Sensors.Environment.Bmxx80.Bmxx80Base.PressureSampling"/> was not set to <see cref="NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped"/>.
|
/// Contains the calculated metres above sea-level if the <see cref="Bmxx80Base.PressureSampling"/> was not set to <see cref="Sampling.Skipped"/>.
|
||||||
/// Contains <see cref="double.NaN"/> otherwise.
|
/// Contains <see cref="double.NaN"/> otherwise.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><code>true</code> if pressure measurement was not skipped, otherwise <code>false</code>.</returns>
|
/// <returns><code>true</code> if pressure measurement was not skipped, otherwise <code>false</code>.</returns>
|
||||||
|
@ -196,7 +196,7 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// Calculates the altitude in meters from the mean sea-level pressure.
|
/// Calculates the altitude in meters from the mean sea-level pressure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="altitude">
|
/// <param name="altitude">
|
||||||
/// Contains the calculated metres above sea-level if the <see cref="NucuCar.Sensors.Environment.Bmxx80.Bmxx80Base.PressureSampling"/> was not set to <see cref="NucuCar.Sensors.Environment.Bmxx80.Sampling.Skipped"/>.
|
/// Contains the calculated metres above sea-level if the <see cref="Bmxx80Base.PressureSampling"/> was not set to <see cref="Sampling.Skipped"/>.
|
||||||
/// Contains <see cref="double.NaN"/> otherwise.
|
/// Contains <see cref="double.NaN"/> otherwise.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns><code>true</code> if pressure measurement was not skipped, otherwise <code>false</code>.</returns>
|
/// <returns><code>true</code> if pressure measurement was not skipped, otherwise <code>false</code>.</returns>
|
||||||
|
@ -208,8 +208,8 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the current status of the device.
|
/// Get the current status of the device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The <see cref="NucuCar.Sensors.Environment.Bmxx80.DeviceStatus"/>.</returns>
|
/// <returns>The <see cref="DeviceStatus"/>.</returns>
|
||||||
public NucuCar.Sensors.Environment.Bmxx80.DeviceStatus ReadStatus()
|
public DeviceStatus ReadStatus()
|
||||||
{
|
{
|
||||||
var status = Read8BitsFromRegister((byte)Bmx280Register.STATUS);
|
var status = Read8BitsFromRegister((byte)Bmx280Register.STATUS);
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
// Bit 0.
|
// Bit 0.
|
||||||
var imageUpdating = (status & 1) == 1;
|
var imageUpdating = (status & 1) == 1;
|
||||||
|
|
||||||
return new NucuCar.Sensors.Environment.Bmxx80.DeviceStatus
|
return new DeviceStatus
|
||||||
{
|
{
|
||||||
ImageUpdating = imageUpdating,
|
ImageUpdating = imageUpdating,
|
||||||
Measuring = measuring
|
Measuring = measuring
|
||||||
|
@ -260,7 +260,7 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
base.SetDefaultConfiguration();
|
base.SetDefaultConfiguration();
|
||||||
FilterMode = Bmx280FilteringMode.Off;
|
FilterMode = Bmx280FilteringMode.Off;
|
||||||
StandbyTime = NucuCar.Sensors.Environment.Bmxx80.StandbyTime.Ms125;
|
StandbyTime = StandbyTime.Ms125;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
|
@ -6,11 +6,11 @@ using System;
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Device.I2c;
|
using System.Device.I2c;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.CalibrationData;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Units;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Units;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the core functionality of the Bmxx80 family.
|
/// Represents the core functionality of the Bmxx80 family.
|
||||||
|
@ -306,15 +306,15 @@ namespace NucuCar.Sensors.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
switch (this)
|
switch (this)
|
||||||
{
|
{
|
||||||
case NucuCar.Sensors.Environment.Bmxx80.Bme280 _:
|
case Bme280 _:
|
||||||
_calibrationData = new Bme280CalibrationData();
|
_calibrationData = new Bme280CalibrationData();
|
||||||
_controlRegister = (byte)Bmx280Register.CTRL_MEAS;
|
_controlRegister = (byte)Bmx280Register.CTRL_MEAS;
|
||||||
break;
|
break;
|
||||||
case NucuCar.Sensors.Environment.Bmxx80.Bmp280 _:
|
case Bmp280 _:
|
||||||
_calibrationData = new Bmp280CalibrationData();
|
_calibrationData = new Bmp280CalibrationData();
|
||||||
_controlRegister = (byte)Bmx280Register.CTRL_MEAS;
|
_controlRegister = (byte)Bmx280Register.CTRL_MEAS;
|
||||||
break;
|
break;
|
||||||
case NucuCar.Sensors.Environment.Bmxx80.Bme680 _:
|
case Bme680 _:
|
||||||
_calibrationData = new Bme680CalibrationData();
|
_calibrationData = new Bme680CalibrationData();
|
||||||
_controlRegister = (byte)Bme680Register.CTRL_MEAS;
|
_controlRegister = (byte)Bme680Register.CTRL_MEAS;
|
||||||
break;
|
break;
|
|
@ -2,12 +2,9 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using Iot.Device.Bmxx80;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using Iot.Device.Bmxx80.CalibrationData;
|
|
||||||
using Iot.Device.Bmxx80.Register;
|
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.CalibrationData
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calibration data for the BME280.
|
/// Calibration data for the BME280.
|
|
@ -2,12 +2,9 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using Iot.Device.Bmxx80;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using Iot.Device.Bmxx80.CalibrationData;
|
|
||||||
using Iot.Device.Bmxx80.Register;
|
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.CalibrationData
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calibration data for the <see cref="Bme680"/>.
|
/// Calibration data for the <see cref="Bme680"/>.
|
|
@ -2,12 +2,9 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using Iot.Device.Bmxx80;
|
using NucuCar.Sensors.Modules.Environment.Bmxx80.Register;
|
||||||
using Iot.Device.Bmxx80.CalibrationData;
|
|
||||||
using Iot.Device.Bmxx80.Register;
|
|
||||||
using NucuCar.Sensors.Environment.Bmxx80.Register;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.CalibrationData
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calibration data for the BMP280.
|
/// Calibration data for the BMP280.
|
|
@ -2,9 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using Iot.Device.Bmxx80;
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.CalibrationData
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.CalibrationData
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calibration data for the Bmxx80 family.
|
/// Calibration data for the Bmxx80 family.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates the status of the device.
|
/// Indicates the status of the device.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.FilteringMode
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.FilteringMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IIR filter coefficient. The higher the coefficient, the slower the sensors
|
/// IIR filter coefficient. The higher the coefficient, the slower the sensors
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.FilteringMode
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.FilteringMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bmx280 devices feature an internal IIR filter.
|
/// Bmx280 devices feature an internal IIR filter.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.PowerMode
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.PowerMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sensor power mode.
|
/// Sensor power mode.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.PowerMode
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.PowerMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sensor power mode.
|
/// Sensor power mode.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Register
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Register
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General control registers for the BME280.
|
/// General control registers for the BME280.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Register
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Register
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General control registers for the BME680.
|
/// General control registers for the BME680.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Register
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Register
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register shared by the Bmx280 family.
|
/// Register shared by the Bmx280 family.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Register
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Register
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers shared in the Bmxx80 family.
|
/// Registers shared in the Bmxx80 family.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Oversampling settings.
|
/// Oversampling settings.
|
|
@ -2,7 +2,7 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls the inactive duration in normal mode.
|
/// Controls the inactive duration in normal mode.
|
|
@ -1,4 +1,4 @@
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Units
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Units
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Structure representing pressure
|
/// Structure representing pressure
|
|
@ -1,4 +1,4 @@
|
||||||
namespace NucuCar.Sensors.Environment.Bmxx80.Units
|
namespace NucuCar.Sensors.Modules.Environment.Bmxx80.Units
|
||||||
{
|
{
|
||||||
public struct Temperature
|
public struct Temperature
|
||||||
{
|
{
|
|
@ -1,5 +1,5 @@
|
||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
namespace NucuCar.Sensors.Health
|
namespace NucuCar.Sensors.Modules.Health
|
||||||
{
|
{
|
||||||
public class CpuTempConfig
|
public class CpuTempConfig
|
||||||
{
|
{
|
|
@ -7,7 +7,7 @@ using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Grpc;
|
using NucuCar.Sensors.Grpc;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Health
|
namespace NucuCar.Sensors.Modules.Health
|
||||||
{
|
{
|
||||||
public class CpuTempGrpcService : HealthSensorGrpcService.HealthSensorGrpcServiceBase
|
public class CpuTempGrpcService : HealthSensorGrpcService.HealthSensorGrpcServiceBase
|
||||||
{
|
{
|
|
@ -8,7 +8,7 @@ using Newtonsoft.Json;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Health
|
namespace NucuCar.Sensors.Modules.Health
|
||||||
{
|
{
|
||||||
public class CpuTempSensor : GenericTelemeterSensor, ISensor<CpuTempSensor>
|
public class CpuTempSensor : GenericTelemeterSensor, ISensor<CpuTempSensor>
|
||||||
{
|
{
|
|
@ -1,8 +1,7 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Telemetry;
|
|
||||||
|
|
||||||
namespace NucuCar.Sensors.Health
|
namespace NucuCar.Sensors.Modules.Health
|
||||||
{
|
{
|
||||||
public class CpuTempWorker : SensorWorker
|
public class CpuTempWorker : SensorWorker
|
||||||
{
|
{
|
|
@ -81,8 +81,4 @@
|
||||||
<ProjectReference Include="..\NucuCar.Domain.Telemetry\NucuCar.Domain.Telemetry.csproj" />
|
<ProjectReference Include="..\NucuCar.Domain.Telemetry\NucuCar.Domain.Telemetry.csproj" />
|
||||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Modules" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
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.Environment;
|
|
||||||
using NucuCar.Sensors.Grpc;
|
using NucuCar.Sensors.Grpc;
|
||||||
using NucuCar.Sensors.Health;
|
using NucuCar.Sensors.Modules.Environment;
|
||||||
|
using NucuCar.Sensors.Modules.Health;
|
||||||
using NucuCar.Telemetry;
|
using NucuCar.Telemetry;
|
||||||
|
|
||||||
namespace NucuCar.Sensors
|
namespace NucuCar.Sensors
|
||||||
|
|
|
@ -3,7 +3,7 @@ using Microsoft.Extensions.Options;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NucuCar.Sensors;
|
using NucuCar.Sensors;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Environment;
|
using NucuCar.Sensors.Modules.Environment;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
|
@ -3,13 +3,13 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NucuCar.Sensors;
|
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Environment;
|
using NucuCar.Sensors.Modules.Environment;
|
||||||
|
using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor.Tests;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor.Tests
|
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor
|
||||||
{
|
{
|
||||||
public class Bme680WorkerTest
|
public class Bme680WorkerTest
|
||||||
{
|
{
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NucuCar.Sensors.Environment;
|
using NucuCar.Sensors.Modules.Environment;
|
||||||
using NucuCarSensorsProto;
|
using NucuCarSensorsProto;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor.Tests
|
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor.Tests
|
Loading…
Reference in a new issue