aboutsummaryrefslogtreecommitdiffstats
path: root/src/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'src/diagnostic')
-rw-r--r--src/diagnostic/active-diagnostic-request.cpp2
-rw-r--r--src/diagnostic/active-diagnostic-request.hpp13
-rw-r--r--src/diagnostic/diagnostic-manager.cpp7
-rw-r--r--src/diagnostic/diagnostic-manager.hpp19
-rw-r--r--src/diagnostic/diagnostic-message.cpp5
-rw-r--r--src/diagnostic/diagnostic-message.hpp6
6 files changed, 31 insertions, 21 deletions
diff --git a/src/diagnostic/active-diagnostic-request.cpp b/src/diagnostic/active-diagnostic-request.cpp
index 96e4b3a..251fddb 100644
--- a/src/diagnostic/active-diagnostic-request.cpp
+++ b/src/diagnostic/active-diagnostic-request.cpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#include "active-diagnostic-request.hpp"
+
active_diagnostic_request_t::active_diagnostic_request_t()
: can_bus_dev_{nullptr}, uint32_t id_{0}, DiagnosticRequestHandle{nullptr}, name_{""},
decoder_{nullptr}, callback_{nullptr}, reccuring_{false}, wait_for_multiple_responses_{false},
diff --git a/src/diagnostic/active-diagnostic-request.hpp b/src/diagnostic/active-diagnostic-request.hpp
index 2850663..f1128c5 100644
--- a/src/diagnostic/active-diagnostic-request.hpp
+++ b/src/diagnostic/active-diagnostic-request.hpp
@@ -21,13 +21,14 @@
#include "uds/uds.h"
#include "uds/uds_types.h"
-#include "can/can-bus.hpp"
-#include "can/can-message.hpp"
+#include "../can/can-bus-dev.hpp"
+#include "../can/can-message.hpp"
+#include "diagnostic-manager.hpp"
-#include "low-can-binding.hpp"
+#include "../low-can-binding.hpp"
class active_diagnostic_request_t;
-class can_bus_dev_t;
+class diagnostic_manager_t;
/* Public: The signature for an optional function that can apply the neccessary
* formula to translate the binary payload into meaningful data.
@@ -80,7 +81,7 @@ private:
public:
active_diagnostic_request_t();
- void updateDiagnosticRequestEntry(DiagnosticsManager* manager, CanBus* bus, DiagnosticRequest* request,
- const char* name, bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
+ void updateDiagnosticRequestEntry(diagnostic_manager_t* manager, can_bus_dev_t* bus, DiagnosticRequest* request,
+ const std::string name, bool wait_for_multiple_responses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz);
};
diff --git a/src/diagnostic/diagnostic-manager.cpp b/src/diagnostic/diagnostic-manager.cpp
index 2be9a05..547b087 100644
--- a/src/diagnostic/diagnostic-manager.cpp
+++ b/src/diagnostic/diagnostic-manager.cpp
@@ -15,10 +15,13 @@
* limitations under the License.
*/
-#include "obd2/diagnostic-manager.hpp"
+#include <algorithm>
+#include "diagnostic-manager.hpp"
+
+#include "uds/uds.h"
#include "../configuration.hpp"
-#include "../low-can-binding.hpp"
+
#define MAX_REQUEST_ENTRIES 50
diagnostic_manager_t::diagnostic_manager_t()
diff --git a/src/diagnostic/diagnostic-manager.hpp b/src/diagnostic/diagnostic-manager.hpp
index bb12f6b..2b804a4 100644
--- a/src/diagnostic/diagnostic-manager.hpp
+++ b/src/diagnostic/diagnostic-manager.hpp
@@ -17,14 +17,15 @@
#pragma once
+#include <queue>
#include <vector>
#include "uds/uds.h"
-#include "can/can-bus-dev.hpp"
-#include "can/can-message.hpp"
-#include "obd2/active-diagnostic-request.hpp"
+#include "../can/can-bus-dev.hpp"
+#include "../can/can-message.hpp"
+#include "active-diagnostic-request.hpp"
-#include "low-can-binding.hpp"
+#include "../low-can-binding.hpp"
/* Private: Each CAN bus needs its own set of shim functions, so this should
* match the maximum CAN controller count.
@@ -57,7 +58,7 @@ private:
std::vector<active_diagnostic_request_t> free_request_entries_; /*!< freeRequestEntries - A list of all available slots for active diagnostic
* requests. This free list is backed by statically allocated entries in
* the requestListEntries attribute.*/
- std::vector<active_diagnostic_request_t> request_list_entries_ /*!< requestListEntries - Static allocation for all active diagnostic requests.*/
+ std::vector<active_diagnostic_request_t> request_list_entries_; /*!< requestListEntries - Static allocation for all active diagnostic requests.*/
bool initialized_; /*!< * initialized - True if the DiagnosticsManager has been initialized with shims. It will interface with the uds-c lib*/
@@ -72,11 +73,13 @@ public:
void checkSupportedPids(const active_diagnostic_request_t& request,
const DiagnosticResponse& response, float parsedPayload);
- bool addRecurringRequest(DiagnosticRequest* request, const char* name,
+ bool add_request(DiagnosticRequest* request, const std::string name,
+ bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
+ const DiagnosticResponseCallback callback);
+
+ bool add_recurring_request(DiagnosticRequest* request, const char* name,
bool waitForMultipleResponses, const DiagnosticResponseDecoder decoder,
const DiagnosticResponseCallback callback, float frequencyHz);
void reset();
-
- void add_request(int pid);
};
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index bd5d0ec..8f42653 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -89,13 +89,14 @@ bool obd2_signal_t::is_obd2_response(can_message_t can_message)
}
return false;
*/
-}
+ return false;
+}
void obd2_signal_t::add_request(int pid)
{
DiagnosticRequest request = {
arbitration_id: OBD2_FUNCTIONAL_BROADCAST_ID,
- mode: 0x1, has_pid: true, pid_ };
+ mode: 0x1, has_pid: true, pid: pid_ };
}
/**
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 2c6d4ba..5ca651c 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -20,10 +20,10 @@
#include <vector>
#include "uds/uds.h"
-#include "can/can-bus.hpp"
-#include "can/can-message.hpp"
+#include "../can/can-bus.hpp"
+#include "../can/can-message.hpp"
-#include "low-can-binding.hpp"
+#include "../low-can-binding.hpp"
enum UNIT {
POURCENT,