}
}
+static int api_dbus_service_start(struct api_dbus *api, int share_session, int onneed)
+{
+ /* not an error when onneed */
+ if (onneed != 0)
+ return 0;
+
+ /* already started: it is an error */
+ ERROR("The Dbus binding %s is not a startable service", api->name);
+ return -1;
+}
+
/* receives events */
static int api_dbus_client_on_event(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
{
/* record it as an API */
afb_api.closure = api;
afb_api.call = (void*)api_dbus_client_call;
+ afb_api.service_start = (void*)api_dbus_service_start;
if (afb_apis_add(api->api, afb_api) < 0)
goto error2;
return 1;
}
-static void afb_api_dbus_server_send_event(struct api_dbus *api, const char *event, struct json_object *object)
+static void afb_api_dbus_server_send_event(struct api_dbus *api, const char *event, int eventid, struct json_object *object)
{
int rc;
json_object_put(object);
}
+/* the interface for events */
+static const struct afb_evt_itf evt_itf = {
+ .broadcast = (void*)afb_api_dbus_server_send_event,
+ .push = (void*)afb_api_dbus_server_send_event
+};
+
/* create the service */
int afb_api_dbus_add_server(const char *path)
{
}
INFO("afb service over dbus installed, name %s, path %s", api->name, api->path);
- api->listener = afb_evt_listener_create((void*)afb_api_dbus_server_send_event, api);
+ api->listener = afb_evt_listener_create(&evt_itf, api);
return 0;
error3: