summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can/can-bus.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-08 12:41:09 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-09 11:43:31 +0200
commitce2bd1c557ae2cb44db1794909f129e82286c305 (patch)
treedb07d6dc4c357485801015240e1449add0f14b2e /CAN-binder/low-can-binding/can/can-bus.cpp
parent5206b26e1a6811d142ffbaf12daaea0731345490 (diff)
Comments, Cleanup, format
Change-Id: I9f032cc232e77ce73e889a1656f1ad86cfdec774 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-bus.cpp')
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index d06eb77c..e481a1bd 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus.cpp
@@ -40,6 +40,14 @@ can_bus_t::can_bus_t(utils::config_parser_t conf_file)
: conf_file_{conf_file}
{}
+/// @brief Take a decoded message to determine if its value comply with the wanted
+/// filtering values.
+///
+/// @param[in] vehicle_message - A decoded message to analyze
+/// @param[in] can_subscription - the subscription which will be notified depending
+/// on its filtering values. Filtering values are stored in the event_filtermember.
+///
+/// @return True if the value is compliant with event filter values, false if not...
bool can_bus_t::apply_filter(const openxc_VehicleMessage& vehicle_message, std::shared_ptr<low_can_subscription_t> can_subscription)
{
bool send = false;
@@ -283,12 +291,8 @@ void can_bus_t::push_new_vehicle_message(int subscription_id, const openxc_Vehic
vehicle_message_q_.push(std::make_pair(subscription_id, v_msg));
}
-/// @brief Return the shared pointer on the can_bus_dev_t initialized
-/// with device_name "bus"
-///
-/// @param[in] bus - CAN bus device name to retrieve.
-///
-/// @return A shared pointer on an object can_bus_dev_t
+/// @brief Fills the CAN device map member with value from device
+/// mapping configuration file read at initialization.
void can_bus_t::set_can_devices()
{
can_devices_ = conf_file_.get_devices_name();
@@ -300,6 +304,9 @@ void can_bus_t::set_can_devices()
}
}
+
+/// @brief Return the CAN device index from the map
+/// map are sorted so index depend upon alphabetical sorting.
int can_bus_t::get_can_device_index(const std::string& bus_name) const
{
int i = 0;
@@ -312,6 +319,9 @@ int can_bus_t::get_can_device_index(const std::string& bus_name) const
return i;
}
+/// @brief Return CAN device name from a logical CAN device name gotten from
+/// the signals.json description file which comes from a CAN databases file in
+/// general.
const std::string can_bus_t::get_can_device_name(const std::string& id_name) const
{
std::string ret;