aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-subscription.cpp
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/low-can-subscription.cpp
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/low-can-subscription.cpp')
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp40
1 files changed, 20 insertions, 20 deletions
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())