using System.Threading.Tasks; using Google.Protobuf.WellKnownTypes; using Grpc.Core; using Microsoft.Extensions.Logging; using NucuCarSensorsProto; namespace NucuCar.Sensors.Health { public class CpuTempGrpcService : HealthSensorGrpcService.HealthSensorGrpcServiceBase { private readonly ILogger _logger; private readonly ISensor _sensor; public CpuTempGrpcService(ILogger logger, ISensor sensor) { _logger = logger; _sensor = sensor; } public override Task GetCpuTemperature(Empty request, ServerCallContext context) { _logger?.LogDebug($"Calling {nameof(GetCpuTemperature)}."); return Task.FromResult(_sensor.Object.GetMeasurement()); } } }