diff options
author | Conlain Kelly <conlain.k@gmail.com> | 2018-07-18 13:11:19 -0400 |
---|---|---|
committer | Conlain Kelly <conlain.k@gmail.com> | 2018-07-18 13:11:25 -0400 |
commit | e380ed1779e4317437cea63f070a8345b41f2d33 (patch) | |
tree | b2d6669663b91a3f235c2ce4a00c0c888751ff20 /src/components/policy | |
parent | 09c941dd2ffd4f98ba706895a67133318c3c5007 (diff) | |
parent | 4f21cbafb247664bd7b89bf2d39944764b1763b1 (diff) | |
download | sdl_core-e380ed1779e4317437cea63f070a8345b41f2d33.tar.gz |
Merge branch 'develop' into feature/boost_lock_implementation
Diffstat (limited to 'src/components/policy')
82 files changed, 1364 insertions, 289 deletions
diff --git a/src/components/policy/policy_external/.gitignore b/src/components/policy/policy_external/.gitignore index d67909069a..d6052d61da 100644 --- a/src/components/policy/policy_external/.gitignore +++ b/src/components/policy/policy_external/.gitignore @@ -29,8 +29,6 @@ src/appMain/hmi_link src/appMain/smartDeviceLinkCore test/components/application_manager/policies_manager/test_policies_table test/components/application_manager/test_formatters_commands -test/components/dbus/test_DBusAdapter -test/components/dbus/test_DBusSchema test/components/protocol_handler/test_ProtocolHandler test/components/request_watchdog/test_RequestWatchdog test/components/smart_objects/SchemaItem/test_SmartObject_AlwaysFalseSchemaItemTest diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt index 8d04f20470..c66313240f 100644 --- a/src/components/policy/policy_external/CMakeLists.txt +++ b/src/components/policy/policy_external/CMakeLists.txt @@ -55,13 +55,10 @@ set(SOURCES ${POLICY_PATH}/src/update_status_manager.cc ${POLICY_PATH}/src/status.cc ${POLICY_PATH}/src/cache_manager.cc + ${POLICY_PATH}/src/access_remote_impl.cc ${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc ) -if (REMOTE_CONTROL) - list(APPEND SOURCES ${POLICY_PATH}/src/access_remote_impl.cc) -endif() - list(APPEND SOURCES ${POLICY_PATH}/src/sql_pt_ext_queries.cc ${POLICY_PATH}/src/sql_pt_ext_representation.cc diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index bda456c90a..f41ddb14cd 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -84,6 +84,22 @@ class CacheManager : public CacheManagerInterface { CheckPermissionResult& result); /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Returns true if Policy Table was not updated yet * from preloaded pt file. */ @@ -642,8 +658,18 @@ class CacheManager : public CacheManagerInterface { * @param policy_app_id Unique application id * @param request_types Request types of application */ - void GetAppRequestTypes(const std::string& policy_app_id, - std::vector<std::string>& request_types) const; + void GetAppRequestTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_types) const OVERRIDE; + + /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @param request_subtypes Request subtypes of application to be filled + */ + void GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_subtypes) const OVERRIDE; virtual const MetaInfo GetMetaInfo() const OVERRIDE; diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index b9e9f73646..1d74780f19 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -47,6 +47,16 @@ namespace policy_table = rpc::policy_table_interface_base; namespace policy { +namespace RequestType { +// Describes available RequestType states in policy table +enum class State { UNAVAILABLE = 0, AVAILABLE, EMPTY, OMITTED }; +} // namespace RequestType + +namespace RequestSubType { +// Describes available RequestSubType states in policy table +enum class State { UNAVAILABLE = 0, AVAILABLE, EMPTY, OMITTED }; +} // namespace RequestSubType + class CacheManagerInterface { public: virtual ~CacheManagerInterface() {} @@ -79,6 +89,21 @@ class CacheManagerInterface { const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) = 0; + /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + virtual RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const = 0; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + virtual RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const = 0; /** * @brief Returns true if Policy Table was not updated yet @@ -706,6 +731,15 @@ class CacheManagerInterface { std::vector<std::string>& request_types) const = 0; /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @param request_subtypes Request subtypes of application to be filled + */ + virtual void GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_subtypes) const = 0; + + /** * @brief Gets meta information * @return meta information */ diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h index 6945f45b45..e399b44719 100644 --- a/src/components/policy/policy_external/include/policy/policy_helper.h +++ b/src/components/policy/policy_external/include/policy/policy_helper.h @@ -192,6 +192,14 @@ struct CheckAppPolicy { */ bool IsRequestTypeChanged(const AppPoliciesValueType& app_policy) const; + /** + * @brief Checks whether App RequestSubTypes have been changed by + * udpated + * @param app_policy Reference to updated application policy + * @return True if changed, otherwise - false + */ + bool IsRequestSubTypeChanged(const AppPoliciesValueType& app_policy) const; + private: PolicyManagerImpl* pm_; const utils::SharedPtr<policy_table::Table> update_; diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 97a2e60055..67756c053d 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -42,11 +42,8 @@ #include "policy/update_status_manager.h" #include "policy/policy_table/functions.h" #include "policy/usage_statistics/statistics_manager.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; @@ -454,7 +451,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 @@ -489,7 +485,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 @@ -538,6 +533,22 @@ class PolicyManagerImpl : public PolicyManager { void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Gets request types for application * @param policy_app_id Unique application id * @return request types of application @@ -546,6 +557,14 @@ class PolicyManagerImpl : public PolicyManager { const std::string policy_app_id) const OVERRIDE; /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @return request subtypes of application + */ + const std::vector<std::string> GetAppRequestSubTypes( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Get information about vehicle * @return vehicle information */ @@ -844,7 +863,6 @@ class PolicyManagerImpl : public PolicyManager { bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; -#ifdef SDL_REMOTE_CONTROL /** * @brief Get resulting RPCs permissions for application which started on * specific device @@ -881,7 +899,6 @@ class PolicyManagerImpl : public PolicyManager { */ bool GetModuleTypes(const std::string& policy_app_id, std::vector<std::string>* modules) const OVERRIDE; -#endif // SDL_REMOTE_CONTROL /** * @brief Notify application about its permissions changes by preparing and @@ -997,12 +1014,10 @@ 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 /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index fa37cfe7a5..d13c545a94 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/enums.h +++ b/src/components/policy/policy_external/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, @@ -90,7 +92,6 @@ enum Parameter { P_EMERGENCYEVENT, P_ECALLINFO, P_ABS_STATE, - P_TURN_SIGNAL, P_FUEL_RANGE, P_TIRE_PRESSURE_VALUE, P_TPMS, @@ -149,7 +150,9 @@ enum RequestType { RT_VEHICLE_DIAGNOSTICS, RT_EMERGENCY, RT_MEDIA, - RT_FOTA + RT_FOTA, + RT_OEM_SPECIFIC, + RT_EMPTY // Added to allow empty Request Types handling }; bool IsValidEnum(RequestType val); @@ -164,10 +167,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_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h index 53f5a35b99..b062fa0966 100644 --- a/src/components/policy/policy_external/include/policy/policy_table/types.h +++ b/src/components/policy/policy_external/include/policy/policy_table/types.h @@ -78,7 +78,7 @@ typedef Map<URL, 1, 255> URLList; typedef Map<URLList, 1, 255> ServiceEndpoints; typedef uint8_t NumberOfNotificationsType; -typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 6> +typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 7> NumberOfNotificationsPerMinute; typedef Array<Integer<uint16_t, 1, 1000>, 0, 5> SecondsBetweenRetries; @@ -102,11 +102,11 @@ typedef Map<DeviceParams, 0, 255> DeviceData; typedef Array<Enum<RequestType>, 0, 255> RequestsTypeArray; -#ifdef SDL_REMOTE_CONTROL +typedef Strings RequestSubTypes; + 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; @@ -173,11 +173,10 @@ struct ApplicationParams : PolicyBase { Optional<Strings> nicknames; Optional<AppHMITypes> AppHMIType; Optional<RequestTypes> RequestType; + Optional<RequestSubTypes> RequestSubType; Optional<Integer<uint16_t, 0, 65225> > memory_kb; Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms; -#ifdef SDL_REMOTE_CONTROL mutable Optional<ModuleTypes> moduleType; -#endif // SDL_REMOTE_CONTROL public: ApplicationParams(); @@ -197,9 +196,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_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml index 8d5a7054f1..7979a0f2ba 100644 --- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml +++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml @@ -26,6 +26,7 @@ <element name="speed" /> <element name="engineTorque" /> <element name="externalTemperature" /> + <element name="turnSignal" /> <element name="fuelLevel" /> <element name="fuelLevel_State" /> <element name="headLampStatus" /> @@ -37,6 +38,7 @@ <element name="vin" /> <element name="accPedalPosition" /> <element name="beltStatus" /> + <element name="electronicParkBrakeStatus" /> <element name="driverBraking" /> <element name="prndl" /> <element name="rpm" /> @@ -130,7 +132,7 @@ minsize="1" maxsize="255" /> <typedef name="NumberOfNotificationsPerMinute" type="Integer" - map="true" maxsize="6" minvalue="0" maxvalue="255" /> + map="true" maxsize="7" minvalue="0" maxvalue="255" /> <typedef name="SecondsBetweenRetries" type="Integer" array="true" maxsize="10" minvalue="1" maxvalue="1000" /> diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index 232191cfea..9682b3d58d 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -267,7 +267,8 @@ struct AppPermissions { , appRevoked(false) , appPermissionsConsentNeeded(false) , appUnauthorized(false) - , requestTypeChanged(false) {} + , requestTypeChanged(false) + , requestSubTypeChanged(false) {} std::string application_id; bool isAppPermissionsRevoked; @@ -280,6 +281,8 @@ struct AppPermissions { DeviceParams deviceInfo; bool requestTypeChanged; std::vector<std::string> requestType; + bool requestSubTypeChanged; + std::vector<std::string> requestSubType; }; /** @@ -503,7 +506,8 @@ enum PermissionsCheckResult { RESULT_CONSENT_NEEDED, RESULT_CONSENT_NOT_REQIURED, RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED, - RESULT_REQUEST_TYPE_CHANGED + RESULT_REQUEST_TYPE_CHANGED, + RESULT_REQUEST_SUBTYPE_CHANGED }; /** diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h index a69df20cfc..646cc7663b 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h @@ -65,6 +65,7 @@ extern const std::string kSelectAppGroups; extern const std::string kSelectNicknames; extern const std::string kSelectAppTypes; extern const std::string kSelectRequestTypes; +extern const std::string kSelectRequestSubTypes; extern const std::string kSelectSecondsBetweenRetries; extern const std::string kSelectIgnitionCycles; extern const std::string kSelectKilometers; @@ -78,6 +79,9 @@ extern const std::string kInsertAppGroup; extern const std::string kInsertNickname; extern const std::string kInsertAppType; extern const std::string kInsertRequestType; +extern const std::string kInsertOmittedRequestType; +extern const std::string kInsertOmittedRequestSubType; +extern const std::string kInsertRequestSubType; extern const std::string kInsertMessageType; extern const std::string kInsertLanguage; extern const std::string kInsertMessageString; @@ -98,6 +102,7 @@ extern const std::string kDeleteExternalConsentEntities; extern const std::string kDeleteAppGroup; extern const std::string kDeleteApplication; extern const std::string kDeleteRequestType; +extern const std::string kDeleteRequestSubType; extern const std::string kDeleteDevice; extern const std::string kIncrementIgnitionCycles; extern const std::string kResetIgnitionCycles; diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h index 54dfb9f0b7..d56f6aeba2 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h @@ -98,7 +98,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; @@ -113,7 +112,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; @@ -133,6 +131,9 @@ class SQLPTRepresentation : public virtual PTRepresentation { policy_table::AppHMITypes* app_types) const; bool GatherRequestType(const std::string& app_id, policy_table::RequestTypes* request_types) const; + bool GatherRequestSubType( + const std::string& app_id, + policy_table::RequestSubTypes* request_subtypes) const; bool GatherNickName(const std::string& app_id, policy_table::Strings* nicknames) const; @@ -168,6 +169,9 @@ class SQLPTRepresentation : public virtual PTRepresentation { const policy_table::AppHMITypes& types); bool SaveRequestType(const std::string& app_id, const policy_table::RequestTypes& types); + bool SaveRequestSubType( + const std::string& app_id, + const policy_table::RequestSubTypes& request_subtypes); public: virtual std::string GetLockScreenIconUrl() const; diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 5aa39cb2f4..00bb1e4a1c 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -41,6 +41,7 @@ #include <vector> #include "utils/file_system.h" +#include "utils/helpers.h" #include "json/reader.h" #include "json/features.h" #include "json/writer.h" @@ -638,13 +639,11 @@ void CacheManager::RemoveAppConsentForGroup(const std::string& app_id, } } -using rpc::policy_table_interface_base::RequestTypes; -using rpc::policy_table_interface_base::RequestType; - void CacheManager::ProcessUpdate( const policy_table::ApplicationPolicies::const_iterator initial_policy_iter) { using namespace policy; + using rpc::policy_table_interface_base::RequestTypes; const RequestTypes& new_request_types = *(initial_policy_iter->second.RequestType); @@ -2392,6 +2391,32 @@ bool CacheManager::ResetPT(const std::string& file_name) { return result; } +policy::RequestType::State CacheManager::GetAppRequestTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(cache_lock_); + policy_table::ApplicationPolicies::const_iterator app_policies_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request types for app_id " << policy_app_id); + return policy::RequestType::State::UNAVAILABLE; + } + const policy_table::RequestTypes& request_types = + *app_policies_iter->second.RequestType; + if (!request_types.is_initialized()) { + LOG4CXX_TRACE(logger_, + "Request types for " << policy_app_id << " are OMITTED"); + return RequestType::State::OMITTED; + } + if (request_types.empty()) { + LOG4CXX_TRACE(logger_, + "Request types for " << policy_app_id << " are EMPTY"); + return policy::RequestType::State::EMPTY; + } + return policy::RequestType::State::AVAILABLE; +} + void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { @@ -2411,16 +2436,64 @@ void CacheManager::GetAppRequestTypes( return; } if (policy_iter->second.RequestType.is_initialized()) { - policy_table::RequestTypes::iterator it_request_type = - policy_iter->second.RequestType->begin(); - for (; it_request_type != policy_iter->second.RequestType->end(); - ++it_request_type) { - request_types.push_back(EnumToJsonString(*it_request_type)); + for (const auto& request_type : *policy_iter->second.RequestType) { + request_types.push_back(EnumToJsonString(request_type)); } } return; } +RequestSubType::State CacheManager::GetAppRequestSubTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(cache_lock_); + policy_table::ApplicationPolicies::const_iterator app_policies_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request subtypes for app_id " << policy_app_id); + return RequestSubType::State::UNAVAILABLE; + } + const policy_table::RequestSubTypes& request_subtypes = + *app_policies_iter->second.RequestSubType; + if (!request_subtypes.is_initialized()) { + LOG4CXX_TRACE(logger_, + "Request subtypes for " << policy_app_id << " are OMITTED"); + return RequestSubType::State::OMITTED; + } + if (request_subtypes.empty()) { + LOG4CXX_TRACE(logger_, + "Request subtypes for " << policy_app_id << " are EMPTY"); + return RequestSubType::State::EMPTY; + } + return RequestSubType::State::AVAILABLE; +} + +void CacheManager::GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_subtypes) const { + LOG4CXX_AUTO_TRACE(logger_); + CACHE_MANAGER_CHECK_VOID(); + if (kDeviceId == policy_app_id) { + LOG4CXX_DEBUG(logger_, + "Request subtypes not applicable for app_id " << kDeviceId); + return; + } + sync_primitives::AutoLock auto_lock(cache_lock_); + policy_table::ApplicationPolicies::iterator policy_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request subtypes for app_id " << policy_app_id); + return; + } + + for (const auto& request_subtype : *policy_iter->second.RequestSubType) { + request_subtypes.push_back(request_subtype); + } + return; +} + const MetaInfo CacheManager::GetMetaInfo() const { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock auto_lock(cache_lock_); diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 8be0372c03..39b9399c24 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -322,9 +322,21 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { PermissionsCheckResult result = CheckPermissionsChanges(app_policy); - if (!IsPredefinedApp(app_policy) && IsRequestTypeChanged(app_policy)) { - SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED); - AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED); + if (!IsPredefinedApp(app_policy)) { + const bool is_request_type_changed = IsRequestTypeChanged(app_policy); + const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy); + if (is_request_type_changed) { + LOG4CXX_TRACE(logger_, + "Request types were changed for application: " << app_id); + SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED); + AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED); + } + if (is_request_subtype_changed) { + LOG4CXX_TRACE( + logger_, "Request subtypes were changed for application: " << app_id); + SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED); + AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED); + } } if (RESULT_NO_CHANGES == result) { @@ -389,17 +401,18 @@ void policy::CheckAppPolicy::SetPendingPermissions( break; case RESULT_REQUEST_TYPE_CHANGED: permissions_diff.requestTypeChanged = true; - { - // Getting RequestTypes from PTU (not from cache) - policy_table::RequestTypes::const_iterator it_request_type = - app_policy.second.RequestType->begin(); - for (; app_policy.second.RequestType->end() != it_request_type; - ++it_request_type) { - permissions_diff.requestType.push_back( - EnumToJsonString(*it_request_type)); - } - } + // Getting Request Types from PTU (not from cache) + for (const auto& request_type : *app_policy.second.RequestType) { + permissions_diff.requestType.push_back(EnumToJsonString(request_type)); + } + break; + case RESULT_REQUEST_SUBTYPE_CHANGED: + permissions_diff.requestSubTypeChanged = true; + // Getting Request SubTypes from PTU (not from cache) + for (const auto& request_subtype : *app_policy.second.RequestSubType) { + permissions_diff.requestSubType.push_back(request_subtype); + } break; default: return; @@ -484,6 +497,32 @@ bool CheckAppPolicy::IsRequestTypeChanged( return diff.size(); } +bool CheckAppPolicy::IsRequestSubTypeChanged( + const AppPoliciesValueType& app_policy) const { + policy::AppPoliciesConstItr it = + snapshot_->policy_table.app_policies_section.apps.find(app_policy.first); + + if (it == snapshot_->policy_table.app_policies_section.apps.end()) { + if (!app_policy.second.RequestSubType->empty()) { + return true; + } + return false; + } + + if (it->second.RequestSubType->size() != + app_policy.second.RequestSubType->size()) { + return true; + } + + policy_table::RequestSubTypes diff; + std::set_difference(it->second.RequestSubType->begin(), + it->second.RequestSubType->end(), + app_policy.second.RequestSubType->begin(), + app_policy.second.RequestSubType->end(), + std::back_inserter(diff)); + return diff.size(); +} + void FillActionsForAppPolicies::operator()( const policy::CheckAppPolicyResults::value_type& value) { const std::string app_id = value.first; @@ -510,6 +549,7 @@ void FillActionsForAppPolicies::operator()( case RESULT_CONSENT_NOT_REQIURED: case RESULT_PERMISSIONS_REVOKED: case RESULT_REQUEST_TYPE_CHANGED: + case RESULT_REQUEST_SUBTYPE_CHANGED: break; case RESULT_NO_CHANGES: default: diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 433a7a6bca..4ac66c0d53 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -50,11 +50,8 @@ #include "policy/update_status_manager.h" #include "config_profile/profile.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(); @@ -216,32 +213,26 @@ 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 , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) - , retry_sequence_url_(0, 0, "") { -} + , retry_sequence_url_(0, 0, "") {} PolicyManagerImpl::PolicyManagerImpl(bool in_memory) : PolicyManager() , listener_(NULL) , cache_(new CacheManager(in_memory)) -#ifdef SDL_REMOTE_CONTROL , access_remote_(new AccessRemoteImpl( CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) -#endif // SDL_REMOTE_CONTROL , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) , 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; @@ -563,6 +554,25 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( return request_types; } +RequestType::State PolicyManagerImpl::GetAppRequestTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetAppRequestTypesState(policy_app_id); +} + +RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetAppRequestSubTypesState(policy_app_id); +} + +const std::vector<std::string> PolicyManagerImpl::GetAppRequestSubTypes( + const std::string& policy_app_id) const { + std::vector<std::string> request_subtypes; + cache_->GetAppRequestSubTypes(policy_app_id, request_subtypes); + return request_subtypes; +} + const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const { return cache_->GetVehicleInfo(); } @@ -773,13 +783,11 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( LOG4CXX_INFO(logger_, "Send notification for application_id:" << application_id); -#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 std::string default_hmi; GetDefaultHmi(application_id, &default_hmi); @@ -1771,11 +1779,6 @@ StatusNotifier PolicyManagerImpl::AddApplication( device_consent); } else { PromoteExistedApplication(application_id, device_consent); - if (helpers::in_range(hmi_types, policy_table::AHT_NAVIGATION) && - !HasCertificate()) { - LOG4CXX_DEBUG(logger_, "Certificate does not exist, scheduling update."); - update_status_manager_.ScheduleUpdate(); - } return utils::MakeShared<utils::CallNothing>(); } } @@ -1919,7 +1922,6 @@ std::ostream& operator<<(std::ostream& output, return output; } -#ifdef SDL_REMOTE_CONTROL void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id, const std::vector<int>& hmi_types) { LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); @@ -2025,6 +2027,5 @@ void PolicyManagerImpl::set_access_remote( utils::SharedPtr<AccessRemote> access_remote) { access_remote_ = access_remote; } -#endif // SDL_REMOTE_CONTROL } // namespace policy diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc index beea68a276..58bae43000 100644 --- a/src/components/policy/policy_external/src/policy_table/enums.cc +++ b/src/components/policy/policy_external/src/policy_table/enums.cc @@ -118,6 +118,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: @@ -140,6 +142,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: @@ -166,8 +170,6 @@ bool IsValidEnum(Parameter val) { return true; case P_ABS_STATE: return true; - case P_TURN_SIGNAL: - return true; case P_FUEL_RANGE: return true; case P_TIRE_PRESSURE_VALUE: @@ -211,6 +213,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: @@ -233,6 +237,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: @@ -259,8 +265,6 @@ const char* EnumToJsonString(Parameter val) { return "eCallInfo"; case P_ABS_STATE: return "abs_State"; - case P_TURN_SIGNAL: - return "turnSignal"; case P_FUEL_RANGE: return "fuelRange"; case P_TIRE_PRESSURE_VALUE: @@ -307,6 +311,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; @@ -340,6 +347,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; @@ -379,9 +389,6 @@ bool EnumFromJsonString(const std::string& literal, Parameter* result) { } else if ("abs_State" == literal) { *result = P_ABS_STATE; return true; - } else if ("turnSignal" == literal) { - *result = P_TURN_SIGNAL; - return true; } else if ("fuelRange" == literal) { *result = P_FUEL_RANGE; return true; @@ -605,6 +612,10 @@ bool IsValidEnum(RequestType val) { return true; case RT_FOTA: return true; + case RT_OEM_SPECIFIC: + return true; + case RT_EMPTY: + return true; default: return false; } @@ -652,6 +663,10 @@ const char* EnumToJsonString(RequestType val) { return "MEDIA"; case RT_FOTA: return "FOTA"; + case RT_OEM_SPECIFIC: + return "OEM_SPECIFIC"; + case RT_EMPTY: + return "EMPTY"; default: return ""; } @@ -737,18 +752,27 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) { if ("FOTA" == literal) { *result = RT_FOTA; return true; + } + if ("OEM_SPECIFIC" == literal) { + *result = RT_OEM_SPECIFIC; + return true; + } + if ("EMPTY" == literal) { + *result = RT_EMPTY; + return true; } else { return false; } } -#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; } @@ -759,6 +783,8 @@ const char* EnumToJsonString(ModuleType val) { return "CLIMATE"; case MT_RADIO: return "RADIO"; + case MT_SEAT: + return "SEAT"; default: return ""; } @@ -771,11 +797,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_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index da83626448..8c4f454dfa 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -238,25 +238,21 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , nicknames(impl::ValueMember(value__, "nicknames")) , AppHMIType(impl::ValueMember(value__, "AppHMIType")) , RequestType(impl::ValueMember(value__, "RequestType")) + , RequestSubType(impl::ValueMember(value__, "RequestSubType")) , memory_kb(impl::ValueMember(value__, "memory_kb"), 0) , heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")) -#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()); impl::WriteJsonField("nicknames", nicknames, &result__); impl::WriteJsonField("AppHMIType", AppHMIType, &result__); impl::WriteJsonField("RequestType", RequestType, &result__); + impl::WriteJsonField("RequestSubType", RequestSubType, &result__); 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__; } @@ -278,11 +274,9 @@ bool ApplicationParams::is_valid() const { if (!heart_beat_timeout_ms.is_valid()) { return false; } -#ifdef SDL_REMOTE_CONTROL if (!moduleType.is_valid()) { return false; } -#endif // SDL_REMOTE_CONTROL return Validate(); } @@ -303,17 +297,18 @@ bool ApplicationParams::struct_empty() const { if (RequestType.is_initialized()) { return false; } + if (RequestSubType.is_initialized()) { + return false; + } if (memory_kb.is_initialized()) { return false; } if (heart_beat_timeout_ms.is_initialized()) { return false; } -#ifdef SDL_REMOTE_CONTROL if (moduleType.is_initialized()) { return false; } -#endif // SDL_REMOTE_CONTROL return true; } @@ -337,6 +332,9 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { if (!RequestType.is_valid()) { RequestType.ReportErrors(&report__->ReportSubobject("RequestType")); } + if (!RequestSubType.is_valid()) { + RequestSubType.ReportErrors(&report__->ReportSubobject("RequestSubType")); + } if (!priority.is_valid()) { priority.ReportErrors(&report__->ReportSubobject("priority")); } @@ -356,23 +354,19 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { heart_beat_timeout_ms.ReportErrors( &report__->ReportSubobject("heart_beat_timeout_ms")); } - -#ifdef SDL_REMOTE_CONTROL if (!moduleType.is_valid()) { moduleType.ReportErrors(&report__->ReportSubobject("moduleType")); } -#endif // SDL_REMOTE_CONTROL } void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { PolicyBase::SetPolicyTableType(pt_type); AppHMIType.SetPolicyTableType(pt_type); RequestType.SetPolicyTableType(pt_type); + RequestSubType.SetPolicyTableType(pt_type); memory_kb.SetPolicyTableType(pt_type); heart_beat_timeout_ms.SetPolicyTableType(pt_type); -#ifdef SDL_REMOTE_CONTROL moduleType.SetPolicyTableType(pt_type); -#endif // SDL_REMOTE_CONTROL } // RpcParameters methods diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc index 48a8578855..9b227615d8 100644 --- a/src/components/policy/policy_external/src/policy_table/validation.cc +++ b/src/components/policy/policy_external/src/policy_table/validation.cc @@ -89,6 +89,7 @@ bool ApplicationPoliciesSection::Validate() const { continue; } + LOG4CXX_TRACE(logger_, "Checking app Request Types..."); RequestTypes& app_request_types = *iter->second.RequestType; if (app_request_types.is_omitted()) { @@ -133,10 +134,36 @@ bool ApplicationPoliciesSection::Validate() const { ++iter; } + LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + iter = apps.begin(); + while (iter != end_iter) { + if (it_default_policy == iter || it_pre_data_policy == iter) { + ++iter; + continue; + } + ApplicationParams& app_params = (*iter).second; + const bool is_request_subtype_omitted = + !app_params.RequestSubType.is_initialized(); + + if (is_request_subtype_omitted) { + LOG4CXX_WARN(logger_, + "App policy RequestSubTypes omitted." + " Will be replaced with default."); + app_params.RequestSubType = apps[kDefaultApp].RequestSubType; + ++iter; + continue; + } + + const bool is_request_subtype_empty = app_params.RequestSubType->empty(); + if (is_request_subtype_empty) { + LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + } + ++iter; + } + 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(); @@ -166,7 +193,6 @@ bool ApplicationParams::ValidateModuleTypes() const { } return true; } -#endif // SDL_REMOTE_CONTROL bool ApplicationParams::Validate() const { if (is_initialized()) { @@ -178,11 +204,7 @@ bool ApplicationParams::Validate() const { } } } -#ifdef SDL_REMOTE_CONTROL return ValidateModuleTypes(); -#else // SDL_REMOTE_CONTROL - return true; -#endif // SDL_REMOTE_CONTROL } bool RpcParameters::Validate() const { diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc index f58a7f0b82..5bb602244e 100644 --- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc @@ -670,6 +670,11 @@ bool SQLPTExtRepresentation::SaveApplicationPoliciesSection( return false; } + if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + return false; + } + // First, all predefined apps (e.g. default, pre_DataConsent) should be saved, // otherwise another app with the predefined permissions can get incorrect // permissions @@ -713,18 +718,17 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( if (!SetDefaultPolicy(app.first)) { return false; } - if (!SaveRequestType(app.first, *app.second.RequestType)) { - return false; - } } else if (kPreDataConsentId.compare(app.second.get_string()) == 0) { if (!SetPredataPolicy(app.first)) { return false; } - if (!SaveRequestType(app.first, *app.second.RequestType)) { - return false; - } } - + if (!SaveRequestType(app.first, *app.second.RequestType)) { + return false; + } + if (!SaveRequestSubType(app.first, *app.second.RequestSubType)) { + return false; + } // Stop saving other params, since predefined permissions already set return true; } @@ -771,6 +775,10 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( return false; } + if (!SaveRequestSubType(app.first, *app.second.RequestSubType)) { + return false; + } + return true; } diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index 9702c315b0..ee53eb1487 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -271,13 +271,21 @@ const std::string kCreateSchema = " REFERENCES `application`(`id`) " "); " "CREATE TABLE IF NOT EXISTS `request_type`( " - " `request_type` VARCHAR(50) NOT NULL, " + " `request_type` VARCHAR(50), " " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`request_type`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " + "CREATE TABLE IF NOT EXISTS `request_subtype`( " + " `request_subtype` VARCHAR(50), " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " + " PRIMARY KEY(`request_subtype`,`application_id`), " + " CONSTRAINT `fk_request_subtype_app_id` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " " ON `app_type`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `consent_group`( " @@ -482,6 +490,7 @@ const std::string kDropSchema = "DROP INDEX IF EXISTS `app_type.fk_app_type_application1_idx`; " "DROP TABLE IF EXISTS `app_type`; " "DROP TABLE IF EXISTS `request_type`; " + "DROP TABLE IF EXISTS `request_subtype`; " "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; " "DROP TABLE IF EXISTS `nickname`; " "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; " @@ -636,6 +645,19 @@ const std::string kInsertRequestType = "INSERT OR IGNORE INTO `request_type` (`application_id`, `request_type`) " "VALUES (?, ?)"; +const std::string kInsertOmittedRequestType = + "INSERT INTO `request_type` (`application_id`) " + "VALUES (?)"; + +const std::string kInsertRequestSubType = + "INSERT INTO `request_subtype` (`application_id`, " + "`request_subtype`) " + "VALUES (?, ?)"; + +const std::string kInsertOmittedRequestSubType = + "INSERT INTO `request_subtype` (`application_id`) " + "VALUES (?)"; + const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?"; const std::string kInsertMessageType = @@ -760,6 +782,11 @@ const std::string kSelectRequestTypes = "SELECT DISTINCT `request_type` FROM `request_type` WHERE `application_id` " "= ?"; +const std::string kSelectRequestSubTypes = + "SELECT DISTINCT `request_subtype` FROM `request_subtype` WHERE " + "`application_id` " + "= ?"; + const std::string kSelectSecondsBetweenRetries = "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`"; @@ -805,6 +832,8 @@ const std::string kDeleteApplication = "DELETE FROM `application`"; const std::string kDeleteRequestType = "DELETE FROM `request_type`"; +const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`"; + const std::string kSelectApplicationRevoked = "SELECT `is_revoked` FROM `application` WHERE `id` = ?"; diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 4315d99b3a..3cd7388672 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -765,7 +765,6 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( return false; } -#ifdef SDL_REMOTE_CONTROL bool denied = false; if (!GatherRemoteControlDenied(app_id, &denied)) { return false; @@ -775,7 +774,6 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( return false; } } -#endif // SDL_REMOTE_CONTROL if (!GatherNickName(app_id, &*params.nicknames)) { return false; @@ -786,6 +784,9 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( if (!GatherRequestType(app_id, &*params.RequestType)) { return false; } + if (!GatherRequestSubType(app_id, &*params.RequestSubType)) { + return false; + } (*policies).apps[app_id] = params; } @@ -1048,14 +1049,11 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( 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; @@ -1175,15 +1173,83 @@ bool SQLPTRepresentation::SaveRequestType( } policy_table::RequestTypes::const_iterator it; - for (it = types.begin(); it != types.end(); ++it) { + if (!types.empty()) { + LOG4CXX_WARN(logger_, "Request types not empty."); + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + return false; + } + } + } else if (types.is_initialized()) { + LOG4CXX_WARN(logger_, "Request types empty."); query.Bind(0, app_id); - query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); + query.Bind(1, + std::string(policy_table::EnumToJsonString( + policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { LOG4CXX_WARN(logger_, "Incorrect insert into request types."); return false; } + } else { + utils::dbms::SQLQuery query_omitted(db()); + if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + return false; + } + LOG4CXX_WARN(logger_, "Request types omitted."); + query_omitted.Bind(0, app_id); + if (!query_omitted.Exec() || !query_omitted.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + return false; + } + } + return true; +} + +bool SQLPTRepresentation::SaveRequestSubType( + const std::string& app_id, + const policy_table::RequestSubTypes& request_subtypes) { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + return false; } + policy_table::Strings::const_iterator it; + if (!request_subtypes.empty()) { + LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, *it); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } + } else if (request_subtypes.is_initialized()) { + LOG4CXX_WARN(logger_, "Request subtypes empty."); + query.Bind(0, app_id); + query.Bind(1, std::string("EMPTY")); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } else { + utils::dbms::SQLQuery query_omitted(db()); + if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + return false; + } + LOG4CXX_WARN(logger_, "Request subtypes omitted."); + query_omitted.Bind(0, app_id); + if (!query_omitted.Exec() || !query_omitted.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } return true; } @@ -1583,11 +1649,36 @@ bool SQLPTRepresentation::GatherRequestType( if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { return false; } + if (policy_table::RequestType::RT_EMPTY == type) { + request_types->mark_initialized(); + continue; + } request_types->push_back(type); } return true; } +bool SQLPTRepresentation::GatherRequestSubType( + const std::string& app_id, + policy_table::RequestSubTypes* request_subtypes) const { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + const std::string request_subtype = query.GetString(0); + if ("EMPTY" == request_subtype) { + request_subtypes->mark_initialized(); + continue; + } + request_subtypes->push_back(request_subtype); + } + return true; +} + bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); @@ -1618,8 +1709,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_); @@ -1809,7 +1898,6 @@ bool SQLPTRepresentation::GatherRemoteRpc( } return true; } -#endif // SDL_REMOTE_CONTROL bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_revoked, @@ -1907,6 +1995,13 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { !SaveRequestType(app_id, request_types)) { return false; } + + policy_table::Strings request_subtypes; + if (!GatherRequestSubType(kDefaultId, &request_subtypes) || + !SaveRequestSubType(app_id, request_subtypes)) { + return false; + } + policy_table::AppHMITypes app_types; if (!GatherAppType(kDefaultId, &app_types) || !SaveAppType(app_id, app_types)) { diff --git a/src/components/policy/policy_external/test/CMakeLists.txt b/src/components/policy/policy_external/test/CMakeLists.txt index a455d43b91..8b77c90dd2 100644 --- a/src/components/policy/policy_external/test/CMakeLists.txt +++ b/src/components/policy/policy_external/test/CMakeLists.txt @@ -55,12 +55,6 @@ file (GLOB POLICY_TEST_SOURCES list (REMOVE_ITEM POLICY_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/policy_manager_impl_stress_test.cc) -if (REMOTE_CONTROL) - list (APPEND testSources - access_remote_impl_test.cc - ) -endif () - create_test("policy_test" "${POLICY_TEST_SOURCES}" "${testLibraries}") #Additional test files (json) diff --git a/src/components/policy/policy_external/test/json/PTU.json b/src/components/policy/policy_external/test/json/PTU.json index c231340f44..4cd71d6004 100644 --- a/src/components/policy/policy_external/test/json/PTU.json +++ b/src/components/policy/policy_external/test/json/PTU.json @@ -403,6 +403,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -419,6 +420,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -435,6 +437,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -451,6 +454,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -475,6 +479,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -498,6 +503,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -521,6 +527,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -543,6 +550,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU2.json b/src/components/policy/policy_external/test/json/PTU2.json index 4970c40e60..9c9436144e 100644 --- a/src/components/policy/policy_external/test/json/PTU2.json +++ b/src/components/policy/policy_external/test/json/PTU2.json @@ -403,6 +403,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -419,6 +420,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -435,6 +437,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -451,6 +454,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -475,6 +479,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -498,6 +503,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -521,6 +527,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -543,6 +550,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU3.json b/src/components/policy/policy_external/test/json/PTU3.json index 98037cf594..279051e7bf 100644 --- a/src/components/policy/policy_external/test/json/PTU3.json +++ b/src/components/policy/policy_external/test/json/PTU3.json @@ -403,6 +403,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -419,6 +420,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -435,6 +437,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -451,6 +454,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -475,6 +479,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -498,6 +503,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -521,6 +527,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -543,6 +550,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json index f232d8fec7..08027f2786 100644 --- a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json +++ b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json @@ -1438,6 +1438,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1450,6 +1451,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1462,6 +1464,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1474,6 +1477,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1595,6 +1599,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1612,6 +1617,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1629,6 +1635,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1645,6 +1652,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json index 942c862d4f..a88bcfbd08 100644 --- a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json +++ b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json @@ -1441,6 +1441,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1453,6 +1454,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1465,6 +1467,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1477,6 +1480,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1598,6 +1602,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1615,6 +1620,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1632,6 +1638,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1648,6 +1655,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json index c72fdbe6cb..250bfb21f2 100644 --- a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json +++ b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json @@ -1438,6 +1438,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1450,6 +1451,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1462,6 +1464,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1474,6 +1477,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1595,6 +1599,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1612,6 +1617,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1629,6 +1635,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1645,6 +1652,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json index b783ac0cc2..85910c098c 100644 --- a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json +++ b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json @@ -1437,6 +1437,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1449,6 +1450,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1461,6 +1463,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1473,6 +1476,7 @@ "parameters" : [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -1594,6 +1598,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1611,6 +1616,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1628,6 +1634,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1644,6 +1651,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json index fdf730917f..1c1b04ca2b 100644 --- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json +++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.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_external/test/json/preloadedPT_with_invalid_default_requestType.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json index 82b6f762ca..51690d7b8e 100644 --- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json +++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.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_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json index 713d057f1a..cfa6c4010c 100644 --- a/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json +++ b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.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_external/test/json/ptu2_requestType.json b/src/components/policy/policy_external/test/json/ptu2_requestType.json index 4765da0771..d7177f2251 100644 --- a/src/components/policy/policy_external/test/json/ptu2_requestType.json +++ b/src/components/policy/policy_external/test/json/ptu2_requestType.json @@ -415,6 +415,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -431,6 +432,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -447,6 +449,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -463,6 +466,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -487,6 +491,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -510,6 +515,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -533,6 +539,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -555,6 +562,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/ptu_requestType.json b/src/components/policy/policy_external/test/json/ptu_requestType.json index 5e34c00a81..6a531dd2ad 100644 --- a/src/components/policy/policy_external/test/json/ptu_requestType.json +++ b/src/components/policy/policy_external/test/json/ptu_requestType.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json index c5386f612e..59e3f947c3 100644 --- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json +++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json @@ -20,6 +20,7 @@ "notifications_per_minute_by_priority": { "EMERGENCY": 60, "NAVIGATION": 15, + "PROJECTION": 15, "COMMUNICATION": 6, "NORMAL": 4, "NONE": 0 @@ -296,6 +297,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +310,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +323,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +336,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +357,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +377,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +397,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,6 +416,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json index 5974b22b8e..a4491fd449 100644 --- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json +++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json @@ -2051,6 +2051,7 @@ [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -2065,6 +2066,7 @@ [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -2079,6 +2081,7 @@ [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -2093,6 +2096,7 @@ [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -2311,6 +2315,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -2332,6 +2337,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -2353,6 +2359,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -2373,6 +2380,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json index 8da6906e8b..83c4ccf15c 100644 --- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json +++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json @@ -415,6 +415,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -431,6 +432,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -447,6 +449,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -463,6 +466,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -487,6 +491,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -510,6 +515,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -533,6 +539,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -555,6 +562,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json b/src/components/policy/policy_external/test/json/sdl_pt_first_update.json index f8be46d2b5..7b882c6ceb 100644 --- a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json +++ b/src/components/policy/policy_external/test/json/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_external/test/json/sdl_pt_second_update.json b/src/components/policy/policy_external/test/json/sdl_pt_second_update.json index fe7b036f94..7d90275328 100644 --- a/src/components/policy/policy_external/test/json/sdl_pt_second_update.json +++ b/src/components/policy/policy_external/test/json/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_external/test/json/sdl_pt_update.json b/src/components/policy/policy_external/test/json/sdl_pt_update.json index c79fd26873..807b0eb312 100644 --- a/src/components/policy/policy_external/test/json/sdl_pt_update.json +++ b/src/components/policy/policy_external/test/json/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", @@ -1596,6 +1600,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1613,6 +1618,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1630,6 +1636,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -1646,6 +1653,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json index 234f57f2db..3d0a004dbe 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json index d309d58674..6a36f1f9c5 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json index be38e7d706..3303d56844 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json index 8686f20f0e..e7a33ba2c0 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json index b9b693ed5b..08739f9d6a 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json index 8bbf7ea421..21396b8cac 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json index 146adaf7a7..5aa467a23c 100644 --- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json +++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json @@ -414,6 +414,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -430,6 +431,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -446,6 +448,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -462,6 +465,7 @@ "parameters": [ "accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -486,6 +490,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -509,6 +514,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -532,6 +538,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -554,6 +561,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", diff --git a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json b/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json index bc8d95302c..5827ab287a 100644 --- a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json +++ b/src/components/policy/policy_external/test/json/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", diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index a657a01145..a5589cc904 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -81,14 +81,14 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, static const std::string kDatabaseName; static utils::dbms::SQLQuery* query_wrapper_; // Gtest can show message that this object doesn't destroyed - static std::auto_ptr<policy_handler_test::MockPolicySettings> + static std::unique_ptr<policy_handler_test::MockPolicySettings> policy_settings_; static void SetUpTestCase() { const std::string kAppStorageFolder = "storage_SQLPTRepresentationTest"; reps = new SQLPTRepresentation(in_memory_); ASSERT_TRUE(reps != NULL); - policy_settings_ = std::auto_ptr<policy_handler_test::MockPolicySettings>( + policy_settings_ = std::unique_ptr<policy_handler_test::MockPolicySettings>( new policy_handler_test::MockPolicySettings()); ON_CALL(*policy_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kAppStorageFolder)); @@ -348,7 +348,7 @@ SQLPTRepresentation* SQLPTRepresentationTest::reps = 0; utils::dbms::SQLQuery* SQLPTRepresentationTest::query_wrapper_ = 0; const std::string SQLPTRepresentationTest::kDatabaseName = ":memory:"; const bool SQLPTRepresentationTest::in_memory_ = true; -std::auto_ptr<policy_handler_test::MockPolicySettings> +std::unique_ptr<policy_handler_test::MockPolicySettings> SQLPTRepresentationTest::policy_settings_; class SQLPTRepresentationTest2 : public ::testing::Test { @@ -407,7 +407,8 @@ TEST_F(SQLPTRepresentationTest, query.Prepare(query_select); query.Next(); - const int policy_tables_number = 32; + // 33 - is current total tables number created by schema + const int policy_tables_number = 33; ASSERT_EQ(policy_tables_number, query.GetInteger(0)); const std::string query_select_count_of_iap_buffer_full = 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/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index 464aa711bd..c22b911135 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -73,6 +73,22 @@ class CacheManager : public CacheManagerInterface { CheckPermissionResult& result); /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Returns true if Policy Table was not updated yet * from preloaded pt file. */ @@ -597,8 +613,18 @@ class CacheManager : public CacheManagerInterface { * @param policy_app_id Unique application id * @param request_types Request types of application */ - void GetAppRequestTypes(const std::string& policy_app_id, - std::vector<std::string>& request_types) const; + void GetAppRequestTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_types) const OVERRIDE; + + /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @param request_subtypes Request subtypes of application to be filled + */ + void GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_subtypes) const OVERRIDE; /** * @brief GetCertificate allows to obtain certificate in order to 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 9f7c7318db..3dd2953865 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 @@ -46,6 +46,16 @@ namespace policy_table = rpc::policy_table_interface_base; namespace policy { +namespace RequestType { +// Describes available RequestType states in policy table +enum class State { UNAVAILABLE = 0, AVAILABLE, EMPTY, OMITTED }; +} // namespace RequestType + +namespace RequestSubType { +// Describes available RequestSubType states in policy table +enum class State { UNAVAILABLE = 0, AVAILABLE, EMPTY, OMITTED }; +} // namespace RequestSubType + class CacheManagerInterface { public: virtual ~CacheManagerInterface() {} @@ -67,6 +77,22 @@ class CacheManagerInterface { CheckPermissionResult& result) = 0; /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + virtual RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const = 0; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + virtual RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const = 0; + + /** * @brief Returns true if Policy Table was not updated yet * from preloaded pt file. */ @@ -627,6 +653,15 @@ class CacheManagerInterface { std::vector<std::string>& request_types) const = 0; /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @param request_subtypes Request subtypes of application to be filled + */ + virtual void GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_subtypes) const = 0; + + /** * @brief GetCertificate allows to obtain certificate in order to * make secure connection * 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 8a60801dd4..7f27ab2676 100644 --- a/src/components/policy/policy_regular/include/policy/policy_helper.h +++ b/src/components/policy/policy_regular/include/policy/policy_helper.h @@ -95,7 +95,8 @@ struct CheckAppPolicy { RESULT_CONSENT_NEEDED, RESULT_CONSENT_NOT_REQIURED, RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED, - RESULT_REQUEST_TYPE_CHANGED + RESULT_REQUEST_TYPE_CHANGED, + RESULT_REQUEST_SUBTYPE_CHANGED }; void SetPendingPermissions(const AppPoliciesValueType& app_policy, @@ -126,6 +127,7 @@ struct CheckAppPolicy { bool IsConsentRequired(const std::string& app_id, const std::string& group_name) const; bool IsRequestTypeChanged(const AppPoliciesValueType& app_policy) const; + bool IsRequestSubTypeChanged(const AppPoliciesValueType& app_policy) const; private: PolicyManagerImpl* pm_; 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 941db1a67f..c162d73011 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 @@ -47,10 +47,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 +446,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 @@ -483,7 +480,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 @@ -532,6 +528,22 @@ class PolicyManagerImpl : public PolicyManager { void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE; /** + * @brief Get state of request types for given application + * @param policy_app_id Unique application id + * @return request type state + */ + RequestType::State GetAppRequestTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** + * @brief Get state of request subtypes for given application + * @param policy_app_id Unique application id + * @return request subtype state + */ + RequestSubType::State GetAppRequestSubTypesState( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Gets request types for application * @param policy_app_id Unique application id * @return request types of application @@ -540,6 +552,14 @@ class PolicyManagerImpl : public PolicyManager { const std::string policy_app_id) const OVERRIDE; /** + * @brief Gets request subtypes for application + * @param policy_app_id Unique application id + * @return request subtypes of application + */ + const std::vector<std::string> GetAppRequestSubTypes( + const std::string& policy_app_id) const OVERRIDE; + + /** * @brief Get information about vehicle * @return vehicle information */ @@ -792,7 +812,6 @@ class PolicyManagerImpl : public PolicyManager { void RetrySequence(); private: -#ifdef SDL_REMOTE_CONTROL /** * @brief Get resulting RPCs permissions for application which started on * specific device @@ -829,10 +848,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_; /** @@ -844,12 +863,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 /** * @brief lock guard for protecting applications list access 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 bd3319dba6..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, @@ -134,7 +136,9 @@ enum RequestType { RT_VEHICLE_DIAGNOSTICS, RT_EMERGENCY, RT_MEDIA, - RT_FOTA + RT_FOTA, + RT_OEM_SPECIFIC, + RT_EMPTY // Added to allow empty Request Types handling }; bool IsValidEnum(RequestType val); @@ -149,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 61585776f2..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 @@ -76,7 +76,7 @@ typedef Map<URL, 1, 255> URLList; typedef Map<URLList, 1, 255> ServiceEndpoints; typedef uint8_t NumberOfNotificationsType; -typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 6> +typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 7> NumberOfNotificationsPerMinute; typedef Array<Integer<uint16_t, 1, 1000>, 0, 5> SecondsBetweenRetries; @@ -96,11 +96,11 @@ typedef Map<DeviceParams, 0, 255> DeviceData; typedef Array<Enum<RequestType>, 0, 255> RequestTypes; -#ifdef SDL_REMOTE_CONTROL +typedef Strings RequestSubTypes; + 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; @@ -139,12 +139,11 @@ struct ApplicationParams : PolicyBase { Optional<Strings> nicknames; Optional<AppHMITypes> AppHMIType; Optional<RequestTypes> RequestType; + Optional<RequestSubTypes> RequestSubType; 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(); @@ -160,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 af1d119e7a..e0fc808e2f 100644 --- a/src/components/policy/policy_regular/include/policy/policy_types.h +++ b/src/components/policy/policy_regular/include/policy/policy_types.h @@ -267,7 +267,8 @@ struct AppPermissions { , appRevoked(false) , appPermissionsConsentNeeded(false) , appUnauthorized(false) - , requestTypeChanged(false) {} + , requestTypeChanged(false) + , requestSubTypeChanged(false) {} std::string application_id; bool isAppPermissionsRevoked; @@ -280,6 +281,8 @@ struct AppPermissions { DeviceParams deviceInfo; bool requestTypeChanged; std::vector<std::string> requestType; + bool requestSubTypeChanged; + std::vector<std::string> requestSubType; }; /** @@ -471,7 +474,8 @@ enum PermissionsCheckResult { RESULT_CONSENT_NEEDED, RESULT_CONSENT_NOT_REQIURED, RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED, - RESULT_REQUEST_TYPE_CHANGED + RESULT_REQUEST_TYPE_CHANGED, + RESULT_REQUEST_SUBTYPE_CHANGED }; /** diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h index 2ded25e456..5259ffa7e9 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h @@ -65,6 +65,7 @@ extern const std::string kSelectAppGroups; extern const std::string kSelectNicknames; extern const std::string kSelectAppTypes; extern const std::string kSelectRequestTypes; +extern const std::string kSelectRequestSubTypes; extern const std::string kSelectSecondsBetweenRetries; extern const std::string kSelectIgnitionCycles; extern const std::string kSelectKilometers; @@ -78,6 +79,9 @@ extern const std::string kInsertAppGroup; extern const std::string kInsertNickname; extern const std::string kInsertAppType; extern const std::string kInsertRequestType; +extern const std::string kInsertOmittedRequestType; +extern const std::string kInsertOmittedRequestSubType; +extern const std::string kInsertRequestSubType; extern const std::string kInsertMessageType; extern const std::string kInsertLanguage; extern const std::string kInsertMessageString; @@ -97,6 +101,7 @@ extern const std::string kDeleteRpc; extern const std::string kDeleteAppGroup; extern const std::string kDeleteApplication; extern const std::string kDeleteRequestType; +extern const std::string kDeleteRequestSubType; extern const std::string kDeleteDevice; extern const std::string kIncrementIgnitionCycles; extern const std::string kResetIgnitionCycles; 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 6b5d6111f1..b26b2c9ede 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 @@ -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; @@ -132,6 +130,9 @@ class SQLPTRepresentation : public virtual PTRepresentation { policy_table::AppHMITypes* app_types) const; bool GatherRequestType(const std::string& app_id, policy_table::RequestTypes* request_types) const; + bool GatherRequestSubType( + const std::string& app_id, + policy_table::RequestSubTypes* request_subtypes) const; bool GatherNickName(const std::string& app_id, policy_table::Strings* nicknames) const; @@ -167,6 +168,9 @@ class SQLPTRepresentation : public virtual PTRepresentation { const policy_table::AppHMITypes& types); bool SaveRequestType(const std::string& app_id, const policy_table::RequestTypes& types); + bool SaveRequestSubType( + const std::string& app_id, + const policy_table::RequestSubTypes& request_subtypes); public: bool UpdateRequired() const; 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 4f87a9e254..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" /> @@ -126,7 +128,7 @@ minsize="1" maxsize="255" /> <typedef name="NumberOfNotificationsPerMinute" type="Integer" - map="true" maxsize="6" minvalue="0" maxvalue="255" /> + map="true" maxsize="7" minvalue="0" maxvalue="255" /> <typedef name="SecondsBetweenRetries" type="Integer" array="true" maxsize="10" minvalue="1" maxvalue="1000" /> diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index b10cd51e8b..aee5c02d4c 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -33,18 +33,19 @@ #include "policy/cache_manager.h" #include <algorithm> -#include <cmath> -#include <ctime> #include <functional> +#include <ctime> +#include <cmath> #include <sstream> -#include "json/features.h" +#include "utils/file_system.h" +#include "utils/helpers.h" #include "json/reader.h" +#include "json/features.h" #include "json/writer.h" +#include "utils/logger.h" #include "utils/date_time.h" -#include "utils/file_system.h" #include "utils/gen_hash.h" -#include "utils/logger.h" #include "utils/macro.h" #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" @@ -102,7 +103,7 @@ CacheManager::CacheManager() : CacheManagerInterface() , pt_(new policy_table::Table) , backup_(new SQLPTRepresentation()) - , update_required(false) { + , update_required(false) LOG4CXX_AUTO_TRACE(logger_); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); @@ -1549,6 +1550,32 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) { return result; } +RequestType::State CacheManager::GetAppRequestTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(cache_lock_); + policy_table::ApplicationPolicies::iterator app_policies_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request types for app_id " << policy_app_id); + return RequestType::State::UNAVAILABLE; + } + const policy_table::RequestTypes& request_types = + *app_policies_iter->second.RequestType; + if (!request_types.is_initialized()) { + LOG4CXX_DEBUG(logger_, + "Request types for " << policy_app_id << " are OMITTED"); + return RequestType::State::OMITTED; + } + if (request_types.empty()) { + LOG4CXX_DEBUG(logger_, + "Request types for " << policy_app_id << " are EMPTY"); + return RequestType::State::EMPTY; + } + return RequestType::State::AVAILABLE; +} + void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { @@ -1567,11 +1594,60 @@ void CacheManager::GetAppRequestTypes( "Can't find request types for app_id " << policy_app_id); return; } - policy_table::RequestTypes::iterator it_request_type = - policy_iter->second.RequestType->begin(); - for (; it_request_type != policy_iter->second.RequestType->end(); - ++it_request_type) { - request_types.push_back(EnumToJsonString(*it_request_type)); + + for (const auto& request_type : *policy_iter->second.RequestType) { + request_types.push_back(EnumToJsonString(request_type)); + } + return; +} + +RequestSubType::State CacheManager::GetAppRequestSubTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(cache_lock_); + policy_table::ApplicationPolicies::iterator app_policies_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request subtypes for app_id " << policy_app_id); + return RequestSubType::State::UNAVAILABLE; + } + const policy_table::RequestSubTypes& request_subtypes = + *app_policies_iter->second.RequestSubType; + if (!request_subtypes.is_initialized()) { + LOG4CXX_DEBUG(logger_, + "Request subtypes for " << policy_app_id << " are OMITTED"); + return RequestSubType::State::OMITTED; + } + if (request_subtypes.empty()) { + LOG4CXX_DEBUG(logger_, + "Request subtypes for " << policy_app_id << " are EMPTY"); + return RequestSubType::State::EMPTY; + } + return RequestSubType::State::AVAILABLE; +} + +void CacheManager::GetAppRequestSubTypes( + const std::string& policy_app_id, + std::vector<std::string>& request_types) const { + LOG4CXX_AUTO_TRACE(logger_); + CACHE_MANAGER_CHECK_VOID(); + sync_primitives::AutoLock auto_lock(cache_lock_); + if (kDeviceId == policy_app_id) { + LOG4CXX_DEBUG(logger_, + "Request subtypes not applicable for app_id " << kDeviceId); + return; + } + policy_table::ApplicationPolicies::iterator policy_iter = + pt_->policy_table.app_policies_section.apps.find(policy_app_id); + if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { + LOG4CXX_DEBUG(logger_, + "Can't find request subtypes for app_id " << policy_app_id); + return; + } + + for (const auto& request_subtype : *policy_iter->second.RequestSubType) { + request_types.push_back(request_subtype); } return; } @@ -1634,9 +1710,8 @@ void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { LOG4CXX_AUTO_TRACE(logger_); - pt.app_policies_section.device = - const_cast<policy_table::PolicyTable&>(new_pt) - .app_policies_section.device; + pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>( + new_pt).app_policies_section.device; pt.app_policies_section.apps[kDefaultId] = const_cast<policy_table::PolicyTable&>(new_pt) diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 95f275769c..796dd25ec4 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -339,9 +339,20 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } PermissionsCheckResult result = CheckPermissionsChanges(app_policy); - if (!IsPredefinedApp(app_policy) && IsRequestTypeChanged(app_policy)) { - SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED); - NotifySystem(app_policy); + if (!IsPredefinedApp(app_policy)) { + const bool is_request_type_changed = IsRequestTypeChanged(app_policy); + const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy); + + if (is_request_type_changed) { + SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED); + } + if (is_request_subtype_changed) { + SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED); + } + + if (is_request_type_changed || is_request_subtype_changed) { + NotifySystem(app_policy); + } } if (RESULT_NO_CHANGES == result) { LOG4CXX_INFO(logger_, @@ -412,17 +423,19 @@ void policy::CheckAppPolicy::SetPendingPermissions( case RESULT_REQUEST_TYPE_CHANGED: permissions_diff.priority.clear(); permissions_diff.requestTypeChanged = true; - { - // Getting RequestTypes from PTU (not from cache) - policy_table::RequestTypes::const_iterator it_request_type = - app_policy.second.RequestType->begin(); - for (; app_policy.second.RequestType->end() != it_request_type; - ++it_request_type) { - permissions_diff.requestType.push_back( - EnumToJsonString(*it_request_type)); - } - } + // Getting Request Types from PTU (not from cache) + for (const auto& request_type : *app_policy.second.RequestType) { + permissions_diff.requestType.push_back(EnumToJsonString(request_type)); + } + break; + case RESULT_REQUEST_SUBTYPE_CHANGED: + permissions_diff.priority.clear(); + permissions_diff.requestSubTypeChanged = true; + // Getting Request SubTypes from PTU (not from cache) + for (const auto& request_subtype : *app_policy.second.RequestSubType) { + permissions_diff.requestSubType.push_back(request_subtype); + } break; default: return; @@ -491,6 +504,32 @@ bool CheckAppPolicy::IsRequestTypeChanged( return diff.size(); } +bool CheckAppPolicy::IsRequestSubTypeChanged( + const AppPoliciesValueType& app_policy) const { + policy::AppPoliciesConstItr it = + snapshot_->policy_table.app_policies_section.apps.find(app_policy.first); + + if (it == snapshot_->policy_table.app_policies_section.apps.end()) { + if (!app_policy.second.RequestSubType->empty()) { + return true; + } + return false; + } + + if (it->second.RequestSubType->size() != + app_policy.second.RequestSubType->size()) { + return true; + } + + policy_table::RequestSubTypes diff; + std::set_difference(it->second.RequestSubType->begin(), + it->second.RequestSubType->end(), + app_policy.second.RequestSubType->begin(), + app_policy.second.RequestSubType->end(), + std::back_inserter(diff)); + return diff.size(); +} + FillNotificationData::FillNotificationData(Permissions& data, GroupConsent group_state, GroupConsent undefined_group_consent) 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 3e08147a4c..d01631a2a2 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -50,11 +50,8 @@ #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 , 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; @@ -219,10 +213,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, return false; } - if (pt_update->policy_table.module_config.certificate.is_initialized()) { - listener_->OnCertificateUpdated( - *(pt_update->policy_table.module_config.certificate)); - } + listener_->OnCertificateUpdated( + *(pt_update->policy_table.module_config.certificate)); std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); @@ -385,6 +377,25 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( return request_types; } +RequestType::State PolicyManagerImpl::GetAppRequestTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetAppRequestTypesState(policy_app_id); +} + +RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + return cache_->GetAppRequestSubTypesState(policy_app_id); +} + +const std::vector<std::string> PolicyManagerImpl::GetAppRequestSubTypes( + const std::string& policy_app_id) const { + std::vector<std::string> request_subtypes; + cache_->GetAppRequestSubTypes(policy_app_id, request_subtypes); + return request_subtypes; +} + const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const { return cache_->GetVehicleInfo(); } @@ -406,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)) { @@ -467,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); @@ -711,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_, @@ -1056,13 +1070,6 @@ StatusNotifier PolicyManagerImpl::AddApplication( device_consent); } else { PromoteExistedApplication(application_id, device_consent); - const policy_table::AppHMIType type = policy_table::AHT_NAVIGATION; - if (helpers::in_range(hmi_types, - (rpc::Enum<policy_table::AppHMIType>)type) && - !HasCertificate()) { - LOG4CXX_DEBUG(logger_, "Certificate does not exist, scheduling update."); - update_status_manager_.ScheduleUpdate(); - } return utils::MakeShared<utils::CallNothing>(); } } @@ -1140,6 +1147,10 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name, if (ret) { RefreshRetrySequence(); update_status_manager_.OnPolicyInit(cache_->UpdateRequired()); + const std::string certificate_data = cache_->GetCertificate(); + if (!certificate_data.empty()) { + listener_->OnCertificateUpdated(certificate_data); + } } return ret; } @@ -1174,7 +1185,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"); @@ -1280,6 +1290,5 @@ void PolicyManagerImpl::set_access_remote( utils::SharedPtr<AccessRemote> access_remote) { access_remote_ = access_remote; } -#endif // SDL_REMOTE_CONTROL } // namespace policy 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 2145f06a4b..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; @@ -468,6 +482,10 @@ bool IsValidEnum(RequestType val) { return true; case RT_FOTA: return true; + case RT_OEM_SPECIFIC: + return true; + case RT_EMPTY: + return true; default: return false; } @@ -515,6 +533,10 @@ const char* EnumToJsonString(RequestType val) { return "MEDIA"; case RT_FOTA: return "FOTA"; + case RT_OEM_SPECIFIC: + return "OEM_SPECIFIC"; + case RT_EMPTY: + return "EMPTY"; default: return ""; } @@ -600,18 +622,27 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) { if ("FOTA" == literal) { *result = RT_FOTA; return true; + } + if ("OEM_SPECIFIC" == literal) { + *result = RT_OEM_SPECIFIC; + return true; + } + if ("EMPTY" == literal) { + *result = RT_EMPTY; + return true; } else { return false; } } -#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; } @@ -622,6 +653,8 @@ const char* EnumToJsonString(ModuleType val) { return "CLIMATE"; case MT_RADIO: return "RADIO"; + case MT_SEAT: + return "SEAT"; default: return ""; } @@ -634,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 5f6f85f5dd..c983e4f12b 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -164,14 +164,11 @@ ApplicationParams::ApplicationParams(const Json::Value* value__) , nicknames(impl::ValueMember(value__, "nicknames")) , AppHMIType(impl::ValueMember(value__, "AppHMIType")) , RequestType(impl::ValueMember(value__, "RequestType")) + , RequestSubType(impl::ValueMember(value__, "RequestSubType")) , 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()); @@ -179,17 +176,17 @@ Json::Value ApplicationParams::ToJsonValue() const { impl::WriteJsonField("nicknames", nicknames, &result__); impl::WriteJsonField("AppHMIType", AppHMIType, &result__); impl::WriteJsonField("RequestType", RequestType, &result__); + impl::WriteJsonField("RequestSubType", RequestSubType, &result__); 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__; } bool ApplicationParams::is_valid() const { - // RequestType is not validated since there is high-level validation logic, + // RequestType and RequestSubType are not validated since there is high-level + // validation logic, // which takes into account information not available here. if (!PolicyBase::is_valid()) { return false; @@ -212,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(); } @@ -240,6 +235,9 @@ bool ApplicationParams::struct_empty() const { if (RequestType.is_initialized()) { return false; } + if (RequestSubType.is_initialized()) { + return false; + } if (memory_kb.is_initialized()) { return false; } @@ -249,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; } @@ -273,6 +269,9 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { if (!RequestType.is_valid()) { RequestType.ReportErrors(&report__->ReportSubobject("RequestType")); } + if (!RequestSubType.is_valid()) { + RequestSubType.ReportErrors(&report__->ReportSubobject("RequestSubType")); + } if (!priority.is_valid()) { priority.ReportErrors(&report__->ReportSubobject("priority")); } @@ -286,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) { @@ -298,12 +295,11 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { groups.SetPolicyTableType(pt_type); AppHMIType.SetPolicyTableType(pt_type); RequestType.SetPolicyTableType(pt_type); + RequestSubType.SetPolicyTableType(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 10b8e4bf7c..714dfaae5a 100644 --- a/src/components/policy/policy_regular/src/policy_table/validation.cc +++ b/src/components/policy/policy_regular/src/policy_table/validation.cc @@ -40,11 +40,12 @@ bool ApplicationPoliciesSection::Validate() const { return false; } - PolicyTableType pt_type = GetPolicyTableType(); + const PolicyTableType pt_type = GetPolicyTableType(); if (PT_PRELOADED != pt_type && PT_UPDATE != pt_type) { return true; } + LOG4CXX_TRACE(logger_, "Checking app Request Types..."); if (!it_default_policy->second.RequestType.is_valid()) { LOG4CXX_WARN(logger_, "Default policy RequestTypes are not valid. Will be cleaned."); @@ -65,10 +66,15 @@ bool ApplicationPoliciesSection::Validate() const { ApplicationPolicies::iterator end_iter = apps.end(); while (iter != end_iter) { + if (it_default_policy == iter || it_pre_data_policy == iter) { + ++iter; + continue; + } ApplicationParams& app_params = (*iter).second; - bool is_request_type_omitted = !app_params.RequestType.is_initialized(); - bool is_request_type_valid = app_params.RequestType.is_valid(); - bool is_request_type_empty = app_params.RequestType->empty(); + const bool is_request_type_omitted = + !app_params.RequestType.is_initialized(); + const bool is_request_type_valid = app_params.RequestType.is_valid(); + const bool is_request_type_empty = app_params.RequestType->empty(); if (PT_PRELOADED == pt_type) { if (!is_request_type_valid) { @@ -111,10 +117,36 @@ bool ApplicationPoliciesSection::Validate() const { ++iter; } + LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + iter = apps.begin(); + while (iter != end_iter) { + if (it_default_policy == iter || it_pre_data_policy == iter) { + ++iter; + continue; + } + ApplicationParams& app_params = (*iter).second; + const bool is_request_subtype_omitted = + !app_params.RequestSubType.is_initialized(); + + if (is_request_subtype_omitted) { + LOG4CXX_WARN(logger_, + "App policy RequestSubTypes omitted." + " Will be replaced with default."); + app_params.RequestSubType = apps[kDefaultApp].RequestSubType; + ++iter; + continue; + } + + const bool is_request_subtype_empty = app_params.RequestSubType->empty(); + if (is_request_subtype_empty) { + LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + } + ++iter; + } + 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(); @@ -148,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_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc index ef4ef49273..91a5573a04 100644 --- a/src/components/policy/policy_regular/src/sql_pt_queries.cc +++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc @@ -258,13 +258,21 @@ const std::string kCreateSchema = " REFERENCES `application`(`id`) " "); " "CREATE TABLE IF NOT EXISTS `request_type`( " - " `request_type` VARCHAR(50) NOT NULL, " + " `request_type` VARCHAR(50), " " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`request_type`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " + "CREATE TABLE IF NOT EXISTS `request_subtype`( " + " `request_subtype` VARCHAR(50), " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " + " PRIMARY KEY(`request_subtype`,`application_id`), " + " CONSTRAINT `fk_request_subtype_app_id` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " " ON `app_type`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `consent_group`( " @@ -440,6 +448,8 @@ const std::string kDropSchema = "DROP TABLE IF EXISTS `consent_group`; " "DROP INDEX IF EXISTS `app_type.fk_app_type_application1_idx`; " "DROP TABLE IF EXISTS `app_type`; " + "DROP TABLE IF EXISTS `request_type`; " + "DROP TABLE IF EXISTS `request_subtype`; " "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; " "DROP TABLE IF EXISTS `nickname`; " "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; " @@ -582,9 +592,22 @@ const std::string kInsertAppType = "INSERT OR IGNORE INTO `app_type` (`application_id`, `name`) VALUES (?, ?)"; const std::string kInsertRequestType = - "INSERT OR IGNORE INTO `request_type` (`application_id`, `request_type`) " + "INSERT INTO `request_type` (`application_id`, `request_type`) " "VALUES (?, ?)"; +const std::string kInsertOmittedRequestType = + "INSERT INTO `request_type` (`application_id`) " + "VALUES (?)"; + +const std::string kInsertRequestSubType = + "INSERT INTO `request_subtype` (`application_id`, " + "`request_subtype`) " + "VALUES (?, ?)"; + +const std::string kInsertOmittedRequestSubType = + "INSERT INTO `request_subtype` (`application_id`) " + "VALUES (?)"; + const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?"; const std::string kInsertMessageType = @@ -695,6 +718,11 @@ const std::string kSelectRequestTypes = "SELECT DISTINCT `request_type` FROM `request_type` WHERE `application_id` " "= ?"; +const std::string kSelectRequestSubTypes = + "SELECT DISTINCT `request_subtype` FROM `request_subtype` WHERE " + "`application_id` " + "= ?"; + const std::string kSelectSecondsBetweenRetries = "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`"; @@ -740,6 +768,8 @@ const std::string kDeleteApplication = "DELETE FROM `application`"; const std::string kDeleteRequestType = "DELETE FROM `request_type`"; +const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`"; + const std::string kSelectApplicationRevoked = "SELECT `is_revoked` FROM `application` WHERE `id` = ?"; 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 9840a08b26..b1e574578e 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -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; } @@ -744,6 +742,10 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection( return false; } + if (!GatherRequestSubType(app_id, &*params.RequestSubType)) { + return false; + } + (*policies).apps[app_id] = params; } return true; @@ -837,6 +839,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( bool SQLPTRepresentation::SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs) { + LOG4CXX_AUTO_TRACE(logger_); utils::dbms::SQLQuery query(db()); utils::dbms::SQLQuery query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || @@ -900,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; @@ -916,6 +917,11 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( return false; } + if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + return false; + } + // All predefined apps (e.g. default, pre_DataConsent) should be saved first, // otherwise another app with the predefined permissions can get incorrect // permissions @@ -988,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; } @@ -1006,6 +1010,10 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( return false; } + if (!SaveRequestSubType(app.first, *app.second.RequestSubType)) { + return false; + } + return true; } @@ -1109,15 +1117,83 @@ bool SQLPTRepresentation::SaveRequestType( } policy_table::RequestTypes::const_iterator it; - for (it = types.begin(); it != types.end(); ++it) { + if (!types.empty()) { + LOG4CXX_WARN(logger_, "Request types not empty."); + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + return false; + } + } + } else if (types.is_initialized()) { + LOG4CXX_WARN(logger_, "Request types empty."); query.Bind(0, app_id); - query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); + query.Bind(1, + std::string(policy_table::EnumToJsonString( + policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { LOG4CXX_WARN(logger_, "Incorrect insert into request types."); return false; } + } else { + utils::dbms::SQLQuery query_omitted(db()); + if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + return false; + } + LOG4CXX_WARN(logger_, "Request types omitted."); + query_omitted.Bind(0, app_id); + if (!query_omitted.Exec() || !query_omitted.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + return false; + } + } + return true; +} + +bool SQLPTRepresentation::SaveRequestSubType( + const std::string& app_id, + const policy_table::RequestSubTypes& request_subtypes) { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + return false; } + policy_table::Strings::const_iterator it; + if (!request_subtypes.empty()) { + LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, *it); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } + } else if (request_subtypes.is_initialized()) { + LOG4CXX_WARN(logger_, "Request subtypes empty."); + query.Bind(0, app_id); + query.Bind(1, std::string("EMPTY")); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } else { + utils::dbms::SQLQuery query_omitted(db()); + if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + return false; + } + LOG4CXX_WARN(logger_, "Request subtypes omitted."); + query_omitted.Bind(0, app_id); + if (!query_omitted.Exec() || !query_omitted.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + return false; + } + } return true; } @@ -1529,11 +1605,36 @@ bool SQLPTRepresentation::GatherRequestType( if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { return false; } + if (policy_table::RequestType::RT_EMPTY == type) { + request_types->mark_initialized(); + continue; + } request_types->push_back(type); } return true; } +bool SQLPTRepresentation::GatherRequestSubType( + const std::string& app_id, + policy_table::RequestSubTypes* request_subtypes) const { + utils::dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + const std::string request_subtype = query.GetString(0); + if ("EMPTY" == request_subtype) { + request_subtypes->mark_initialized(); + continue; + } + request_subtypes->push_back(request_subtype); + } + return true; +} + bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); @@ -1564,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_); @@ -1755,7 +1854,6 @@ bool SQLPTRepresentation::GatherRemoteRpc( } return true; } -#endif // SDL_REMOTE_CONTROL bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_revoked, @@ -1858,6 +1956,13 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { !SaveRequestType(app_id, request_types)) { return false; } + + policy_table::Strings request_subtypes; + if (!GatherRequestSubType(kDefaultId, &request_subtypes) || + !SaveRequestSubType(app_id, request_subtypes)) { + return false; + } + policy_table::AppHMITypes app_types; if (!GatherAppType(kDefaultId, &app_types) || !SaveAppType(app_id, app_types)) { 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/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index 5fd0a48f7c..e4e361c52c 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 @@ -53,9 +53,8 @@ #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 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(); manager->set_access_remote(access_remote); -#endif // SDL_REMOTE_CONTROL } void TearDown() OVERRIDE { 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 c5386f612e..59e3f947c3 100644 --- a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json +++ b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json @@ -20,6 +20,7 @@ "notifications_per_minute_by_priority": { "EMERGENCY": 60, "NAVIGATION": 15, + "PROJECTION": 15, "COMMUNICATION": 6, "NORMAL": 4, "NONE": 0 @@ -296,6 +297,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -308,6 +310,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -320,6 +323,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -332,6 +336,7 @@ "LIMITED"], "parameters": ["accPedalPosition", "beltStatus", + "electronicParkBrakeStatus", "driverBraking", "myKey", "prndl", @@ -352,6 +357,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -371,6 +377,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -390,6 +397,7 @@ "engineOilLife", "engineTorque", "externalTemperature", + "turnSignal", "fuelLevel", "fuelLevel_State", "headLampStatus", @@ -408,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 fd83c82b1a..40dae10a4f 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 @@ -78,12 +78,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)); @@ -289,6 +289,7 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, app_policies["default"]["default_hmi"] = Json::Value("FULL"); app_policies["default"]["keep_context"] = Json::Value(true); app_policies["default"]["steal_focus"] = Json::Value(true); + app_policies["default"]["RequestType"] = Json::Value(Json::arrayValue); app_policies["pre_DataConsent"] = Json::Value(Json::objectValue); app_policies["pre_DataConsent"]["memory_kb"] = Json::Value(40); @@ -300,6 +301,9 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, app_policies["pre_DataConsent"]["is_revoked"] = Json::Value(false); app_policies["pre_DataConsent"]["keep_context"] = Json::Value(true); app_policies["pre_DataConsent"]["steal_focus"] = Json::Value(true); + app_policies["pre_DataConsent"]["RequestType"] = + Json::Value(Json::arrayValue); + app_policies["1234"] = Json::Value(Json::objectValue); app_policies["1234"]["memory_kb"] = Json::Value(150); app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(200); @@ -310,6 +314,8 @@ class SQLPTRepresentationTest : public SQLPTRepresentation, app_policies["1234"]["is_revoked"] = Json::Value(true); app_policies["1234"]["keep_context"] = Json::Value(false); app_policies["1234"]["steal_focus"] = Json::Value(false); + app_policies["1234"]["RequestType"] = Json::Value(Json::arrayValue); + app_policies["device"] = Json::Value(Json::objectValue); app_policies["device"]["groups"] = Json::Value(Json::arrayValue); app_policies["device"]["groups"][0] = Json::Value("default"); @@ -420,7 +426,9 @@ TEST_F(SQLPTRepresentationTest, ASSERT_EQ(0, dbms->FetchOneInt(query_select)); ASSERT_TRUE(reps->RefreshDB()); // Check PT structure destroyed and tables number is 0 - const int32_t total_tables_number = 28; + + // There are 29 tables in the database, now. + const int32_t total_tables_number = 29; ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select)); const char* query_select_count_of_iap_buffer_full = "SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`"; 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", |