X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fdiagnostic%2Fdiagnostic-message.cpp;h=656a868cf9f4b72908430d1d9dab4571ff944958;hb=2049aca0927b55f2a256fd60ff686616b73eecb7;hp=71b0f7d7eb1187ad4937a2683a2cbf95ba832426;hpb=4d5b071ab451260ef9d3cbf393aca0992104b0d7;p=apps%2Fagl-service-can-low-level.git diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp index 71b0f7d7..656a868c 100644 --- a/src/diagnostic/diagnostic-message.cpp +++ b/src/diagnostic/diagnostic-message.cpp @@ -19,8 +19,6 @@ #include "utils/signals.hpp" -#define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df - const char *UNIT_NAMES[10] = { "POURCENT", "DEGREES_CELSIUS", @@ -34,41 +32,6 @@ const char *UNIT_NAMES[10] = { "NM" }; -/* -* Pre-defined OBD-II PIDs to query for if supported by the vehicle. -*/ - std::vector OBD2_PIDS = { - { 0x04, "obd2.engine.load", 0, 100, POURCENT, 5, false}, - { 0x05, "obd2.engine.coolant.temperature", -40, 215, DEGREES_CELSIUS, 1, false}, - { 0x0a, "obd2.fuel.pressure", 0, 765, KPA, 1, false}, - { 0x0b, "obd2.intake.manifold.pressure", 0, 255, KPA, 1, false}, - { 0x0c, "obd2.engine.speed", 0, 16383, RPM, 5, false}, - { 0x0d, "obd2.vehicle.speed", 0, 255, KM_H, 5, false}, - { 0x0f, "obd2.intake.air.temperature", -40, 215, DEGREES_CELSIUS, 1, false}, - { 0x10, "obd2.mass.airflow", 0, 655, GRAMS_SEC, 5, false}, - { 0x11, "obd2.throttle.position", 0, 100, POURCENT, 5, false}, - { 0x1f, "obd2.running.time", 0, 65535, SECONDS, 1, false}, - { 0x2d, "obd2.EGR.error", -100, 99, POURCENT, 0, false}, - { 0x2f, "obd2.fuel.level", 0, 100, POURCENT, 1, false}, - { 0x33, "obd2.barometric.pressure", 0, 255, KPA, 1, false}, - { 0x4c, "obd2.commanded.throttle.position", 0, 100, POURCENT, 1, false}, - { 0x52, "obd2.ethanol.fuel.percentage", 0, 100, POURCENT, 1, false}, - { 0x5a, "obd2.accelerator.pedal.position", 0, 100, POURCENT, 5, false}, - { 0x5b, "obd2.hybrid.battery-pack.remaining.life", 0, 100, POURCENT, 5, false}, - { 0x5c, "obd2.engine.oil.temperature",-40, 210, DEGREES_CELSIUS, 1, false}, - { 0x63, "obd2.engine.torque", 0, 65535, NM, 1, false} -}; - -uint32_t get_signal_id(obd2_signals_t& sig) -{ - return sig.get_pid(); -} - -std::vector& get_obd2_signals() -{ - return OBD2_PIDS; -} - obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int min, const int max, enum UNIT unit, int frequency, bool supported) : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit}, frequency_{frequency}, supported_{supported} { @@ -105,22 +68,9 @@ void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vect DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size()); } -uint32_t get_signal_id(const obd2_signals_t& sig) -{ - return (uint32_t)sig.pid; -} - -void shims_logger(const char* m, const struct afb_binding_interface *interface) -{ - DEBUG(interface, "%s", m); -} - -void shims_timer() -{ -} - bool obd2_signals_t::is_obd2_response(can_message_t can_message) { + /* if(can_message.get_id() >= 0x7E8 && can_message.get_id() <= 0x7EF) { openxc_VehicleMessage message = {0}; @@ -158,13 +108,14 @@ bool obd2_signals_t::is_obd2_response(can_message_t can_message) status=false; } return false; + */ } void obd2_signals_t::add_request(int pid) { DiagnosticRequest request = { arbitration_id: OBD2_FUNCTIONAL_BROADCAST_ID, - mode: 0x1, has_true, pid}; + mode: 0x1, has_pid: true, pid_ }; } /**