Code Review
/
apps
/
agl-service-can-low-level.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implement a new socket type CAN for j1939 protocol
[apps/agl-service-can-low-level.git]
/
low-can-binding
/
binding
/
low-can-cb.cpp
diff --git
a/low-can-binding/binding/low-can-cb.cpp
b/low-can-binding/binding/low-can-cb.cpp
index
daeb5a0
..
750baef
100644
(file)
--- 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)
{
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();
utils::socketcan_bcm_t& s = can_subscription->get_socket();
-
s >> cm
;
+
cm = s.read_message()
;
// Sure we got a valid CAN 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
}
// check if error or hangup
@@
-263,7
+263,7
@@
static int subscribe_unsubscribe_can_signals(afb_req_t request,
{return -1;}
rets++;
{return -1;}
rets++;
- AFB_DEBUG("
signal: %s subscribed", sig->get_name().c_str()
);
+ AFB_DEBUG("
%s Signal: %s %ssubscribed", sig->get_message()->is_fd() ? "FD": "", sig->get_name().c_str(), subscribe ? "":"un"
);
}
return rets;
}
}
return rets;
}