NucuCar/NucuCar.Sensors/Telemetry/SensorTelemetry.cs

23 lines
634 B
C#
Raw Normal View History

using Microsoft.Extensions.Logging;
using NucuCar.Domain.Telemetry;
namespace NucuCar.Sensors.Telemetry
{
public class SensorTelemetry
{
public TelemetryPublisher Publisher { get; }
public SensorTelemetry(ILogger<SensorTelemetry> logger, TelemetryConfig configuration)
{
if (configuration.ServiceEnabled)
{
Publisher = TelemetryPublisherAzure.CreateFromConnectionString(configuration.ConnectionString,
"NucuCar.Sensors", logger);
}
else
{
Publisher = null;
}
}
}
}