NUC-41: Extract concrete Telemetry implementations in a project.
This commit is contained in:
parent
9d4135d6d3
commit
d85447aee8
19 changed files with 153 additions and 117 deletions
|
@ -13,7 +13,7 @@ namespace NucuCar.Domain
|
|||
/// <param name="argumentName">The argument name that will be logged in the exception message.</param>
|
||||
/// <param name="argument">The argument to check if it's null or whitespace.</param>
|
||||
/// <exception cref="ArgumentNullException">Raised if the argument is null or whitespace.</exception>
|
||||
internal static void ArgumentNotNullOrWhiteSpace(string argumentName, string argument)
|
||||
public static void ArgumentNotNullOrWhiteSpace(string argumentName, string argument)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(argument))
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using NucuCar.Sensors.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
|
||||
namespace NucuCar.Sensors.Environment
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using NucuCar.Sensors.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
|
||||
namespace NucuCar.Sensors.Health
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<PackageReference Include="Iot.Device.Bindings" Version="1.0.0" />
|
||||
<PackageReference Include="jose-jwt" Version="2.5.0" />
|
||||
<PackageReference Include="libgrpc_csharp_ext.arm7" Version="1.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.3" />
|
||||
<PackageReference Include="System.Device.Gpio" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -79,5 +79,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Telemetry" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -4,7 +4,7 @@ using Microsoft.Extensions.Hosting;
|
|||
using NucuCar.Sensors.Environment;
|
||||
using NucuCar.Sensors.Grpc;
|
||||
using NucuCar.Sensors.Health;
|
||||
using NucuCar.Sensors.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
|
||||
namespace NucuCar.Sensors
|
||||
{
|
||||
|
|
15
NucuCar.Telemetry/NucuCar.Telemetry.csproj
Normal file
15
NucuCar.Telemetry/NucuCar.Telemetry.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -4,7 +4,7 @@ using NucuCar.Domain.Telemetry;
|
|||
|
||||
// ReSharper disable ClassWithVirtualMembersNeverInherited.Global
|
||||
|
||||
namespace NucuCar.Sensors.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
public class SensorTelemetry
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
using NucuCar.Domain.Telemetry;
|
||||
|
||||
namespace NucuCar.Sensors.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
public class TelemetryConfig
|
||||
{
|
|
@ -5,8 +5,9 @@ using System.Threading.Tasks;
|
|||
using Microsoft.Azure.Devices.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
|
||||
namespace NucuCar.Domain.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructs an instance of <see cref="TelemetryPublisherAzure"/>. It is used to publish telemetry to Microsoft
|
|
@ -6,9 +6,10 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
using NucuCar.Domain.Utilities;
|
||||
|
||||
namespace NucuCar.Domain.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// The TelemetryPublisherDisk is used to publish telemetry data to a file on the disk.
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NucuCar.Domain;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
|
||||
namespace NucuCar.Domain.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// The TelemetryPublisherFactory is used instantiate TelemetryPublishers.
|
|
@ -8,9 +8,10 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
using NucuCar.Domain.Utilities;
|
||||
|
||||
namespace NucuCar.Domain.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to publish the telemetry data to Google's Cloud Firestore.
|
||||
|
@ -66,6 +67,7 @@ namespace NucuCar.Domain.Telemetry
|
|||
_httpClient = new HttpClient();
|
||||
_httpClient.BaseAddress = new Uri(requestUrl);
|
||||
Logger?.LogInformation($"Initialized {nameof(TelemetryPublisherFirestore)}");
|
||||
Logger?.LogInformation($"ProjectId: {firestoreProjectId}; CollectionName: {firestoreCollection}.");
|
||||
}
|
||||
|
||||
private async Task SetupAuthenticationHeaders()
|
|
@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging;
|
|||
using Microsoft.Extensions.Options;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
|
||||
namespace NucuCar.Sensors.Telemetry
|
||||
namespace NucuCar.Telemetry
|
||||
{
|
||||
/// <summary>
|
||||
/// Telemetry service, which pools the telemetry sources and pushes telemetry data to the cloud.
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -7,6 +7,7 @@ using CommandLine;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
|
||||
namespace NucuCar.TestClient.Telemetry
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using NucuCar.Domain.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
using Xunit;
|
||||
|
||||
namespace NucuCar.UnitTests.NucuCar.Domain.Tests.Telemetry
|
||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.Extensions.Options;
|
|||
using Moq;
|
||||
using NucuCar.Sensors;
|
||||
using NucuCar.Sensors.Environment;
|
||||
using NucuCar.Sensors.Telemetry;
|
||||
using NucuCar.Telemetry;
|
||||
using NucuCarSensorsProto;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
||||
<ProjectReference Include="..\NucuCar.Sensors\NucuCar.Sensors.csproj" />
|
||||
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Domain", "NucuCar.D
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.UnitTests", "NucuCar.UnitTests\NucuCar.UnitTests.csproj", "{C6F07921-1052-4945-911E-F328A622F229}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Telemetry", "NucuCar.Telemetry\NucuCar.Telemetry.csproj", "{C20407F3-AB62-4590-B4FF-A0DCFCFA232B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -30,5 +32,9 @@ Global
|
|||
{C6F07921-1052-4945-911E-F328A622F229}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C6F07921-1052-4945-911E-F328A622F229}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C6F07921-1052-4945-911E-F328A622F229}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C20407F3-AB62-4590-B4FF-A0DCFCFA232B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C20407F3-AB62-4590-B4FF-A0DCFCFA232B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C20407F3-AB62-4590-B4FF-A0DCFCFA232B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C20407F3-AB62-4590-B4FF-A0DCFCFA232B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
Loading…
Reference in a new issue