Пример #1
0
        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);
        }
Пример #2
0
 private static void OnThrottle(ThrottlePosition throttle)
 {
     Startup.TestHub.Clients.All.SendAsync("ReceiveMessage", throttle.Value);
 }
Пример #3
0
 void Awake()
 {
     _audioSource      = GetComponent <AudioSource>();
     _throttlePosition = GetComponent <ThrottlePosition>();
 }