summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/diagnostic
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder/low-can-binding/diagnostic')
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp51
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp1
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-message.hpp2
3 files changed, 11 insertions, 43 deletions
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
index 7dab749..cfabfea 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
@@ -72,9 +72,8 @@ void diagnostic_manager_t::reset()
cleanup_active_requests(true);
}
-/// @brief send function use by diagnostic library. Only one bus used for now
-/// so diagnostic request is sent using the default diagnostic bus not matter of
-/// which is specified in the diagnostic message definition.
+/// @brief send function use by diagnostic library. It will open a BCM CAN socket TX_SETUP type.
+/// That socket will send cyclic messages configured from a diagnostic request.
///
/// @param[in] arbitration_id - CAN arbitration ID to use when send message. OBD2 broadcast ID
/// is 0x7DF by example.
@@ -163,15 +162,6 @@ DiagnosticShims& diagnostic_manager_t::get_shims()
return shims_;
}
-bool diagnostic_manager_t::is_active_requests_running()
-{
- if(non_recurring_requests_.empty() && recurring_requests_.empty())
- {
- return true;
- }
- return false;
-}
-
/// @brief Search for a specific active diagnostic request in the provided requests list
/// and erase it from the vector. This is useful at unsubscription to clean up the list otherwize
/// all received CAN messages will be passed to DiagnosticRequestHandle of all active diagnostic request
@@ -186,7 +176,7 @@ void diagnostic_manager_t::find_and_erase(active_diagnostic_request_t* entry, st
requests_list.erase(i);
}
-// @brief TODO: implement cancel_request if needed... Don't know.
+/// @brief Free memory allocated on active_diagnostic_request_t object and close the socket.
void diagnostic_manager_t::cancel_request(active_diagnostic_request_t* entry)
{
entry->get_socket().close();
@@ -259,7 +249,7 @@ active_diagnostic_request_t* diagnostic_manager_t::find_recurring_request(Diagno
return nullptr;
}
-/// @brief Add and send a new one-time diagnostic request.
+/// @brief Add and send a new one-time diagnostic request. DON'T USED AT THIS TIME
///
/// A one-time (aka non-recurring) request can existing in parallel with a
/// recurring request for the same PID or mode, that's not a problem.
@@ -320,6 +310,12 @@ active_diagnostic_request_t* diagnostic_manager_t::add_request(DiagnosticRequest
return entry;
}
+/// @brief Validate frequency asked don't get higher than the maximum of a classical
+/// CAN bus OBD2 request.
+///
+/// @param[in] frequencyHz - frequency asked for sending diagnostic requests.
+///
+/// @return True if frequency is below the Maximum false if not.
bool diagnostic_manager_t::validate_optional_request_attributes(float frequencyHz)
{
if(frequencyHz > MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ) {
@@ -334,32 +330,7 @@ bool diagnostic_manager_t::validate_optional_request_attributes(float frequencyH
///
/// At most one recurring request can be active for the same arbitration ID, mode
/// and (if set) PID on the same bus at one time. If you try and call
-/// addRecurringRequest with the same key, it will return an error.
-///
-/// TODO: This also adds any neccessary CAN acceptance filters so we can receive the
-/// response. If the request is to the functional broadcast ID (0x7df) filters
-/// are added for all functional addresses (0x7e8 to 0x7f0).
-///
-/// Example:
-///
-/// // Creating a functional broadcast, mode 1 request for PID 2.
-/// DiagnosticRequest request = {
-/// arbitration_id: 0x7df,
-/// mode: 1,
-/// has_pid: true,
-/// pid: 2
-/// };
-///
-/// // Add a recurring request, to be sent at 1Hz, and published with the
-/// // name "my_pid_request"
-/// addRecurringRequest(&getConfiguration()->diagnosticsManager,
-/// canBus,
-/// &request,
-/// "my_pid_request",
-/// false,
-/// NULL,
-/// NULL,
-/// 1);
+/// add_recurring_request with the same key, it will return an error.
///
/// @param[in] request - The parameters for the request.
/// @param[in] name - An optional human readable name this response, to be used when
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
index 4c023c6..05a67c8 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.hpp
@@ -67,7 +67,6 @@ public:
const std::string get_bus_device_name() const;
active_diagnostic_request_t* get_last_recurring_requests() const;
DiagnosticShims& get_shims();
- bool is_active_requests_running();
void find_and_erase(active_diagnostic_request_t* entry, std::vector<active_diagnostic_request_t*>& requests_list);
void cancel_request(active_diagnostic_request_t* entry);
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-message.hpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-message.hpp
index 8217614..99c4811 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-message.hpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-message.hpp
@@ -41,9 +41,7 @@ enum UNIT {
class can_message_set_t;
-///
/// @brief - A representation of an OBD-II PID.
-///
class diagnostic_message_t
{
private: