diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/application_manager_impl.h')
-rw-r--r-- | src/components/application_manager/include/application_manager/application_manager_impl.h | 235 |
1 files changed, 204 insertions, 31 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 7a26501afc..3e7fab60fb 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 @@ -48,12 +48,12 @@ #include "application_manager/message_helper.h" #include "application_manager/request_controller.h" #include "application_manager/resumption/resume_ctrl.h" -#include "application_manager/vehicle_info_data.h" #include "application_manager/state_controller_impl.h" #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/application_manager_settings.h" #include "application_manager/event_engine/event_dispatcher_impl.h" #include "application_manager/hmi_interfaces_impl.h" +#include "application_manager/command_holder.h" #include "protocol_handler/protocol_observer.h" #include "protocol_handler/protocol_handler.h" @@ -311,6 +311,7 @@ class ApplicationManagerImpl bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const; /** + * DEPRECATED * @brief Checks if Application is subscribed for way points * @param Application AppID * @return true if Application is subscribed for way points @@ -319,18 +320,40 @@ class ApplicationManagerImpl bool IsAppSubscribedForWayPoints(const uint32_t app_id) const OVERRIDE; /** + * DEPRECATED * @brief Subscribe Application for way points * @param Application AppID */ void SubscribeAppForWayPoints(const uint32_t app_id) OVERRIDE; /** + * DEPRECATED * @brief Unsubscribe Application for way points * @param Application AppID */ void UnsubscribeAppFromWayPoints(const uint32_t app_id) OVERRIDE; /** + * @brief Checks if Application is subscribed for way points + * @param Application pointer + * @return true if Application is subscribed for way points + * otherwise false + */ + bool IsAppSubscribedForWayPoints(ApplicationSharedPtr app) const OVERRIDE; + + /** + * @brief Subscribe Application for way points + * @param Application pointer + */ + void SubscribeAppForWayPoints(ApplicationSharedPtr app) OVERRIDE; + + /** + * @brief Unsubscribe Application for way points + * @param Application pointer + */ + void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) OVERRIDE; + + /** * @brief Is Any Application is subscribed for way points * @return true if some app is subscribed otherwise false */ @@ -349,11 +372,18 @@ class ApplicationManagerImpl * @param vehicle_info Enum value of type of vehicle data * @param new value (for integer values currently) of vehicle data */ - std::vector<ApplicationSharedPtr> IviInfoUpdated(VehicleDataType vehicle_info, - int value) OVERRIDE; + std::vector<ApplicationSharedPtr> IviInfoUpdated( + mobile_apis::VehicleDataType::eType vehicle_info, int value) OVERRIDE; void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE; + /** + * @brief OnApplicationSwitched starts processing of commands collected + * during device switching process + * @param app Application + */ + void OnApplicationSwitched(ApplicationSharedPtr app) OVERRIDE; + HMICapabilities& hmi_capabilities() OVERRIDE; const HMICapabilities& hmi_capabilities() const OVERRIDE; @@ -423,8 +453,9 @@ class ApplicationManagerImpl */ void UnregisterAllApplications(); - bool RemoveAppDataFromHMI(ApplicationSharedPtr app); - bool LoadAppDataToHMI(ApplicationSharedPtr app); + DEPRECATED bool RemoveAppDataFromHMI(ApplicationSharedPtr app); + + DEPRECATED bool LoadAppDataToHMI(ApplicationSharedPtr app); bool ActivateApplication(ApplicationSharedPtr app) OVERRIDE; /** @@ -464,16 +495,19 @@ class ApplicationManagerImpl * * @return Current state of the distraction state */ - inline bool driver_distraction() const; + hmi_apis::Common_DriverDistractionState::eType driver_distraction_state() + const; /* * @brief Sets state for driver distraction * * @param state New state to be set */ - void set_driver_distraction(const bool is_distracting) OVERRIDE; + void set_driver_distraction_state( + const hmi_apis::Common_DriverDistractionState::eType state) OVERRIDE; /* + * DEPRECATED * @brief Retrieves if VR session has started * * @return Current VR session state (started, stopped) @@ -481,6 +515,7 @@ class ApplicationManagerImpl inline bool vr_session_started() const; /* + * DEPRECATED * @brief Sets VR session state * * @param state Current HMI VR session state @@ -503,13 +538,28 @@ class ApplicationManagerImpl /** * @brief CreateRegularState create regular HMI state for application - * @param app_id + * @param app Application * @param hmi_level of returned state * @param audio_state of returned state * @param system_context of returned state * @return new regular HMI state */ HmiStatePtr CreateRegularState( + utils::SharedPtr<Application> app, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const OVERRIDE; + + /** + * DEPRECATED + * @brief CreateRegularState create regular HMI state for application + * @param app_id Application id + * @param hmi_level of returned state + * @param audio_state of returned state + * @param system_context of returned state + * @return new regular HMI state + */ + DEPRECATED HmiStatePtr CreateRegularState( uint32_t app_id, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, @@ -838,8 +888,27 @@ class ApplicationManagerImpl void OnFindNewApplicationsRequest() OVERRIDE; void RemoveDevice( const connection_handler::DeviceHandle& device_handle) OVERRIDE; - // DEPRECATED - bool OnServiceStartedCallback( + + /** + * @brief OnDeviceSwitchingStart is invoked on device transport switching + * start (e.g. from Bluetooth to USB) and creates waiting list of applications + * expected to be re-registered after switching is complete + * @param device_from device params being switched to the new transport + * @param device_to device params on the new transport + */ + void OnDeviceSwitchingStart( + const connection_handler::Device& device_from, + const connection_handler::Device& device_to) FINAL; + + /** + * @brief OnDeviceSwitchingFinish is invoked on device trasport switching end + * i.e. timeout for switching is expired, unregisters applications from + * waiting list which haven't been re-registered and clears the waiting list + * @param device_uid UID of device being switched + */ + void OnDeviceSwitchingFinish(const std::string& device_uid) FINAL; + + DEPRECATED bool OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, const protocol_handler::ServiceType& type) OVERRIDE; @@ -853,14 +922,42 @@ class ApplicationManagerImpl const protocol_handler::ServiceType& type, const connection_handler::CloseSessionReason& close_reason) OVERRIDE; + /** + * @brief Check if application with specified app_id has NAVIGATION HMI type + * @param app_id id of application to check + * @return true if application is navi otherwise returns false + */ + bool CheckAppIsNavi(const uint32_t app_id) const OVERRIDE; + #ifdef ENABLE_SECURITY - // Overriden SecurityManagerListener method + /** + * @brief Notification about protection result + * @param connection_key Unique key of session which triggers handshake + * @param result result of connection protection + * @return true on success notification handling or false otherwise + */ bool OnHandshakeDone( uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) OVERRIDE; + /** + * @brief Notification that certificate update is required. + */ void OnCertificateUpdateRequired() OVERRIDE; + /** + * @brief Get certificate data from policy + * @param reference to string where to save certificate data + * @return true if listener saved some data to string otherwise false + */ + bool GetPolicyCertificateData(std::string& data) const OVERRIDE; + + /** + * @brief Get unique handshake context by application id + * @param key id of application + * @return generated handshake context or empty context if application with + * provided id does not exist + */ security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const OVERRIDE; #endif // ENABLE_SECURITY @@ -991,15 +1088,15 @@ class ApplicationManagerImpl uint32_t GenerateNewHMIAppID() OVERRIDE; /** + * DERPECATED * @brief Parse smartObject and replace mobile app Id by HMI app ID - * * @param message Smartobject to be parsed */ void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** + * DEPRECATED * @brief Parse smartObject and replace HMI app ID by mobile app Id - * * @param message Smartobject to be parsed */ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); @@ -1056,6 +1153,7 @@ class ApplicationManagerImpl void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE; /** + * DEPRECATED * @brief method adds application in FULL and LIMITED state * to on_phone_call_app_list_. * Also OnHMIStateNotification with BACKGROUND state sent for these apps @@ -1063,6 +1161,7 @@ class ApplicationManagerImpl void CreatePhoneCallAppList(); /** + * DEPRECATED * @brief method removes application from on_phone_call_app_list_. * * Also OnHMIStateNotification with previous HMI state sent for these apps @@ -1169,15 +1268,6 @@ class ApplicationManagerImpl } }; - struct SubscribedToIVIPredicate { - int32_t vehicle_info_; - SubscribedToIVIPredicate(int32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - bool operator()(const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; - } - }; - struct GrammarIdPredicate { uint32_t grammar_id_; GrammarIdPredicate(uint32_t grammar_id) : grammar_id_(grammar_id) {} @@ -1214,11 +1304,32 @@ class ApplicationManagerImpl bool IsAppsQueriedFrom( const connection_handler::DeviceHandle handle) const OVERRIDE; + /** + * @brief IsAppInReconnectMode check if application belongs to session + * affected by transport switching at the moment by checking internal + * waiting list prepared on switching start + * @param policy_app_id Application id + * @return True if application is in the waiting list, otherwise - false + */ + bool IsAppInReconnectMode(const std::string& policy_app_id) const FINAL; + bool IsStopping() const OVERRIDE { return is_stopping_; } /** + * @brief ProcessReconnection handles reconnection flow for application on + * transport switch + * @param application Pointer to switched application, must be validated + * before passing + * @param connection_key Connection key from registration request of + * switched + * application + */ + void ProcessReconnection(ApplicationSharedPtr application, + const uint32_t connection_key) FINAL; + + /** * @brief Clears all applications' persistent data */ void ClearAppsPersistentData(); @@ -1354,6 +1465,32 @@ class ApplicationManagerImpl */ bool IsLowVoltage(); + /** + * @brief Allows to process postponed commands for application + * when its HMI level has been changed. + * @param app_id the application id for processing. + * @param from the old HMILevel. + * @param to the new HMILevel for the certain app. + */ + void ProcessPostponedMessages(const uint32_t app_id); + + /** + * @brief Allows to process applications after HMILevel has been changed. + * @param app_id the application id for processing. + * @param from the old HMILevel. + * @param to the new HMILevel for the certain app. + */ + void ProcessApp(const uint32_t app_id, + const mobile_apis::HMILevel::eType from, + const mobile_apis::HMILevel::eType to); + + /** + * @brief Allows to send appropriate message to mobile device. + * @param message The smart object which contains all neccesary info to send + * notification. + */ + void SendMobileMessage(smart_objects::SmartObjectSPtr message); + private: /* * NaviServiceStatusMap shows which navi service (audio/video) is opened @@ -1402,9 +1539,8 @@ class ApplicationManagerImpl * @param service_type Type of service to start * @return True on success, false on fail */ - // DEPRECATED - bool StartNaviService(uint32_t app_id, - protocol_handler::ServiceType service_type); + DEPRECATED bool StartNaviService(uint32_t app_id, + protocol_handler::ServiceType service_type); /** * @brief Starts specified navi service for application @@ -1447,6 +1583,14 @@ class ApplicationManagerImpl protocol_handler::MajorProtocolVersion SupportedSDLVersion() const; /** + * @brief Checks if driver distraction state is valid, creates message + * and puts it to postponed message. + * @param application contains registered application. + */ + void PutDriverDistractionMessageToPostponed( + ApplicationSharedPtr application) const; + + /** * @brief Types of directories used by Application Manager */ enum DirectoryType { TYPE_STORAGE, TYPE_SYSTEM, TYPE_ICONS }; @@ -1488,6 +1632,28 @@ class ApplicationManagerImpl void ClearTTSGlobalPropertiesList(); /** + * @brief EraseAppFromReconnectionList drops application from reconnection + * list on transport switch success + * @param app Pointer to application + */ + void EraseAppFromReconnectionList(const ApplicationSharedPtr& app); + + /** + * @brief SwitchApplication updates parameters of switched application and + * internal applications list + * @param app Pointer to switched application, must be validated before + * passing in + * @param connection_key Connection key of switched application from its + * registration request + * @param device_id Device id of switched application + * @param mac_address New device mac address + */ + void SwitchApplication(ApplicationSharedPtr app, + const uint32_t connection_key, + const size_t device_id, + const std::string& mac_address); + + /** * @brief Converts BSON object containing video parameters to * smart object's map object * @param output the smart object to add video parameters @@ -1538,7 +1704,7 @@ class ApplicationManagerImpl bool audio_pass_thru_active_; sync_primitives::Lock audio_pass_thru_lock_; sync_primitives::Lock tts_global_properties_app_list_lock_; - bool is_distracting_driver_; + hmi_apis::Common_DriverDistractionState::eType driver_distraction_state_; bool is_vr_session_strated_; bool hmi_cooperating_; bool is_all_apps_allowed_; @@ -1620,6 +1786,15 @@ class ApplicationManagerImpl std::auto_ptr<app_launch::AppLaunchData> app_launch_dto_; std::auto_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_; + #ifdef TELEMETRY_MONITOR AMTelemetryObserver* metric_observer_; #endif // TELEMETRY_MONITOR @@ -1634,6 +1809,8 @@ class ApplicationManagerImpl volatile bool is_stopping_; + std::unique_ptr<CommandHolder> commands_holder_; + #ifdef BUILD_TESTS public: /** @@ -1649,14 +1826,10 @@ class ApplicationManagerImpl DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl); }; -bool ApplicationManagerImpl::vr_session_started() const { +DEPRECATED bool ApplicationManagerImpl::vr_session_started() const { return is_vr_session_strated_; } -bool ApplicationManagerImpl::driver_distraction() const { - return is_distracting_driver_; -} - inline bool ApplicationManagerImpl::all_apps_allowed() const { return is_all_apps_allowed_; } |