#include "can-utils.hpp"
-
/********************************************************************************
*
* CanMessage method implementation
*/
void can_bus_dev_t::start_reading()
{
- th_reading_ = std::thread(can_reader, this);
+ th_reading_ = std::thread(can_reader, *this);
is_running_ = true;
}
*/
int can_bus_dev_t::send_can_message(can_message_t& can_msg, const struct afb_binding_interface* interface)
{
- size_t nbytes;
+ ssize_t nbytes;
canfd_frame f;
f = can_msg.convert_to_canfd_frame();
*/
void can_bus_t::start_threads()
{
- th_decoding_ = std::thread(can_decoder, this);
- th_pushing_ = std::thread(can_event_push, this);
+ th_decoding_ = std::thread(can_decode_message, *this);
+ th_pushing_ = std::thread(can_event_push, *this);
}
/**
{
std::vector<std::string> ret;
json_object *jo, *canbus;
- int n, i, ok;
+ int n, i;
FILE *fd = fdopen(conf_file_, "r");
if (fd)
else
{
n = json_object_array_length(canbus);
- ok = 0;
for (i = 0 ; i < n ; i++)
- ret.push_back(json_object_get_string(json_object_array_get_idx(canbus, i)));
+ ret.push_back(json_object_get_string(json_object_array_get_idx(canbus, i)));
}
return ret;
}
{
int ret;
+ // TODO: lock the subscribed_signals when insert/remove
const auto& ss_i = subscribed_signals.find(sig.genericName);
if (ss_i != subscribed_signals.end())
{
static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, const std::vector<CanSignal>& signals)
{
- int ret;
+ int ret = 0;
- // TODO: lock the subscribed_signals when insert/remove
for(const auto& signal_i : signals)
{
ret = subscribe_unsubscribe_signal(request, subscribe, signal_i);
if(ret == 0)
return ret;
}
+ return ret;
}
static int subscribe_unsubscribe_all(struct afb_req request, bool subscribe)