summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include/application_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/include/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h14
-rw-r--r--src/components/application_manager/include/application_manager/command_holder.h3
-rw-r--r--src/components/application_manager/include/application_manager/command_holder_impl.h14
-rw-r--r--src/components/application_manager/include/application_manager/helpers/application_helper.h13
4 files changed, 33 insertions, 11 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 969ec53c41..4b1f8a4601 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -170,6 +170,7 @@ class ApplicationManagerImpl
DataAccessor<ApplicationSet> applications() const OVERRIDE;
DataAccessor<AppsWaitRegistrationSet> pending_applications() const OVERRIDE;
+ DataAccessor<ReregisterWaitList> reregister_applications() const OVERRIDE;
ApplicationSharedPtr application(uint32_t app_id) const OVERRIDE;
ApplicationSharedPtr active_application() const OVERRIDE;
@@ -182,6 +183,8 @@ class ApplicationManagerImpl
const std::string& app_name) const OVERRIDE;
ApplicationSharedPtr pending_application_by_policy_id(
const std::string& policy_app_id) const OVERRIDE;
+ ApplicationSharedPtr reregister_application_by_policy_id(
+ const std::string& policy_app_id) const OVERRIDE;
std::vector<ApplicationSharedPtr> applications_by_button(
uint32_t button) OVERRIDE;
@@ -1436,12 +1439,14 @@ class ApplicationManagerImpl
ApplicationSet applications_;
AppsWaitRegistrationSet apps_to_register_;
ForbiddenApps forbidden_applications;
+ ReregisterWaitList reregister_wait_list_;
// Lock for applications list
mutable std::shared_ptr<sync_primitives::RecursiveLock>
applications_list_lock_ptr_;
mutable std::shared_ptr<sync_primitives::Lock>
apps_to_register_list_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::Lock> reregister_wait_list_lock_ptr_;
mutable sync_primitives::Lock subscribed_way_points_apps_lock_;
/**
@@ -1533,15 +1538,6 @@ class ApplicationManagerImpl
std::unique_ptr<app_launch::AppLaunchData> app_launch_dto_;
std::unique_ptr<app_launch::AppLaunchCtrl> app_launch_ctrl_;
- /**
- * @brief ReregisterWaitList is list of applications expected to be
- * re-registered after transport switching is complete
- */
- typedef std::vector<ApplicationSharedPtr> ReregisterWaitList;
- ReregisterWaitList reregister_wait_list_;
-
- mutable sync_primitives::Lock reregister_wait_list_lock_;
-
// This is a cache to remember DeviceHandle of secondary transports. Only used
// during RegisterApplication().
typedef std::map<int32_t, connection_handler::DeviceHandle> DeviceMap;
diff --git a/src/components/application_manager/include/application_manager/command_holder.h b/src/components/application_manager/include/application_manager/command_holder.h
index 8cfe5f0889..3f5f657a0e 100644
--- a/src/components/application_manager/include/application_manager/command_holder.h
+++ b/src/components/application_manager/include/application_manager/command_holder.h
@@ -35,6 +35,7 @@
#include <string>
#include "application_manager/application.h"
+#include "application_manager/commands/command.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
@@ -59,10 +60,12 @@ class CommandHolder {
* internally
* @param application Application pointer
* @param type Command type
+ * @param source The source of suspended command
* @param command Command
*/
virtual void Suspend(ApplicationSharedPtr application,
CommandType type,
+ commands::Command::CommandSource source,
smart_objects::SmartObjectSPtr command) = 0;
/**
diff --git a/src/components/application_manager/include/application_manager/command_holder_impl.h b/src/components/application_manager/include/application_manager/command_holder_impl.h
index 8867336b3e..530aae47d2 100644
--- a/src/components/application_manager/include/application_manager/command_holder_impl.h
+++ b/src/components/application_manager/include/application_manager/command_holder_impl.h
@@ -64,10 +64,12 @@ class CommandHolderImpl : public CommandHolder {
* @brief Suspend collects command for specific application id internally
* @param application Application pointer
* @param type Command type
+ * @param source The source of suspended command
* @param command Command
*/
void Suspend(ApplicationSharedPtr application,
CommandType type,
+ commands::Command::CommandSource source,
smart_objects::SmartObjectSPtr command) FINAL;
/**
@@ -97,9 +99,17 @@ class CommandHolderImpl : public CommandHolder {
*/
void ResumeMobileCommand(ApplicationSharedPtr application);
+ /**
+ * @brief Descriptor of each suspended command containing all necessary
+ * command info
+ */
+ struct AppCommandInfo {
+ std::shared_ptr<smart_objects::SmartObject> command_ptr_;
+ commands::Command::CommandSource command_source_;
+ };
+
using AppCommands =
- std::map<ApplicationSharedPtr,
- std::vector<std::shared_ptr<smart_objects::SmartObject> > >;
+ std::map<ApplicationSharedPtr, std::vector<AppCommandInfo> >;
ApplicationManager& app_manager_;
sync_primitives::Lock commands_lock_;
diff --git a/src/components/application_manager/include/application_manager/helpers/application_helper.h b/src/components/application_manager/include/application_manager/helpers/application_helper.h
index 18267c9e7f..a7933c2451 100644
--- a/src/components/application_manager/include/application_manager/helpers/application_helper.h
+++ b/src/components/application_manager/include/application_manager/helpers/application_helper.h
@@ -69,6 +69,19 @@ ApplicationSharedPtr FindPendingApp(
return app;
}
+template <class UnaryPredicate>
+ApplicationSharedPtr FindReregisterApp(
+ DataAccessor<ReregisterWaitList> accessor, UnaryPredicate finder) {
+ ReregisterWaitList::const_iterator begin = accessor.GetData().begin();
+ ReregisterWaitList::const_iterator end = accessor.GetData().end();
+ ReregisterWaitList::const_iterator it = std::find_if(begin, end, finder);
+ if (accessor.GetData().end() == it) {
+ return ApplicationSharedPtr();
+ }
+ ApplicationSharedPtr app = *it;
+ return app;
+}
+
/**
* Helper function for lookup through applications list and returning all
* applications satisfying predicate logic