2019-11-24 15:47:17 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using NucuCar.Domain.Telemetry;
|
|
|
|
|
|
|
|
namespace NucuCar.Sensors.Telemetry
|
|
|
|
{
|
|
|
|
public class SensorTelemetry
|
|
|
|
{
|
|
|
|
public TelemetryPublisher Publisher { get; }
|
|
|
|
|
2019-11-24 16:40:42 +00:00
|
|
|
public SensorTelemetry(ILogger<SensorTelemetry> logger, TelemetryConfig configuration)
|
2019-11-24 15:47:17 +00:00
|
|
|
{
|
2019-11-24 16:40:42 +00:00
|
|
|
if (configuration.ServiceEnabled)
|
2019-11-24 15:47:17 +00:00
|
|
|
{
|
2019-11-25 09:40:17 +00:00
|
|
|
Publisher = TelemetryPublisherAzure.CreateFromConnectionString(configuration.ConnectionString,
|
|
|
|
"NucuCar.Sensors", logger);
|
2019-11-24 15:47:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Publisher = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|