diff options
author | Conlain Kelly <conlain.k@gmail.com> | 2018-08-10 11:04:43 -0400 |
---|---|---|
committer | Conlain Kelly <conlain.k@gmail.com> | 2018-08-10 11:04:43 -0400 |
commit | 72a64f7419d20bc379d1e050fdaac90b2a6d097f (patch) | |
tree | f5be0f57b4699b2fd30a459c105cfb44c6903508 /src/components/policy/policy_regular | |
parent | 3b5ddfdacb94f4e3f5752bb7165ca668f62f4a5d (diff) | |
parent | 43e53192045daeff8e9e2887c8b67894725240b5 (diff) | |
download | sdl_core-72a64f7419d20bc379d1e050fdaac90b2a6d097f.tar.gz |
Merge branch 'develop' of https://github.com/smartdevicelink/sdl_core into feature/boost_datetime_implementation
Diffstat (limited to 'src/components/policy/policy_regular')
46 files changed, 278 insertions, 241 deletions
diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt index c7b9c068b9..225e99329a 100644 --- a/src/components/policy/policy_regular/CMakeLists.txt +++ b/src/components/policy/policy_regular/CMakeLists.txt @@ -71,11 +71,6 @@ set(PATHS ) collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") -if (NOT REMOTE_CONTROL) - list(REMOVE_ITEM SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/access_remote_impl.cc) -endif() - set(LIBRARIES ConfigProfile policy_struct diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h index 933690dc49..dbe317667a 100644 --- a/src/components/policy/policy_regular/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include <map> #include "policy/policy_table/types.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "policy/access_remote.h" #include "policy/cache_manager.h" @@ -46,7 +46,7 @@ namespace policy { class AccessRemoteImpl : public AccessRemote { public: AccessRemoteImpl(); - explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -139,7 +139,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr<CacheManager> cache_; + std::shared_ptr<CacheManager> cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index 4a0a09db83..a28f1b3461 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -35,7 +35,6 @@ #include <map> -#include "utils/shared_ptr.h" #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -216,7 +215,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -723,7 +722,7 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; - utils::SharedPtr<policy_table::Table> pt() const { + std::shared_ptr<policy_table::Table> pt() const { return pt_; } @@ -775,14 +774,14 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; bool update_required; typedef std::set<std::string> UnpairedDevices; UnpairedDevices is_unpaired_; - mutable sync_primitives::Lock cache_lock_; + mutable sync_primitives::RecursiveLock cache_lock_; sync_primitives::Lock unpaired_lock_; typedef std::map<std::string, Permissions> AppCalculatedPermissions; diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h index 3dd2953865..10a6ea7f89 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h @@ -36,7 +36,6 @@ #include <string> #include <vector> -#include "utils/shared_ptr.h" #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" @@ -222,7 +221,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -670,12 +669,12 @@ class CacheManagerInterface { virtual std::string GetCertificate() const = 0; /** - * @brief pt allows to obtain SharedPtr to PT. + * @brief pt allows to obtain std::shared_ptr to PT. * Used ONLY in Unit tests - * @return SharedPTR to PT + * @return std::shared_ptr to PT * */ - virtual utils::SharedPtr<policy_table::Table> pt() const = 0; + virtual std::shared_ptr<policy_table::Table> pt() const = 0; /** * @brief OnDeviceSwitching Processes existing policy permissions for devices @@ -687,7 +686,7 @@ class CacheManagerInterface { const std::string& device_id_to) = 0; }; -typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h index 7f27ab2676..3ca0f93ebd 100644 --- a/src/components/policy/policy_regular/include/policy/policy_helper.h +++ b/src/components/policy/policy_regular/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -82,8 +82,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); bool operator()(const AppPoliciesValueType& app_policy); private: @@ -131,8 +131,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> snapshot_; }; /* diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 8379cf4d82..51d4ee88aa 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -37,7 +37,6 @@ #include <list> #include <cstdint> -#include "utils/shared_ptr.h" #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.h" @@ -47,10 +46,8 @@ #include "policy/usage_statistics/statistics_manager.h" #include "policy/policy_helper.h" #include "utils/timer.h" -#ifdef SDL_REMOTE_CONTROL #include "policy/access_remote.h" #include "policy/access_remote_impl.h" -#endif // SDL_REMOTE_CONTROL namespace policy_table = rpc::policy_table_interface_base; @@ -448,7 +445,6 @@ class PolicyManagerImpl : public PolicyManager { const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE; -#ifdef SDL_REMOTE_CONTROL /** * @brief Assigns new HMI types for specified application * @param application_id Unique application id @@ -470,7 +466,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Setter for access_remote instance * @param access_remote pointer to new access_remote instance */ - void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -483,7 +479,6 @@ class PolicyManagerImpl : public PolicyManager { * @param application_id Unique id of application */ void OnPrimaryGroupsChanged(const std::string& application_id); -#endif // SDL_REMOTE_CONTROL /** * @brief Removes consent for application functional group @@ -675,7 +670,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> Parse( const BinaryMessage& pt_content); #else /** @@ -683,7 +678,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> ParseArray( + virtual std::shared_ptr<policy_table::Table> ParseArray( const BinaryMessage& pt_content); #endif @@ -709,8 +704,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ void CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); /** * @brief Fill structure to be sent with OnPermissionsChanged notification @@ -807,7 +802,7 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; /** @@ -816,7 +811,6 @@ class PolicyManagerImpl : public PolicyManager { void RetrySequence(); private: -#ifdef SDL_REMOTE_CONTROL /** * @brief Get resulting RPCs permissions for application which started on * specific device @@ -853,10 +847,10 @@ class PolicyManagerImpl : public PolicyManager { */ bool GetModuleTypes(const std::string& policy_app_id, std::vector<std::string>* modules) const OVERRIDE; -#endif // SDL_REMOTE_CONTROL - /** - * @brief pointer to policy table listener for callbacks - */ + + /** + * @brief pointer to policy table listener for callbacks + */ PolicyListener* listener_; /** @@ -868,12 +862,11 @@ class PolicyManagerImpl : public PolicyManager { * @brief pointer to CacheManagerInterface instance for getting policy data */ CacheManagerInterfaceSPtr cache_; -#ifdef SDL_REMOTE_CONTROL + /** * @brief pointer to AccessRemote instance for working with RC applications */ - utils::SharedPtr<AccessRemote> access_remote_; -#endif + std::shared_ptr<AccessRemote> access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_regular/include/policy/policy_table.h b/src/components/policy/policy_regular/include/policy/policy_table.h index afee8a34e4..353cdda871 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table.h +++ b/src/components/policy/policy_regular/include/policy/policy_table.h @@ -33,7 +33,6 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ -#include "utils/shared_ptr.h" #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" @@ -42,7 +41,7 @@ namespace policy { class PolicyTable { public: PolicyTable(); - explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +49,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h index dbe00d0f9c..8d81a742e4 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h @@ -66,6 +66,7 @@ enum Parameter { P_SPEED, P_ENGINETORQUE, P_EXTERNALTEMPERATURE, + P_TURNSIGNAL, P_FUELLEVEL, P_FUELLEVEL_STATE, P_HEADLAMPSTATUS, @@ -77,6 +78,7 @@ enum Parameter { P_VIN, P_ACCPEDALPOSITION, P_BELTSTATUS, + P_ELECTRONICPARKBRAKESTATUS, P_DRIVERBRAKING, P_PRNDL, P_RPM, @@ -151,10 +153,7 @@ bool IsValidEnum(Input val); const char* EnumToJsonString(Input val); bool EnumFromJsonString(const std::string& literal, Input* result); -enum ModuleType { - MT_CLIMATE, - MT_RADIO, -}; +enum ModuleType { MT_CLIMATE, MT_RADIO, MT_SEAT }; bool IsValidEnum(ModuleType val); const char* EnumToJsonString(ModuleType val); bool EnumFromJsonString(const std::string& literal, ModuleType* result); diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h index 8197247907..ebfbb7f29f 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table/types.h +++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h @@ -98,11 +98,9 @@ typedef Array<Enum<RequestType>, 0, 255> RequestTypes; typedef Strings RequestSubTypes; -#ifdef SDL_REMOTE_CONTROL typedef Map<Strings, 0, 255> RemoteRpcs; typedef Map<RemoteRpcs, 0, 255> AccessModules; typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes; -#endif // SDL_REMOTE_CONTROL typedef AppHMIType AppHmiType; typedef std::vector<AppHMIType> AppHmiTypes; @@ -145,9 +143,7 @@ struct ApplicationParams : PolicyBase { Optional<Integer<uint16_t, 0, 65225> > memory_kb; Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms; Optional<String<0, 255> > certificate; -#ifdef SDL_REMOTE_CONTROL mutable Optional<ModuleTypes> moduleType; -#endif // SDL_REMOTE_CONTROL public: ApplicationParams(); @@ -163,9 +159,7 @@ struct ApplicationParams : PolicyBase { private: bool Validate() const; -#ifdef SDL_REMOTE_CONTROL bool ValidateModuleTypes() const; -#endif // SDL_REMOTE_CONTROL }; struct ApplicationPoliciesSection : CompositeType { diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h index e0fc808e2f..276a0a5dca 100644 --- a/src/components/policy/policy_regular/include/policy/policy_types.h +++ b/src/components/policy/policy_regular/include/policy/policy_types.h @@ -39,7 +39,8 @@ #include <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" +#include <memory> + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +80,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h index 08bd6d4923..378a294532 100644 --- a/src/components/policy/policy_regular/include/policy/pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/pt_representation.h @@ -35,9 +35,11 @@ #include <vector> #include <string> +#include <memory> #include "policy/policy_types.h" #include "policy/policy_table/types.h" #include "policy/policy_settings.h" +#include "utils/macro.h" namespace policy { namespace policy_table = rpc::policy_table_interface_base; @@ -208,7 +210,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h index e39e0d5873..0e9302dfac 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h @@ -84,7 +84,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const; virtual bool Save(const policy_table::Table& table); bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = NULL, @@ -97,7 +97,6 @@ class SQLPTRepresentation : public virtual PTRepresentation { } #endif // BUILD_TESTS protected: -#ifdef SDL_REMOTE_CONTROL enum TypeAccess { kAllowed, kManual }; bool GatherModuleType(const std::string& app_id, policy_table::ModuleTypes* module_types) const; @@ -112,7 +111,6 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool SaveAccessModule(TypeAccess access, const policy_table::AccessModules& modules); bool SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs); -#endif // SDL_REMOTE_CONTROL virtual void GatherModuleMeta(policy_table::ModuleMeta* meta) const; virtual void GatherModuleConfig(policy_table::ModuleConfig* config) const; diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h index a68d986d10..52d5b92b8a 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr<Status> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -198,17 +198,17 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h index e118f9974f..b9da90f929 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h @@ -33,7 +33,6 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ -#include "utils/shared_ptr.h" #include "policy/policy_types.h" #include "policy/status.h" @@ -55,14 +54,14 @@ class UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - virtual void SetNextStatus(utils::SharedPtr<Status> status) = 0; + virtual void SetNextStatus(std::shared_ptr<Status> status) = 0; /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - virtual void SetPostponedStatus(utils::SharedPtr<Status> status) = 0; + virtual void SetPostponedStatus(std::shared_ptr<Status> status) = 0; /** * @brief Sets listener pointer * @param listener Pointer to policy listener implementation @@ -112,7 +111,7 @@ class UpdateStatusManagerInterface { virtual void OnPolicyInit(bool is_update_required) = 0; }; -typedef utils::SharedPtr<UpdateStatusManagerInterface> +typedef std::shared_ptr<UpdateStatusManagerInterface> UpdateStatusManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h index 1e263ec9df..72ae5fd9e0 100644 --- a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include <ctime> #include "policy/usage_statistics/statistics_manager.h" #include "policy/usage_statistics/app_stopwatch.h" -#include "utils/shared_ptr.h" + #include "utils/timer.h" #include "utils/macro.h" @@ -46,18 +46,18 @@ using timer::Timer; class GlobalCounter { public: - GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type); void operator++() const; @@ -65,12 +65,12 @@ class AppCounter { private: std::string app_id_; AppCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type); void Update(const std::string& new_info) const; @@ -78,14 +78,14 @@ class AppInfo { private: std::string app_id_; AppInfoId info_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, std::uint32_t timeout); void Start(AppStopwatchId stopwatch_type) OVERRIDE; @@ -96,7 +96,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); diff --git a/src/components/policy/policy_regular/policy_table_interface_ext.xml b/src/components/policy/policy_regular/policy_table_interface_ext.xml index 93edce3e3a..393a419139 100644 --- a/src/components/policy/policy_regular/policy_table_interface_ext.xml +++ b/src/components/policy/policy_regular/policy_table_interface_ext.xml @@ -27,6 +27,7 @@ <element name="speed" /> <element name="engineTorque" /> <element name="externalTemperature" /> + <element name="turnSignal" /> <element name="fuelLevel" /> <element name="fuelLevel_State" /> <element name="headLampStatus" /> @@ -38,6 +39,7 @@ <element name="vin" /> <element name="accPedalPosition" /> <element name="beltStatus" /> + <element name="electronicParkBrakeStatus" /> <element name="driverBraking" /> <element name="prndl" /> <element name="rpm" /> diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f99b226f2e..f743a4d56e 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 99621269e2..0a36251fda 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -103,8 +103,7 @@ CacheManager::CacheManager() : CacheManagerInterface() , pt_(new policy_table::Table) , backup_(new SQLPTRepresentation()) - , update_required(false) - , cache_lock_(true) { + , update_required(false) { LOG4CXX_AUTO_TRACE(logger_); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); @@ -934,8 +933,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1029,10 +1028,10 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); - snapshot_ = new policy_table::Table(); + snapshot_ = std::make_shared<policy_table::Table>(); // Copy all members of policy table except messages in consumer friendly // messages @@ -1426,7 +1425,7 @@ bool CacheManager::Init(const std::string& file_name, result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " << std::boolalpha << result); diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 796dd25ec4..bae9fceb49 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -121,8 +121,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot) + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot) : pm_(pm), update_(update), snapshot_(snapshot) {} bool policy::CheckAppPolicy::HasRevokedGroups( diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 5462601c35..f4b6f0ae03 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -44,17 +44,14 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" -#ifdef SDL_REMOTE_CONTROL #include "policy/access_remote.h" #include "policy/access_remote_impl.h" -#endif // SDL_REMOTE_CONTROL policy::PolicyManager* CreateManager() { return new policy::PolicyManagerImpl(); @@ -76,10 +73,8 @@ PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() , listener_(NULL) , cache_(new CacheManager) -#ifdef SDL_REMOTE_CONTROL - , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) -#endif // SDL_REMOTE_CONTROL + , access_remote_( + new AccessRemoteImpl(std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(kDefaultRetryTimeoutInMSec) , retry_sequence_index_(0) , timer_retry_sequence_("Retry sequence timer", @@ -89,8 +84,7 @@ PolicyManagerImpl::PolicyManagerImpl() , retry_sequence_url_(0, 0, "") , wrong_ptu_update_received_(false) , send_on_update_sent_out_(false) - , trigger_ptu_(false) { -} + , trigger_ptu_(false) {} void PolicyManagerImpl::set_listener(PolicyListener* listener) { listener_ = listener; @@ -99,21 +93,21 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { #ifdef USE_HMI_PTU_DECRYPTION -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; Json::Reader reader; if (reader.parse(json.c_str(), value)) { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::make_shared<policy_table::Table>(); } } #else -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -122,12 +116,12 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( // For PT Update received from SDL Server. if (value["data"].size() != 0) { Json::Value data = value["data"]; - return new policy_table::Table(&data[0]); + return std::make_shared<policy_table::Table>(&data[0]); } else { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -160,11 +154,11 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Assuemes Policy Table was parsed, formatted, and/or decrypted by // the HMI after system request before calling OnReceivedPolicyUpdate // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); #else // Message Received from server unecnrypted with PTU in first element // of 'data' array. No Parsing was done by HMI. - utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content); + std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is 0."); @@ -193,7 +187,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -244,8 +238,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } void PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -280,7 +274,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, bool PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -423,12 +417,16 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, "CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); -#ifdef SDL_REMOTE_CONTROL ApplicationOnDevice who = {device_id, app_id}; - const policy_table::Strings& groups = access_remote_->GetGroups(who); -#else // SDL_REMOTE_CONTROL - const policy_table::Strings& groups = cache_->GetGroups(app_id); -#endif // SDL_REMOTE_CONTROL + policy_table::Strings groups; + if (access_remote_->IsAppRemoteControl(who)) { + groups = access_remote_->GetGroups(who); + LOG4CXX_INFO(logger_, + "CheckPermissions for " << app_id << " and rpc " << rpc + << " for " << hmi_level << " level."); + } else { + groups = cache_->GetGroups(app_id); + } cache_->CheckPermissions(groups, hmi_level, rpc, result); if (cache_->IsApplicationRevoked(app_id)) { @@ -484,13 +482,11 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( std::string default_hmi; default_hmi = "NONE"; -#ifdef SDL_REMOTE_CONTROL const ApplicationOnDevice who = {device_id, application_id}; if (access_remote_->IsAppRemoteControl(who)) { listener()->OnPermissionsUpdated(application_id, notification_data); return; } -#endif // SDL_REMOTE_CONTROL listener()->OnPermissionsUpdated( application_id, notification_data, default_hmi); @@ -728,14 +724,15 @@ void PolicyManagerImpl::GetPermissionsForApp( } FunctionalIdType group_types; -#ifdef SDL_REMOTE_CONTROL - allowed_by_default = false; - bool ret = access_remote_->GetPermissionsForApp( - device_id, policy_app_id, group_types); -#else - bool ret = - cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); -#endif // REMOTE_CONTROL + const ApplicationOnDevice who = {device_id, app_id_to_check}; + bool ret = false; + if (access_remote_->IsAppRemoteControl(who)) { + allowed_by_default = false; + ret = access_remote_->GetPermissionsForApp( + device_id, policy_app_id, group_types); + } else { + ret = cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); + } if (!ret) { LOG4CXX_WARN(logger_, @@ -809,7 +806,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -1068,11 +1065,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, - device_consent); + return std::make_shared<CallStatusChange>(update_status_manager_, + device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -1167,7 +1164,7 @@ void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { void PolicyManagerImpl::set_cache_manager( CacheManagerInterface* cache_manager) { - cache_ = cache_manager; + cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager); } void PolicyManagerImpl::RetrySequence() { @@ -1187,7 +1184,6 @@ void PolicyManagerImpl::RetrySequence() { timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic); } -#ifdef SDL_REMOTE_CONTROL void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id, const std::vector<int>& hmi_types) { LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); @@ -1290,9 +1286,8 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } -#endif // SDL_REMOTE_CONTROL } // namespace policy diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index c5c6e3e132..b0fa5739da 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc index 1dae9c5f96..2f5ba69ad7 100644 --- a/src/components/policy/policy_regular/src/policy_table/enums.cc +++ b/src/components/policy/policy_regular/src/policy_table/enums.cc @@ -119,6 +119,8 @@ bool IsValidEnum(Parameter val) { return true; case P_EXTERNALTEMPERATURE: return true; + case P_TURNSIGNAL: + return true; case P_FUELLEVEL: return true; case P_FUELLEVEL_STATE: @@ -141,6 +143,8 @@ bool IsValidEnum(Parameter val) { return true; case P_BELTSTATUS: return true; + case P_ELECTRONICPARKBRAKESTATUS: + return true; case P_DRIVERBRAKING: return true; case P_PRNDL: @@ -181,6 +185,8 @@ const char* EnumToJsonString(Parameter val) { return "engineTorque"; case P_EXTERNALTEMPERATURE: return "externalTemperature"; + case P_TURNSIGNAL: + return "turnSignal"; case P_FUELLEVEL: return "fuelLevel"; case P_FUELLEVEL_STATE: @@ -203,6 +209,8 @@ const char* EnumToJsonString(Parameter val) { return "accPedalPosition"; case P_BELTSTATUS: return "beltStatus"; + case P_ELECTRONICPARKBRAKESTATUS: + return "electronicParkBrakeStatus"; case P_DRIVERBRAKING: return "driverBraking"; case P_PRNDL: @@ -247,6 +255,9 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) { } else if ("externalTemperature" == literal) { *result = P_EXTERNALTEMPERATURE; return true; + } else if ("turnSignal" == literal) { + *result = P_TURNSIGNAL; + return true; } else if ("fuelLevel" == literal) { *result = P_FUELLEVEL; return true; @@ -280,6 +291,9 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) { } else if ("beltStatus" == literal) { *result = P_BELTSTATUS; return true; + } else if ("electronicParkBrakeStatus" == literal) { + *result = P_ELECTRONICPARKBRAKESTATUS; + return true; } else if ("driverBraking" == literal) { *result = P_DRIVERBRAKING; return true; @@ -621,13 +635,14 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) { } } -#ifdef SDL_REMOTE_CONTROL bool IsValidEnum(ModuleType val) { switch (val) { case MT_CLIMATE: return true; case MT_RADIO: return true; + case MT_SEAT: + return true; default: return false; } @@ -638,6 +653,8 @@ const char* EnumToJsonString(ModuleType val) { return "CLIMATE"; case MT_RADIO: return "RADIO"; + case MT_SEAT: + return "SEAT"; default: return ""; } @@ -650,11 +667,13 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) { } else if ("RADIO" == literal) { *result = MT_RADIO; return true; + } else if ("SEAT" == literal) { + *result = MT_SEAT; + return true; } else { return false; } } -#endif // SDL_REMOTE_CONTROL const std::string kDefaultApp = "default"; const std::string kPreDataConsentApp = "pre_DataConsent"; diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc index c4846c0d40..c983e4f12b 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -168,11 +168,7 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , memory_kb(impl::ValueMember(value__, "memory_kb"), 0) , heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")) , certificate(impl::ValueMember(value__, "certificate"), "not_specified") -#ifdef SDL_REMOTE_CONTROL - , moduleType(impl::ValueMember(value__, "moduleType")) -#endif // SDL_REMOTE_CONTROL -{ -} + , moduleType(impl::ValueMember(value__, "moduleType")) {} Json::Value ApplicationParams::ToJsonValue() const { Json::Value result__(PolicyBase::ToJsonValue()); @@ -184,9 +180,7 @@ Json::Value ApplicationParams::ToJsonValue() const { impl::WriteJsonField("memory_kb", memory_kb, &result__); impl::WriteJsonField( "heart_beat_timeout_ms", heart_beat_timeout_ms, &result__); -#ifdef SDL_REMOTE_CONTROL impl::WriteJsonField("moduleType", moduleType, &result__); -#endif // SDL_REMOTE_CONTROL return result__; } @@ -215,11 +209,9 @@ bool ApplicationParams::is_valid() const { if (!certificate.is_valid()) { return false; } -#ifdef SDL_REMOTE_CONTROL if (!moduleType.is_valid()) { return false; } -#endif // SDL_REMOTE_CONTROL return Validate(); } @@ -255,11 +247,9 @@ bool ApplicationParams::struct_empty() const { if (certificate.is_initialized()) { return false; } -#ifdef SDL_REMOTE_CONTROL if (moduleType.is_initialized()) { return false; } -#endif // SDL_REMOTE_CONTROL return true; } @@ -295,11 +285,9 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { if (!certificate.is_valid()) { certificate.ReportErrors(&report__->ReportSubobject("certificate")); } -#ifdef SDL_REMOTE_CONTROL if (!moduleType.is_valid()) { moduleType.ReportErrors(&report__->ReportSubobject("moduleType")); } -#endif // SDL_REMOTE_CONTROL } void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { @@ -311,9 +299,7 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { memory_kb.SetPolicyTableType(pt_type); heart_beat_timeout_ms.SetPolicyTableType(pt_type); certificate.SetPolicyTableType(pt_type); -#ifdef SDL_REMOTE_CONTROL moduleType.SetPolicyTableType(pt_type); -#endif // SDL_REMOTE_CONTROL } // RpcParameters methods diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc index e760293ea6..714dfaae5a 100644 --- a/src/components/policy/policy_regular/src/policy_table/validation.cc +++ b/src/components/policy/policy_regular/src/policy_table/validation.cc @@ -147,7 +147,6 @@ bool ApplicationPoliciesSection::Validate() const { return true; } -#ifdef SDL_REMOTE_CONTROL bool ApplicationParams::ValidateModuleTypes() const { // moduleType is optional so see Optional<T>::is_valid() bool is_initialized = moduleType->is_initialized(); @@ -181,11 +180,6 @@ bool ApplicationParams::ValidateModuleTypes() const { bool ApplicationParams::Validate() const { return ValidateModuleTypes(); } -#else // SDL_REMOTE_CONTROL -bool ApplicationParams::Validate() const { - return true; -} -#endif // SDL_REMOTE_CONTROL bool RpcParameters::Validate() const { return true; diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index 043a5e54d4..8efe2fb59e 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -483,10 +483,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); @@ -723,7 +723,6 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( if (!GatherAppGroup(app_id, ¶ms.groups)) { return false; } -#ifdef SDL_REMOTE_CONTROL bool denied = false; if (!GatherRemoteControlDenied(app_id, &denied)) { return false; @@ -733,7 +732,6 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( return false; } } -#endif // SDL_REMOTE_CONTROL if (!GatherNickName(app_id, &*params.nicknames)) { return false; } @@ -905,12 +903,10 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); return false; } -#ifdef SDL_REMOTE_CONTROL if (!query_delete.Exec(sql_pt::kDeleteModuleTypes)) { LOG4CXX_WARN(logger_, "Incorrect delete from module_type."); return false; } -#endif // SDL_REMOTE_CONTROL if (!query_delete.Exec(sql_pt::kDeleteApplication)) { LOG4CXX_WARN(logger_, "Incorrect delete from application."); return false; @@ -998,13 +994,11 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( if (!SaveAppGroup(app.first, app.second.groups)) { return false; } -#ifdef SDL_REMOTE_CONTROL bool denied = !app.second.moduleType->is_initialized(); if (!SaveRemoteControlDenied(app.first, denied) || !SaveModuleType(app.first, *app.second.moduleType)) { return false; } -#endif // SDL_REMOTE_CONTROL if (!SaveNickname(app.first, *app.second.nicknames)) { return false; } @@ -1671,8 +1665,6 @@ bool SQLPTRepresentation::GatherAppGroup( return true; } -#ifdef SDL_REMOTE_CONTROL - bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, bool* denied) const { LOG4CXX_AUTO_TRACE(logger_); @@ -1862,7 +1854,6 @@ bool SQLPTRepresentation::GatherRemoteRpc( } return true; } -#endif // SDL_REMOTE_CONTROL bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_revoked, diff --git a/src/components/policy/policy_regular/src/status.cc b/src/components/policy/policy_regular/src/status.cc index 8d65c606d0..00a6a95af3 100644 --- a/src/components/policy/policy_regular/src/status.cc +++ b/src/components/policy/policy_regular/src/status.cc @@ -32,7 +32,6 @@ #include "policy/status.h" #include "policy/update_status_manager_interface.h" -#include "utils/make_shared.h" policy::UpToDateStatus::UpToDateStatus() : Status("UP_TO_DATE", policy::PolicyTableStatus::StatusUpToDate) {} @@ -44,7 +43,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManagerInterface* manager, case kOnResetPolicyTableRequireUpdate: case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,17 +58,17 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -88,22 +87,22 @@ void policy::UpdatingStatus::ProcessEvent( switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 941113c753..66d21dea54 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -33,7 +33,6 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" namespace policy { @@ -41,7 +40,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) {} @@ -55,11 +54,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_regular/src/usage_statistics/counter.cc b/src/components/policy/policy_regular/src/usage_statistics/counter.cc index a0b6b689d4..ed16fa3e8d 100644 --- a/src/components/policy/policy_regular/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_regular/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -52,7 +52,7 @@ void GlobalCounter::operator++() const { } } -AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, +AppCounter::AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -65,7 +65,7 @@ void AppCounter::operator++() const { } } -AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, +AppInfo::AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -79,7 +79,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -90,7 +90,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) diff --git a/src/components/policy/policy_regular/test/CMakeLists.txt b/src/components/policy/policy_regular/test/CMakeLists.txt index 62ff691f83..bd6af96867 100644 --- a/src/components/policy/policy_regular/test/CMakeLists.txt +++ b/src/components/policy/policy_regular/test/CMakeLists.txt @@ -45,11 +45,6 @@ include_directories( ) collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}") -if (NOT REMOTE_CONTROL) - list (REMOVE_ITEM SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/access_remote_impl_test.cc - ) -endif () set(LIBRARIES gmock diff --git a/src/components/policy/policy_regular/test/PTU.json b/src/components/policy/policy_regular/test/PTU.json index 7d6837f94e..2f4735dd66 100644 --- a/src/components/policy/policy_regular/test/PTU.json +++ b/src/components/policy/policy_regular/test/PTU.json @@ -296,6 +296,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +309,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +322,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +335,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +356,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +376,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +396,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,6 +415,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/PTU2.json b/src/components/policy/policy_regular/test/PTU2.json index 7a5c29410c..806ab8bcc0 100644 --- a/src/components/policy/policy_regular/test/PTU2.json +++ b/src/components/policy/policy_regular/test/PTU2.json @@ -296,6 +296,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +309,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +322,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +335,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +356,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +376,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +396,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,6 +415,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/PTU3.json b/src/components/policy/policy_regular/test/PTU3.json index 1b3340ec8c..28396be29a 100644 --- a/src/components/policy/policy_regular/test/PTU3.json +++ b/src/components/policy/policy_regular/test/PTU3.json @@ -296,6 +296,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +309,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +322,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +335,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +356,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +376,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +396,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,6 +415,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/PTU4.json b/src/components/policy/policy_regular/test/PTU4.json index 9aa04dd8ba..4592e228df 100644 --- a/src/components/policy/policy_regular/test/PTU4.json +++ b/src/components/policy/policy_regular/test/PTU4.json @@ -296,6 +296,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +309,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +322,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +335,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +356,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +376,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +396,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,6 +415,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc index d086144d86..f79bb683f8 100644 --- a/src/components/policy/policy_regular/test/access_remote_impl_test.cc +++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc @@ -37,7 +37,7 @@ namespace policy { TEST(AccessRemoteImplTest, CheckModuleType) { AccessRemoteImpl access_remote; - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); // No application EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); @@ -81,7 +81,7 @@ TEST(AccessRemoteImplTest, GetGroups) { ApplicationOnDevice who = {"dev1", "1234"}; access_remote.hmi_types_[who].push_back(policy_table::AHT_REMOTE_CONTROL); - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); policy_table::ApplicationPolicies& apps = access_remote.cache_->pt_->policy_table.app_policies_section.apps; apps["1234"].groups.push_back("group_default"); diff --git a/src/components/policy/policy_regular/test/counter_test.cc b/src/components/policy/policy_regular/test/counter_test.cc index 2c0ab73c0b..d11bcec2ac 100644 --- a/src/components/policy/policy_regular/test/counter_test.cc +++ b/src/components/policy/policy_regular/test/counter_test.cc @@ -53,7 +53,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -67,7 +67,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -82,7 +82,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -96,7 +96,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -110,7 +110,7 @@ TEST( TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -123,7 +123,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -138,7 +138,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerAddMethod, AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); @@ -155,7 +155,7 @@ TEST(StatisticsManagerAddMethod, TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp"); hmi_full_stopwatch.Start(SECONDS_HMI_FULL); @@ -171,7 +171,7 @@ TEST( StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager> >(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); diff --git a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h index 8a47e7ca97..72f183175c 100644 --- a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h +++ b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h @@ -76,7 +76,7 @@ class MockPTRepresentation : virtual public PTRepresentation { MOCK_METHOD0(Close, bool()); MOCK_METHOD0(Clear, bool()); MOCK_METHOD0(Drop, bool()); - MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); MOCK_METHOD1(SaveUpdateRequired, void(bool value)); diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index 08a939ecda..867cf5b2ef 100644 --- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc @@ -51,11 +51,10 @@ #include "utils/macro.h" #include "utils/file_system.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/gen_hash.h" -#ifdef SDL_REMOTE_CONTROL #include "policy/mock_access_remote.h" -#endif // SDL_REMOTE_CONTROL + using ::testing::ReturnRef; using ::testing::DoAll; using ::testing::SetArgReferee; @@ -146,20 +145,15 @@ class PolicyManagerImplTest : public ::testing::Test { MockCacheManagerInterface* cache_manager; NiceMock<MockPolicyListener> listener; const std::string device_id; -#ifdef SDL_REMOTE_CONTROL - utils::SharedPtr<access_remote_test::MockAccessRemote> access_remote; -#endif // SDL_REMOTE_CONTROL + std::shared_ptr<access_remote_test::MockAccessRemote> access_remote; void SetUp() OVERRIDE { manager = new PolicyManagerImpl(); manager->set_listener(&listener); cache_manager = new MockCacheManagerInterface(); manager->set_cache_manager(cache_manager); - -#ifdef SDL_REMOTE_CONTROL - access_remote = new access_remote_test::MockAccessRemote(); + access_remote = std::shared_ptr<access_remote_test::MockAccessRemote>(); manager->set_access_remote(access_remote); -#endif // SDL_REMOTE_CONTROL } void TearDown() OVERRIDE { @@ -358,7 +352,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { // Get cache ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); // Get table_snapshot - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Set functional groupings from policy table input_functional_groupings = table->policy_table.functional_groupings; } @@ -726,8 +720,8 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) { const std::string json = table.toStyledString(); ::policy::BinaryMessage msg(json.begin(), json.end()); - utils::SharedPtr<policy_table::Table> snapshot = - utils::MakeShared<policy_table::Table>(update.policy_table); + std::shared_ptr<policy_table::Table> snapshot = + std::make_shared<policy_table::Table>(update.policy_table); // Assert EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot)); EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true)); @@ -967,7 +961,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) { // Arrange ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Get FunctionalGroupings policy_table::FunctionalGroupings& fc = table->policy_table.functional_groupings; @@ -1259,7 +1253,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT("sdl_preloaded_pt.json"); GetPTU("valid_sdl_pt_update.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo(); @@ -1340,7 +1334,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT("sdl_preloaded_pt.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; pt->SetPolicyTableType(type1); diff --git a/src/components/policy/policy_regular/test/ptu2_requestType.json b/src/components/policy/policy_regular/test/ptu2_requestType.json index e127b2fad6..2a05a94f8b 100644 --- a/src/components/policy/policy_regular/test/ptu2_requestType.json +++ b/src/components/policy/policy_regular/test/ptu2_requestType.json @@ -416,6 +416,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -432,6 +433,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -448,6 +450,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -464,6 +467,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -488,6 +492,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -511,6 +516,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -534,6 +540,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -556,6 +563,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/ptu_requestType.json b/src/components/policy/policy_regular/test/ptu_requestType.json index bd6a86dac3..b0d9117568 100644 --- a/src/components/policy/policy_regular/test/ptu_requestType.json +++ b/src/components/policy/policy_regular/test/ptu_requestType.json @@ -416,6 +416,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -432,6 +433,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -448,6 +450,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -464,6 +467,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -488,6 +492,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -511,6 +516,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -534,6 +540,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -556,6 +563,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json index ced0a9d603..59e3f947c3 100644 --- a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json +++ b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json @@ -297,6 +297,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -309,6 +310,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -321,6 +323,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -333,6 +336,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -353,6 +357,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -372,6 +377,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -391,6 +397,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -409,6 +416,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/sdl_pt_first_update.json b/src/components/policy/policy_regular/test/sdl_pt_first_update.json index f8be46d2b5..7b882c6ceb 100644 --- a/src/components/policy/policy_regular/test/sdl_pt_first_update.json +++ b/src/components/policy/policy_regular/test/sdl_pt_first_update.json @@ -1431,6 +1431,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1443,6 +1444,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1455,6 +1457,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1467,6 +1470,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1612,6 +1616,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1629,6 +1634,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1646,6 +1652,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1662,6 +1669,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/sdl_pt_second_update.json b/src/components/policy/policy_regular/test/sdl_pt_second_update.json index fe7b036f94..7d90275328 100644 --- a/src/components/policy/policy_regular/test/sdl_pt_second_update.json +++ b/src/components/policy/policy_regular/test/sdl_pt_second_update.json @@ -1431,6 +1431,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1443,6 +1444,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1455,6 +1457,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1467,6 +1470,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1612,6 +1616,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1629,6 +1634,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1646,6 +1652,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1662,6 +1669,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/sdl_pt_update.json b/src/components/policy/policy_regular/test/sdl_pt_update.json index e013243760..909e4d5238 100644 --- a/src/components/policy/policy_regular/test/sdl_pt_update.json +++ b/src/components/policy/policy_regular/test/sdl_pt_update.json @@ -1433,6 +1433,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1445,6 +1446,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1457,6 +1459,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1469,6 +1472,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1590,6 +1594,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1607,6 +1612,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1624,6 +1630,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1640,6 +1647,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc index a5f3741331..7d192515dc 100644 --- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc @@ -47,8 +47,7 @@ #include "json/writer.h" #include "json/reader.h" #include "rpc_base/rpc_base.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + #include "utils/file_system.h" #include "utils/sqlite_wrapper/sql_database.h" @@ -78,12 +77,12 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, static const std::string kDatabaseName; static const std::string kAppStorageFolder; // Gtest can show message that this object doesn't destroyed - std::auto_ptr<NiceMock<MockPolicySettings> > policy_settings_; + std::unique_ptr<NiceMock<MockPolicySettings> > policy_settings_; void SetUp() OVERRIDE { file_system::CreateDirectory(kAppStorageFolder); reps = new SQLPTRepresentation; - policy_settings_ = std::auto_ptr<NiceMock<MockPolicySettings> >( + policy_settings_ = std::unique_ptr<NiceMock<MockPolicySettings> >( new NiceMock<MockPolicySettings>()); ON_CALL(*policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); @@ -1517,7 +1516,7 @@ TEST_F(SQLPTRepresentationTest, ASSERT_TRUE(reps->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); // Remove fields which must be absent in snapshot table["policy_table"]["consumer_friendly_messages"].removeMember("messages"); diff --git a/src/components/policy/policy_regular/test/update_status_manager_test.cc b/src/components/policy/policy_regular/test/update_status_manager_test.cc index 9d0326d0be..6f301c6720 100644 --- a/src/components/policy/policy_regular/test/update_status_manager_test.cc +++ b/src/components/policy/policy_regular/test/update_status_manager_test.cc @@ -34,7 +34,6 @@ #include "policy/mock_policy_listener.h" #include "policy/policy_manager_impl.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" namespace test { namespace components { @@ -46,13 +45,13 @@ using ::testing::Return; class UpdateStatusManagerTest : public ::testing::Test { protected: - utils::SharedPtr<UpdateStatusManager> manager_; - utils::SharedPtr<MockPolicyListener> listener_; + std::shared_ptr<UpdateStatusManager> manager_; + std::shared_ptr<MockPolicyListener> listener_; public: UpdateStatusManagerTest() - : manager_(utils::MakeShared<UpdateStatusManager>()) - , listener_(utils::MakeShared<MockPolicyListener>()) {} + : manager_(std::make_shared<UpdateStatusManager>()) + , listener_(std::make_shared<MockPolicyListener>()) {} void SetUp() OVERRIDE { manager_->set_listener(listener_.get()); diff --git a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json index bc8d95302c..5827ab287a 100644 --- a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json +++ b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json @@ -1431,6 +1431,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1443,6 +1444,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1455,6 +1457,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1467,6 +1470,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1588,6 +1592,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1605,6 +1610,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1622,6 +1628,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1638,6 +1645,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", |