-/*
- * TBF TBF TBF
- * called on an event on the CAN bus
- */
-static int on_event(sd_event_source *s, int fd, uint32_t revents, void *userdata)
-{
- openxc_CanMessage can_message;
-
- can_message = openxc_CanMessage_init_default;
-
- /* read available data */
- if ((revents & EPOLLIN) != 0)
- {
- read_can(&can_message);
- send_event();
- }
-
- /* check if error or hangup */
- if ((revents & (EPOLLERR|EPOLLRDHUP|EPOLLHUP)) != 0)
- {
- sd_event_source_unref(s);
- close(fd);
- connect_to_event_loop();
- }
-
- return 0;
-}
-
-/*
- * USELESS SINCE THREADS SEPARATION
- *
- * Get the event loop running.
- * Will trigger on_event function on EPOLLIN event on socket
- *
- * Return 0 or positive value on success. Else negative value for failure.
-static int connect_to_event_loop(CanBus &CanBus_handler)
-{
- sd_event *event_loop;
- sd_event_source *source;
- int rc;
-
- if (CanBus_handler.socket < 0)
- {
- return CanBus_handler.socket;
- }
-
- event_loop = afb_daemon_get_event_loop(interface->daemon);
- rc = sd_event_add_io(event_loop, &source, CanBus_handler.socket, EPOLLIN, on_event, NULL);
- if (rc < 0)
- {
- CanBus_handler.close();
- ERROR(interface, "Can't connect CAN bus %s to the event loop", CanBus_handler.device);
- } else
- {
- NOTICE(interface, "Connected CAN bus %s to the event loop", CanBus_handler.device);
- }
-
- return rc;
-}
- */
-