X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fafb-service-itf.h;h=081b1db62f056b1892a8efc512035edc6640b4d7;hb=9c1c9a1ba46eb9ddada4167ce9d20143ee3c9636;hp=1218cd5b2a97248c3930e6862f101683e00a05ec;hpb=7059e59cddc1c81321639875636e88895bc14309;p=src%2Fapp-framework-binder.git diff --git a/include/afb/afb-service-itf.h b/include/afb/afb-service-itf.h index 1218cd5b..081b1db6 100644 --- a/include/afb/afb-service-itf.h +++ b/include/afb/afb-service-itf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 "IoT.bzh" + * Copyright (C) 2016, 2017 "IoT.bzh" * Author: José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,23 +20,29 @@ /* avoid inclusion of */ struct json_object; +/* + * Interface for internal of services + * It records the functions to be called for the request. + * Don't use this structure directly. + * Use the helper functions documented below. + */ struct afb_service_itf { - void (*call)(void *closure, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *callback_closure); + /* CAUTION: respect the order, add at the end */ + + void (*call)(void *closure, const char *api, const char *verb, struct json_object *args, + void (*callback)(void*, int, struct json_object*), void *callback_closure); + + int (*call_sync)(void *closure, const char *api, const char *verb, struct json_object *args, + struct json_object **result); }; +/* + * Object that encapsulate accesses to service items + */ struct afb_service { const struct afb_service_itf *itf; void *closure; }; -extern int afbBindingV1ServiceInit(struct afb_service service); - -extern void afbBindingV1ServiceEvent(const char *event, struct json_object *object); - -static inline void afb_service_call(struct afb_service service, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *callback_closure) -{ - service.itf->call(service.closure, api, verb, args, callback, callback_closure); -} -