X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fbinding%2Flow-can-hat.cpp;h=ae16f5d032dc833e3c125f139e70b3b1639cd137;hb=e1d2eb87248861b63f1c0a90398b6e71338571e3;hp=dae3a4afe2e4e512c1fcfe9add8eb8bb8da6266c;hpb=38f9b3de40b1d1d8e9ed5db0fee40bdaa763d577;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/binding/low-can-hat.cpp b/low-can-binding/binding/low-can-hat.cpp index dae3a4af..ae16f5d0 100644 --- a/low-can-binding/binding/low-can-hat.cpp +++ b/low-can-binding/binding/low-can-hat.cpp @@ -40,13 +40,23 @@ extern "C" return a; } - static const struct afb_auth loa_1 = { loa_afb_auth(1) }; + static constexpr struct afb_auth perm_afb_auth(const char* permission) + { + struct afb_auth a = {}; + a.type = afb_auth_Permission; + a.text = permission; + return a; + } + + static const struct afb_auth afb_auth_loa_1 = { loa_afb_auth(1) }; + static const struct afb_auth afb_auth_perm = { perm_afb_auth("urn:AGL:permission::platform:can:write") }; static const struct afb_verb_v2 verbs[]= { + { .verb= "auth", .callback= auth, .auth= &afb_auth_perm, .info="Authentification against service to get the required level of confidence", .session= AFB_SESSION_NONE}, { .verb= "subscribe", .callback= subscribe, .auth= NULL, .info="Let subscribe to signals", .session= AFB_SESSION_NONE}, { .verb= "unsubscribe", .callback= unsubscribe, .auth= NULL, .info="Let unsubscribe signals", .session= AFB_SESSION_NONE}, - { .verb= "swrite", .callback= swrite, .auth= &loa_1, .info="Write a single CAN message on a CAN bus", .session= AFB_SESSION_LOA_1}, + { .verb= "write", .callback= write, .auth= &afb_auth_loa_1, .info="Write a single CAN message on a CAN bus", .session= AFB_SESSION_LOA_1}, { .verb= NULL, .callback= NULL, .auth= NULL, .info=NULL, .session= 0} };