diff options
author | Jacob Keeler <jacob.keeler@livioradio.com> | 2019-03-07 22:43:04 -0500 |
---|---|---|
committer | jacobkeeler <jacob.keeler@livioradio.com> | 2019-03-07 22:45:21 -0500 |
commit | 9a60799a4f119e2411ee0a0a9d94ae1c8fa668f8 (patch) | |
tree | 730bd51dc8503a0d9c24f4e6f5c18ea5c56ddae9 /src/components/application_manager/include | |
parent | 3be4d6a8384f5422a040121c11b448a7dd6901fc (diff) | |
parent | 3da1fc5cd3a1873400ea28cb9977926ffa56e34c (diff) | |
download | sdl_core-9a60799a4f119e2411ee0a0a9d94ae1c8fa668f8.tar.gz |
Merge branch 'feature/cloud_app_transport' into feature/base_app_services_implementation
Diffstat (limited to 'src/components/application_manager/include')
9 files changed, 76 insertions, 13 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 7a59263299..b4d8ca857e 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -957,10 +957,10 @@ class Application : public virtual InitialApplicationData, * websocket open. * @return cloud app auth token */ - virtual const std::string& cloud_app_auth_token() const = 0; + virtual const std::string& auth_token() const = 0; /** - * @brief Get cloud app tranpsport type. Defines the type of websocket + * @brief Get cloud app transport type. Defines the type of websocket * connection used. * @return cloud app transport type */ @@ -994,7 +994,7 @@ class Application : public virtual InitialApplicationData, /** * @brief Set cloud app auth token */ - virtual void set_cloud_app_auth_token(const std::string& auth_token) = 0; + virtual void set_auth_token(const std::string& auth_token) = 0; /** * @brief Set cloud app transport type diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index 6d627d0c67..ff34d2a96a 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -420,10 +420,10 @@ class ApplicationImpl : public virtual Application, * websocket open. * @return cloud app auth token */ - const std::string& cloud_app_auth_token() const OVERRIDE; + const std::string& auth_token() const OVERRIDE; /** - * @brief Get cloud app tranpsport type. Defines the type of websocket + * @brief Get cloud app transport type. Defines the type of websocket * connection used. * @return cloud app transport type */ @@ -457,7 +457,7 @@ class ApplicationImpl : public virtual Application, /** * @brief Set cloud app auth token */ - void set_cloud_app_auth_token(const std::string& auth_token) OVERRIDE; + void set_auth_token(const std::string& auth_token) OVERRIDE; /** * @brief Set cloud app transport type 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 12f2310d36..27be913cd5 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 @@ -117,6 +117,14 @@ struct CommandParametersPermissions; typedef std::map<std::string, hmi_apis::Common_TransportType::eType> DeviceTypes; +struct AppIconInfo { + std::string endpoint; + bool pending_request; + AppIconInfo(); + AppIconInfo(std::string ws_endpoint, bool pending) + : endpoint(ws_endpoint), pending_request(pending) {} +}; + CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") typedef std::shared_ptr<timer::Timer> TimerSPtr; @@ -156,6 +164,7 @@ class ApplicationManagerImpl bool Stop() OVERRIDE; DataAccessor<ApplicationSet> applications() const OVERRIDE; + DataAccessor<AppsWaitRegistrationSet> pending_applications() const OVERRIDE; ApplicationSharedPtr application(uint32_t app_id) const OVERRIDE; ApplicationSharedPtr active_application() const OVERRIDE; @@ -164,6 +173,10 @@ class ApplicationManagerImpl uint32_t hmi_app_id) const OVERRIDE; ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; + ApplicationSharedPtr application_by_name( + const std::string& app_name) const OVERRIDE; + ApplicationSharedPtr pending_application_by_policy_id( + const std::string& policy_app_id) const OVERRIDE; std::vector<ApplicationSharedPtr> applications_by_button( uint32_t button) OVERRIDE; @@ -194,6 +207,9 @@ class ApplicationManagerImpl void SendDriverDistractionState(ApplicationSharedPtr application); + void SendGetIconUrlNotifications(const uint32_t connection_key, + ApplicationSharedPtr application); + ApplicationSharedPtr application( const std::string& device_id, const std::string& policy_app_id) const OVERRIDE; @@ -365,6 +381,8 @@ class ApplicationManagerImpl void ConnectToDevice(const std::string& device_mac) OVERRIDE; void OnHMIStartedCooperation() OVERRIDE; + void DisconnectCloudApp(ApplicationSharedPtr app) OVERRIDE; + void RefreshCloudAppInformation() OVERRIDE; void CreatePendingApplication( @@ -372,6 +390,14 @@ class ApplicationManagerImpl const transport_manager::DeviceInfo& device_info, connection_handler::DeviceHandle device_id); + void SetPendingApplicationState( + const transport_manager::ConnectionUID connection_id, + const transport_manager::DeviceInfo& device_info); + + std::string PolicyIDByIconUrl(const std::string url) OVERRIDE; + + void SetIconFileFromSystemRequest(const std::string policy_id) OVERRIDE; + /** * @brief Notifies the applicaiton manager that a cloud connection status has * updated and should trigger an UpdateAppList RPC to the HMI @@ -383,7 +409,6 @@ class ApplicationManagerImpl * @param app A cloud application * @return The current CloudConnectionStatus of app */ - hmi_apis::Common_CloudConnectionStatus::eType GetCloudAppConnectionStatus( ApplicationConstSharedPtr app) const; @@ -510,9 +535,6 @@ class ApplicationManagerImpl // typedef for Applications list typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet; - typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter> - AppsWaitRegistrationSet; - // typedef for Applications list iterator typedef ApplictionSet::iterator ApplictionSetIt; @@ -1002,6 +1024,14 @@ class ApplicationManagerImpl } }; + struct AppNamePredicate { + std::string app_name_; + AppNamePredicate(const std::string& app_name) : app_name_(app_name) {} + bool operator()(const ApplicationSharedPtr app) const { + return app ? app->name() == app_name_ : false; + } + }; + /** * @brief Sends UpdateAppList notification to HMI */ @@ -1496,6 +1526,9 @@ class ApplicationManagerImpl pending_device_map_lock_ptr_; std::map<std::string, std::string> pending_device_map_; + sync_primitives::Lock app_icon_map_lock_ptr_; + std::map<std::string, AppIconInfo> app_icon_map_; + #ifdef TELEMETRY_MONITOR AMTelemetryObserver* metric_observer_; #endif // TELEMETRY_MONITOR 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 145bef659e..18267c9e7f 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 @@ -57,6 +57,18 @@ ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor, return app; } +template <class UnaryPredicate> +ApplicationSharedPtr FindPendingApp( + DataAccessor<AppsWaitRegistrationSet> accessor, UnaryPredicate finder) { + AppsWaitRegistrationSet::iterator it = std::find_if( + accessor.GetData().begin(), accessor.GetData().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 diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 07d9c8dc23..774376b249 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -207,7 +207,7 @@ class HmiState { } protected: - std::shared_ptr<Application> app_; + uint32_t hmi_app_id_; StateID state_id_; const ApplicationManager& app_mngr_; HmiStatePtr parent_; diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 8a8e50bf1c..ac84bcfaa5 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -786,6 +786,14 @@ class MessageHelper { static hmi_apis::Common_Language::eType CommonLanguageFromString( const std::string& language); + /** + * @brief CommonLightNameFromString convert string to LightName enum value + * @param lightName string to convert + * @return value LightName enum value + */ + static hmi_apis::Common_LightName::eType CommonLightNameFromString( + const std::string& lightName); + static smart_objects::SmartObjectSPtr GetOnAppInterfaceUnregisteredNotificationToMobile( int32_t connection_key, diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index df96ade313..abc98876a2 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -187,6 +187,8 @@ class PolicyHandler : public PolicyHandlerInterface, void GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) OVERRIDE; virtual std::string GetLockScreenIconUrl() const OVERRIDE; + virtual std::string GetIconUrl( + const std::string& policy_app_id) const OVERRIDE; uint32_t NextRetryTimeout() OVERRIDE; /** @@ -431,7 +433,7 @@ class PolicyHandler : public PolicyHandlerInterface, * @param hybrid_app_preference Filled with the hybrid app preference for the * cloud application set by the user */ - void GetCloudAppParameters(const std::string& policy_app_id, + bool GetCloudAppParameters(const std::string& policy_app_id, bool& enabled, std::string& endpoint, std::string& certificate, @@ -480,6 +482,9 @@ class PolicyHandler : public PolicyHandlerInterface, #ifdef EXTERNAL_PROPRIETARY_MODE void OnCertificateDecrypted(bool is_succeeded) OVERRIDE; #endif // EXTERNAL_PROPRIETARY_MODE + void OnAuthTokenUpdated(const std::string& policy_app_id, + const std::string& auth_token); + virtual bool CanUpdate() OVERRIDE; virtual void OnDeviceConsentChanged(const std::string& device_id, diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h index 07d234f036..68e7511b43 100644 --- a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h +++ b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h @@ -48,6 +48,9 @@ class PolicyHandlerObserver { return false; } + virtual void OnAuthTokenUpdated(const std::string& policy_app_id, + const std::string& auth_token) {} + virtual void OnPTUFinished(const bool ptu_result) {} virtual ~PolicyHandlerObserver() {} diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 5d030dace6..67c849c8fc 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -190,12 +190,14 @@ extern const char* green; extern const char* blue; extern const char* display_layout; extern const char* icon_resumed; +extern const char* nicknames; extern const char* enabled; -extern const char* cloud_app_auth_token; +extern const char* auth_token; extern const char* cloud_transport_type; extern const char* hybrid_app_preference; extern const char* is_cloud_application; extern const char* cloud_connection_status; +extern const char* endpoint; // PutFile extern const char* sync_file_name; |