Rename GetTelemetryData to GetTelemetryJson in ITelemeter

This commit is contained in:
Denis-Cosmin Nutiu 2021-10-03 18:08:07 +03:00
parent 5f86a37724
commit b52f292db1
7 changed files with 8 additions and 8 deletions

View file

@ -13,7 +13,7 @@ namespace NucuCar.Sensors.Abstractions
{
protected bool TelemetryEnabled;
public abstract string GetIdentifier();
public abstract Dictionary<string, object> GetTelemetryData();
public abstract Dictionary<string, object> GetTelemetryJson();
public abstract bool IsTelemetryEnabled();
}
}

View file

@ -153,7 +153,7 @@ namespace NucuCar.Sensors.Modules.BME680
return "Environment";
}
public override Dictionary<string, object> GetTelemetryData()
public override Dictionary<string, object> GetTelemetryJson()
{
Dictionary<string, object> returnValue = null;
if (_lastMeasurement != null && TelemetryEnabled)

View file

@ -84,7 +84,7 @@ namespace NucuCar.Sensors.Modules.CpuTemperature
return "CpuTemperature";
}
public override Dictionary<string, object> GetTelemetryData()
public override Dictionary<string, object> GetTelemetryJson()
{
Dictionary<string, object> returnValue = null;
if (!double.IsNaN(_lastTemperatureCelsius) && TelemetryEnabled)

View file

@ -59,7 +59,7 @@ namespace NucuCar.Sensors.Modules.Heartbeat
return "Heartbeat";
}
public override Dictionary<string, object> GetTelemetryData()
public override Dictionary<string, object> GetTelemetryJson()
{
var returnValue = new Dictionary<string, object>
{

View file

@ -124,7 +124,7 @@ namespace NucuCar.Sensors.Modules.PMS5003
return "Pms5003";
}
public override Dictionary<string, object> GetTelemetryData()
public override Dictionary<string, object> GetTelemetryJson()
{
Dictionary<string, object> returnValue = null;
if (_pms5003Data != null && TelemetryEnabled)

View file

@ -14,14 +14,14 @@ namespace NucuCar.Telemetry.Abstractions
/// <returns>An identifier for the telemetry source.</returns>
string GetIdentifier();
// TODO: Perhaps here it's better if we return a string.
// TODO: Perhaps here it's better if we return a string or a json object from Newtonsoft.
/// <summary>
/// This function should return a dictionary containing the telemetry data.
/// When implementing this function you should return null if the telemetry is disabled.
/// See: <see cref="IsTelemetryEnabled"/>
/// </summary>
/// <returns>The telemetry data. It should be JSON serializable.</returns>
Dictionary<string, object> GetTelemetryData();
Dictionary<string, object> GetTelemetryJson();
/// <summary>
/// This function should return whether the sensor has telemetry enabled or not.

View file

@ -103,7 +103,7 @@ namespace NucuCar.Telemetry.Abstractions
var data = new List<Dictionary<string, object>>();
foreach (var telemeter in RegisteredTelemeters)
{
var telemetryData = telemeter.GetTelemetryData();
var telemetryData = telemeter.GetTelemetryJson();
if (telemetryData == null)
{
Logger?.LogWarning("Warning! Data for {Identifier} is null!", telemeter.GetIdentifier());