diff options
Diffstat (limited to 'src/components/policy/policy_external/include')
15 files changed, 591 insertions, 88 deletions
diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h index 0fa53b0237..cee2a8774f 100644 --- a/src/components/policy/policy_external/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include <map> #include "policy/policy_table/types.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "policy/access_remote.h" #include "policy/cache_manager.h" @@ -46,7 +46,7 @@ namespace policy { class AccessRemoteImpl : public AccessRemote { public: AccessRemoteImpl(); - explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -144,7 +144,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr<CacheManager> cache_; + std::shared_ptr<CacheManager> cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index bda456c90a..d30e7cea24 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -35,7 +35,6 @@ #include <map> -#include "utils/shared_ptr.h" #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -84,6 +83,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. */ @@ -216,7 +231,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -642,8 +657,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; @@ -694,7 +719,7 @@ class CacheManager : public CacheManagerInterface { void SetExternalConsentForApp(const PermissionConsent& permissions) OVERRIDE; #ifdef BUILD_TESTS - utils::SharedPtr<policy_table::Table> GetPT() const { + std::shared_ptr<policy_table::Table> GetPT() const { return pt_; } #endif @@ -756,15 +781,15 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; - utils::SharedPtr<PTExtRepresentation> ex_backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; + std::shared_ptr<PTExtRepresentation> ex_backup_; bool update_required; typedef std::set<std::string> UnpairedDevices; UnpairedDevices is_unpaired_; - mutable sync_primitives::Lock cache_lock_; + mutable sync_primitives::RecursiveLock cache_lock_; sync_primitives::Lock unpaired_lock_; typedef std::map<std::string, Permissions> AppCalculatedPermissions; diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index b9e9f73646..bb9ce14c7f 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 @@ -38,7 +38,7 @@ #include "policy/policy_table/types.h" #include "policy/pt_representation.h" -#include "utils/shared_ptr.h" + #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.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 @@ -212,7 +237,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -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 */ @@ -789,16 +823,16 @@ class CacheManagerInterface { #ifdef BUILD_TESTS /** - * @brief GetPT allows to obtain SharedPtr to PT. + * @brief GetPT allows to obtain std::shared_ptr to PT. * Used ONLY in Unit tests - * @return SharedPTR to PT + * @return std::shared_ptr to PT * */ - virtual utils::SharedPtr<policy_table::Table> GetPT() const = 0; + virtual std::shared_ptr<policy_table::Table> GetPT() const = 0; #endif }; -typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr; } // namespace policy 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..e3cb509c15 100644 --- a/src/components/policy/policy_external/include/policy/policy_helper.h +++ b/src/components/policy/policy_external/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -85,8 +85,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot, + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot, CheckAppPolicyResults& out_results); bool operator()(const AppPoliciesValueType& app_policy); @@ -100,7 +100,8 @@ struct CheckAppPolicy { * @param result Result of check of updated policy */ void SetPendingPermissions(const AppPoliciesValueType& app_policy, - PermissionsCheckResult result) const; + PermissionsCheckResult result, + AppPermissions& permissions_diff) const; /** * @brief Analyzes updated application policy whether any changes received. If * yes - provides appropriate result code @@ -192,10 +193,30 @@ 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; + + /** + * @brief Helper function that inserts permissions into app_permissions_diff_ + * map. + * udpated + * @param app_policy Reference to updated application policy + * @param permissions_diff Reference to app permissions to be inserted into + * map. + * @return void + */ + void InsertPermission(const std::string& app_id, + const AppPermissions& permissions_diff); + private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> snapshot_; CheckAppPolicyResults& out_results_; }; @@ -247,8 +268,26 @@ struct FillNotificationData { const std::set<Parameter>& target); void InitRpcKeys(const std::string& rpc_name); bool RpcParametersEmpty(RpcPermissions& rpc); - bool IsSectionEmpty(ParameterPermissions& permissions, - const std::string& section); + + /** + * @brief Checks if specific section in specified permissions is empty + * @param permissions reference to the permissions structure + * @param section reference to the section name + * @return true if specified section in permissions is empty otherwise returns + * false + */ + bool IsSectionEmpty(const ParameterPermissions& permissions, + const std::string& section) const; + + /** + * @brief Checks if at least one parameter is allowed for the specified + * permissions + * @param permissions reference to the permissions structure + * @return true if at least one parameter is allowed for the specified + * permissions otherwise returns false + */ + bool IsSomeParameterAllowed(const ParameterPermissions& permissions) const; + std::string current_key_; Permissions& data_; const bool does_require_user_consent_; 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..3837dda1fa 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 @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ #include <list> -#include "utils/shared_ptr.h" + #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.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 @@ -476,7 +472,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Setter for access_remote instance * @param access_remote pointer to new access_remote instance */ - void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -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 */ @@ -698,7 +717,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> Parse( const BinaryMessage& pt_content); private: @@ -717,8 +736,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ CheckAppPolicyResults CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); /** * @brief Processes results from policy table update analysis done by @@ -841,10 +860,9 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; -#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 + std::shared_ptr<AccessRemote> access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_external/include/policy/policy_table.h b/src/components/policy/policy_external/include/policy/policy_table.h index ecbd56c2e4..fe27f1cb57 100644 --- a/src/components/policy/policy_external/include/policy/policy_table.h +++ b/src/components/policy/policy_external/include/policy/policy_table.h @@ -33,7 +33,6 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_ -#include "utils/shared_ptr.h" #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" @@ -42,7 +41,7 @@ namespace policy { class PolicyTable { public: PolicyTable(); - explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +49,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h index 4f8ae5c98d..34864c5602 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 @@ -44,6 +44,7 @@ enum Priority { P_VOICECOM, P_COMMUNICATION, P_NORMAL, + P_PROJECTION, P_NONE, }; @@ -66,20 +67,24 @@ enum Parameter { P_SPEED, P_ENGINETORQUE, P_EXTERNALTEMPERATURE, + P_TURNSIGNAL, P_FUELLEVEL, P_FUELLEVEL_STATE, P_HEADLAMPSTATUS, P_INSTANTFUELCONSUMPTION, + P_FUELRANGE, P_ODOMETER, P_TIREPRESSURE, P_WIPERSTATUS, P_VIN, P_ACCPEDALPOSITION, P_BELTSTATUS, + P_ELECTRONICPARKBRAKESTATUS, P_DRIVERBRAKING, P_PRNDL, P_RPM, P_STEERINGWHEELANGLE, + P_ENGINEOILLIFE, P_MYKEY, P_AIRBAGSTATUS, P_BODYINFORMATION, @@ -88,7 +93,6 @@ enum Parameter { P_EMERGENCYEVENT, P_ECALLINFO, P_ABS_STATE, - P_TURN_SIGNAL, P_FUEL_RANGE, P_TIRE_PRESSURE_VALUE, P_TPMS, @@ -147,7 +151,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); @@ -165,11 +171,382 @@ bool EnumFromJsonString(const std::string& literal, Input* result); enum ModuleType { MT_CLIMATE, MT_RADIO, + MT_SEAT, + MT_AUDIO, + MT_LIGHT, + MT_HMI_SETTINGS, + MT_EMPTY }; bool IsValidEnum(ModuleType val); const char* EnumToJsonString(ModuleType val); bool EnumFromJsonString(const std::string& literal, ModuleType* result); +/** + * @brief Enumeration FunctionID. + * + * Enumeration linking function names with function IDs in AppLink protocol. + * Assumes enumeration starts at value 0. + */ +enum FunctionID { + /** + * @brief RESERVED. + */ + RESERVED = 0, + + /** + * @brief RegisterAppInterfaceID. + */ + RegisterAppInterfaceID = 1, + + /** + * @brief UnregisterAppInterfaceID. + */ + UnregisterAppInterfaceID = 2, + + /** + * @brief SetGlobalPropertiesID. + */ + SetGlobalPropertiesID = 3, + + /** + * @brief ResetGlobalPropertiesID. + */ + ResetGlobalPropertiesID = 4, + + /** + * @brief AddCommandID. + */ + AddCommandID = 5, + + /** + * @brief DeleteCommandID. + */ + DeleteCommandID = 6, + + /** + * @brief AddSubMenuID. + */ + AddSubMenuID = 7, + + /** + * @brief DeleteSubMenuID. + */ + DeleteSubMenuID = 8, + + /** + * @brief CreateInteractionChoiceSetID. + */ + CreateInteractionChoiceSetID = 9, + + /** + * @brief PerformInteractionID. + */ + PerformInteractionID = 10, + + /** + * @brief DeleteInteractionChoiceSetID. + */ + DeleteInteractionChoiceSetID = 11, + + /** + * @brief AlertID. + */ + AlertID = 12, + + /** + * @brief ShowID. + */ + ShowID = 13, + + /** + * @brief SpeakID. + */ + SpeakID = 14, + + /** + * @brief SetMediaClockTimerID. + */ + SetMediaClockTimerID = 15, + + /** + * @brief PerformAudioPassThruID. + */ + PerformAudioPassThruID = 16, + + /** + * @brief EndAudioPassThruID. + */ + EndAudioPassThruID = 17, + + /** + * @brief SubscribeButtonID. + */ + SubscribeButtonID = 18, + + /** + * @brief UnsubscribeButtonID. + */ + UnsubscribeButtonID = 19, + + /** + * @brief SubscribeVehicleDataID. + */ + SubscribeVehicleDataID = 20, + + /** + * @brief UnsubscribeVehicleDataID. + */ + UnsubscribeVehicleDataID = 21, + + /** + * @brief GetVehicleDataID. + */ + GetVehicleDataID = 22, + + /** + * @brief ReadDIDID. + */ + ReadDIDID = 23, + + /** + * @brief GetDTCsID. + */ + GetDTCsID = 24, + + /** + * @brief ScrollableMessageID. + */ + ScrollableMessageID = 25, + + /** + * @brief SliderID. + */ + SliderID = 26, + + /** + * @brief ShowConstantTBTID. + */ + ShowConstantTBTID = 27, + + /** + * @brief AlertManeuverID. + */ + AlertManeuverID = 28, + + /** + * @brief UpdateTurnListID. + */ + UpdateTurnListID = 29, + + /** + * @brief ChangeRegistrationID. + */ + ChangeRegistrationID = 30, + + /** + * @brief GenericResponseID. + */ + GenericResponseID = 31, + + /** + * @brief PutFileID. + */ + PutFileID = 32, + + /** + * @brief DeleteFileID. + */ + DeleteFileID = 33, + + /** + * @brief ListFilesID. + */ + ListFilesID = 34, + + /** + * @brief SetAppIconID. + */ + SetAppIconID = 35, + + /** + * @brief SetDisplayLayoutID. + */ + SetDisplayLayoutID = 36, + + /** + * @brief DiagnosticMessageID. + */ + DiagnosticMessageID = 37, + + /** + * @brief SystemRequestID. + */ + SystemRequestID = 38, + + /** + * @brief SendLocationID. + */ + SendLocationID = 39, + + /** + * @brief DialNumberID. + */ + DialNumberID = 40, + + /** + * @brief ButtonPressID. + */ + ButtonPressID = 41, + + /** + * @brief GetInteriorVehicleDataID. + */ + GetInteriorVehicleDataID = 43, + + /** + * @brief SetInteriorVehicleDataID. + */ + SetInteriorVehicleDataID = 44, + + /** + * @brief GetWayPointsID. + */ + GetWayPointsID = 45, + + /** + * @brief SubscribeWayPointsID. + */ + SubscribeWayPointsID = 46, + + /** + * @brief UnsubscribeWayPointsID. + */ + UnsubscribeWayPointsID = 47, + + /** + * @brief GetSystemCapabilityID. + */ + GetSystemCapabilityID = 48, + + /** + * @brief SendHapticDataID. + */ + SendHapticDataID = 49, + + /** + * @brief OnHMIStatusID. + */ + OnHMIStatusID = 32768, + + /** + * @brief OnAppInterfaceUnregisteredID. + */ + OnAppInterfaceUnregisteredID = 32769, + + /** + * @brief OnButtonEventID. + */ + OnButtonEventID = 32770, + + /** + * @brief OnButtonPressID. + */ + OnButtonPressID = 32771, + + /** + * @brief OnVehicleDataID. + */ + OnVehicleDataID = 32772, + + /** + * @brief OnCommandID. + */ + OnCommandID = 32773, + + /** + * @brief OnTBTClientStateID. + */ + OnTBTClientStateID = 32774, + + /** + * @brief OnDriverDistractionID. + */ + OnDriverDistractionID = 32775, + + /** + * @brief OnPermissionsChangeID. + */ + OnPermissionsChangeID = 32776, + + /** + * @brief OnAudioPassThruID. + */ + OnAudioPassThruID = 32777, + + /** + * @brief OnLanguageChangeID. + */ + OnLanguageChangeID = 32778, + + /** + * @brief OnKeyboardInputID. + */ + OnKeyboardInputID = 32779, + + /** + * @brief OnTouchEventID. + */ + OnTouchEventID = 32780, + + /** + * @brief OnSystemRequestID. + */ + OnSystemRequestID = 32781, + + /** + * @brief OnHashChangeID. + */ + OnHashChangeID = 32782, + + /** + * @brief OnInteriorVehicleDataID. + */ + OnInteriorVehicleDataID = 32783, + + /** + * @brief OnWayPointChangeID. + */ + OnWayPointChangeID = 32784, + + /** + * @brief OnRCStatusID. + */ + OnRCStatusID = 32785, + + /** + * @brief EncodedSyncPDataID. + */ + EncodedSyncPDataID = 65536, + + /** + * @brief SyncPDataID. + */ + SyncPDataID = 65537, + + /** + * @brief OnEncodedSyncPDataID. + */ + OnEncodedSyncPDataID = 98304, + + /** + * @brief OnSyncPDataID. + */ + OnSyncPDataID = 98305 +}; +bool IsValidEnum(FunctionID val); +const char* EnumToJsonString(FunctionID val); +bool EnumFromJsonString(const std::string& literal, FunctionID* result); + extern const std::string kDefaultApp; extern const std::string kPreDataConsentApp; extern const std::string kDeviceApp; 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..68e29a97ee 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 { @@ -306,6 +303,7 @@ struct ModuleConfig : CompositeType { Optional<String<0, 10> > preloaded_date; Optional<String<0, 65535> > certificate; Optional<Boolean> preloaded_pt; + Optional<Boolean> full_app_id_supported; public: ModuleConfig(); 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 91518f8f6e..26af165506 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,20 +26,24 @@ <element name="speed" /> <element name="engineTorque" /> <element name="externalTemperature" /> + <element name="turnSignal" /> <element name="fuelLevel" /> <element name="fuelLevel_State" /> <element name="headLampStatus" /> <element name="instantFuelConsumption" /> + <element name="fuelRange" /> <element name="odometer" /> <element name="tirePressure" /> <element name="wiperStatus" /> <element name="vin" /> <element name="accPedalPosition" /> <element name="beltStatus" /> + <element name="electronicParkBrakeStatus" /> <element name="driverBraking" /> <element name="prndl" /> <element name="rpm" /> <element name="steeringWheelAngle" /> + <element name="engineOilLife" /> <element name="myKey" /> <element name="airbagStatus" /> <element name="bodyInformation" /> @@ -94,8 +98,7 @@ <typedef name="HmiLevels" type="HmiLevel" array="true" maxsize="4" /> - <typedef name="Parameters" type="Parameter" array="true" - maxsize="24" /> + <typedef name="Parameters" type="Parameter" array="true"/> <struct name="RpcParameters"> <!-- maxsizes are equal to number of currently known elements of @@ -128,7 +131,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" /> @@ -136,6 +139,7 @@ <struct name="ModuleConfig"> <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> <param name="preloaded_pt" type="Boolean" mandatory="false" /> + <param name="full_app_id_supported" type="Boolean" mandatory="false" /> <param name="exchange_after_x_ignition_cycles" type="Integer" maxvalue="255" /> <param name="exchange_after_x_kilometers" type="Integer" 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..84d9376a93 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -39,7 +39,8 @@ #include <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" +#include <memory> + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +80,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; @@ -267,7 +268,8 @@ struct AppPermissions { , appRevoked(false) , appPermissionsConsentNeeded(false) , appUnauthorized(false) - , requestTypeChanged(false) {} + , requestTypeChanged(false) + , requestSubTypeChanged(false) {} std::string application_id; bool isAppPermissionsRevoked; @@ -280,6 +282,8 @@ struct AppPermissions { DeviceParams deviceInfo; bool requestTypeChanged; std::vector<std::string> requestType; + bool requestSubTypeChanged; + std::vector<std::string> requestSubType; }; /** @@ -503,7 +507,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/pt_representation.h b/src/components/policy/policy_external/include/policy/pt_representation.h index 66a9218771..f25fcc6cab 100644 --- a/src/components/policy/policy_external/include/policy/pt_representation.h +++ b/src/components/policy/policy_external/include/policy/pt_representation.h @@ -213,7 +213,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h index a69df20cfc..dd9e0204e7 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,7 @@ extern const std::string kInsertAppGroup; extern const std::string kInsertNickname; extern const std::string kInsertAppType; extern const std::string kInsertRequestType; +extern const std::string kInsertRequestSubType; extern const std::string kInsertMessageType; extern const std::string kInsertLanguage; extern const std::string kInsertMessageString; @@ -98,6 +100,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..13816eb6c5 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 @@ -85,7 +85,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const; virtual bool Save(const policy_table::Table& table); bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = NULL, @@ -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/include/policy/update_status_manager.h b/src/components/policy/policy_external/include/policy/update_status_manager.h index b663610a5b..3a9e13b83f 100644 --- a/src/components/policy/policy_external/include/policy/update_status_manager.h +++ b/src/components/policy/policy_external/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr<Status> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -114,15 +114,15 @@ class UpdateStatusManager { void OnResetRetrySequence(); /** - * @brief Update status handler on new application registering + * @brief Update status handler on existed application registering + * @param is_update_required Update necessity flag */ - void OnNewApplicationAdded(const DeviceConsent consent); + void OnExistedApplicationAdded(const bool is_update_required); /** - * @brief Update status handler for policy initialization - * @param is_update_required Update necessity flag + * @brief Update status handler on new application registering */ - void OnPolicyInit(bool is_update_required); + void OnNewApplicationAdded(const DeviceConsent consent); /** * @brief In case application from non-consented device has been registered @@ -199,17 +199,17 @@ class UpdateStatusManager { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; @@ -227,7 +227,7 @@ class UpdateStatusManager { volatile uint32_t timeout_; volatile bool stop_flag_; - sync_primitives::Lock state_lock_; + sync_primitives::RecursiveLock state_lock_; sync_primitives::ConditionalVariable termination_condition_; UpdateStatusManager* update_status_manager_; }; diff --git a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h index adaef0eb28..c145bb432b 100644 --- a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include <ctime> #include "policy/usage_statistics/statistics_manager.h" #include "policy/usage_statistics/app_stopwatch.h" -#include "utils/shared_ptr.h" + #include "utils/timer.h" #include "utils/macro.h" @@ -46,18 +46,18 @@ using timer::Timer; class GlobalCounter { public: - GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type); void operator++() const; @@ -65,12 +65,12 @@ class AppCounter { private: std::string app_id_; AppCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type); void Update(const std::string& new_info) const; @@ -78,14 +78,14 @@ class AppInfo { private: std::string app_id_; AppInfoId info_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, std::uint32_t timeout); ~AppStopwatchImpl(); @@ -97,7 +97,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); |