summaryrefslogtreecommitdiffstats
path: root/src/can_reader.cpp
blob: 4ee1c48b6da4ad3d03758dfb59b3f27d90d72c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (C) 2015, 2016 "IoT.bzh"
 * Author "Romain Forlot" <romain.forlot@iot.bzh>
 * Author "Loic Collignon" <loic.collignon@iot.bzh>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	 http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "can_reader.hpp"

#include "low-can-binding.hpp"
#include "can-bus.hpp"

void can_reader(can_bus_dev_t &can_bus_dev, can_bus_t& can_bus)
{
	can_message_t can_message;

	while(can_bus_dev.is_running())
	{
		can_message.convert_from_canfd_frame(can_bus_dev.read());

		{
			std::lock_guard<std::mutex> can_message_lock(can_bus.get_can_message_mutex());
			can_bus.push_new_can_message(can_message);
		}
		can_bus.get_new_can_message().notify_one();
	}
}
dy.Lights.DirectionIndicator.Left.IsSignaling value: false - signal: Vehicle.Body.Lights.DirectionIndicator.Right.IsSignaling value: false - signal: Vehicle.Powertrain.Transmission.SelectedGear value: 127 - signal: Vehicle.Body.Lights.Beam.Low.IsOn value: true - signal: Vehicle.Body.Lights.Beam.High.IsOn value: false - signal: Vehicle.Body.Lights.Parking.IsOn value: false - signal: Vehicle.Body.Lights.Hazard.IsSignaling value: false - signal: Vehicle.TraveledDistance value: 1763 - signal: Vehicle.TraveledDistanceSinceStart value: 0 - signal: Vehicle.Body.Trunk.Rear.IsLocked value: true - signal: Vehicle.Body.Trunk.Rear.IsOpen value: false - signal: Vehicle.Powertrain.Transmission.PerformanceMode value: "NORMAL" - signal: Vehicle.Cabin.HVAC.AmbientAirTemperature value: 22 - signal: Vehicle.Exterior.AirTemperature value: 24 - signal: Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure value: 220 - signal: Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure value: 216 - signal: Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure value: 217 - signal: Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure value: 222 - signal: Vehicle.OBD.Status.IsMILOn value: false - signal: Vehicle.Cabin.Infotainment.HMI.DistanceUnit value: "KILOMETERS" - signal: Vehicle.Cabin.Infotainment.HMI.TemperatureUnit value: "C" - signal: Vehicle.Cabin.Infotainment.HMI.TirePressureUnit value: "KPA" - signal: Vehicle.ADAS.CruiseControl.IsEnabled value: false - signal: Vehicle.ADAS.CruiseControl.IsActive value: false - signal: Vehicle.ADAS.CruiseControl.SpeedSet value: false - signal: Vehicle.ADAS.CruiseControl.IsError value: false - signal: Vehicle.Powertrain.TractionBattery.Charging.IsCharging value: false - signal: Vehicle.Powertrain.TractionBattery.Charging.IsChargingCableConnected value: false - signal: Vehicle.Powertrain.TractionBattery.Charging.IsChargingCableLocked value: false - signal: Vehicle.Powertrain.TractionBattery.Charging.IsDischarging value: false #- signal: Vehicle.CurrentLocation.Latitude # value: #- signal: Vehicle.CurrentLocation.Longitude # value: # # AGL specific signals # - signal: Vehicle.Cabin.Infotainment.Navigation.State value: "STOPPED" - signal: Vehicle.Cabin.Infotainment.Navigation.ElapsedDistance value: 0.0 #- signal: Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Latitude # value: #- signal: Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Longitude # value: - signal: Vehicle.Cabin.SteeringWheel.Switches.Info value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.VolumeUp value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.VolumeDown value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.VolumeMute value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.Next value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.Previous value: false - signal: Vehicle.Cabin.SteeringWheel.Switches.Mode value: false mock: - Vehicle.Cabin.Infotainment.HMI.DistanceUnit - Vehicle.Cabin.Infotainment.HMI.TemperatureUnit - Vehicle.Cabin.Infotainment.HMI.TirePressureUnit - Vehicle.ADAS.CruiseControl.IsEnabled - Vehicle.ADAS.CruiseControl.IsActive - Vehicle.ADAS.CruiseControl.SpeedSet