X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-context.c;h=0bcc79c37f5bea924786e255da87db05a653e074;hb=91f3e6ecdada77d57c8d92a955776fd8fe6d402e;hp=a7010dbb1c516d7974ba999e1bb3ec3208e23fbf;hpb=ad9cee7d6e86ba4497ffb09b4acb3b2c07b42a12;p=src%2Fapp-framework-binder.git diff --git a/src/afb-context.c b/src/afb-context.c index a7010dbb..0bcc79c3 100644 --- a/src/afb-context.c +++ b/src/afb-context.c @@ -1,6 +1,7 @@ /* - * Copyright (C) 2015, 2016 "IoT.bzh" + * Copyright (C) 2015, 2016, 2017 "IoT.bzh" * Author "Fulup Ar Foll" + * Author José Bollo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +59,7 @@ int afb_context_connect(struct afb_context *context, const char *uuid, const cha init_context(context, session, token); if (created) { context->created = 1; - context->refreshing = 1; + /* context->refreshing = 1; */ } return 0; } @@ -138,16 +139,19 @@ int afb_context_check_loa(struct afb_context *context, unsigned loa) return context->loa_in >= loa; } -void afb_context_change_loa(struct afb_context *context, unsigned loa) +int afb_context_change_loa(struct afb_context *context, unsigned loa) { - assert(context->validated); + if (!context->validated || loa > 7) + return 0; - if (loa == context->loa_in) + if (loa == context->loa_in && !context->loa_changed) context->loa_changing = 0; else { - context->loa_changing = 1; context->loa_out = loa & 7; + context->loa_changing = 1; + context->loa_changed = 0; } + return 1; }