summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include
diff options
context:
space:
mode:
authoragaliuzov <agaliuzov@luxoft.com>2016-06-23 07:53:58 -0700
committerIra Lytvynenko <ILytvynenko@luxoft.com>2017-12-22 17:26:19 +0200
commit11ce1efd850cadbe63a9ac8017b49b372afc5c3f (patch)
treea3c1e427d8c6f6f2772a3d23c9839c285f720451 /src/components/application_manager/include
parent0b19cf498d1c9972d67b85793dc6b029c26378a0 (diff)
downloadsdl_core-11ce1efd850cadbe63a9ac8017b49b372afc5c3f.tar.gz
Implement new behavior for OnDriverDistraction.
According to the new behaviour SDL has to postpone OnDriverDistraction for the application which are in NONE hmi level and send this notification once device change hmi level in some other hmi level.
Diffstat (limited to 'src/components/application_manager/include')
-rw-r--r--src/components/application_manager/include/application_manager/application.h20
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h9
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h46
3 files changed, 68 insertions, 7 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index fdb0c15922..c0a1007541 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -168,6 +168,11 @@ typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions;
*/
typedef std::set<mobile_apis::ButtonName::eType> ButtonSubscriptions;
+/**
+ * @breif Collection for the mobile command smart object.
+ */
+typedef std::vector<smart_objects::SmartObjectSPtr> MobileMessageQueue;
+
class DynamicApplicationData {
public:
virtual ~DynamicApplicationData() {}
@@ -786,6 +791,21 @@ class Application : public virtual InitialApplicationData,
*/
virtual uint32_t GetAvailableDiskSpace() = 0;
+ /**
+ * @brief Allows to save mobile's command smart object in order to perform
+ * this command later.
+ * @param mobile_message the message smart_object.
+ */
+ virtual void PushMobileMessage(
+ smart_objects::SmartObjectSPtr mobile_message) = 0;
+
+ /**
+ * @brief Allows to obtain the whole list of pending commands in order to
+ * process them.
+ * @param mobile_message the messages array which is filled by the method.
+ */
+ virtual void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) = 0;
+
#ifdef SDL_REMOTE_CONTROL
/**
* @brief set_system_context Set system context for application
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 3304200372..2a2c18e116 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -341,6 +341,11 @@ class ApplicationImpl : public virtual Application,
AppExtensionPtr QueryInterface(AppExtensionUID uid) OVERRIDE;
#endif
+ void PushMobileMessage(
+ smart_objects::SmartObjectSPtr mobile_message) OVERRIDE;
+
+ void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) OVERRIDE;
+
protected:
/**
* @brief Clean up application folder. Persistent files will stay
@@ -467,6 +472,10 @@ class ApplicationImpl : public virtual Application,
sync_primitives::Lock button_lock_;
std::string folder_name_;
ApplicationManager& application_manager_;
+
+ sync_primitives::Lock mobile_message_lock_;
+ MobileMessageQueue mobile_message_queue_;
+
DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
};
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 2f118a7e3f..23bc698194 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
@@ -463,14 +463,16 @@ 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;
/*
* @brief Retrieves if VR session has started
@@ -1353,6 +1355,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
@@ -1446,6 +1474,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 };
@@ -1537,7 +1573,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_;
@@ -1652,10 +1688,6 @@ 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_;
}