-static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, const CanSignal& sig)
+static int make_subscription_unsubscription(struct afb_req request, const std::string& sig_name, std::map<std::string, struct afb_event>& s, bool subscribe)
+{
+ /* Make the subscription or unsubscription to the event */
+ if (((subscribe ? afb_req_subscribe : afb_req_unsubscribe)(request, s[sig_name.c_str()])) < 0)
+ {
+ ERROR(binder_interface, "Operation goes wrong for signal: %s", sig_name);
+ return 0;
+ }
+ return 1;
+
+}
+
+static int create_event_handle(const std::string& sig_name, std::map<std::string, struct afb_event>& s)
+{
+ s[sig_name] = afb_daemon_make_event(binder_interface->daemon, sig_name.c_str());
+ if (!afb_event_is_valid(s[sig_name]))
+ {
+ ERROR(binder_interface, "Can't create an event, something goes wrong.");
+ return 0;
+ }
+ return 1;
+}
+
+static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, const std::string& sig)