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 | 174 |
1 files changed, 130 insertions, 44 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 c8074b3528..510e35e699 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ +#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> @@ -41,6 +41,9 @@ #include "policy/policy_table/types.h" #include "policy/policy_listener.h" #include "policy/usage_statistics/statistics_manager.h" +#ifdef SDL_REMOTE_CONTROL +#include "policy/access_remote.h" +#endif // SDL_REMOTE_CONTROL namespace policy { class PolicySettings; @@ -50,12 +53,17 @@ class PolicyManager : public usage_statistics::StatisticsManager { public: virtual ~PolicyManager() {} + /** + * @brief set_listener set new policy listener instance + * @param listener new policy listener + */ virtual void set_listener(PolicyListener* listener) = 0; /** - * Inits Policy Table - * @param file_name Path to preloaded PT file - * @return true if successfully + * @brief Inits Policy Table + * @param file_name path to preloaded PT file + * @param settings pointer to policy init settings + * @return true if init is successful */ virtual bool InitPT(const std::string& file_name, const PolicySettings* settings) = 0; @@ -66,13 +74,13 @@ 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 bool Success of operation + * @return true if successfully */ virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content) = 0; /** - * Resets Policy Table + * @brief Resets Policy Table * @param file_name Path to preloaded PT file * @return true if successfully */ @@ -80,7 +88,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief GetLockScreenIcon allows to obtain lock screen icon url; - * * @return url which point to the resourse where lock screen icon could be *obtained. */ @@ -89,7 +96,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Gets all URLs for sending PTS to from PT itself. * @param service_type Service specifies user of URL - * @return vector of urls + * @param out_end_points output vector of urls */ virtual void GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) = 0; @@ -105,11 +112,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @brief Check if specified RPC for specified application * has permission to be executed in specified HMI Level * and also its permitted params. + * @param device_id Id of device of application * @param app_id Id of application provided during registration * @param hmi_level Current HMI Level of application * @param rpc Name of RPC - * @param CheckPermissionResult containing flag if HMI Level is allowed - * and list of allowed params. + * @param rpc_params List of RPC params + * @param result containing flag if HMI Level is allowed and list of + * allowed params. */ virtual void CheckPermissions(const PTString& device_id, const PTString& app_id, @@ -118,6 +127,12 @@ class PolicyManager : public usage_statistics::StatisticsManager { const RPCParams& rpc_params, CheckPermissionResult& result) = 0; + /** + * @brief Changes isConsentNeeded for app pending permissions, in case + * user set permissions before app activation. + * @param Unique app id + * @param Current permissions for app + */ virtual void CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) = 0; @@ -135,36 +150,38 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual std::string GetPolicyTableStatus() const = 0; /** - * Checks is PT exceeded kilometers + * @brief Checks is PT exceeded kilometers * @param kilometers current kilometers at odometer * @return true if exceeded */ virtual void KmsChanged(int kilometers) = 0; /** - * Increments counter of ignition cycles + * @brief Increments counter of ignition cycles */ virtual void IncrementIgnitionCycles() = 0; /** * @brief Exchange by hmi or mobile request + * @return Current status of policy table */ virtual std::string ForcePTExchange() = 0; /** - * @brief ExchangeByUserRequest + * @brief Exchange by user request + * @return Current status of policy table */ virtual std::string ForcePTExchangeAtUserRequest() = 0; /** - * Gets timeout to wait before next retry updating PT - * If timeout is equal to zero then the retry sequence is not need. + * @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 */ virtual uint32_t NextRetryTimeout() = 0; /** - * Gets timeout to wait until receive response + * @brief Gets timeout to wait until receive response * @return timeout in seconds */ virtual uint32_t TimeoutExchangeMSec() = 0; @@ -177,7 +194,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0; /** - * Handler of exceeding timeout of exchanging policy table + * @brief Handler of exceeding timeout of exchanging policy table */ virtual void OnExceededTimeout() = 0; @@ -187,7 +204,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void OnUpdateStarted() = 0; /** - * @brief Check user consent for mobile device data connection + * @brief Gets user consent for mobile device data connection * @param device_id Unique device identifier * @return status of device consent */ @@ -195,7 +212,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& device_id) const = 0; /** - * @brief Get user consent for application + * @brief Gets user consent for application * @param device_id Device id * @param policy_app_id Unique application id * @param permissions Array of functional groups permissions @@ -216,20 +233,24 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Update Application Policies as reaction * on User allowing/disallowing device this app is running on. + * @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; + /** - * Sets counter value that passed for receiving PT UPdate. + * @brief Sets counter value that passed for receiving PT UPdate. */ virtual void PTUpdatedAt(Counters counter, int value) = 0; /** * @brief Retrieves data from app_policies about app on its registration: - * @param app_id - id of registered app - * @param app_types Section on HMI where app can appear (Navigation, Phone - * etc) + * @param application_id - id of registered app * @param nicknames Synonyms for application + * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone + * etc) */ virtual bool GetInitialAppData(const std::string& application_id, StringArray* nicknames = NULL, @@ -291,7 +312,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { const std::string& language) = 0; /** - * Checks if the application is revoked + * @brief Checks if the application is revoked * @param app_id application id * @return true if application is revoked */ @@ -318,11 +339,15 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual AppPermissions GetAppPermissionsChanges( const std::string& policy_app_id) = 0; + /** + * @brief Removes specific application permissions changes + * @param app_id Unique application id + */ virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0; /** * @brief Return device id, which hosts specific application - * @param Application id, which is required to update device id + * @param policy_app_id Application id, which is required to update device id */ virtual std::string& GetCurrentDeviceId( const std::string& policy_app_id) const = 0; @@ -345,13 +370,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Send OnPermissionsUpdated for choosen application - * @param application_id + * @param application_id Unique application id */ virtual void SendNotificationOnPermissionsUpdated( const std::string& application_id) = 0; /** - * Marks device as upaired + * @brief Marks device as upaired * @param device_id id device */ virtual void MarkUnpairedDevice(const std::string& device_id) = 0; @@ -359,26 +384,31 @@ 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 Application id assigned by Ford to the application + * @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& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0; + /** * @brief Removes unpaired device records and related records from DB - * @param device_ids List of device_id, which should be removed * @return true, if succedeed, otherwise - false */ virtual bool CleanupUnpairedDevices() = 0; /** * @brief Check if app can keep context. + * @param app_id Unique application id + * @return true if app can keep context, otherwise - false */ virtual bool CanAppKeepContext(const std::string& app_id) const = 0; /** * @brief Check if app can steal focus. + * @param app_id Unique application id + * @return true if app can steal focus, otherwise - false */ virtual bool CanAppStealFocus(const std::string& app_id) const = 0; @@ -390,9 +420,9 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual void OnSystemReady() = 0; /** - * @brief GetNotificationNumber - * @param priority - * @return + * @brief Get number of notification by priority + * @param priority Specified priority + * @return notification number */ virtual uint32_t GetNotificationsNumber( const std::string& priority) const = 0; @@ -411,7 +441,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual bool IsPredataPolicy(const std::string& policy_app_id) const = 0; /** - * Returns heart beat timeout + * @brief Returns heart beat timeout * @param app_id application id * @return if timeout was set then value in milliseconds greater zero * otherwise heart beat for specific application isn't set @@ -419,7 +449,8 @@ class PolicyManager : public usage_statistics::StatisticsManager { virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0; /** - * @brief SaveUpdateStatusRequired alows to save update status. + * @brief SaveUpdateStatusRequired allows to save update status. + * @param is_update_needed true if update needed */ virtual void SaveUpdateStatusRequired(bool is_update_needed) = 0; @@ -430,26 +461,28 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief Handler on applications search completed + * @param trigger_ptu contains true if PTU should be triggered */ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0; + /** * @brief Gets request types for application * @param policy_app_id Unique application id - * @return request_types Request types of application + * @return request types of application */ virtual const std::vector<std::string> GetAppRequestTypes( const std::string policy_app_id) const = 0; /** * @brief Get information about vehicle + * @return vehicle information */ virtual const VehicleInfo GetVehicleInfo() const = 0; /** - * @brief OnAppRegisteredOnMobile alows to handle event when application were + * @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 application_id registered application. */ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0; @@ -457,7 +490,6 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief RetrieveCertificate Allows to obtain certificate in order * to start secure connection. - * * @return The certificate in PKCS#7 format. */ virtual std::string RetrieveCertificate() const = 0; @@ -465,11 +497,14 @@ class PolicyManager : public usage_statistics::StatisticsManager { /** * @brief HasCertificate check whether policy table has certificate * int module_config section. - * * @return true in case certificate exists, false otherwise */ virtual bool HasCertificate() const = 0; + /** + * @brief Getter for policy settings + * @return policy settings instance + */ virtual const PolicySettings& get_settings() const = 0; /** @@ -479,6 +514,57 @@ class PolicyManager : public usage_statistics::StatisticsManager { * urls vector */ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0; +#ifdef SDL_REMOTE_CONTROL + /** + * @brief Assigns new HMI types for specified application + * @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; + + /** + * @brief Gets HMI types + * @param application_id ID application + * @param app_types list to save HMI types + * @return true if policy has specific policy for this application + */ + virtual bool GetHMITypes(const std::string& application_id, + std::vector<int>* app_types) = 0; + + /** + * @brief Checks if module for application is present in policy table + * @param app_id id of application + * @param module type + * @return true if module is present, otherwise - false + */ + virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0; + + /** + * @brief Send OnPermissionsChange notification to mobile app + * when it's permissions are changed. + * @param device_id Device on which app is running + * @param application_id ID of app whose permissions are changed + */ + virtual void SendAppPermissionsChanged(const std::string& device_id, + 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 + */ + virtual bool GetModuleTypes(const std::string& policy_app_id, + std::vector<std::string>* modules) const = 0; + + /** + * @brief Setter for access_remote instance + * @param access_remote pointer to new access_remote instance + */ + virtual void set_access_remote( + utils::SharedPtr<AccessRemote> access_remote) = 0; +#endif // SDL_REMOTE_CONTROL /** * @brief Checks if there is existing URL in the EndpointUrls vector with @@ -494,13 +580,13 @@ class PolicyManager : public usage_statistics::StatisticsManager { protected: /** - * Checks is PT exceeded IgnitionCycles + * @brief Checks is PT exceeded IgnitionCycles * @return true if exceeded */ virtual bool ExceededIgnitionCycles() = 0; /** - * Checks is PT exceeded days + * @brief Checks is PT exceeded days * @return true if exceeded */ virtual bool ExceededDays() = 0; @@ -518,4 +604,4 @@ class PolicyManager : public usage_statistics::StatisticsManager { extern "C" policy::PolicyManager* CreateManager(); extern "C" void DeleteManager(policy::PolicyManager*); -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_H_ +#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ |