X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=low-can-binding%2Fbinding%2Flow-can-subscription.cpp;fp=low-can-binding%2Fbinding%2Flow-can-subscription.cpp;h=4bdf3181a0380948ba383a7836b49ad6c7797a6d;hb=43cc23cd9d0986ae370f5839aa952c6e3eb196d0;hp=3cbcb6c93de25c25f7b8f4f8521baf77a09cf93a;hpb=c57722b34d38c9843a728829204d2711aaadacbb;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp index 3cbcb6c9..4bdf3181 100644 --- a/low-can-binding/binding/low-can-subscription.cpp +++ b/low-can-binding/binding/low-can-subscription.cpp @@ -254,6 +254,11 @@ float low_can_subscription_t::get_max() const return event_filter_.max; } +bool low_can_subscription_t::get_promisc() const +{ + return event_filter_.promisc; +} + /** * @brief Getter of the rx_id of the event_filter * @@ -314,6 +319,11 @@ void low_can_subscription_t::set_max(float max) event_filter_.max = max; } +void low_can_subscription_t::set_promisc(bool promisc) +{ + event_filter_.promisc = promisc; +} + /** * @brief Setter for the rx_id of the event_filter * @@ -409,30 +419,32 @@ int low_can_subscription_t::open_socket(low_can_subscription_t &subscription, co else if(flags & J1939_ADDR_CLAIM_PROTOCOL) { pgn_t pgn = J1939_NO_PGN; + std::shared_ptr socket = std::make_shared(); if(!bus_name.empty()) { - std::shared_ptr socket = std::make_shared(); ret = socket->open(bus_name, pgn); - subscription.socket_ = socket; } + subscription.socket_ = socket; subscription.index_ = (int)subscription.socket_->socket(); } else if(flags & J1939_PROTOCOL) { pgn_t pgn = J1939_NO_PGN; + std::shared_ptr socket = std::make_shared(); if(subscription.signal_) { pgn = subscription.signal_->get_message()->get_id(); - std::shared_ptr socket = std::make_shared(); ret = socket->open(subscription.signal_->get_message()->get_bus_device_name(), pgn); - subscription.socket_ = socket; } else if(!bus_name.empty()) { - std::shared_ptr socket = std::make_shared(); ret = socket->open(bus_name, pgn); - subscription.socket_ = socket; } + + if(ret) + socket->define_opt(!j1939_pgn_is_pdu1(pgn),subscription.event_filter_.promisc); + + subscription.socket_ = socket; subscription.index_ = (int)subscription.socket_->socket(); } #endif