Make low-can use afb-genskel by default
[apps/agl-service-can-low-level.git] / low-can-binding / diagnostic / diagnostic-message.cpp
index 6f61557..69ca4e3 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "diagnostic-message.hpp"
 
 
 #include "diagnostic-message.hpp"
 
-#include "../configuration.hpp"
+#include "../binding/application.hpp"
 #include "../utils/signals.hpp"
 
 const char *UNIT_NAMES[10] = {
 #include "../utils/signals.hpp"
 
 const char *UNIT_NAMES[10] = {
@@ -34,10 +34,10 @@ const char *UNIT_NAMES[10] = {
        "NM"
 };
 
        "NM"
 };
 
-diagnostic_message_t::diagnostic_message_t(uint8_t pid, const std::string generic_name, const int min,
+diagnostic_message_t::diagnostic_message_t(uint8_t pid, const std::string& generic_name, const int min,
        const int max, enum UNIT unit, float frequency, DiagnosticResponseDecoder decoder,
        DiagnosticResponseCallback callback, bool supported)
        const int max, enum UNIT unit, float frequency, DiagnosticResponseDecoder decoder,
        DiagnosticResponseCallback callback, bool supported)
-       : pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit},
+       : parent_{nullptr}, pid_{pid}, generic_name_{generic_name}, min_{min}, max_{max}, unit_{unit},
        frequency_{frequency}, decoder_{decoder}, callback_{callback}, supported_{supported}
 {}
 
        frequency_{frequency}, decoder_{decoder}, callback_{callback}, supported_{supported}
 {}
 
@@ -46,7 +46,7 @@ uint32_t diagnostic_message_t::get_pid()
        return (uint32_t)pid_;
 }
 
        return (uint32_t)pid_;
 }
 
-const std::string& diagnostic_message_t::get_generic_name() const
+const std::string diagnostic_message_t::get_generic_name() const
 {
        return generic_name_;
 }
 {
        return generic_name_;
 }
@@ -80,11 +80,16 @@ void diagnostic_message_t::set_supported(bool value)
        supported_ = value;
 }
 
        supported_ = value;
 }
 
+void diagnostic_message_t::set_parent(can_message_set_t* parent)
+{
+       parent_ = parent;
+}
+
 ///
 /// @brief Build a DiagnosticRequest struct to be passed
 ///  to diagnostic manager instance.
 ///
 ///
 /// @brief Build a DiagnosticRequest struct to be passed
 ///  to diagnostic manager instance.
 ///
-const DiagnosticRequest diagnostic_message_t::build_diagnostic_request()
+ const DiagnosticRequest diagnostic_message_t::build_diagnostic_request() const
 {
        return {/*arbitration_id: */OBD2_FUNCTIONAL_BROADCAST_ID,
                        /*mode: */0x1,
 {
        return {/*arbitration_id: */OBD2_FUNCTIONAL_BROADCAST_ID,
                        /*mode: */0x1,