summaryrefslogtreecommitdiffstats
path: root/src/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'src/diagnostic')
-rw-r--r--src/diagnostic/diagnostic-message.cpp28
-rw-r--r--src/diagnostic/diagnostic-message.hpp9
2 files changed, 15 insertions, 22 deletions
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index bfca85b..c358aae 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -15,9 +15,11 @@
* limitations under the License.
*/
-#include "obd2-signals.hpp"
+#include "obd2/obd2-signals.hpp"
-#include "signals.hpp"
+#include "utils/signals.hpp"
+
+#define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df
const char *UNIT_NAMES[10] = {
"POURCENT",
@@ -62,16 +64,9 @@ obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int
{
}
-void obd2_signals_t::init_diagnostic_shims(can_bus_dev_t& can_bus_dev)
+std::vector<obd2_signals_t>& get_obd2_signals()
{
- DiagnosticShims shims_ = diagnostic_init_shims(shims_logger, can_bus_dev.send_can_message, NULL);
-
- int n_pids_, i_;
-
- n_pids_ = size(Obd2Pid);
- for(i_=0; i_<=n_pids_; i_++)
- {
- }
+ return OBD2_PIDS;
}
/**
@@ -83,7 +78,7 @@ void obd2_signals_t::init_diagnostic_shims(can_bus_dev_t& can_bus_dev)
*
* @return std::vector<std::string> Vector of signals name found.
*/
-void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<Obd2Pid*>& found_signals)
+void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& found_signals)
{
switch(key.type)
{
@@ -100,11 +95,6 @@ void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vect
DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size());
}
-std::vector<Obd2Pid>& get_obd2_signals()
-{
- return OBD2_PIDS;
-}
-
uint32_t get_signal_id(const Obd2Pid& sig)
{
return (uint32_t)sig.pid;
@@ -156,7 +146,9 @@ bool obd2_signals_t::is_obd2_response(can_message_t can_message)
{
debug("Sent message ID is outside the valid range for emulator (7DF to 7E7)");
status=false;
-};
+ }
+ return false;
+}
void obd2_signals_t::add_request(int pid)
{
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 1ee9d96..5a19393 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -76,14 +76,13 @@ class obd2_signals_t {
bool supported_;
public:
+ const char* generic_name = generic_name_;
obd2_signals_t(uint8_t pid, const char* generic_name, const int min_, const int max_, enum UNIT unit, int frequency, bool supported);
- void init_diagnostic_shims(can_bus_dev_t& can_bus_dev);
void add_request(int pid);
- std::vector<Obd2Pid>& get_obd2_signals();
uint32_t get_signal_id(const Obd2Pid& sig);
- void find_obd2_signals(const openxc_DynamicField &key, std::vector<Obd2Pid*>& found_signals);
+ void find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& found_signals);
bool is_obd2_response(can_message_t can_message);
@@ -91,4 +90,6 @@ class obd2_signals_t {
bool is_obd2_signal(const char *name);
float decode_obd2_response(const DiagnosticResponse* response, float parsedPayload);
-}; \ No newline at end of file
+};
+
+std::vector<obd2_signals_t>& get_obd2_signals(); \ No newline at end of file