diff options
Diffstat (limited to 'src/components/application_manager/src/state_controller_impl.cc')
-rw-r--r-- | src/components/application_manager/src/state_controller_impl.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index be72ec1cd7..47876f9bb6 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -722,17 +722,29 @@ void StateControllerImpl::on_event(const event_engine::MobileEvent& event) { switch (event.id()) { case FunctionID::RegisterAppInterfaceID: { uint32_t connection_key = - event.smart_object()[strings::connection_key].asUInt(); + event.smart_object()[strings::params][strings::connection_key] + .asUInt(); ApplicationSharedPtr app = app_mngr_.application(connection_key); if (app.use_count() == 0) { - SDL_LOG_ERROR("OnHMIStatusNotification application doesn't exist"); + SDL_LOG_WARN("Application doesn't exist"); + return; + } + + auto it = pending_hmistatus_notification_apps_.find(app->app_id()); + if (it == pending_hmistatus_notification_apps_.end()) { + SDL_LOG_WARN("Application does not have a pending OnHMIStatus"); return; } auto notification = MessageHelper::CreateHMIStatusNotification(app, 0); app_mngr_.GetRPCService().ManageMobileCommand( notification, commands::Command::SOURCE_SDL); + pending_hmistatus_notification_apps_.erase(app->app_id()); + if (pending_hmistatus_notification_apps_.empty()) { + unsubscribe_from_event(FunctionID::RegisterAppInterfaceID); + } + } break; default: |