summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2018-09-20 11:39:15 -0400
committerJackLivio <jack@livio.io>2018-09-20 11:39:15 -0400
commit4f332d48670014e0625020cd2907e93980b56377 (patch)
tree66163a95225b3413b43019b3290cae4737f1892d
parent77f318f8902a57ad8c1daa5075d19a6e6feb9bdc (diff)
downloadsdl_core-patch/4.1LTS_policy_table_filtering.tar.gz
Add PT filtering for remaining typespatch/4.1LTS_policy_table_filtering
-rw-r--r--src/components/policy/include/policy/policy_table/enums.h648
-rw-r--r--src/components/policy/src/policy_manager_impl.cc151
-rw-r--r--src/components/policy/src/policy_table/enums.cc642
-rw-r--r--src/components/policy/test/policy_manager_impl_test.cc24
4 files changed, 768 insertions, 697 deletions
diff --git a/src/components/policy/include/policy/policy_table/enums.h b/src/components/policy/include/policy/policy_table/enums.h
index aa0d21ef6e..128b191f94 100644
--- a/src/components/policy/include/policy/policy_table/enums.h
+++ b/src/components/policy/include/policy/policy_table/enums.h
@@ -109,330 +109,330 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result);
* 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 GetWayPointsID.
- */
- GetWayPointsID = 45,
-
- /**
- * @brief SubscribeWayPointsID.
- */
- SubscribeWayPointsID = 46,
-
- /**
- * @brief UnsubscribeWayPointsID.
- */
- UnsubscribeWayPointsID = 47,
-
- /**
- * @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 OnWayPointChangeID.
- */
- OnWayPointChangeID = 32784,
-
- /**
- * @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);
+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 GetWayPointsID.
+ */
+ GetWayPointsID = 45,
+
+ /**
+ * @brief SubscribeWayPointsID.
+ */
+ SubscribeWayPointsID = 46,
+
+ /**
+ * @brief UnsubscribeWayPointsID.
+ */
+ UnsubscribeWayPointsID = 47,
+
+ /**
+ * @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 OnWayPointChangeID.
+ */
+ OnWayPointChangeID = 32784,
+
+ /**
+ * @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;
diff --git a/src/components/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy_manager_impl.cc
index 4ae06f7898..6b4cca504f 100644
--- a/src/components/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy_manager_impl.cc
@@ -137,46 +137,117 @@ void PolicyManagerImpl::CheckTriggers() {
* @brief FilterInvalidFunctions filter functions that are absent in schema
* @param rpcs list of functions to filter
*/
- void FilterInvalidFunctions(policy_table::Rpc& rpcs) {
- policy_table::Rpc valid_rpcs;
- for (const auto& rpc : rpcs) {
- const std::string& rpc_name = rpc.first;
- policy_table::FunctionID function_id;
- if (policy_table::EnumFromJsonString(rpc_name, &function_id)) {
- valid_rpcs.insert(rpc);
- }
- }
- rpcs.swap(valid_rpcs);
- }
-
- /**
- * @brief FilterInvalidParameters filter parameters that not present in schema
- * @param rpc_parameters parameters to filter
- */
- void FilterInvalidParameters(policy_table::RpcParameters& rpc_parameters) {
- policy_table::Parameters valid_params;
- for (auto& param : *(rpc_parameters.parameters)) {
- if (param.is_valid()) {
- valid_params.push_back(param);
- }
- }
- rpc_parameters.parameters->swap(valid_params);
- }
-
- /**
- * @brief FilterPolicyTable filter values that not present in schema
- * @param pt policy table to filter
- */
- void FilterPolicyTable(policy_table::PolicyTable& pt) {
- for (auto& group : pt.functional_groupings) {
- policy_table::Rpc& rpcs = group.second.rpcs;
- FilterInvalidFunctions(rpcs);
-
- for (auto& func : rpcs) {
- FilterInvalidParameters(func.second);
- }
- }
- }
+void FilterInvalidFunctions(policy_table::Rpc& rpcs) {
+ policy_table::Rpc valid_rpcs;
+ for (const auto& rpc : rpcs) {
+ const std::string& rpc_name = rpc.first;
+ policy_table::FunctionID function_id;
+ if (policy_table::EnumFromJsonString(rpc_name, &function_id)) {
+ valid_rpcs.insert(rpc);
+ }
+ }
+ rpcs.swap(valid_rpcs);
+}
+
+/**
+ * @brief FilterInvalidParameters filter parameters that not present in schema
+ * @param rpc_parameters parameters to filter
+ */
+void FilterInvalidRPCParameters(policy_table::RpcParameters& rpc_parameters) {
+ policy_table::HmiLevels valid_hmi_levels;
+ for (auto& hmi_level : rpc_parameters.hmi_levels) {
+ if (hmi_level.is_valid()) {
+ valid_hmi_levels.push_back(hmi_level);
+ }
+ }
+ rpc_parameters.hmi_levels.swap(valid_hmi_levels);
+ policy_table::Parameters valid_params;
+ for (auto& param : *(rpc_parameters.parameters)) {
+ if (param.is_valid()) {
+ valid_params.push_back(param);
+ }
+ }
+ rpc_parameters.parameters->swap(valid_params);
+}
+
+/**
+ * @brief FilterInvalidNotifications filter notification priorities that are not
+ * present in schema
+ * @param notification priorities to filter
+ */
+
+void FilterInvalidNotifications(
+ policy_table::NumberOfNotificationsPerMinute& notifications) {
+ policy_table::NumberOfNotificationsPerMinute valid_notifications;
+ for (const auto& notification : notifications) {
+ policy_table::Priority priority;
+ if (policy_table::EnumFromJsonString(notification.first, &priority)) {
+ valid_notifications.insert(notification);
+ }
+ }
+ notifications.swap(valid_notifications);
+}
+
+/**
+ * @brief FilterInvalidApplicationParameters filter app params that are not
+ * present in schema
+ * @param object of app policy params to filter
+ */
+void FilterInvalidApplicationParameters(
+ policy_table::ApplicationParams& app_params) {
+ // Filter AppHMIType array
+ policy_table::AppHMITypes valid_app_hmi_types;
+ policy_table::AppHMITypes app_hmi_types = *(app_params.AppHMIType);
+ for (const auto& app_hmi_type : app_hmi_types) {
+ if (app_hmi_type.is_valid()) {
+ valid_app_hmi_types.push_back(app_hmi_type);
+ }
+ }
+ app_params.AppHMIType->swap(valid_app_hmi_types);
+ // Filter RquestTypes array
+ policy_table::RequestTypes valid_request_types;
+ policy_table::RequestTypes request_types = *(app_params.RequestType);
+ for (const auto& request_type : request_types) {
+ if (request_type.is_valid()) {
+ valid_request_types.push_back(request_type);
+ }
+ }
+ if (valid_request_types.empty() && !request_types.empty()) {
+ // An empty RequestType array will allow all request types. No valid
+ // parameters are in the filtered array, so assign an uninitizlied value to
+ // for array to be "omitted"
+ policy_table::RequestTypes omitted_request_types;
+ *(app_params.RequestType) = omitted_request_types;
+ } else {
+ app_params.RequestType->swap(valid_request_types);
+ }
+}
+
+/**
+ * @brief FilterPolicyTable filter values that not present in schema
+ * @param pt policy table to filter
+ */
+void FilterPolicyTable(policy_table::PolicyTable& pt) {
+ policy_table::ModuleConfig& module_config = pt.module_config;
+ if (module_config.is_initialized() &&
+ module_config.notifications_per_minute_by_priority.is_initialized()) {
+ FilterInvalidNotifications(
+ module_config.notifications_per_minute_by_priority);
+ }
+ if (pt.app_policies_section.is_initialized()) {
+ policy_table::ApplicationPolicies& apps = pt.app_policies_section.apps;
+ for (auto& app_policy : apps) {
+ FilterInvalidApplicationParameters(app_policy.second);
+ }
+ }
+ for (auto& group : pt.functional_groupings) {
+ policy_table::Rpc& rpcs = group.second.rpcs;
+ FilterInvalidFunctions(rpcs);
+ for (auto& func : rpcs) {
+ FilterInvalidRPCParameters(func.second);
+ }
+ }
+}
bool PolicyManagerImpl::LoadPT(const std::string& file,
const BinaryMessage& pt_content) {
diff --git a/src/components/policy/src/policy_table/enums.cc b/src/components/policy/src/policy_table/enums.cc
index 8e8631db43..77833dd17a 100644
--- a/src/components/policy/src/policy_table/enums.cc
+++ b/src/components/policy/src/policy_table/enums.cc
@@ -570,327 +570,327 @@ bool EnumFromJsonString(const std::string& literal, RequestType* result) {
}
bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
- if ("RESERVE" == literal) {
- *result = RESERVED;
- return true;
- }
-
- if ("RegisterAppInterface" == literal) {
- *result = RegisterAppInterfaceID;
- return true;
- }
-
- if ("UnregisterAppInterface" == literal) {
- *result = UnregisterAppInterfaceID;
- return true;
- }
-
- if ("SetGlobalProperties" == literal) {
- *result = SetGlobalPropertiesID;
- return true;
- }
-
- if ("ResetGlobalProperties" == literal) {
- *result = ResetGlobalPropertiesID;
- return true;
- }
-
- if ("AddCommand" == literal) {
- *result = AddCommandID;
- return true;
- }
-
- if ("DeleteCommand" == literal) {
- *result = DeleteCommandID;
- return true;
- }
-
- if ("AddSubMenu" == literal) {
- *result = AddSubMenuID;
- return true;
- }
-
- if ("DeleteSubMenu" == literal) {
- *result = DeleteSubMenuID;
- return true;
- }
-
- if ("CreateInteractionChoiceSet" == literal) {
- *result = CreateInteractionChoiceSetID;
- return true;
- }
-
- if ("PerformInteraction" == literal) {
- *result = PerformInteractionID;
- return true;
- }
-
- if ("DeleteInteractionChoiceSet" == literal) {
- *result = DeleteInteractionChoiceSetID;
- return true;
- }
-
- if ("Alert" == literal) {
- *result = AlertID;
- return true;
- }
-
- if ("Show" == literal) {
- *result = ShowID;
- return true;
- }
-
- if ("Speak" == literal) {
- *result = SpeakID;
- return true;
- }
-
- if ("SetMediaClockTimer" == literal) {
- *result = SetMediaClockTimerID;
- return true;
- }
-
- if ("PerformAudioPassThru" == literal) {
- *result = PerformAudioPassThruID;
- return true;
- }
-
- if ("EndAudioPassThru" == literal) {
- *result = EndAudioPassThruID;
- return true;
- }
-
- if ("SubscribeButton" == literal) {
- *result = SubscribeButtonID;
- return true;
- }
-
- if ("UnsubscribeButton" == literal) {
- *result = UnsubscribeButtonID;
- return true;
- }
-
- if ("SubscribeVehicleData" == literal) {
- *result = SubscribeVehicleDataID;
- return true;
- }
-
- if ("UnsubscribeVehicleData" == literal) {
- *result = UnsubscribeVehicleDataID;
- return true;
- }
-
- if ("GetVehicleData" == literal) {
- *result = GetVehicleDataID;
- return true;
- }
-
- if ("ReadD" == literal) {
- *result = ReadDIDID;
- return true;
- }
-
- if ("GetDTCs" == literal) {
- *result = GetDTCsID;
- return true;
- }
-
- if ("ScrollableMessage" == literal) {
- *result = ScrollableMessageID;
- return true;
- }
-
- if ("Slider" == literal) {
- *result = SliderID;
- return true;
- }
-
- if ("ShowConstantTBT" == literal) {
- *result = ShowConstantTBTID;
- return true;
- }
-
- if ("AlertManeuver" == literal) {
- *result = AlertManeuverID;
- return true;
- }
-
- if ("UpdateTurnList" == literal) {
- *result = UpdateTurnListID;
- return true;
- }
-
- if ("ChangeRegistration" == literal) {
- *result = ChangeRegistrationID;
- return true;
- }
-
- if ("GenericResponse" == literal) {
- *result = GenericResponseID;
- return true;
- }
-
- if ("PutFile" == literal) {
- *result = PutFileID;
- return true;
- }
-
- if ("DeleteFile" == literal) {
- *result = DeleteFileID;
- return true;
- }
-
- if ("ListFiles" == literal) {
- *result = ListFilesID;
- return true;
- }
-
- if ("SetAppIcon" == literal) {
- *result = SetAppIconID;
- return true;
- }
-
- if ("SetDisplayLayout" == literal) {
- *result = SetDisplayLayoutID;
- return true;
- }
-
- if ("DiagnosticMessage" == literal) {
- *result = DiagnosticMessageID;
- return true;
- }
-
- if ("SystemRequest" == literal) {
- *result = SystemRequestID;
- return true;
- }
-
- if ("SendLocation" == literal) {
- *result = SendLocationID;
- return true;
- }
-
- if ("DialNumber" == literal) {
- *result = DialNumberID;
- return true;
- }
-
- if ("GetWayPoints" == literal) {
- *result = GetWayPointsID;
- return true;
- }
-
- if ("SubscribeWayPoints" == literal) {
- *result = SubscribeWayPointsID;
- return true;
- }
-
- if ("UnsubscribeWayPoints" == literal) {
- *result = UnsubscribeWayPointsID;
- return true;
- }
-
- if ("OnHMIStatus" == literal) {
- *result = OnHMIStatusID;
- return true;
- }
-
- if ("OnAppInterfaceUnregistered" == literal) {
- *result = OnAppInterfaceUnregisteredID;
- return true;
- }
-
- if ("OnButtonEvent" == literal) {
- *result = OnButtonEventID;
- return true;
- }
-
- if ("OnButtonPress" == literal) {
- *result = OnButtonPressID;
- return true;
- }
-
- if ("OnVehicleData" == literal) {
- *result = OnVehicleDataID;
- return true;
- }
-
- if ("OnCommand" == literal) {
- *result = OnCommandID;
- return true;
- }
-
- if ("OnTBTClientState" == literal) {
- *result = OnTBTClientStateID;
- return true;
- }
-
- if ("OnDriverDistraction" == literal) {
- *result = OnDriverDistractionID;
- return true;
- }
-
- if ("OnPermissionsChange" == literal) {
- *result = OnPermissionsChangeID;
- return true;
- }
-
- if ("OnAudioPassThru" == literal) {
- *result = OnAudioPassThruID;
- return true;
- }
-
- if ("OnLanguageChange" == literal) {
- *result = OnLanguageChangeID;
- return true;
- }
-
- if ("OnKeyboardInput" == literal) {
- *result = OnKeyboardInputID;
- return true;
- }
-
- if ("OnTouchEvent" == literal) {
- *result = OnTouchEventID;
- return true;
- }
-
- if ("OnSystemRequest" == literal) {
- *result = OnSystemRequestID;
- return true;
- }
-
- if ("OnHashChange" == literal) {
- *result = OnHashChangeID;
- return true;
- }
-
- if ("OnWayPointChange" == literal) {
- *result = OnWayPointChangeID;
- return true;
- }
-
- if ("EncodedSyncPData" == literal) {
- *result = EncodedSyncPDataID;
- return true;
- }
-
- if ("SyncPData" == literal) {
- *result = SyncPDataID;
- return true;
- }
-
- if ("OnEncodedSyncPData" == literal) {
- *result = OnEncodedSyncPDataID;
- return true;
- }
-
- if ("OnSyncPData" == literal) {
- *result = OnSyncPDataID;
- return true;
- }
- return false;
- };
+ if ("RESERVE" == literal) {
+ *result = RESERVED;
+ return true;
+ }
+
+ if ("RegisterAppInterface" == literal) {
+ *result = RegisterAppInterfaceID;
+ return true;
+ }
+
+ if ("UnregisterAppInterface" == literal) {
+ *result = UnregisterAppInterfaceID;
+ return true;
+ }
+
+ if ("SetGlobalProperties" == literal) {
+ *result = SetGlobalPropertiesID;
+ return true;
+ }
+
+ if ("ResetGlobalProperties" == literal) {
+ *result = ResetGlobalPropertiesID;
+ return true;
+ }
+
+ if ("AddCommand" == literal) {
+ *result = AddCommandID;
+ return true;
+ }
+
+ if ("DeleteCommand" == literal) {
+ *result = DeleteCommandID;
+ return true;
+ }
+
+ if ("AddSubMenu" == literal) {
+ *result = AddSubMenuID;
+ return true;
+ }
+
+ if ("DeleteSubMenu" == literal) {
+ *result = DeleteSubMenuID;
+ return true;
+ }
+
+ if ("CreateInteractionChoiceSet" == literal) {
+ *result = CreateInteractionChoiceSetID;
+ return true;
+ }
+
+ if ("PerformInteraction" == literal) {
+ *result = PerformInteractionID;
+ return true;
+ }
+
+ if ("DeleteInteractionChoiceSet" == literal) {
+ *result = DeleteInteractionChoiceSetID;
+ return true;
+ }
+
+ if ("Alert" == literal) {
+ *result = AlertID;
+ return true;
+ }
+
+ if ("Show" == literal) {
+ *result = ShowID;
+ return true;
+ }
+
+ if ("Speak" == literal) {
+ *result = SpeakID;
+ return true;
+ }
+
+ if ("SetMediaClockTimer" == literal) {
+ *result = SetMediaClockTimerID;
+ return true;
+ }
+
+ if ("PerformAudioPassThru" == literal) {
+ *result = PerformAudioPassThruID;
+ return true;
+ }
+
+ if ("EndAudioPassThru" == literal) {
+ *result = EndAudioPassThruID;
+ return true;
+ }
+
+ if ("SubscribeButton" == literal) {
+ *result = SubscribeButtonID;
+ return true;
+ }
+
+ if ("UnsubscribeButton" == literal) {
+ *result = UnsubscribeButtonID;
+ return true;
+ }
+
+ if ("SubscribeVehicleData" == literal) {
+ *result = SubscribeVehicleDataID;
+ return true;
+ }
+
+ if ("UnsubscribeVehicleData" == literal) {
+ *result = UnsubscribeVehicleDataID;
+ return true;
+ }
+
+ if ("GetVehicleData" == literal) {
+ *result = GetVehicleDataID;
+ return true;
+ }
+
+ if ("ReadD" == literal) {
+ *result = ReadDIDID;
+ return true;
+ }
+
+ if ("GetDTCs" == literal) {
+ *result = GetDTCsID;
+ return true;
+ }
+
+ if ("ScrollableMessage" == literal) {
+ *result = ScrollableMessageID;
+ return true;
+ }
+
+ if ("Slider" == literal) {
+ *result = SliderID;
+ return true;
+ }
+
+ if ("ShowConstantTBT" == literal) {
+ *result = ShowConstantTBTID;
+ return true;
+ }
+
+ if ("AlertManeuver" == literal) {
+ *result = AlertManeuverID;
+ return true;
+ }
+
+ if ("UpdateTurnList" == literal) {
+ *result = UpdateTurnListID;
+ return true;
+ }
+
+ if ("ChangeRegistration" == literal) {
+ *result = ChangeRegistrationID;
+ return true;
+ }
+
+ if ("GenericResponse" == literal) {
+ *result = GenericResponseID;
+ return true;
+ }
+
+ if ("PutFile" == literal) {
+ *result = PutFileID;
+ return true;
+ }
+
+ if ("DeleteFile" == literal) {
+ *result = DeleteFileID;
+ return true;
+ }
+
+ if ("ListFiles" == literal) {
+ *result = ListFilesID;
+ return true;
+ }
+
+ if ("SetAppIcon" == literal) {
+ *result = SetAppIconID;
+ return true;
+ }
+
+ if ("SetDisplayLayout" == literal) {
+ *result = SetDisplayLayoutID;
+ return true;
+ }
+
+ if ("DiagnosticMessage" == literal) {
+ *result = DiagnosticMessageID;
+ return true;
+ }
+
+ if ("SystemRequest" == literal) {
+ *result = SystemRequestID;
+ return true;
+ }
+
+ if ("SendLocation" == literal) {
+ *result = SendLocationID;
+ return true;
+ }
+
+ if ("DialNumber" == literal) {
+ *result = DialNumberID;
+ return true;
+ }
+
+ if ("GetWayPoints" == literal) {
+ *result = GetWayPointsID;
+ return true;
+ }
+
+ if ("SubscribeWayPoints" == literal) {
+ *result = SubscribeWayPointsID;
+ return true;
+ }
+
+ if ("UnsubscribeWayPoints" == literal) {
+ *result = UnsubscribeWayPointsID;
+ return true;
+ }
+
+ if ("OnHMIStatus" == literal) {
+ *result = OnHMIStatusID;
+ return true;
+ }
+
+ if ("OnAppInterfaceUnregistered" == literal) {
+ *result = OnAppInterfaceUnregisteredID;
+ return true;
+ }
+
+ if ("OnButtonEvent" == literal) {
+ *result = OnButtonEventID;
+ return true;
+ }
+
+ if ("OnButtonPress" == literal) {
+ *result = OnButtonPressID;
+ return true;
+ }
+
+ if ("OnVehicleData" == literal) {
+ *result = OnVehicleDataID;
+ return true;
+ }
+
+ if ("OnCommand" == literal) {
+ *result = OnCommandID;
+ return true;
+ }
+
+ if ("OnTBTClientState" == literal) {
+ *result = OnTBTClientStateID;
+ return true;
+ }
+
+ if ("OnDriverDistraction" == literal) {
+ *result = OnDriverDistractionID;
+ return true;
+ }
+
+ if ("OnPermissionsChange" == literal) {
+ *result = OnPermissionsChangeID;
+ return true;
+ }
+
+ if ("OnAudioPassThru" == literal) {
+ *result = OnAudioPassThruID;
+ return true;
+ }
+
+ if ("OnLanguageChange" == literal) {
+ *result = OnLanguageChangeID;
+ return true;
+ }
+
+ if ("OnKeyboardInput" == literal) {
+ *result = OnKeyboardInputID;
+ return true;
+ }
+
+ if ("OnTouchEvent" == literal) {
+ *result = OnTouchEventID;
+ return true;
+ }
+
+ if ("OnSystemRequest" == literal) {
+ *result = OnSystemRequestID;
+ return true;
+ }
+
+ if ("OnHashChange" == literal) {
+ *result = OnHashChangeID;
+ return true;
+ }
+
+ if ("OnWayPointChange" == literal) {
+ *result = OnWayPointChangeID;
+ return true;
+ }
+
+ if ("EncodedSyncPData" == literal) {
+ *result = EncodedSyncPDataID;
+ return true;
+ }
+
+ if ("SyncPData" == literal) {
+ *result = SyncPDataID;
+ return true;
+ }
+
+ if ("OnEncodedSyncPData" == literal) {
+ *result = OnEncodedSyncPDataID;
+ return true;
+ }
+
+ if ("OnSyncPData" == literal) {
+ *result = OnSyncPDataID;
+ return true;
+ }
+ return false;
+};
const std::string kDefaultApp = "default";
const std::string kPreDataConsentApp = "pre_DataConsent";
diff --git a/src/components/policy/test/policy_manager_impl_test.cc b/src/components/policy/test/policy_manager_impl_test.cc
index 34bcc1127e..17ef41e070 100644
--- a/src/components/policy/test/policy_manager_impl_test.cc
+++ b/src/components/policy/test/policy_manager_impl_test.cc
@@ -375,12 +375,12 @@ Json::Value CreatePTforLoad() {
"}"
"},"
"\"notifications_per_minute_by_priority\": {"
- "\"emergency\": 1,"
- "\"navigation\": 2,"
- "\"VOICECOMM\": 3,"
- "\"communication\": 4,"
- "\"normal\": 5,"
- "\"none\": 6"
+ "\"EMERGENCY\": 1,"
+ "\"NAVIGATION\": 2,"
+ "\"VOICECOM\": 3,"
+ "\"COMMUNICATION\": 4,"
+ "\"NORMAL\": 5,"
+ "\"NONE\": 6"
"},"
"\"vehicle_make\" : \"MakeT\","
"\"vehicle_model\" : \"ModelT\","
@@ -469,27 +469,27 @@ TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) {
EXPECT_CALL(listener, OnUpdateStatusChanged(_));
EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
- std::string priority = "emergency";
+ std::string priority = "EMERGENCY";
uint32_t notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "navigation";
+ priority = "NAVIGATION";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(2u, notif_number);
- priority = "emergency";
+ priority = "EMERGENCY";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "VOICECOMM";
+ priority = "VOICECOM";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(3u, notif_number);
- priority = "normal";
+ priority = "NORMAL";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(5u, notif_number);
- priority = "none";
+ priority = "NONE";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(6u, notif_number);
}