diff options
Diffstat (limited to 'src/components/policy/policy_regular/include/policy')
9 files changed, 371 insertions, 647 deletions
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 a28f1b3461..48e00f7049 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -36,7 +36,6 @@ #include <map> #include "policy/pt_representation.h" -#include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" #include "policy/cache_manager_interface.h" #include "utils/threads/thread.h" diff --git a/src/components/policy/policy_regular/include/policy/policy_table.h b/src/components/policy/policy_regular/include/policy/policy_table.h index 353cdda871..8ef3cd7fc8 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table.h +++ b/src/components/policy/policy_regular/include/policy/policy_table.h @@ -34,7 +34,6 @@ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ #include "policy/pt_representation.h" -#include "policy/pt_ext_representation.h" namespace policy { diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h index b2acf77ec1..1f10db9f6f 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 @@ -44,6 +44,7 @@ enum Priority { P_VOICECOM, P_COMMUNICATION, P_NORMAL, + P_PROJECTION, P_NONE, }; @@ -166,6 +167,372 @@ 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_regular/include/policy/pt_ext_representation.h b/src/components/policy/policy_regular/include/policy/pt_ext_representation.h deleted file mode 100644 index f70946d1f5..0000000000 --- a/src/components/policy/policy_regular/include/policy/pt_ext_representation.h +++ /dev/null @@ -1,336 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ - -#include "policy/pt_representation.h" - -namespace policy { - -enum StatisticsType { - S_NONE = 0, - S_IAP_BUFFER_FULL, - S_SYNC_OUT_OF_MEMORY, - S_SYNC_REBOOTS, - S_MINS_HMI_FULL, - S_MINS_HMI_LIMITED, - S_MINS_HMI_BACKGROUND, - S_MINS_HMI_NONE, - S_RFCOM_LIMIT_REACHED, - S_USER_SELECTIONS, - S_REJECTIONS_SYNC_OUT_OF_MEMORY, - S_REJECTIONS_NICKNAME_MISMATCH, - S_REJECTIONS_DUPLICATE_NAME, - S_REJECTED_RPC_CALLS, - S_RPCS_IN_HMI_NONE, - S_REMOVALS_MISBEHAVED, - S_RUN_ATTEMPTS_WHILE_REVOKED -}; - -enum LanguageType { L_NONE = 0, L_GUI, L_VUI }; - -class PTExtRepresentation : public virtual PTRepresentation { - public: - virtual ~PTExtRepresentation() {} - - /** - * @brief Is application allowed to send notifications while in - * Backgound or limited mode. - * @param app_id Application id - * @return bool Allowed/disallowed. - */ - virtual bool CanAppKeepContext(const std::string& app_id) = 0; - - /** - * @brief Is application allowed to move foreground at will? - * @param app_id Application id - * @return bool Allowed/disallowed. - */ - virtual bool CanAppStealFocus(const std::string& app_id) = 0; - - /** - * @brief Get default_hmi for given application - * @param policy_app_id Unique application id - * @param default_hmi Default HMI level for application or empty, if value was - * not set - * @return true, if succedeed, otherwise - false - */ - virtual bool GetDefaultHMI(const std::string& policy_app_id, - std::string* default_hmi) = 0; - - /** - * @brief Reset user consent for device data and applications permissions - * @return - */ - virtual bool ResetUserConsent() = 0; - - /** - * @brief Reset user consent for device data - * @return - */ - virtual bool ResetDeviceConsents() = 0; - - /** - * @brief Reset user consent for applications permissions - * @return - */ - virtual bool ResetAppConsents() = 0; - - /** - * @brief Get user permissions for device data usage - * @param device_id Generated or obtained id of device - * @param consented_groups Groups consented by user - * @param disallowed_groups Groups not consented by user - * @return true, if query was successfull, otherwise - false - */ - virtual bool GetUserPermissionsForDevice( - const std::string& device_id, - StringArray* consented_groups = NULL, - StringArray* disallowed_groups = NULL) = 0; - - /** - * @brief Gets list of groups permissions from policy table - * @param device_id Unique device id, which hosts specific application - * @param policy_app_id Unique application id - * @param group_types Group list sorted by permission status - * @return true, if query was successfull, otherwise - false - */ - virtual bool GetPermissionsForApp(const std::string& device_id, - const std::string& policy_app_id, - FunctionalIdType* group_types) = 0; - - /** - * @brief Get device groups and preconsented groups from policies section - * @param groups List of groups to be consented for device usage - * @param preconsented_groups List of preconsented groups for device usage - * @return true, if query was successful, otherwise - false - */ - virtual bool GetDeviceGroupsFromPolicies( - policy_table::Strings* groups = NULL, - policy_table::Strings* preconsented_groups = NULL) = 0; - - /** - * @brief Record information about mobile device in Policy Table. - * @param device_id Generated or obtained id of device - * @return bool Success of operation - */ - virtual bool SetDeviceData(const std::string& device_id, - const std::string& hardware = "", - const std::string& firmware = "", - const std::string& os = "", - const std::string& os_version = "", - const std::string& carrier = "", - const uint32_t number_of_ports = 0, - const std::string& connection_type = "") = 0; - - /** - * @brief Sets user consent for particular mobile device, - * i.e. to use device for exchanging of Policy Table. - * @return bool Success of operation - */ - virtual bool SetUserPermissionsForDevice( - const std::string& device_id, - const StringArray& consented_groups = StringArray(), - const StringArray& disallowed_gropus = StringArray()) = 0; - - /** - * @brief Update Application Policies as reaction - * on User allowing/disallowing device this app is running on. - */ - virtual bool ReactOnUserDevConsentForApp(const std::string& app_id, - bool is_device_allowed) = 0; - - /** - * @brief Set user consent on functional groups - * @param permissions User consent on functional group - * @return true, if operation succedeed, otherwise - false - */ - virtual bool SetUserPermissionsForApp( - const PermissionConsent& permissions) = 0; - - /** - * @brief Counter for statistics information: adds 1 to existing number. - * @param type Type of statistics (errors, mins in mode etc) - * @return bool Success of operation - */ - virtual bool IncreaseStatisticsData(StatisticsType type) = 0; - - /** - * @brief Records information about what language - * application tried to register with. - * @param app_id Id of application - * @param type - language for UI/VR - * @param language Language - * @return bool Success of operation - */ - virtual bool SetAppRegistrationLanguage(const std::string& app_id, - LanguageType type, - const std::string& language) = 0; - - /** - * @brief Records information about head unit system to PT - * @return bool Success of operation - */ - virtual bool SetMetaInfo(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language) = 0; - - /** - * @brief Checks, if specific head unit is present in PT - * @return boot Suceess, if present, otherwise - false - */ - virtual bool IsMetaInfoPresent() = 0; - - /** - * @brief Kms pass since last successfull PT update - */ - virtual int GetKmFromSuccessfulExchange() = 0; - - /** - * @brief Days pass since last successfull PT update - */ - virtual int GetDayFromScsExchange() = 0; - - /** - * @brief Ignition cycles pass since last successfull PT update - */ - virtual int GetIgnitionsFromScsExchange() = 0; - - /** - * @brief Set current system language - * @param language System language - * @return true, if succedeed, otherwise - false - */ - virtual bool SetSystemLanguage(const std::string& language) = 0; - - /** - * Increments global counter - * @param type type of counter - */ - virtual void Increment(const std::string& type) const = 0; - - /** - * Increments counter of application - * @param app_id id application - * @param type type of counter - */ - virtual void Increment(const std::string& app_id, - const std::string& type) const = 0; - - /** - * Sets value of application information - * @param app_id id application - * @param type type of information - * @param value value of information - */ - virtual void Set(const std::string& app_id, - const std::string& type, - const std::string& value) const = 0; - - /** - * Adds value to stopwatch of application - * @param app_id id application - * @param type type of stopwatch - * @param seconds value for adding in seconds - */ - virtual void Add(const std::string& app_id, - const std::string& type, - int seconds) const = 0; - - virtual bool CountUnconsentedGroups(const std::string& policy_app_id, - const std::string& device_id, - int* result) const = 0; - - /** - * @brief Gets functional group names and user_consent_prompts, if any - * @param Array to be filled with group ids, names and functional prompts - * @return true, if succeeded, otherwise - false - */ - // TODO(AOleynik): Possibly, we can get rid of this method. Check this. - virtual bool GetFunctionalGroupNames(policy::FunctionalGroupNames& names) = 0; - - /** - * @brief Set app policy to pre_DataConsented policy - * @param app_id Policy ID of application to be changed - * @return true, if succeeded, otherwise - false - */ - virtual bool SetPredataPolicy(const std::string& app_id) = 0; - - /** - * @brief Updates application policy to either pre_DataConsented or not - * @param app_id Policy Id of application to be checked - * @param is_pre_data True of False to setting app policy to be - * pre_DataConsented - * @return true, if succeeded, otherwise - false - */ - virtual bool SetIsPredata(const std::string& app_id, bool is_pre_data) = 0; - - /** - * @brief Removes unpaired devices - * @return true if success - */ - virtual bool CleanupUnpairedDevices(const DeviceIds& device_ids) const = 0; - - /** - * Sets flag of unpaired device - * @param device_id Unique device id - * @param unpaired True, if unpaired, otherwise - false - * @return true if success - */ - virtual bool SetUnpairedDevice(const std::string& device_id, - bool unpaired) const = 0; - - /** - * Gets list of unpaired devices - * @param device_ids output list - * @return true if success - */ - virtual bool UnpairedDevicesList(DeviceIds* device_ids) const = 0; - - /** - * @brief Remove application consent for particular group - * @param policy_app_id Unique application id - * @param functional_group_name Functional group name, which consents should - * be removed - * @return true, in case of success, otherwise - false - */ - virtual bool RemoveAppConsentForGroup( - const std::string& policy_app_id, - const std::string& functional_group_name) const = 0; - virtual bool SaveExternalConsentStatus( - const ExternalConsentStatus& status) const = 0; - virtual ExternalConsentStatus GetExternalConsentStatus() const = 0; -}; -} // namespace policy - -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h deleted file mode 100644 index 727c0b165d..0000000000 --- a/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (c) 2013, " Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, " with or without - modification, " are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, " this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, " - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR - CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN - CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ - -#include <string> - -namespace policy { -namespace sql_pt_ext { - -extern const std::string kSelectKeepContext; -extern const std::string kSelectStealFocus; -extern const std::string kResetDeviceConsents; -extern const std::string kResetAppConsents; -extern const std::string kCountDeviceConsentGroup; -extern const std::string kCountDevice; -extern const std::string kSelectDeviceConsentedGroup; -extern const std::string kUpdateDeviceConsentedGroup; -extern const std::string kUpdateDevice; -extern const std::string kInsertDeviceConsentedGroup; -extern const std::string kInsertDevice; -extern const std::string kSelectDeviceData; -extern const std::string kSelectConsentGroup; -extern const std::string kInsertPreconsentedGroups; -extern const std::string kSelectPreconsentedGroups; -extern const std::string kDeletePreconsentedGroups; -extern const std::string kSelectUsageAndErrorCount; -extern const std::string kSelectAppLevels; -extern const std::string kUpdateGlobalCounters; -extern const std::string kInsertDeviceData; -extern const std::string kDeleteDeviceData; -extern const std::string kInsertConsentGroups; -extern const std::string kCountUnconsentedGroups; -extern const std::string kSelectModuleMeta; -extern const std::string kUpdateMetaParams; -extern const std::string kUpdateModuleMetaVinParam; -extern const std::string kSaveModuleMeta; -extern const std::string kSelectMetaParams; -extern const std::string kCountAppLevel; -extern const std::string kUpdateGroupPermissions; -extern const std::string kSelectDefaultHmi; -extern const std::string kInsertApplication; -extern const std::string kSelectFriendlyMsg; -extern const std::string kCollectFriendlyMsg; -extern const std::string kSelectAppGroupsId; -extern const std::string kSelectConsentedGroupsId; -extern const std::string kCountAppConsents; -extern const std::string kSelectPreconsentedGroupsId; -extern const std::string kSelectFunctionalGroupNames; -extern const std::string kSelectAppPolicies; -extern const std::string kUpdateMetaLanguage; -extern const std::string kDeleteDeviceConsent; -extern const std::string kDeleteAppGroupConsent; -extern const std::string kSelectGroupId; -extern const std::string kSelectApplicationIsPreData; -extern const std::string kUpdateIsPredata; -extern const std::string kHasAppPreloadedGroups; -extern const std::string kUpdateUnpairedDevice; -extern const std::string kSelectUnpairedDevices; -extern const std::string kHasMsgLanguageCode; -extern const std::string kDeletePreconsentedGroupsByApplicationId; -extern const std::string kDeleteAppConsent; -extern const std::string kSelectExternalConsentStatus; -} // namespace sql_pt_ext -} // namespace policy - -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h deleted file mode 100644 index 0958bad5e1..0000000000 --- a/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ -#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ - -#include <string> -#include "policy/sql_pt_representation.h" -#include "policy/pt_ext_representation.h" - -namespace policy { - -class SQLPTExtRepresentation : public SQLPTRepresentation, - public PTExtRepresentation { - public: - bool CanAppKeepContext(const std::string& app_id); - bool CanAppStealFocus(const std::string& app_id); - bool GetDefaultHMI(const std::string& policy_app_id, - std::string* default_hmi); - bool ResetUserConsent(); - bool ResetDeviceConsents(); - bool ResetAppConsents(); - bool GetUserPermissionsForDevice(const std::string& device_id, - StringArray* consented_groups = NULL, - StringArray* disallowed_groups = NULL); - - bool GetPermissionsForApp(const std::string& device_id, - const std::string& policy_app_id, - FunctionalIdType* group_types); - - bool GetDeviceGroupsFromPolicies( - policy_table::Strings* groups = NULL, - policy_table::Strings* preconsented_groups = NULL); - bool SetDeviceData(const std::string& device_id, - const std::string& hardware = "", - const std::string& firmware = "", - const std::string& os = "", - const std::string& os_version = "", - const std::string& carrier = "", - const uint32_t number_of_ports = 0, - const std::string& connection_type = ""); - bool SetUserPermissionsForDevice( - const std::string& device_id, - const StringArray& consented_groups = StringArray(), - const StringArray& disallowed_groups = StringArray()); - - bool ReactOnUserDevConsentForApp(const std::string& app_id, - bool is_device_allowed); - - bool SetUserPermissionsForApp(const PermissionConsent& permissions); - - std::vector<UserFriendlyMessage> GetUserFriendlyMsg( - const std::vector<std::string>& msg_codes, const std::string& language); - - bool IncreaseStatisticsData(StatisticsType type) { - return true; - } - bool SetAppRegistrationLanguage(const std::string& app_id, - LanguageType type, - const std::string& language) { - return true; - } - - bool SetMetaInfo(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language); - - bool IsMetaInfoPresent(); - - bool SetSystemLanguage(const std::string& language); - - int GetKmFromSuccessfulExchange() { - return true; - } - int GetDayFromScsExchange() { - return true; - } - int GetIgnitionsFromScsExchange() { - return true; - } - - bool GetFunctionalGroupNames(FunctionalGroupNames& names); - bool CleanupUnpairedDevices(const DeviceIds& device_ids) const; - - void Increment(const std::string& type) const; - void Increment(const std::string& app_id, const std::string& type) const; - void Set(const std::string& app_id, - const std::string& type, - const std::string& value) const; - void Add(const std::string& app_id, - const std::string& type, - int seconds) const; - bool SetDefaultPolicy(const std::string& app_id); - bool SetPredataPolicy(const std::string& app_id); - bool SetIsPredata(const std::string& app_id, bool is_pre_data); - bool IsPredataPolicy(const std::string& app_id) const; - bool SetUnpairedDevice(const std::string& device_id, bool unpaired) const; - bool UnpairedDevicesList(DeviceIds* device_ids) const; - bool RemoveAppConsentForGroup(const std::string& policy_app_id, - const std::string& functional_group_name) const; - - virtual bool SetVINValue(const std::string& value); - bool SaveExternalConsentStatus(const ExternalConsentStatus& status) const; - ExternalConsentStatus GetExternalConsentStatus() const; - - private: - void GatherModuleMeta(policy_table::ModuleMeta* meta) const; - void GatherPreconsentedGroup(const std::string& app_id, - policy_table::Strings* groups) const; - bool GatherUsageAndErrorCounts( - policy_table::UsageAndErrorCounts* counts) const; - bool GatherAppLevels(policy_table::AppLevels* apps) const; - void GatherDeviceData(policy_table::DeviceData* data) const; - void GatherConsentGroup(const std::string& device_id, - policy_table::UserConsentRecords* records) const; - bool GatherApplicationPoliciesSection( - policy_table::ApplicationPoliciesSection* policies) const; - bool SaveDeviceData(const policy_table::DeviceData& devices); - bool GatherConsumerFriendlyMessages( - policy_table::ConsumerFriendlyMessages* messages) const; - bool SaveConsentGroup(const std::string& device_id, - const policy_table::UserConsentRecords& records); - bool SaveApplicationPoliciesSection( - const policy_table::ApplicationPoliciesSection& policies); - bool SaveSpecificAppPolicy( - const policy_table::ApplicationPolicies::value_type& app); - bool SaveDevicePolicy(const policy_table::DevicePolicy& device); - bool SavePreconsentedGroup(const std::string& app_id, - const policy_table::Strings& groups); - bool SaveMessageString(const std::string& type, - const std::string& lang, - const policy_table::MessageString& strings); - - virtual bool SaveUsageAndErrorCounts( - const policy_table::UsageAndErrorCounts& counts); - - virtual bool SaveModuleMeta(const policy_table::ModuleMeta& meta); - - bool SaveAppCounters(const policy_table::AppLevels& app_levels); - - bool SaveGlobalCounters(const policy_table::UsageAndErrorCounts& counts); - - bool IsExistAppLevel(const std::string& app_id) const; - - bool GetAllAppGroups(const std::string& policy_app_id, - FunctionalGroupIDs& all_groups); - - bool GetConsentedGroups(const std::string& policy_app_id, - const std::string& device_id, - FunctionalGroupIDs& allowed_groups, - FunctionalGroupIDs& disallowed_groups); - - bool GetPreconsentedGroups(const std::string& policy_app_id, - FunctionalGroupIDs& preconsented_groups); - - void FillFunctionalGroupPermissions( - FunctionalGroupIDs& ids, - FunctionalGroupNames& names, - GroupConsent state, - std::vector<FunctionalGroupPermission>& permissions); - bool CountUnconsentedGroups(const std::string& policy_app_id, - const std::string& device_id, - int* result) const; - - /** - * @brief Checks, if there is message present with requested language in PT - * @param message Message name - * @param language Required message language - * @return True, if message with requested language is present, otherwise - - * false - */ - bool IsMsgLanguagePresent(const std::string& message, - const std::string& language); - -} // namespace policy - -#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ 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 5259ffa7e9..191873efe0 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 @@ -79,8 +79,6 @@ 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; diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h index 52d5b92b8a..c90acd4957 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h @@ -118,10 +118,10 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { void OnNewApplicationAdded(const DeviceConsent consent); /** - * @brief Update status handler for policy initialization + * @brief Update status handler on existed application registering * @param is_update_required Update necessity flag */ - void OnPolicyInit(bool is_update_required); + void OnExistedApplicationAdded(const bool is_update_required); /** * @brief In case application from non-consented device has been registered diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h index b9da90f929..4763ff2eb5 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h @@ -105,10 +105,10 @@ class UpdateStatusManagerInterface { virtual void OnNewApplicationAdded(DeviceConsent device_consent) = 0; /** - * @brief Update status handler for policy initialization + * @brief Update status handler on existed application registering * @param is_update_required Update necessity flag */ - virtual void OnPolicyInit(bool is_update_required) = 0; + virtual void OnExistedApplicationAdded(const bool is_update_required) = 0; }; typedef std::shared_ptr<UpdateStatusManagerInterface> |