private static async Task <RealTimePayload> GetRealTimePayload(ELM327 device) { EngineRPM rpmData = await device.RequestDataAsync <EngineRPM>(); VehicleSpeed speedData = await device.RequestDataAsync <VehicleSpeed>(); EngineCoolantTemperature engineCoolantTemperatureData = await device.RequestDataAsync <EngineCoolantTemperature>(); EngineOilTemperature engineOilTemperatureData = await device.RequestDataAsync <EngineOilTemperature>(); FuelTankLevelInput fuelTankLevelInputData = await device.RequestDataAsync <FuelTankLevelInput>(); ThrottlePosition throttlePossition = await device.RequestDataAsync <ThrottlePosition>(); RealTimePayload realTimePayLoad = new RealTimePayload() { CarId = "MH12KE2651", Rpm = rpmData.Rpm, Speed = speedData.Speed, CoolantTemperature = engineCoolantTemperatureData.Temperature, EngineOilTemperature = 43, FuelLevel = throttlePossition.Position, PayloadTimestamp = DateTime.UtcNow.Ticks }; return(realTimePayLoad); }
private static void OnThrottle(ThrottlePosition throttle) { Startup.TestHub.Clients.All.SendAsync("ReceiveMessage", throttle.Value); }
void Awake() { _audioSource = GetComponent <AudioSource>(); _throttlePosition = GetComponent <ThrottlePosition>(); }