Add async modifier in Sensors.Modules.*GrpcService

This commit is contained in:
Denis-Cosmin Nutiu 2020-08-01 20:08:27 +03:00
parent 8bd7283316
commit b233b48336
2 changed files with 6 additions and 6 deletions

View file

@ -26,16 +26,16 @@ namespace NucuCar.Sensors.Modules.Environment
_options = options; _options = options;
} }
public override Task<NucuCarSensorResponse> GetMeasurement(Empty request, public override async Task<NucuCarSensorResponse> GetMeasurement(Empty request,
ServerCallContext context) ServerCallContext context)
{ {
_logger?.LogDebug($"Calling {nameof(GetMeasurement)}."); _logger?.LogDebug($"Calling {nameof(GetMeasurement)}.");
if (_options.Value.Grpc) if (_options.Value.Grpc)
{ {
return Task.FromResult(_bme680Sensor.Object.GetMeasurement()); return await Task.FromResult(_bme680Sensor.Object.GetMeasurement());
} }
return Task.FromResult(Responses.GrpcIsDisabledResponse); return await Task.FromResult(Responses.GrpcIsDisabledResponse);
} }
} }
} }

View file

@ -23,15 +23,15 @@ namespace NucuCar.Sensors.Modules.Health
_options = options; _options = options;
} }
public override Task<NucuCarSensorResponse> GetCpuTemperature(Empty request, ServerCallContext context) public override async Task<NucuCarSensorResponse> GetCpuTemperature(Empty request, ServerCallContext context)
{ {
_logger?.LogDebug($"Calling {nameof(GetCpuTemperature)}."); _logger?.LogDebug($"Calling {nameof(GetCpuTemperature)}.");
if (_options.Value.Grpc) if (_options.Value.Grpc)
{ {
return Task.FromResult(_sensor.Object.GetMeasurement()); return await Task.FromResult(_sensor.Object.GetMeasurement());
} }
return Task.FromResult(Responses.GrpcIsDisabledResponse); return await Task.FromResult(Responses.GrpcIsDisabledResponse);
} }
} }
} }