X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fapp.cpp;h=05f8b6497b090b9fbda7254fc6d3bd0ddcda6f93;hb=f509e0a79eef109e77532b9e391f07609e296b87;hp=7d2f12163830f980a637eb3cdb886a707a55e49e;hpb=b88b923f24dd0903d393240cd63aa3ef4efde59c;p=apps%2Fagl-service-windowmanager.git diff --git a/src/app.cpp b/src/app.cpp index 7d2f121..05f8b64 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -95,12 +95,18 @@ struct result load_layer_map(char const *filename) { namespace rm { App *context; -static void eventHandler(json_object* json_out) { - context->updateWindowResource(json_out); +static void onStateTransitioned(json_object* json_out) { + context->updateWindowResources(json_out); +} + +static void onError(json_object* json_out) { + HMI_DEBUG("wm", "error message from PolicyManager:%s", + json_object_get_string(json_out)); } } // namespace rm -void App::updateWindowResource(json_object* json_out) { + +void App::updateCarStates(json_object* json_out) { // Check parking brake state json_object* json_parking_brake; if (!json_object_object_get_ex(json_out, "parking_brake", &json_parking_brake)) { @@ -238,7 +244,9 @@ void App::updateWindowResource(json_object* json_out) { return; } } +} +void App::updateLayers(json_object* json_out) { // Get displayed roles from current layout json_object* json_layers; if (!json_object_object_get_ex(json_out, "layers", &json_layers)) { @@ -320,6 +328,13 @@ void App::updateWindowResource(json_object* json_out) { } } +void App::updateWindowResources(json_object* json_out) { + // Update car states + this->updateCarStates(json_out); + + // Update layers + this->updateLayers(json_out); +} /** * App Impl @@ -379,8 +394,8 @@ int App::init() { // Register callback to PolicyManager PolicyManager::CallbackTable callback; - callback.onStateTransitioned = rm::eventHandler; - callback.onError = nullptr; + callback.onStateTransitioned = rm::onStateTransitioned; + callback.onError = rm::onError; this->pm_.registerCallback(callback); // Initialize LayoutManager