summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-11-20 19:46:00 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-11-22 11:10:26 +0100
commit3275f391bbf331643e7dec536008d9d64872f21f (patch)
treedf487fe0759936b38f9f9b391db4b9161c84f7a0 /low-can-binding/binding
parent2daa033bd69b9ede497afa4355a5fdbb119895eb (diff)
Handle several can_frame in a BCM message
Also clean an unused function Change-Id: I4faabf5a1af53da898ee70f2bc4b528acea3ded3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding')
-rw-r--r--low-can-binding/binding/low-can-socket.cpp32
-rw-r--r--low-can-binding/binding/low-can-socket.hpp1
2 files changed, 2 insertions, 31 deletions
diff --git a/low-can-binding/binding/low-can-socket.cpp b/low-can-binding/binding/low-can-socket.cpp
index 0aebfa3c..db9b164b 100644
--- a/low-can-binding/binding/low-can-socket.cpp
+++ b/low-can-binding/binding/low-can-socket.cpp
@@ -208,15 +208,8 @@ struct utils::simple_bcm_msg low_can_socket_t::make_bcm_head(uint32_t opcode, ui
/// a multiplexed message with several can_frame.
void low_can_socket_t::add_bcm_frame(const struct can_frame& cf, struct utils::simple_bcm_msg& bcm_msg) const
{
- for(int i=0; i < CAN_MAX_DLEN; i++)
- {
- if(cf.data[i] != 0)
- {
- bcm_msg.msg_head.nframes = 1;
- bcm_msg.frames = cf;
- return;
- }
- }
+ bcm_msg.msg_head.nframes++;
+ bcm_msg.frames = cf;
}
/// @brief Create a RX_SETUP receive job to be used by the BCM socket for a CAN signal
@@ -305,27 +298,6 @@ int low_can_socket_t::create_rx_filter(utils::simple_bcm_msg& bcm_msg)
/// @brief Creates a TX_SEND job that is used by the BCM socket to
/// send a message
///
-/// @return 0 if ok, else -1
-int low_can_socket_t::tx_send(const struct can_frame& cf, std::shared_ptr<can_signal_t> sig)
-{
- can_signal_ = sig;
-
- utils::simple_bcm_msg bcm_msg = make_bcm_head(TX_SEND);
- add_bcm_frame(cf, bcm_msg);
-
- if(open_socket() < 0)
- {return -1;}
-
- socket_ << bcm_msg;
- if(! socket_)
- return -1;
-
- return 0;
-}
-
-/// @brief Creates a TX_SEND job that is used by the BCM socket to
-/// send a message
-///
/// @return 0 if ok else -1
int low_can_socket_t::tx_send(const struct can_frame& cf, const std::string& bus_name)
{
diff --git a/low-can-binding/binding/low-can-socket.hpp b/low-can-binding/binding/low-can-socket.hpp
index 00f6825a..48ed47f9 100644
--- a/low-can-binding/binding/low-can-socket.hpp
+++ b/low-can-binding/binding/low-can-socket.hpp
@@ -90,6 +90,5 @@ public:
int create_rx_filter(std::shared_ptr<diagnostic_message_t> sig);
int create_rx_filter(utils::simple_bcm_msg& bcm_msg);
- int tx_send(const struct can_frame& cf, std::shared_ptr<can_signal_t> sig);
int tx_send(const struct can_frame& cf, const std::string& bus_name);
};