summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include
diff options
context:
space:
mode:
authorVeronica Veremjova <vveremjova@luxoft.com>2016-05-11 16:32:39 +0300
committerVeronica Veremjova <vveremjova@luxoft.com>2016-05-12 15:52:17 +0300
commitb908974e224a6375e3d4aa1bbda859dfbb4a58dc (patch)
tree9b749c95982bbb8305f74adae87dd62559b0b25b /src/components/application_manager/include
parentb58e6058ea5be28b09583a7f57757b7cf369591c (diff)
downloadsdl_core-b908974e224a6375e3d4aa1bbda859dfbb4a58dc.tar.gz
Refactoring: deleted unuseful members and functions in resumption data
Added ability to create database in memory Fixed code after merge
Diffstat (limited to 'src/components/application_manager/include')
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h20
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h50
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h20
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
4 files changed, 20 insertions, 71 deletions
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index d7fa3968c6..469be2c902 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -72,16 +72,6 @@ class ResumptionData {
virtual void SaveApplication(app_mngr::ApplicationSharedPtr application) = 0;
/**
- * @brief Returns HMI level of application from saved data
- * @param policy_app_id contains policy application id of application
- * @param device_id contains id of device on which is running application
- * @return HMI level, if saved data does not contain HMI level method
- * returns -1
- */
- virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
- const std::string& device_id) const = 0;
-
- /**
* @brief Checks if saved data of applications have hmi app id
* @param hmi_app_id - hmi application id
* @return true if exist, false otherwise
@@ -89,16 +79,6 @@ class ResumptionData {
virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const = 0;
/**
- * @brief Checks if saved data have application
- * and removes this data if it is not valid
- * @param policy_app_id - policy application id
- * @param device_id - contains id of device on which is running application
- * @return true if data exists and data is valid, false otherwise
- */
- virtual bool CheckSavedApplication(const std::string& policy_app_id,
- const std::string& device_id) = 0;
-
- /**
* @brief Retrieves HMI app ID for the given mobile app ID
* and device ID from stored information.
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index 4441b2d4e3..94af6a1c51 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -58,6 +58,14 @@ struct ApplicationParams {
};
/**
+ * @brief Show should database be saved in a disk file or in memory
+ */
+enum DbStorage {
+ In_Memory_Storage = 0,
+ In_File_Storage
+};
+
+/**
* @brief class contains logic for representation application data in
* data base
*/
@@ -68,6 +76,7 @@ class ResumptionDataDB : public ResumptionData {
* @param db_storage show database should be saved in a disk file or in memory
*/
ResumptionDataDB(
+ DbStorage db_storage,
const application_manager::ApplicationManager& application_manager);
/**
@@ -88,31 +97,12 @@ class ResumptionDataDB : public ResumptionData {
*/
void SaveApplication(app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
- * @brief Returns HMI level of application from saved data
- * @param policy_app_id contains policy id of application
- * @param device_id contains id of device on which is running application
- * @return HMI level, if saved data does not contain HMI level method
- * returns -1
- */
- virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
- const std::string& device_id) const;
-
- /**
* @brief Checks if saved data of applications have hmi app id
* @param hmi_app_id - hmi application id
* @return true if exist, otherwise false
*/
virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const;
/**
- * @brief Checks if saved data have application
- * @param policy_app_id - policy application id
- * @param device_id - contains id of device on which is running application
- * @return true if application exists, false otherwise
- */
- virtual bool CheckSavedApplication(const std::string& policy_app_id,
- const std::string& device_id);
-
- /**
* @brief Retrieves HMI app ID for the given mobile app ID
* and device ID from stored data.
* @param policy_app_id - mobile application id
@@ -203,11 +193,6 @@ class ResumptionDataDB : public ResumptionData {
mobile_apis::HMILevel::eType hmi_level);
/**
- * @brief Write database to file system
- */
- void Persist() OVERRIDE;
-
- /**
* @brief Re-creates and re-init DB
* @return true if success, otherwise - false
*/
@@ -241,6 +226,16 @@ class ResumptionDataDB : public ResumptionData {
bool DropAppDataResumption(const std::string& device_id,
const std::string& app_id) OVERRIDE;
+ /**
+ * @brief Write json resumption info to file system
+ */
+ void Persist() OVERRIDE;
+
+protected:
+ /**
+ * @brief returns pointer to data base
+ */
+ utils::dbms::SQLDatabase* db() const;
private:
/**
@@ -305,7 +300,7 @@ class ResumptionDataDB : public ResumptionData {
*/
bool CheckExistenceApplication(const std::string& policy_app_id,
const std::string& device_id,
- bool application_exist) const;
+ bool& application_exist) const;
/**
* @brief Retrieves data from saved application
@@ -827,11 +822,6 @@ class ResumptionDataDB : public ResumptionData {
void WriteDb();
/**
- * @brief returns pointer to data base
- */
- utils::dbms::SQLDatabase* db() const;
-
- /**
* @brief Updates grammarID for application
* @param policy_app_id Application ID
* @param device_id Device ID
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 1b6eb02776..0be6d64db2 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -65,16 +65,6 @@ class ResumptionDataJson : public ResumptionData {
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
- * @brief Returns HMI level of application from saved data
- * @param policy_app_id contains policy application id of application
- * @param device_id contains id of device on which is running application
- * @return HMI level, if saved data does not contain HMI level method
- * returns -1
- */
- virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
- const std::string& device_id) const;
-
- /**
* @brief Checks if saved data of applications have hmi app id
* @param hmi_app_id - hmi application id
* @return true if exist, false otherwise
@@ -82,16 +72,6 @@ class ResumptionDataJson : public ResumptionData {
virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const;
/**
- * @brief Checks if saved data have application
- * and removes this data if it is not valid
- * @param policy_app_id - policy application id
- * @param device_id - contains id of device on which is running application
- * @return true if data exists and data is valid, false otherwise
- */
- virtual bool CheckSavedApplication(const std::string& policy_app_id,
- const std::string& device_id);
-
- /**
* @brief Retrieves HMI app ID for the given mobile app ID
* and device ID from stored information.
* @param policy_app_id - mobile application id
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 d15ba2fb2b..1fda170c34 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
@@ -270,7 +270,6 @@ extern const char* last_ign_off_time;
extern const char* resume_vr_grammars;
extern const char* ign_off_count;
-extern const char* suspend_count;
extern const char* connection_info;
extern const char* is_download_complete;