diff options
Diffstat (limited to 'src/components/include/policy/policy_regular/policy/policy_manager.h')
-rw-r--r-- | src/components/include/policy/policy_regular/policy/policy_manager.h | 128 |
1 files changed, 99 insertions, 29 deletions
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index 18fb3e1c2b..ee1f5fa98f 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -33,23 +33,28 @@ #ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ #define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ -#include <vector> #include <cstdint> +#include <vector> +#include "boost/optional.hpp" -#include "utils/callable.h" -#include "policy/policy_types.h" -#include "policy/policy_table/types.h" +#include "policy/access_remote.h" +#include "policy/cache_manager_interface.h" #include "policy/policy_listener.h" +#include "policy/policy_table/types.h" +#include "policy/policy_types.h" #include "policy/usage_statistics/statistics_manager.h" -#include "policy/cache_manager_interface.h" -#include "policy/access_remote.h" +#include "utils/callable.h" +#include "utils/optional.h" namespace policy { class PolicySettings; typedef std::shared_ptr<utils::Callable> StatusNotifier; -class PolicyManager : public usage_statistics::StatisticsManager { +class PolicyManager : public usage_statistics::StatisticsManager, + public PolicyEncryptionFlagGetterInterface { public: + enum PtProcessingResult { kSuccess, kWrongPtReceived, kNewPtRequired }; + virtual ~PolicyManager() {} /** @@ -73,10 +78,16 @@ class PolicyManager : public usage_statistics::StatisticsManager { * sent in snapshot and received Policy Table. * @param file name of file with update policy table * @param pt_content PTU as binary string - * @return true if successfully + * @return result of PT processing + */ + virtual PtProcessingResult LoadPT(const std::string& file, + const BinaryMessage& pt_content) = 0; + + /** + * @brief Performs finalizing actions after PT update was processed + * @param ptu_result result of last PT processing */ - virtual bool LoadPT(const std::string& file, - const BinaryMessage& pt_content) = 0; + virtual void OnPTUFinished(const PtProcessingResult ptu_result) = 0; /** * @brief Resets Policy Table @@ -114,7 +125,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief PTU is needed, for this PTS has to be formed and sent. */ - virtual bool RequestPTUpdate() = 0; + virtual bool RequestPTUpdate(const PTUIterationType iteration_type) = 0; /** * @brief Check if specified RPC for specified application @@ -165,6 +176,23 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void KmsChanged(int kilometers) = 0; /** + * @brief Returns state of the lock screen that could be able to be dismissed + * while connected to SDL, allowing users the ability to interact with the + * app. + * @return bool True if lock screen can be dismissed. + */ + virtual const boost::optional<bool> LockScreenDismissalEnabledState() + const = 0; + + /** + * @brief Returns lock screen warning message + * @param language_code Specific language for which need message + * @return std::string Lock screen warning message + */ + virtual const boost::optional<std::string> LockScreenDismissalWarningMessage( + const std::string& language) const = 0; + + /** * @brief Increments counter of ignition cycles */ virtual void IncrementIgnitionCycles() = 0; @@ -182,6 +210,18 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual std::string ForcePTExchangeAtUserRequest() = 0; /** + * @brief Stops retry sequence timer and resets retry sequence + */ + virtual void StopRetrySequence() = 0; + + /** + * @brief Resets retry sequence + * @param send_event - if true corresponding event is sent to + * UpdateStatusManager + */ + virtual void ResetRetrySequence(const ResetRetryCountType reset_type) = 0; + + /** * @brief Gets timeout to wait before next retry updating PT * If timeout is less or equal to zero then the retry sequence is not need. * @return timeout in seconds @@ -241,12 +281,15 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Update Application Policies as reaction * on User allowing/disallowing device this app is running on. + * @param device_handle device identifier * @param app_id Unique application id * @param is_device_allowed true if user allowing device otherwise false * @return true if operation was successful */ - virtual bool ReactOnUserDevConsentForApp(const std::string app_id, - bool is_device_allowed) = 0; + virtual bool ReactOnUserDevConsentForApp( + const transport_manager::DeviceHandle& device_handle, + const std::string app_id, + bool is_device_allowed) = 0; /** * @brief Sets counter value that passed for receiving PT UPdate. @@ -292,12 +335,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Get default HMI level for application + * @param device_id device identifier * @param policy_app_id Unique application id * @param default_hmi Default HMI level for application or empty, if value * was not set * @return true, if succedeed, otherwise - false */ - virtual bool GetDefaultHmi(const std::string& policy_app_id, + virtual bool GetDefaultHmi(const std::string& device_id, + const std::string& policy_app_id, std::string* default_hmi) const = 0; /** @@ -341,11 +386,12 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Gets specific application permissions changes since last policy * table update + * @param device_id device identifier * @param policy_app_id Unique application id * @return Permissions changes */ virtual AppPermissions GetAppPermissionsChanges( - const std::string& policy_app_id) = 0; + const std::string& device_id, const std::string& policy_app_id) = 0; /** * @brief Removes specific application permissions changes @@ -355,9 +401,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Return device id, which hosts specific application + * @param device_handle device identifier * @param policy_app_id Application id, which is required to update device id */ virtual std::string& GetCurrentDeviceId( + const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) const = 0; /** @@ -378,10 +426,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Send OnPermissionsUpdated for choosen application + * @param device_id device identifier * @param application_id Unique application id */ virtual void SendNotificationOnPermissionsUpdated( - const std::string& application_id) = 0; + const std::string& device_id, const std::string& application_id) = 0; /** * @brief Marks device as upaired @@ -392,11 +441,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Adds, application to the db or update existed one * run PTU if policy update is necessary for application. + * @param device_id device identifier * @param application_id Unique application id * @param hmi_types application HMI types * @return function that will notify update manager about new application */ virtual StatusNotifier AddApplication( + const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0; @@ -506,12 +557,25 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& policy_app_id) const = 0; /** - * @brief Get information about vehicle - * @return vehicle information + * @brief Gets vehicle data items + * @return Structure with vehicle data items */ - virtual const VehicleInfo GetVehicleInfo() const = 0; + virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems() + const = 0; /** + * @brief Gets removed vehicle data items + * @return Structure with vehicle data items + */ + virtual std::vector<policy_table::VehicleDataItem> + GetRemovedVehicleDataItems() const = 0; + + /** + * @brief Gets copy of current policy table data + * @return policy_table as json object + */ + virtual Json::Value GetPolicyTableData() const = 0; + /** * @brief Get a list of enabled cloud applications * @param enabled_apps List filled with the policy app id of each enabled * cloud application @@ -610,17 +674,20 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @brief Check if an app can send unknown rpc requests to an app service * provider * @param policy_app_id Unique application id - */ + */ virtual bool UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const = 0; /** * @brief OnAppRegisteredOnMobile allows to handle event when application were * succesfully registered on mobile device. - * It will send OnAppPermissionSend notification and will try to start PTU. * + * It will send OnAppPermissionSend notification and will try to start PTU. + * + * @param device_id device identifier * @param application_id registered application. */ - virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0; + virtual void OnAppRegisteredOnMobile(const std::string& device_id, + const std::string& application_id) = 0; virtual void OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) = 0; @@ -655,11 +722,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Assigns new HMI types for specified application + * @param device_handle device identifier * @param application_id Unique application id * @param hmi_types new HMI types list */ - virtual void SetDefaultHmiTypes(const std::string& application_id, - const std::vector<int>& hmi_types) = 0; + virtual void SetDefaultHmiTypes( + const transport_manager::DeviceHandle& device_handle, + const std::string& application_id, + const std::vector<int>& hmi_types) = 0; /** * @brief Gets HMI types @@ -688,11 +758,11 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& application_id) = 0; /** - * @brief Gets all allowed module types - * @param policy_app_id unique identifier of application - * @param modules list of allowed module types - * @return true if application has allowed modules - */ + * @brief Gets all allowed module types + * @param policy_app_id unique identifier of application + * @param modules list of allowed module types + * @return true if application has allowed modules + */ virtual bool GetModuleTypes(const std::string& policy_app_id, std::vector<std::string>* modules) const = 0; |