diff options
author | 2017-05-31 12:46:02 +0200 | |
---|---|---|
committer | 2017-06-01 18:22:49 +0200 | |
commit | 1f4eb8c5562bf5c0bc6ebd1b35977cd71d9b3a83 (patch) | |
tree | 0373a64035f894a7b18139306cbf879989d28268 /CAN-binder/low-can-binding/can/can-signals.cpp | |
parent | c28f479a597de89f38b2bbd155afc26c7f2de822 (diff) |
Reworked subscription to integrate filtering.
- Creation of an object which old the subscription context
(filter, signal) : low_can_subscription_t
- Move socket from can_signal_t to this new object.
- Adding a member to can_message_t to transport subscription_id to be able to
retrieve it with all the context through running.
Change-Id: I87be8cd6c3c93a81040357920d8c081a316800c3
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can/can-signals.cpp')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-signals.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp index 324cecc..362e358 100644 --- a/CAN-binder/low-can-binding/can/can-signals.cpp +++ b/CAN-binder/low-can-binding/can/can-signals.cpp @@ -83,12 +83,6 @@ can_signal_t::can_signal_t( , received_{b.received_} , last_value_{b.last_value_} {}*/ - -utils::socketcan_bcm_t can_signal_t::get_socket() const -{ - return socket_; -} - can_message_definition_t* can_signal_t::get_message() const { return parent_; @@ -220,43 +214,3 @@ void can_signal_t::set_timestamp(uint64_t timestamp) frequency_.tick(timestamp); } -/// @brief Create a RX_SETUP receive job used by the BCM socket. -/// -/// @return 0 if ok else -1 -int can_signal_t::create_rx_filter() -{ - // Make sure that socket has been opened. - if(! socket_) - socket_.open( - get_message()->get_bus_device_name()); - - uint32_t can_id = get_message()->get_id(); - - struct utils::simple_bcm_msg bcm_msg; - struct can_frame cfd; - - memset(&cfd, 0, sizeof(cfd)); - memset(&bcm_msg.msg_head, 0, sizeof(bcm_msg.msg_head)); - float val = (float)(1 << bit_size_)-1; - struct timeval freq = frequency_.get_timeval_from_period(); - - bcm_msg.msg_head.opcode = RX_SETUP; - bcm_msg.msg_head.can_id = can_id; - bcm_msg.msg_head.flags = SETTIMER|RX_NO_AUTOTIMER; - bcm_msg.msg_head.ival2.tv_sec = freq.tv_sec ; - bcm_msg.msg_head.ival2.tv_usec = freq.tv_usec; - bcm_msg.msg_head.nframes = 1; - bitfield_encode_float(val, - bit_position_, - bit_size_, - factor_, - offset_, - cfd.data, - CAN_MAX_DLEN); - - bcm_msg.frames = cfd; - - if(socket_ << bcm_msg) - return 0; - return -1; -} |