summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding
diff options
context:
space:
mode:
authorArthur Guyader <arthur.guyader@iot.bzh>2019-05-24 12:16:28 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-06-26 17:55:05 +0200
commita6fb72a70f90c35e0968f2460d324a8505410562 (patch)
tree6f975e72a72585563c2bb7c4a279db7f26626b40 /low-can-binding/binding
parent2eda264a201385f5073362207b7de84bf71f9ec1 (diff)
Implement a new socket type CAN for j1939 protocol
This commit implements a new socket class for the j1939 protocol and prepares the bases classes by modifying the write and read methods. Bug-AGL: SPEC-2386 Change-Id: I16ba493418a4bb37a0262b61a2a2629be6ab5051 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/low-can-cb.cpp8
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index f200b192..750baeff 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -85,13 +85,13 @@ int read_message(sd_event_source *event_source, int fd, uint32_t revents, void *
low_can_subscription_t* can_subscription = (low_can_subscription_t*)userdata;
if ((revents & EPOLLIN) != 0)
{
- can_message_t cm;
+ std::shared_ptr<can_message_t> cm;
utils::socketcan_bcm_t& s = can_subscription->get_socket();
- s >> cm;
+ cm = s.read_message();
// Sure we got a valid CAN message ?
- if(! cm.get_id() == 0 && ! cm.get_length() == 0)
- {push_n_notify(cm);}
+ if(! cm->get_id() == 0 && ! cm->get_length() == 0)
+ {push_n_notify(*cm);}
}
// check if error or hangup
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index fe1ede81..d8149b64 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -337,7 +337,7 @@ int low_can_subscription_t::create_rx_filter(utils::bcm_msg& bcm_msg)
// else monitor all standard 8 CAN OBD2 ID response.
if(bcm_msg.msg_head.can_id != OBD2_FUNCTIONAL_BROADCAST_ID)
{
- socket_ << bcm_msg;
+ socket_.write_message(bcm_msg);
if(! socket_)
return -1;
}
@@ -347,7 +347,7 @@ int low_can_subscription_t::create_rx_filter(utils::bcm_msg& bcm_msg)
{
bcm_msg.msg_head.can_id = OBD2_FUNCTIONAL_RESPONSE_START + i;
- socket_ << bcm_msg;
+ socket_.write_message(bcm_msg);
if(! socket_)
return -1;
}
@@ -384,7 +384,7 @@ int low_can_subscription_t::tx_send(struct canfd_frame& cfd, const std::string&
if(open_socket(bus_name) < 0)
{return -1;}
- socket_ << bcm_msg;
+ socket_.write_message(bcm_msg);
if(! socket_)
return -1;