summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-06-26 15:51:19 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-06-26 18:04:58 +0200
commit2f60d294b3fa4e243fa67a738f9b82a0b428a7fc (patch)
treeed6b50772964ce360eb2a0ebeadac29a8fb9ed2c /low-can-binding/binding
parentd2180abe18533be7cbe68971a6767e5c2a0ecf6d (diff)
Rename some of the classes removing can- prefix
This commit renames files and classes : - can_message_definition_t -> message_definition_t - can_message_set_t -> message_set_t - can_signals_t -> signals_t This prepares the implementation of j1939 protocol. Bug-AGL: SPEC-2386 Change-Id: Ie3ee4f25c236c861b92eb12a56fa03a5a9afffbb Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding')
-rw-r--r--low-can-binding/binding/application-generated.cpp102
-rw-r--r--low-can-binding/binding/application.cpp24
-rw-r--r--low-can-binding/binding/application.hpp16
-rw-r--r--low-can-binding/binding/low-can-cb.cpp28
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp40
-rw-r--r--low-can-binding/binding/low-can-subscription.hpp14
6 files changed, 112 insertions, 112 deletions
diff --git a/low-can-binding/binding/application-generated.cpp b/low-can-binding/binding/application-generated.cpp
index 45b6a8cc..de7d6a17 100644
--- a/low-can-binding/binding/application-generated.cpp
+++ b/low-can-binding/binding/application-generated.cpp
@@ -4,18 +4,18 @@
application_t::application_t()
: can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
- , can_message_set_{
- {std::make_shared<can_message_set_t>(can_message_set_t{0,"AGL Virtual Car",
+ , message_set_{
+ {std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car",
{ // beginning can_message_definition_ vector
- {std::make_shared<can_message_definition_t>(can_message_definition_t{
+ {std::make_shared<message_definition_t>(message_definition_t{
"ls",
0x30,
false,
- can_message_format_t::EXTENDED,
+ message_format_t::EXTENDED,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"hvac.fan.speed",
32,
8,
@@ -33,7 +33,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"hvac.temperature.left",
0,
8,
@@ -51,7 +51,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"hvac.temperature.right",
8,
8,
@@ -69,7 +69,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"hvac.temperature.average",
16,
8,
@@ -89,15 +89,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x3D9,
true,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"engine.speed",
16,
16,
@@ -115,7 +115,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"fuel.level.low",
55,
1,
@@ -133,7 +133,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"fuel.level",
8,
8,
@@ -153,15 +153,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x3E9,
false,
- can_message_format_t::EXTENDED,
+ message_format_t::EXTENDED,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"vehicle.average.speed",
0,
15,
@@ -181,15 +181,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x4D1,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"engine.oil.temp",
16,
8,
@@ -207,7 +207,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"engine.oil.temp.high",
7,
1,
@@ -227,15 +227,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x5D1,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"accelerator.pedal.position",
16,
8,
@@ -253,7 +253,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"steering.wheel.angle",
4,
12,
@@ -273,15 +273,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x5D2,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"transmission.gearinfo",
20,
4,
@@ -299,7 +299,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"transmission.mode",
16,
4,
@@ -319,15 +319,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x5D3,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"turnsignal.status",
26,
3,
@@ -345,7 +345,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"lightstatus.brake",
7,
1,
@@ -363,7 +363,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"parking.brake.status",
8,
1,
@@ -383,15 +383,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x620,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"doors.boot.open",
47,
1,
@@ -409,7 +409,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"doors.front_left.open",
43,
1,
@@ -427,7 +427,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"doors.front_right.open",
44,
1,
@@ -445,7 +445,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"doors.rear_left.open",
46,
1,
@@ -463,7 +463,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"doors.rear_right.open",
45,
4,
@@ -483,15 +483,15 @@ application_t::application_t()
})}
} // end can_signals vector
})} // end can_message_definition entry
-, {std::make_shared<can_message_definition_t>(can_message_definition_t{
+, {std::make_shared<message_definition_t>(message_definition_t{
"hs",
0x799,
false,
- can_message_format_t::STANDARD,
+ message_format_t::STANDARD,
frequency_clock_t(5.00000f),
true,
{ // beginning can_signals vector
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"windows.front_left.open",
43,
1,
@@ -509,7 +509,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"windows.front_right.open",
44,
1,
@@ -527,7 +527,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"windows.rear_left.open",
46,
1,
@@ -545,7 +545,7 @@ application_t::application_t()
nullptr,
false
})},
- {std::make_shared<can_signal_t> (can_signal_t{
+ {std::make_shared<signal_t> (signal_t{
"windows.rear_right.open",
45,
4,
@@ -825,16 +825,16 @@ application_t::application_t()
})} // end can_message_set entry
} // end can_message_set vector
{
- for(auto& cms: can_message_set_)
+ for(auto& cms: message_set_)
{
- std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
+ std::vector<std::shared_ptr<message_definition_t> >& can_messages_definition = cms->get_messages_definition();
for(auto& cmd : can_messages_definition)
{
- cmd->set_parent(cms.get());
- std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
+ cmd->set_parent(cms);
+ std::vector<std::shared_ptr<signal_t> >& can_signals = cmd->get_signals();
for(auto& sig: can_signals)
{
- sig->set_parent(cmd.get());
+ sig->set_parent(cmd);
}
}
diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp
index a85b5184..5e0a6537 100644
--- a/low-can-binding/binding/application.cpp
+++ b/low-can-binding/binding/application.cpp
@@ -52,24 +52,24 @@ uint8_t application_t::get_active_message_set() const
return active_message_set_;
}
-std::vector<std::shared_ptr<can_message_set_t> > application_t::get_can_message_set()
+std::vector<std::shared_ptr<message_set_t> > application_t::get_message_set()
{
- return can_message_set_;
+ return message_set_;
}
-std::vector<std::shared_ptr<can_signal_t> > application_t::get_all_can_signals()
+std::vector<std::shared_ptr<signal_t> > application_t::get_all_signals()
{
- return can_message_set_[active_message_set_]->get_all_can_signals();
+ return message_set_[active_message_set_]->get_all_signals();
}
-std::vector<std::shared_ptr<diagnostic_message_t> >& application_t::get_diagnostic_messages()
+std::vector<std::shared_ptr<diagnostic_message_t> > application_t::get_diagnostic_messages()
{
- return can_message_set_[active_message_set_]->get_diagnostic_messages();
+ return message_set_[active_message_set_]->get_diagnostic_messages();
}
-std::vector<std::shared_ptr<can_message_definition_t> >& application_t::get_can_message_definition()
+std::vector<std::shared_ptr<message_definition_t>> application_t::get_messages_definition()
{
- return can_message_set_[active_message_set_]->get_can_message_definition();
+ return message_set_[active_message_set_]->get_messages_definition();
}
uint32_t application_t::get_signal_id(diagnostic_message_t& sig) const
@@ -77,7 +77,7 @@ uint32_t application_t::get_signal_id(diagnostic_message_t& sig) const
return sig.get_pid();
}
-uint32_t application_t::get_signal_id(can_signal_t& sig) const
+uint32_t application_t::get_signal_id(signal_t& sig) const
{
return sig.get_message()->get_id();
}
@@ -95,12 +95,12 @@ bool application_t::isEngineOn()
bool engine_on = false;
uint64_t last_timestamp_in_s;
- if(sf.can_signals.size() == 1)
+ if(sf.signals.size() == 1)
{
- last_timestamp_in_s = sf.can_signals.front()->get_last_value_with_timestamp().second
+ last_timestamp_in_s = sf.signals.front()->get_last_value_with_timestamp().second
/ MICROSECONDS_IN_SECOND;
- if(sf.can_signals.front()->get_last_value_with_timestamp().first > 0 &&
+ if(sf.signals.front()->get_last_value_with_timestamp().first > 0 &&
std::difftime(std::time(nullptr), last_timestamp_in_s) < ENGINE_VALUE_TIMEOUT)
{
engine_on = true;
diff --git a/low-can-binding/binding/application.hpp b/low-can-binding/binding/application.hpp
index e017685b..f56900a7 100644
--- a/low-can-binding/binding/application.hpp
+++ b/low-can-binding/binding/application.hpp
@@ -23,8 +23,8 @@
#include <memory>
#include "../can/can-bus.hpp"
-#include "../can/can-message-set.hpp"
-#include "../can/can-signals.hpp"
+#include "../can/message-set.hpp"
+#include "../can/signals.hpp"
#include "../diagnostic/diagnostic-manager.hpp"
///
@@ -45,7 +45,7 @@ class application_t
diagnostic_manager_t diagnostic_manager_; ///< Diagnostic manager use to manage diagnostic message communication.
uint8_t active_message_set_ = 0; ///< Which is the active message set ? Default to 0.
- std::vector<std::shared_ptr<can_message_set_t> > can_message_set_; ///< Vector holding all message set from JSON signals description file
+ std::vector<std::shared_ptr<message_set_t> > message_set_; ///< Vector holding all message set from JSON signals description file
std::map<std::string, std::shared_ptr<low_can_subscription_t> > can_devices_; ///< Map containing all independant opened CAN sockets, key is the socket int value.
@@ -64,19 +64,19 @@ class application_t
uint8_t get_active_message_set() const;
- std::vector<std::shared_ptr<can_message_set_t> > get_can_message_set();
+ std::vector<std::shared_ptr<message_set_t> > get_message_set();
- std::vector<std::shared_ptr<can_signal_t> > get_all_can_signals();
+ std::vector<std::shared_ptr<signal_t> > get_all_signals();
- std::vector<std::shared_ptr<diagnostic_message_t> >& get_diagnostic_messages();
+ std::vector<std::shared_ptr<diagnostic_message_t> > get_diagnostic_messages();
const std::vector<std::string>& get_signals_prefix() const;
- std::vector<std::shared_ptr<can_message_definition_t> >& get_can_message_definition();
+ std::vector<std::shared_ptr<message_definition_t> > get_messages_definition();
uint32_t get_signal_id(diagnostic_message_t& sig) const;
- uint32_t get_signal_id(can_signal_t& sig) const;
+ uint32_t get_signal_id(signal_t& sig) const;
bool isEngineOn();
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 9515424a..8edd1daa 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -31,7 +31,7 @@
#include "application.hpp"
#include "../can/can-encoder.hpp"
#include "../can/can-bus.hpp"
-#include "../can/can-signals.hpp"
+#include "../can/signals.hpp"
#include "../can/message/message.hpp"
#include "../utils/signals.hpp"
#include "../diagnostic/diagnostic-message.hpp"
@@ -241,14 +241,14 @@ static int subscribe_unsubscribe_diagnostic_messages(afb_req_t request,
return rets;
}
-static int subscribe_unsubscribe_can_signals(afb_req_t request,
+static int subscribe_unsubscribe_signals(afb_req_t request,
bool subscribe,
- std::vector<std::shared_ptr<can_signal_t> > can_signals,
+ std::vector<std::shared_ptr<signal_t> > signals,
struct event_filter_t& event_filter,
std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
{
int rets = 0;
- for(const auto& sig: can_signals)
+ for(const auto& sig: signals)
{
auto it = std::find_if(s.begin(), s.end(), [&sig, &event_filter](std::pair<int, std::shared_ptr<low_can_subscription_t> > sub){ return sub.second->is_signal_subscription_corresponding(sig, event_filter) ; });
std::shared_ptr<low_can_subscription_t> can_subscription;
@@ -277,7 +277,7 @@ static int subscribe_unsubscribe_can_signals(afb_req_t request,
///
/// @param[in] afb_req request : contains original request use to subscribe or unsubscribe
/// @param[in] subscribe boolean value, which chooses between a subscription operation or an unsubscription
-/// @param[in] signals - struct containing vectors with can_signal_t and diagnostic_messages to subscribe
+/// @param[in] signals - struct containing vectors with signal_t and diagnostic_messages to subscribe
///
/// @return Number of correctly subscribed signal
///
@@ -293,7 +293,7 @@ static int subscribe_unsubscribe_signals(afb_req_t request,
std::map<int, std::shared_ptr<low_can_subscription_t> >& s = sm.get_subscribed_signals();
rets += subscribe_unsubscribe_diagnostic_messages(request, subscribe, signals.diagnostic_messages, event_filter, s, false);
- rets += subscribe_unsubscribe_can_signals(request, subscribe, signals.can_signals, event_filter, s);
+ rets += subscribe_unsubscribe_signals(request, subscribe, signals.signals, event_filter, s);
return rets;
}
@@ -325,7 +325,7 @@ static int one_subscribe_unsubscribe(afb_req_t request,
// subscribe or unsubscribe
openxc_DynamicField search_key = build_DynamicField(tag);
sf = utils::signals_manager_t::instance().find_signals(search_key);
- if (sf.can_signals.empty() && sf.diagnostic_messages.empty())
+ if (sf.signals.empty() && sf.diagnostic_messages.empty())
{
AFB_NOTICE("No signal(s) found for %s.", tag.c_str());
ret = -1;
@@ -466,13 +466,13 @@ static void write_signal(afb_req_t request, const std::string& name, json_object
sf = utils::signals_manager_t::instance().find_signals(search_key);
openxc_DynamicField dynafield_value = build_DynamicField(json_value);
- if (sf.can_signals.empty())
+ if (sf.signals.empty())
{
afb_req_fail_f(request, "No signal(s) found for %s. Message not sent.", name.c_str());
return;
}
- std::shared_ptr<can_signal_t>& sig = sf.can_signals[0];
+ std::shared_ptr<signal_t>& sig = sf.signals[0];
if(! sig->get_writable())
{
afb_req_fail_f(request, "%s isn't writable. Message not sent.", sig->get_name().c_str());
@@ -521,13 +521,13 @@ static struct json_object *get_signals_value(const std::string& name)
openxc_DynamicField search_key = build_DynamicField(name);
sf = utils::signals_manager_t::instance().find_signals(search_key);
- if (sf.can_signals.empty())
+ if (sf.signals.empty())
{
AFB_WARNING("No signal(s) found for %s.", name.c_str());
return NULL;
}
ans = json_object_new_array();
- for(const auto& sig: sf.can_signals)
+ for(const auto& sig: sf.signals)
{
struct json_object *jobj = json_object_new_object();
json_object_object_add(jobj, "event", json_object_new_string(sig->get_name().c_str()));
@@ -575,13 +575,13 @@ static struct json_object *list_can_message(const std::string& name)
openxc_DynamicField search_key = build_DynamicField(name);
sf = utils::signals_manager_t::instance().find_signals(search_key);
- if (sf.can_signals.empty() && sf.diagnostic_messages.empty())
+ if (sf.signals.empty() && sf.diagnostic_messages.empty())
{
AFB_WARNING("No signal(s) found for %s.", name.c_str());
return NULL;
}
ans = json_object_new_array();
- for(const auto& sig: sf.can_signals)
+ for(const auto& sig: sf.signals)
{
json_object_array_add(ans,
json_object_new_string(sig->get_name().c_str()));
@@ -646,7 +646,7 @@ int init_binding(afb_api_t api)
openxc_DynamicField search_key = build_DynamicField("diagnostic_messages.engine.speed");
struct utils::signals_found sf = utils::signals_manager_t::instance().find_signals(search_key);
- if(sf.can_signals.empty() && sf.diagnostic_messages.size() == 1)
+ if(sf.signals.empty() && sf.diagnostic_messages.size() == 1)
{
afb_req_t request = nullptr;
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index 27f4ebba..8e4429f5 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -59,7 +59,7 @@ low_can_subscription_t::~low_can_subscription_t()
low_can_subscription_t::operator bool() const
{
- return ((can_signal_ != nullptr || ! diagnostic_message_.empty()) && ! socket_);
+ return ((signal_ != nullptr || ! diagnostic_message_.empty()) && ! socket_);
}
afb_event_t low_can_subscription_t::get_event()
{
@@ -118,14 +118,14 @@ int low_can_subscription_t::get_index() const
return index_;
}
-const std::shared_ptr<can_signal_t> low_can_subscription_t::get_can_signal() const
+const std::shared_ptr<signal_t> low_can_subscription_t::get_signal() const
{
- return can_signal_;
+ return signal_;
}
-bool low_can_subscription_t::is_signal_subscription_corresponding(const std::shared_ptr<can_signal_t> can_signal, const struct event_filter_t& event_filter) const
+bool low_can_subscription_t::is_signal_subscription_corresponding(const std::shared_ptr<signal_t> signal, const struct event_filter_t& event_filter) const
{
- return can_signal_ == can_signal && event_filter_ == event_filter;
+ return signal_ == signal && event_filter_ == event_filter;
}
const std::vector<std::shared_ptr<diagnostic_message_t> > low_can_subscription_t::get_diagnostic_message() const
@@ -169,8 +169,8 @@ const std::shared_ptr<diagnostic_message_t> low_can_subscription_t::get_diagnost
/// or no CAN signal subscribed
const std::string low_can_subscription_t::get_name() const
{
- if (can_signal_ != nullptr)
- return can_signal_->get_name();
+ if (signal_ != nullptr)
+ return signal_->get_name();
else if (!diagnostic_message_.empty())
return "diagnostic_messages";
@@ -233,8 +233,8 @@ int low_can_subscription_t::open_socket(const std::string& bus_name)
int ret = 0;
if(! socket_)
{
- if( can_signal_ != nullptr)
- {ret = socket_->open(can_signal_->get_message()->get_bus_device_name());}
+ if( signal_ != nullptr)
+ {ret = socket_->open(signal_->get_message()->get_bus_device_name());}
else if (! diagnostic_message_ .empty())
{ret = socket_->open(application_t::instance().get_diagnostic_manager().get_bus_device_name());}
else if ( ! bus_name.empty())
@@ -284,9 +284,9 @@ void low_can_subscription_t::add_one_bcm_frame(struct canfd_frame& cfd, struct b
}
#ifdef USE_FEATURE_J1939
-int low_can_subscription_t::create_rx_filter_j1939(low_can_subscription_t &subscription, std::shared_ptr<can_signal_t> sig)
+int low_can_subscription_t::create_rx_filter_j1939(low_can_subscription_t &subscription, std::shared_ptr<signal_t> sig)
{
- subscription.can_signal_= sig;
+ subscription.signal_= sig;
// Make sure that socket is opened.
if(subscription.open_socket() < 0)
@@ -301,13 +301,13 @@ int low_can_subscription_t::create_rx_filter_j1939(low_can_subscription_t &subsc
/// subscription
///
/// @return 0 if ok else -1
-int low_can_subscription_t::create_rx_filter_can(low_can_subscription_t &subscription, std::shared_ptr<can_signal_t> sig)
+int low_can_subscription_t::create_rx_filter_can(low_can_subscription_t &subscription, std::shared_ptr<signal_t> sig)
{
uint32_t flags;
float val;
struct timeval freq, timeout = {0, 0};
struct canfd_frame cfd;
- subscription.can_signal_= sig;
+ subscription.signal_= sig;
if (sig->get_message()->is_fd())
{
@@ -319,26 +319,26 @@ int low_can_subscription_t::create_rx_filter_can(low_can_subscription_t &subscri
flags = SETTIMER|RX_NO_AUTOTIMER;
cfd.len = CAN_MAX_DLEN;
}
- val = (float)(1 << subscription.can_signal_->get_bit_size()) - 1;
+ val = (float)(1 << subscription.signal_->get_bit_size()) - 1;
if(! bitfield_encode_float(val,
- subscription.can_signal_->get_bit_position(),
- subscription.can_signal_->get_bit_size(),
+ subscription.signal_->get_bit_position(),
+ subscription.signal_->get_bit_size(),
1,
- subscription.can_signal_->get_offset(),
+ subscription.signal_->get_offset(),
cfd.data,
cfd.len))
return -1;
- frequency_clock_t f = subscription.event_filter_.frequency == 0 ? subscription.can_signal_->get_frequency() : frequency_clock_t(subscription.event_filter_.frequency);
+ frequency_clock_t f = subscription.event_filter_.frequency == 0 ? subscription.signal_->get_frequency() : frequency_clock_t(subscription.event_filter_.frequency);
freq = f.get_timeval_from_period();
- struct bcm_msg bcm_msg = subscription.make_bcm_head(RX_SETUP, subscription.can_signal_->get_message()->get_id(), flags, timeout, freq);
+ struct bcm_msg bcm_msg = subscription.make_bcm_head(RX_SETUP, subscription.signal_->get_message()->get_id(), flags, timeout, freq);
subscription.add_one_bcm_frame(cfd, bcm_msg);
return create_rx_filter_bcm(subscription, bcm_msg);
}
-int low_can_subscription_t::create_rx_filter(std::shared_ptr<can_signal_t> sig)
+int low_can_subscription_t::create_rx_filter(std::shared_ptr<signal_t> sig)
{
#ifdef USE_FEATURE_J1939
if(sig->get_message()->is_j1939())
diff --git a/low-can-binding/binding/low-can-subscription.hpp b/low-can-binding/binding/low-can-subscription.hpp
index c9cd2e3f..01264ff4 100644
--- a/low-can-binding/binding/low-can-subscription.hpp
+++ b/low-can-binding/binding/low-can-subscription.hpp
@@ -21,7 +21,7 @@
#include <cmath>
#include <utility>
-#include "../can/can-signals.hpp"
+#include "../can/signals.hpp"
#include "../diagnostic/diagnostic-message.hpp"
#include "../utils/socketcan-bcm.hpp"
@@ -51,7 +51,7 @@ private:
afb_event_t event_; ///< event_ - application framework event used to push on client
/// Signal part
- std::shared_ptr<can_signal_t> can_signal_; ///< can_signal_ - the CAN signal subscribed
+ std::shared_ptr<signal_t> signal_; ///< signal_ - the CAN signal subscribed
std::vector<std::shared_ptr<diagnostic_message_t> > diagnostic_message_; ///< diagnostic_message_ - diagnostic messages meant to receive OBD2
/// responses. Normal diagnostic request and response are not tested for now.
std::shared_ptr<utils::socketcan_t> socket_; ///< socket_ - socket_ that receives CAN messages.
@@ -73,8 +73,8 @@ public:
int unsubscribe(afb_req_t request);
int get_index() const;
- const std::shared_ptr<can_signal_t> get_can_signal() const;
- bool is_signal_subscription_corresponding(const std::shared_ptr<can_signal_t>, const struct event_filter_t& event_filter) const;
+ const std::shared_ptr<signal_t> get_signal() const;
+ bool is_signal_subscription_corresponding(const std::shared_ptr<signal_t>, const struct event_filter_t& event_filter) const;
const std::shared_ptr<diagnostic_message_t> get_diagnostic_message(uint32_t pid) const;
const std::vector<std::shared_ptr<diagnostic_message_t> > get_diagnostic_message() const;
const std::shared_ptr<diagnostic_message_t> get_diagnostic_message(const std::string& name) const;
@@ -94,10 +94,10 @@ public:
int open_socket(const std::string& bus_name = "");
- int create_rx_filter(std::shared_ptr<can_signal_t> sig);
+ int create_rx_filter(std::shared_ptr<signal_t> sig);
int create_rx_filter(std::shared_ptr<diagnostic_message_t> sig);
- static int create_rx_filter_can(low_can_subscription_t &subscription, std::shared_ptr<can_signal_t> sig);
- static int create_rx_filter_j1939(low_can_subscription_t &subscription, std::shared_ptr<can_signal_t> sig);
+ static int create_rx_filter_can(low_can_subscription_t &subscription, std::shared_ptr<signal_t> sig);
+ static int create_rx_filter_j1939(low_can_subscription_t &subscription, std::shared_ptr<signal_t> sig);
static int create_rx_filter_bcm(low_can_subscription_t &subscription, struct bcm_msg& bcm_msg);
static int tx_send(low_can_subscription_t &subscription, struct canfd_frame& cfd, const std::string& bus_name);