X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fc%2B%2B%2Fbinding-wrap.hpp;h=c65c4c7f3e2f2a7484c0a37103b0de37c194226b;hb=8506a0dc4974703982732da57f06d96e335195d2;hp=d7707df70f22e99d2a065ebfec89fd8756b3fe68;hpb=5d7c5d44c4a709016ddc0946c9e36412d8c5af29;p=src%2Fapp-framework-binder.git diff --git a/include/afb/c++/binding-wrap.hpp b/include/afb/c++/binding-wrap.hpp index d7707df7..c65c4c7f 100644 --- a/include/afb/c++/binding-wrap.hpp +++ b/include/afb/c++/binding-wrap.hpp @@ -460,7 +460,7 @@ inline void call(const char *api, const char *verb, struct json_object *args, vo template inline void call(const char *api, const char *verb, struct json_object *args, void (*callback)(T*closure, struct json_object *result, const char *error, const char *info, afb_api_t api), T *closure) { - afb_service_call(api, verb, args, reinterpret_cast(callback), reinterpret_cast(closure)); + afb_service_call(api, verb, args, reinterpret_cast(callback), reinterpret_cast(closure)); } inline bool callsync(const char *api, const char *verb, struct json_object *args, struct json_object *&result, char *&error, char *&info) @@ -571,6 +571,37 @@ constexpr afb_verb_t verb( return r; } +void __attribute__((weak)) __afb__verb__cb__for__global__(afb_req_t r) +{ + void *vcbdata; + void (*callback)(req); + + vcbdata = afb_req_get_vcbdata(r); + callback = reinterpret_cast(vcbdata); + callback(req(r)); +} + +constexpr afb_verb_t verb( + const char *name, + void (&callback)(req), + const char *info = nullptr, + uint16_t session = 0, + const afb_auth *auth = nullptr, + bool glob = false, + void *vcbdata = nullptr +) +{ + return verb( + name, + __afb__verb__cb__for__global__, + info, + session, + auth, + glob, + (void*)(&callback) + ); +} + constexpr afb_verb_t verbend() { afb_verb_t r = verb(nullptr, nullptr);