diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-06-09 16:59:19 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-06-09 16:59:19 +0200 |
commit | 6518887513840471ea9c5af7e534787717e6bd82 (patch) | |
tree | 6aa4d2f8e777f25d318348a91d2c02ca62298b6b /src/afb-api-dbus.c | |
parent | 741d4e0505c588f38a64350c1d3c53c74f7ac22c (diff) |
Make possible to call a method from a binding
The new request call 'afb_req_subcall' allows
a binding to call the method of an other binding.
Change-Id: I8538185be7a1663153a25db2bc940f9e2bdedb1a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-dbus.c')
-rw-r--r-- | src/afb-api-dbus.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index eda7985f..905c723d 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -36,6 +36,7 @@ #include "afb-api-so.h" #include "afb-context.h" #include "afb-evt.h" +#include "afb-subcall.h" #include "verbose.h" static const char DEFAULT_PATH_PREFIX[] = "/org/agl/afb/api/"; @@ -446,6 +447,18 @@ static void dbus_req_send(struct dbus_req *dreq, const char *buffer, size_t size dbus_req_reply(dreq, RETRAW, buffer, ""); } +static int dbus_req_subscribe(struct dbus_req *dreq, struct afb_event event) +{ + return -1; +} + +static int dbus_req_unsubscribe(struct dbus_req *dreq, struct afb_event event) +{ + return -1; +} + +static void dbus_req_subcall(struct dbus_req *dreq, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure); + const struct afb_req_itf afb_api_dbus_req_itf = { .json = (void*)dbus_req_json, .get = (void*)dbus_req_get, @@ -456,9 +469,19 @@ const struct afb_req_itf afb_api_dbus_req_itf = { .context_get = (void*)afb_context_get, .context_set = (void*)afb_context_set, .addref = (void*)dbus_req_addref, - .unref = (void*)dbus_req_unref + .unref = (void*)dbus_req_unref, + .session_close = (void*)afb_context_close, + .session_set_LOA = (void*)afb_context_change_loa, + .subscribe = (void*)dbus_req_subscribe, + .unsubscribe = (void*)dbus_req_unsubscribe, + .subcall = (void*)dbus_req_subcall }; +static void dbus_req_subcall(struct dbus_req *dreq, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure) +{ + afb_subcall(&dreq->context, api, verb, args, callback, closure, (struct afb_req){ .itf = &afb_api_dbus_req_itf, .closure = dreq }); +} + /******************* server part **********************************/ /* called when the object for the service is called */ |