aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/can/can-signals.cpp9
-rw-r--r--src/can/can-signals.hpp5
-rw-r--r--src/diagnostic/diagnostic-message.cpp27
-rw-r--r--src/diagnostic/diagnostic-message.hpp8
-rw-r--r--src/low-can-binding.cpp1
5 files changed, 37 insertions, 13 deletions
diff --git a/src/can/can-signals.cpp b/src/can/can-signals.cpp
index 2d2e7eaf..00b6ee07 100644
--- a/src/can/can-signals.cpp
+++ b/src/can/can-signals.cpp
@@ -30,16 +30,21 @@ can_message_definition_t& can_signal_t::get_message()
return message_;
}
-std::string& can_signal_t::get_generic_name()
+const std::string& can_signal_t::get_generic_name() const
{
return generic_name_;
}
-std::string can_signal_t::get_name()
+const std::string can_signal_t::get_name() const
{
return prefix_ + "." + generic_name_;
}
+const std::string& can_signal_t::get_prefix() const
+{
+ return prefix_;
+}
+
uint8_t can_signal_t::get_bit_position() const
{
return bit_position_;
diff --git a/src/can/can-signals.hpp b/src/can/can-signals.hpp
index 10403da4..c1d07eee 100644
--- a/src/can/can-signals.hpp
+++ b/src/can/can-signals.hpp
@@ -110,8 +110,9 @@ private:
public:
can_message_definition_t& get_message();
- std::string& get_generic_name();
- std::string get_name();
+ const std::string& get_generic_name() const;
+ const std::string get_name() const;
+ const std::string& get_prefix() const;
uint8_t get_bit_position() const;
uint8_t get_bit_size() const;
float get_factor() const;
diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp
index bd76de0b..62e97b8f 100644
--- a/src/diagnostic/diagnostic-message.cpp
+++ b/src/diagnostic/diagnostic-message.cpp
@@ -43,16 +43,21 @@ uint32_t obd2_signal_t::get_pid()
return (uint32_t)pid_;
}
-std::string& obd2_signal_t::get_generic_name()
+const std::string& obd2_signal_t::get_generic_name() const
{
return generic_name_;
}
-std::string obd2_signal_t::get_name()
+const std::string obd2_signal_t::get_name() const
{
return prefix_ + "." + generic_name_;
}
+const std::string& obd2_signal_t::get_prefix() const
+{
+ return prefix_;
+}
+
void obd2_signal_t::set_prefix(std::string val)
{
prefix_ = val;
@@ -102,11 +107,21 @@ bool obd2_signal_t::is_obd2_response(can_message_t can_message)
return false;
}
-void obd2_signal_t::add_request(int pid)
+/**
+ * @brief Build a DiagnosticRequest struct to be passed
+ * to diagnostic manager instance.
+ */
+const DiagnosticRequest obd2_signal_t::build_diagnostic_request()
{
- DiagnosticRequest request = {
- arbitration_id: OBD2_FUNCTIONAL_BROADCAST_ID,
- mode: 0x1, has_pid: true, pid: pid_ };
+ return {/*arbitration_id: */OBD2_FUNCTIONAL_BROADCAST_ID,
+ /*mode: */0x1,
+ /*has_pid: */true,
+ /*pid: */pid_,
+ /*pid_length: */0,
+ /*payload[]: */{0},
+ /*payload_length: */0,
+ /*no_frame_padding: */false,
+ /*DiagnosticRequestType: */DiagnosticRequestType::DIAGNOSTIC_REQUEST_TYPE_PID };
}
/**
diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp
index 534b9a59..8301917f 100644
--- a/src/diagnostic/diagnostic-message.hpp
+++ b/src/diagnostic/diagnostic-message.hpp
@@ -59,11 +59,13 @@ class obd2_signal_t {
obd2_signal_t(uint8_t pid, const char* generic_name, const int min_, const int max_, enum UNIT unit, int frequency, bool supported);
uint32_t get_pid();
- std::string& get_generic_name();
- std::string get_name();
+ const std::string& get_generic_name() const;
+ const std::string get_name() const;
+ const std::string& get_prefix() const;
void set_prefix(std::string val);
- void add_request(int pid);
+
+ const DiagnosticRequest build_diagnostic_request();
bool is_obd2_response(can_message_t can_message);
bool is_obd2_request(DiagnosticRequest *request);
diff --git a/src/low-can-binding.cpp b/src/low-can-binding.cpp
index 8411b65d..a2b54567 100644
--- a/src/low-can-binding.cpp
+++ b/src/low-can-binding.cpp
@@ -123,6 +123,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
for(auto& sig : signals)
{
+ //if (sig.find_first_of())
int ret = subscribe_unsubscribe_signal(request, subscribe, sig);
if(ret <= 0)
return ret;