bool can_bus_t::apply_filter(const openxc_VehicleMessage& vehicle_message, std::shared_ptr<low_can_subscription_t> can_subscription)
{
+ bool send = false;
if(is_valid(vehicle_message))
{
- return true;
+ float min = std::isnan(can_subscription->get_min()) ? -INFINITY : can_subscription->get_min();
+ float max = std::isnan(can_subscription->get_max()) ? INFINITY : can_subscription->get_max();
+ double value = get_numerical_from_DynamicField(vehicle_message);
+ send = (value < min && value > max) ? false : true;
}
- return false;
+ return send;
}
/// @brief Will make the decoding operation on a classic CAN message. It will not
jo = json_object_new_object();
jsonify_simple(s_message, jo);
if(afb_event_push(s[v_message.first]->get_event(), jo) == 0)
- on_no_clients(std::string(s_message.name));
+ {
+ if(v_message.second.has_diagnostic_response)
+ {on_no_clients(s[v_message.first], v_message.second.diagnostic_response.pid);}
+ on_no_clients(s[v_message.first]);
+ }
}
}
}
{
is_decoding_ = true;
th_decoding_ = std::thread(&can_bus_t::can_decode_message, this);
- if(!th_decoding_.joinable())
- is_decoding_ = false;
+ th_decoding_.detach();
is_pushing_ = true;
th_pushing_ = std::thread(&can_bus_t::can_event_push, this);
- if(!th_pushing_.joinable())
- is_pushing_ = false;
+ th_pushing_.detach();
}
/// @brief Will stop all threads holded by can_bus_t object