summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/binding')
-rw-r--r--low-can-binding/binding/application.cpp8
-rw-r--r--low-can-binding/binding/application.hpp4
-rw-r--r--low-can-binding/binding/low-can-cb.cpp22
-rw-r--r--low-can-binding/binding/low-can-hat.hpp6
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp2
-rw-r--r--low-can-binding/binding/low-can-subscription.hpp5
6 files changed, 25 insertions, 22 deletions
diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp
index d93bf0cf..d22633f9 100644
--- a/low-can-binding/binding/application.cpp
+++ b/low-can-binding/binding/application.cpp
@@ -57,17 +57,17 @@ std::vector<std::shared_ptr<message_set_t> > application_t::get_message_set()
return message_set_;
}
-std::vector<std::shared_ptr<signal_t> > application_t::get_all_signals()
+vect_ptr_signal_t application_t::get_all_signals()
{
return message_set_[active_message_set_]->get_all_signals();
}
-std::vector<std::shared_ptr<diagnostic_message_t>> application_t::get_diagnostic_messages()
+vect_ptr_diag_msg_t application_t::get_diagnostic_messages()
{
return message_set_[active_message_set_]->get_diagnostic_messages();
}
-std::vector<std::shared_ptr<message_definition_t>> application_t::get_messages_definition()
+vect_ptr_msg_def_t application_t::get_messages_definition()
{
return message_set_[active_message_set_]->get_messages_definition();
}
@@ -76,7 +76,7 @@ std::vector<std::shared_ptr<message_definition_t>> application_t::get_messages_d
std::shared_ptr<message_definition_t> application_t::get_message_definition(uint32_t id)
{
std::shared_ptr<message_definition_t> ret = nullptr;
- std::vector<std::shared_ptr<message_definition_t>> messages_definition = get_messages_definition();
+ vect_ptr_msg_def_t messages_definition = get_messages_definition();
for(std::shared_ptr<message_definition_t> &msg_def : messages_definition)
{
if(msg_def->get_id() == id)
diff --git a/low-can-binding/binding/application.hpp b/low-can-binding/binding/application.hpp
index 5045ddab..47a0e2f1 100644
--- a/low-can-binding/binding/application.hpp
+++ b/low-can-binding/binding/application.hpp
@@ -73,9 +73,9 @@ class application_t
std::vector<std::shared_ptr<message_set_t> > get_message_set();
- std::vector<std::shared_ptr<signal_t> > get_all_signals();
+ vect_ptr_signal_t get_all_signals();
- std::vector<std::shared_ptr<diagnostic_message_t> > get_diagnostic_messages();
+ vect_ptr_diag_msg_t get_diagnostic_messages();
const std::vector<std::string>& get_signals_prefix() const;
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 6c8a1ee0..5879b686 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -47,7 +47,7 @@
///
///*******************************************************************************/
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, map_subscription& s)
{
bool is_permanent_recurring_request = false;
@@ -68,7 +68,7 @@ void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uin
on_no_clients(can_subscription, s);
}
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, map_subscription& s)
{
auto it = s.find(can_subscription->get_index());
s.erase(it);
@@ -132,7 +132,7 @@ int read_message(sd_event_source *event_source, int fd, uint32_t revents, void *
static int subscribe_unsubscribe_signal(afb_req_t request,
bool subscribe,
std::shared_ptr<low_can_subscription_t>& can_subscription,
- std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
+ map_subscription& s)
{
int ret = 0;
int sub_index = can_subscription->get_index();
@@ -194,9 +194,9 @@ static int add_to_event_loop(std::shared_ptr<low_can_subscription_t>& can_subscr
static int subscribe_unsubscribe_diagnostic_messages(afb_req_t request,
bool subscribe,
- std::list<std::shared_ptr<diagnostic_message_t> > diagnostic_messages,
+ list_ptr_diag_msg_t diagnostic_messages,
struct event_filter_t& event_filter,
- std::map<int, std::shared_ptr<low_can_subscription_t> >& s,
+ map_subscription& s,
bool perm_rec_diag_req)
{
int rets = 0;
@@ -259,9 +259,9 @@ static int subscribe_unsubscribe_diagnostic_messages(afb_req_t request,
static int subscribe_unsubscribe_signals(afb_req_t request,
bool subscribe,
- std::list<std::shared_ptr<signal_t> > signals,
+ list_ptr_signal_t signals,
struct event_filter_t& event_filter,
- std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
+ map_subscription& s)
{
int rets = 0;
for(const auto& sig: signals)
@@ -309,7 +309,7 @@ static int subscribe_unsubscribe_signals(afb_req_t request,
utils::signals_manager_t& sm = utils::signals_manager_t::instance();
std::lock_guard<std::mutex> subscribed_signals_lock(sm.get_subscribed_signals_mutex());
- std::map<int, std::shared_ptr<low_can_subscription_t> >& s = sm.get_subscribed_signals();
+ map_subscription& s = sm.get_subscribed_signals();
rets += subscribe_unsubscribe_diagnostic_messages(request, subscribe, signals.diagnostic_messages, event_filter, s, false);
rets += subscribe_unsubscribe_signals(request, subscribe, signals.signals, event_filter, s);
@@ -390,7 +390,7 @@ static int one_subscribe_unsubscribe_id(afb_req_t request, bool subscribe, const
if(message_definition)
{
- sf.signals = std::list<std::shared_ptr<signal_t>>(message_definition->get_signals().begin(),message_definition->get_signals().end());
+ sf.signals = list_ptr_signal_t(message_definition->get_signals().begin(),message_definition->get_signals().end());
}
if(sf.signals.empty())
@@ -956,14 +956,14 @@ int init_binding(afb_api_t api)
struct event_filter_t event_filter;
event_filter.frequency = sf.diagnostic_messages.front()->get_frequency();
- std::map<int, std::shared_ptr<low_can_subscription_t> >& s = sm.get_subscribed_signals();
+ map_subscription& s = sm.get_subscribed_signals();
subscribe_unsubscribe_diagnostic_messages(request, true, sf.diagnostic_messages, event_filter, s, true);
}
#ifdef USE_FEATURE_J1939
- std::vector<std::shared_ptr<message_definition_t>> current_messages_definition = application.get_messages_definition();
+ vect_ptr_msg_def_t current_messages_definition = application.get_messages_definition();
for(std::shared_ptr<message_definition_t> message_definition: current_messages_definition)
{
if(message_definition->is_j1939())
diff --git a/low-can-binding/binding/low-can-hat.hpp b/low-can-binding/binding/low-can-hat.hpp
index 1662ce04..131b61f2 100644
--- a/low-can-binding/binding/low-can-hat.hpp
+++ b/low-can-binding/binding/low-can-hat.hpp
@@ -29,8 +29,10 @@
class low_can_subscription_t;
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
-void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
+typedef std::map<int, std::shared_ptr<low_can_subscription_t>> map_subscription;
+
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, map_subscription& s);
+void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, map_subscription& s);
int read_message(sd_event_source *s, int fd, uint32_t revents, void *userdata);
inline bool caseInsCharCompareN(char a, char b) {
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index 6d02b101..9cc5fcbb 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -139,7 +139,7 @@ bool low_can_subscription_t::is_signal_subscription_corresponding(const std::sha
return signal_ == signal && event_filter_ == event_filter;
}
-const std::vector<std::shared_ptr<diagnostic_message_t> > low_can_subscription_t::get_diagnostic_message() const
+const vect_ptr_diag_msg_t low_can_subscription_t::get_diagnostic_message() const
{
return diagnostic_message_;
}
diff --git a/low-can-binding/binding/low-can-subscription.hpp b/low-can-binding/binding/low-can-subscription.hpp
index 3f2c3acd..5abf8550 100644
--- a/low-can-binding/binding/low-can-subscription.hpp
+++ b/low-can-binding/binding/low-can-subscription.hpp
@@ -44,6 +44,7 @@ struct event_filter_t
}
};
+
/// @brief The object stores socket to CAN to be used to write on it.
/// This is a simple access to a CAN bus device without any subscriptions attached
class low_can_subscription_t
@@ -55,7 +56,7 @@ private:
/// Signal part
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
+ vect_ptr_diag_msg_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.
@@ -79,7 +80,7 @@ public:
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 vect_ptr_diag_msg_t get_diagnostic_message() const;
const std::shared_ptr<diagnostic_message_t> get_diagnostic_message(const std::string& name) const;
const std::string get_name() const;
const std::string get_name(uint32_t pid) const;