+/**
+ * @brief Set the event calling the afb_daemon_make_event function to
+ * create it and the checks its validity.
+ *
+ * @return int - 0 if OK, -1 if not
+ */
+int low_can_subscription_t::set_event()
+{
+ std::string event_name = get_name();
+ event_ = afb_daemon_make_event(event_name.c_str());
+ if (! afb_event_is_valid(event_))
+ {
+ AFB_ERROR("Can't create an event for %s, something goes wrong.", event_name.c_str());
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * @brief Subscribe to the event member of the object
+ *
+ * @param request the subscribe AFB client request which want to
+ * subscribe
+ *
+ * @return int - 0 if OK, -1 if not
+ */
+int low_can_subscription_t::subscribe(afb_req_t request)
+{
+ if(set_event() < 0)
+ return -1;
+ return afb_req_subscribe(request, event_);
+}
+
+/**
+ * @brief Unsubscribe to the event member of the object
+ *
+ * @param request the unsubscribe AFB client request which want to
+ * unsubscribe
+ *
+ * @return int - 0 if OK, -1 if not
+ */
+int low_can_subscription_t::unsubscribe(afb_req_t request)
+{
+ return afb_req_unsubscribe(request, event_);
+}
+