NucuCar/NucuCar.Sensors/Telemetry/SensorTelemetry.cs
2019-11-26 20:24:27 +02:00

24 lines
No EOL
674 B
C#

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