summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_regular/src/policy_table
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/policy/policy_regular/src/policy_table')
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc1491
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc523
-rw-r--r--src/components/policy/policy_regular/src/policy_table/validation.cc49
3 files changed, 567 insertions, 1496 deletions
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index 50746b31a0..8aabf54c5d 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -3,1497 +3,6 @@
namespace rpc {
namespace policy_table_interface_base {
-bool IsValidEnum(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return true;
- case P_NAVIGATION:
- return true;
- case P_VOICECOM:
- return true;
- case P_COMMUNICATION:
- return true;
- case P_NORMAL:
- return true;
- case P_PROJECTION:
- return true;
- case P_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return "EMERGENCY";
- case P_NAVIGATION:
- return "NAVIGATION";
- case P_VOICECOM:
- return "VOICECOM";
- case P_COMMUNICATION:
- return "COMMUNICATION";
- case P_NORMAL:
- return "NORMAL";
- case P_PROJECTION:
- return "PROJECTION";
- case P_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, Priority* result) {
- if ("EMERGENCY" == literal) {
- *result = P_EMERGENCY;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = P_NAVIGATION;
- return true;
- } else if ("VOICECOM" == literal) {
- *result = P_VOICECOM;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = P_COMMUNICATION;
- return true;
- } else if ("NORMAL" == literal) {
- *result = P_NORMAL;
- return true;
- } else if ("PROJECTION" == literal) {
- *result = P_PROJECTION;
- return true;
- } else if ("NONE" == literal) {
- *result = P_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return true;
- case HL_FULL:
- return true;
- case HL_LIMITED:
- return true;
- case HL_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return "BACKGROUND";
- case HL_FULL:
- return "FULL";
- case HL_LIMITED:
- return "LIMITED";
- case HL_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, HmiLevel* result) {
- if ("BACKGROUND" == literal) {
- *result = HL_BACKGROUND;
- return true;
- } else if ("FULL" == literal) {
- *result = HL_FULL;
- return true;
- } else if ("LIMITED" == literal) {
- *result = HL_LIMITED;
- return true;
- } else if ("NONE" == literal) {
- *result = HL_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(Parameter val) {
- switch (val) {
- case P_GPS:
- return true;
- case P_SPEED:
- return true;
- case P_ENGINETORQUE:
- return true;
- case P_EXTERNALTEMPERATURE:
- return true;
- case P_TURNSIGNAL:
- return true;
- case P_FUELLEVEL:
- return true;
- case P_FUELLEVEL_STATE:
- return true;
- case P_HEADLAMPSTATUS:
- return true;
- case P_INSTANTFUELCONSUMPTION:
- return true;
- case P_FUELRANGE:
- return true;
- case P_CLOUD_APP_VEHICLE_ID:
- return true;
- case P_ODOMETER:
- return true;
- case P_TIREPRESSURE:
- return true;
- case P_WIPERSTATUS:
- return true;
- case P_VIN:
- return true;
- case P_ACCPEDALPOSITION:
- return true;
- case P_BELTSTATUS:
- return true;
- case P_ELECTRONICPARKBRAKESTATUS:
- return true;
- case P_DRIVERBRAKING:
- return true;
- case P_PRNDL:
- return true;
- case P_RPM:
- return true;
- case P_STEERINGWHEELANGLE:
- return true;
- case P_ENGINEOILLIFE:
- return true;
- case P_MYKEY:
- return true;
- case P_AIRBAGSTATUS:
- return true;
- case P_BODYINFORMATION:
- return true;
- case P_CLUSTERMODESTATUS:
- return true;
- case P_DEVICESTATUS:
- return true;
- case P_EMERGENCYEVENT:
- return true;
- case P_ECALLINFO:
- return true;
- case P_EMPTY:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(Parameter val) {
- switch (val) {
- case P_GPS:
- return "gps";
- case P_SPEED:
- return "speed";
- case P_ENGINETORQUE:
- return "engineTorque";
- case P_EXTERNALTEMPERATURE:
- return "externalTemperature";
- case P_TURNSIGNAL:
- return "turnSignal";
- case P_FUELLEVEL:
- return "fuelLevel";
- case P_FUELLEVEL_STATE:
- return "fuelLevel_State";
- case P_HEADLAMPSTATUS:
- return "headLampStatus";
- case P_INSTANTFUELCONSUMPTION:
- return "instantFuelConsumption";
- case P_FUELRANGE:
- return "fuelRange";
- case P_CLOUD_APP_VEHICLE_ID:
- return "cloudAppVehicleID";
- case P_ODOMETER:
- return "odometer";
- case P_TIREPRESSURE:
- return "tirePressure";
- case P_WIPERSTATUS:
- return "wiperStatus";
- case P_VIN:
- return "vin";
- case P_ACCPEDALPOSITION:
- return "accPedalPosition";
- case P_BELTSTATUS:
- return "beltStatus";
- case P_ELECTRONICPARKBRAKESTATUS:
- return "electronicParkBrakeStatus";
- case P_DRIVERBRAKING:
- return "driverBraking";
- case P_PRNDL:
- return "prndl";
- case P_RPM:
- return "rpm";
- case P_STEERINGWHEELANGLE:
- return "steeringWheelAngle";
- case P_ENGINEOILLIFE:
- return "engineOilLife";
- case P_MYKEY:
- return "myKey";
- case P_AIRBAGSTATUS:
- return "airbagStatus";
- case P_BODYINFORMATION:
- return "bodyInformation";
- case P_CLUSTERMODESTATUS:
- return "clusterModeStatus";
- case P_DEVICESTATUS:
- return "deviceStatus";
- case P_EMERGENCYEVENT:
- return "emergencyEvent";
- case P_ECALLINFO:
- return "eCallInfo";
- case P_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, Parameter* result) {
- if ("gps" == literal) {
- *result = P_GPS;
- return true;
- } else if ("speed" == literal) {
- *result = P_SPEED;
- return true;
- } else if ("engineTorque" == literal) {
- *result = P_ENGINETORQUE;
- return true;
- } else if ("externalTemperature" == literal) {
- *result = P_EXTERNALTEMPERATURE;
- return true;
- } else if ("turnSignal" == literal) {
- *result = P_TURNSIGNAL;
- return true;
- } else if ("fuelLevel" == literal) {
- *result = P_FUELLEVEL;
- return true;
- } else if ("fuelLevel_State" == literal) {
- *result = P_FUELLEVEL_STATE;
- return true;
- } else if ("headLampStatus" == literal) {
- *result = P_HEADLAMPSTATUS;
- return true;
- } else if ("instantFuelConsumption" == literal) {
- *result = P_INSTANTFUELCONSUMPTION;
- return true;
- } else if ("fuelRange" == literal) {
- *result = P_FUELRANGE;
- return true;
- } else if ("cloudAppVehicleID" == literal) {
- *result = P_CLOUD_APP_VEHICLE_ID;
- return true;
- } else if ("odometer" == literal) {
- *result = P_ODOMETER;
- return true;
- } else if ("tirePressure" == literal) {
- *result = P_TIREPRESSURE;
- return true;
- } else if ("wiperStatus" == literal) {
- *result = P_WIPERSTATUS;
- return true;
- } else if ("vin" == literal) {
- *result = P_VIN;
- return true;
- } else if ("accPedalPosition" == literal) {
- *result = P_ACCPEDALPOSITION;
- return true;
- } else if ("beltStatus" == literal) {
- *result = P_BELTSTATUS;
- return true;
- } else if ("electronicParkBrakeStatus" == literal) {
- *result = P_ELECTRONICPARKBRAKESTATUS;
- return true;
- } else if ("driverBraking" == literal) {
- *result = P_DRIVERBRAKING;
- return true;
- } else if ("prndl" == literal) {
- *result = P_PRNDL;
- return true;
- } else if ("rpm" == literal) {
- *result = P_RPM;
- return true;
- } else if ("steeringWheelAngle" == literal) {
- *result = P_STEERINGWHEELANGLE;
- return true;
- } else if ("engineOilLife" == literal) {
- *result = P_ENGINEOILLIFE;
- return true;
- } else if ("myKey" == literal) {
- *result = P_MYKEY;
- return true;
- } else if ("airbagStatus" == literal) {
- *result = P_AIRBAGSTATUS;
- return true;
- } else if ("bodyInformation" == literal) {
- *result = P_BODYINFORMATION;
- return true;
- } else if ("clusterModeStatus" == literal) {
- *result = P_CLUSTERMODESTATUS;
- return true;
- } else if ("deviceStatus" == literal) {
- *result = P_DEVICESTATUS;
- return true;
- } else if ("emergencyEvent" == literal) {
- *result = P_EMERGENCYEVENT;
- return true;
- } else if ("eCallInfo" == literal) {
- *result = P_ECALLINFO;
- return true;
- } else if ("EMPTY" == literal) {
- *result = P_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return true;
- case AHT_COMMUNICATION:
- return true;
- case AHT_MEDIA:
- return true;
- case AHT_MESSAGING:
- return true;
- case AHT_NAVIGATION:
- return true;
- case AHT_INFORMATION:
- return true;
- case AHT_SOCIAL:
- return true;
- case AHT_BACKGROUND_PROCESS:
- return true;
- case AHT_TESTING:
- return true;
- case AHT_SYSTEM:
- return true;
- case AHT_PROJECTION:
- return true;
- case AHT_REMOTE_CONTROL:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return "DEFAULT";
- case AHT_COMMUNICATION:
- return "COMMUNICATION";
- case AHT_MEDIA:
- return "MEDIA";
- case AHT_MESSAGING:
- return "MESSAGING";
- case AHT_NAVIGATION:
- return "NAVIGATION";
- case AHT_INFORMATION:
- return "INFORMATION";
- case AHT_SOCIAL:
- return "SOCIAL";
- case AHT_BACKGROUND_PROCESS:
- return "BACKGROUND_PROCESS";
- case AHT_TESTING:
- return "TESTING";
- case AHT_SYSTEM:
- return "SYSTEM";
- case AHT_PROJECTION:
- return "PROJECTION";
- case AHT_REMOTE_CONTROL:
- return "REMOTE_CONTROL";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, AppHMIType* result) {
- if ("DEFAULT" == literal) {
- *result = AHT_DEFAULT;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = AHT_COMMUNICATION;
- return true;
- } else if ("MEDIA" == literal) {
- *result = AHT_MEDIA;
- return true;
- } else if ("MESSAGING" == literal) {
- *result = AHT_MESSAGING;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = AHT_NAVIGATION;
- return true;
- } else if ("INFORMATION" == literal) {
- *result = AHT_INFORMATION;
- return true;
- } else if ("SOCIAL" == literal) {
- *result = AHT_SOCIAL;
- return true;
- } else if ("BACKGROUND_PROCESS" == literal) {
- *result = AHT_BACKGROUND_PROCESS;
- return true;
- } else if ("TESTING" == literal) {
- *result = AHT_TESTING;
- return true;
- } else if ("SYSTEM" == literal) {
- *result = AHT_SYSTEM;
- return true;
- } else if ("PROJECTION" == literal) {
- *result = AHT_PROJECTION;
- return true;
- } else if ("REMOTE_CONTROL" == literal) {
- *result = AHT_REMOTE_CONTROL;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return true;
- case RT_FILE_RESUME:
- return true;
- case RT_AUTH_REQUEST:
- return true;
- case RT_AUTH_CHALLENGE:
- return true;
- case RT_AUTH_ACK:
- return true;
- case RT_PROPRIETARY:
- return true;
- case RT_QUERY_APPS:
- return true;
- case RT_LAUNCH_APP:
- return true;
- case RT_LOCK_SCREEN_ICON_URL:
- return true;
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return true;
- case RT_DRIVER_PROFILE:
- return true;
- case RT_VOICE_SEARCH:
- return true;
- case RT_NAVIGATION:
- return true;
- case RT_PHONE:
- return true;
- case RT_CLIMATE:
- return true;
- case RT_SETTINGS:
- return true;
- case RT_VEHICLE_DIAGNOSTICS:
- return true;
- case RT_EMERGENCY:
- return true;
- case RT_MEDIA:
- return true;
- case RT_FOTA:
- return true;
- case RT_OEM_SPECIFIC:
- return true;
- case RT_EMPTY:
- return true;
- default:
- return false;
- }
-}
-
-const char* EnumToJsonString(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return "HTTP";
- case RT_FILE_RESUME:
- return "FILE_RESUME";
- case RT_AUTH_REQUEST:
- return "AUTH_REQUEST";
- case RT_AUTH_CHALLENGE:
- return "AUTH_CHALLENGE";
- case RT_AUTH_ACK:
- return "AUTH_ACK";
- case RT_PROPRIETARY:
- return "PROPRIETARY";
- case RT_QUERY_APPS:
- return "QUERY_APPS";
- case RT_LAUNCH_APP:
- return "LAUNCH_APP";
- case RT_LOCK_SCREEN_ICON_URL:
- return "LOCK_SCREEN_ICON_URL";
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return "TRAFFIC_MESSAGE_CHANNEL";
- case RT_DRIVER_PROFILE:
- return "DRIVER_PROFILE";
- case RT_VOICE_SEARCH:
- return "VOICE_SEARCH";
- case RT_NAVIGATION:
- return "NAVIGATION";
- case RT_PHONE:
- return "PHONE";
- case RT_CLIMATE:
- return "CLIMATE";
- case RT_SETTINGS:
- return "SETTINGS";
- case RT_VEHICLE_DIAGNOSTICS:
- return "VEHICLE_DIAGNOSTICS";
- case RT_EMERGENCY:
- return "EMERGENCY";
- case RT_MEDIA:
- return "MEDIA";
- case RT_FOTA:
- return "FOTA";
- case RT_OEM_SPECIFIC:
- return "OEM_SPECIFIC";
- case RT_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, RequestType* result) {
- if ("HTTP" == literal) {
- *result = RT_HTTP;
- return true;
- }
- if ("FILE_RESUME" == literal) {
- *result = RT_FILE_RESUME;
- return true;
- }
- if ("AUTH_REQUEST" == literal) {
- *result = RT_AUTH_REQUEST;
- return true;
- }
- if ("AUTH_CHALLENGE" == literal) {
- *result = RT_AUTH_CHALLENGE;
- return true;
- }
- if ("AUTH_ACK" == literal) {
- *result = RT_AUTH_ACK;
- return true;
- }
- if ("PROPRIETARY" == literal) {
- *result = RT_PROPRIETARY;
- return true;
- }
- if ("QUERY_APPS" == literal) {
- *result = RT_QUERY_APPS;
- return true;
- }
- if ("LAUNCH_APP" == literal) {
- *result = RT_LAUNCH_APP;
- return true;
- }
- if ("LOCK_SCREEN_ICON_URL" == literal) {
- *result = RT_LOCK_SCREEN_ICON_URL;
- return true;
- }
- if ("TRAFFIC_MESSAGE_CHANNEL" == literal) {
- *result = RT_TRAFFIC_MESSAGE_CHANNEL;
- return true;
- }
- if ("DRIVER_PROFILE" == literal) {
- *result = RT_DRIVER_PROFILE;
- return true;
- }
- if ("VOICE_SEARCH" == literal) {
- *result = RT_VOICE_SEARCH;
- return true;
- }
- if ("NAVIGATION" == literal) {
- *result = RT_NAVIGATION;
- return true;
- }
- if ("PHONE" == literal) {
- *result = RT_PHONE;
- return true;
- }
- if ("CLIMATE" == literal) {
- *result = RT_CLIMATE;
- return true;
- }
- if ("SETTINGS" == literal) {
- *result = RT_SETTINGS;
- return true;
- }
- if ("VEHICLE_DIAGNOSTICS" == literal) {
- *result = RT_VEHICLE_DIAGNOSTICS;
- return true;
- }
- if ("EMERGENCY" == literal) {
- *result = RT_EMERGENCY;
- return true;
- }
- if ("MEDIA" == literal) {
- *result = RT_MEDIA;
- return true;
- }
- if ("FOTA" == literal) {
- *result = RT_FOTA;
- return true;
- }
- if ("OEM_SPECIFIC" == literal) {
- *result = RT_OEM_SPECIFIC;
- return true;
- }
- if ("EMPTY" == literal) {
- *result = RT_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return true;
- case MT_RADIO:
- return true;
- case MT_SEAT:
- return true;
- case MT_AUDIO:
- return true;
- case MT_LIGHT:
- return true;
- case MT_HMI_SETTINGS:
- return true;
- case MT_EMPTY:
- return true;
- default:
- return false;
- }
-}
-
-const char* EnumToJsonString(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return "CLIMATE";
- case MT_RADIO:
- return "RADIO";
- case MT_SEAT:
- return "SEAT";
- case MT_AUDIO:
- return "AUDIO";
- case MT_LIGHT:
- return "LIGHT";
- case MT_HMI_SETTINGS:
- return "HMI_SETTINGS";
- case MT_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
- if ("CLIMATE" == literal) {
- *result = MT_CLIMATE;
- return true;
- } else if ("RADIO" == literal) {
- *result = MT_RADIO;
- return true;
- } else if ("SEAT" == literal) {
- *result = MT_SEAT;
- return true;
- } else if ("AUDIO" == literal) {
- *result = MT_AUDIO;
- return true;
- } else if ("LIGHT" == literal) {
- *result = MT_LIGHT;
- return true;
- } else if ("HMI_SETTINGS" == literal) {
- *result = MT_HMI_SETTINGS;
- return true;
- } else if ("EMPTY" == literal) {
- *result = MT_EMPTY;
- return true;
- }
- return false;
-}
-
-bool IsValidEnum(HybridAppPreference val) {
- return strlen(EnumToJsonString(val)) > 0;
-}
-
-const char* EnumToJsonString(HybridAppPreference val) {
- switch (val) {
- case HAP_MOBILE:
- return "MOBILE";
- case HAP_CLOUD:
- return "CLOUD";
- case HAP_BOTH:
- return "BOTH";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal,
- HybridAppPreference* result) {
- if ("MOBILE" == literal) {
- *result = HAP_MOBILE;
- return true;
- } else if ("CLOUD" == literal) {
- *result = HAP_CLOUD;
- return true;
- } else if ("BOTH" == literal) {
- *result = HAP_BOTH;
- return true;
- }
- return false;
-}
-
-bool IsValidEnum(FunctionID val) {
- switch (val) {
- case RegisterAppInterfaceID:
- return true;
- case UnregisterAppInterfaceID:
- return true;
- case SetGlobalPropertiesID:
- return true;
- case ResetGlobalPropertiesID:
- return true;
- case AddCommandID:
- return true;
- case DeleteCommandID:
- return true;
- case AddSubMenuID:
- return true;
- case DeleteSubMenuID:
- return true;
- case CreateInteractionChoiceSetID:
- return true;
- case PerformInteractionID:
- return true;
- case DeleteInteractionChoiceSetID:
- return true;
- case AlertID:
- return true;
- case ShowID:
- return true;
- case SpeakID:
- return true;
- case SetMediaClockTimerID:
- return true;
- case PerformAudioPassThruID:
- return true;
- case EndAudioPassThruID:
- return true;
- case SubscribeButtonID:
- return true;
- case UnsubscribeButtonID:
- return true;
- case SubscribeVehicleDataID:
- return true;
- case UnsubscribeVehicleDataID:
- return true;
- case GetVehicleDataID:
- return true;
- case ReadDIDID:
- return true;
- case GetDTCsID:
- return true;
- case ScrollableMessageID:
- return true;
- case SliderID:
- return true;
- case ShowConstantTBTID:
- return true;
- case AlertManeuverID:
- return true;
- case UpdateTurnListID:
- return true;
- case ChangeRegistrationID:
- return true;
- case GenericResponseID:
- return true;
- case PutFileID:
- return true;
- case DeleteFileID:
- return true;
- case ListFilesID:
- return true;
- case SetAppIconID:
- return true;
- case SetDisplayLayoutID:
- return true;
- case DiagnosticMessageID:
- return true;
- case SystemRequestID:
- return true;
- case SendLocationID:
- return true;
- case DialNumberID:
- return true;
- case ButtonPressID:
- return true;
- case GetInteriorVehicleDataID:
- return true;
- case SetInteriorVehicleDataID:
- return true;
- case GetWayPointsID:
- return true;
- case SubscribeWayPointsID:
- return true;
- case UnsubscribeWayPointsID:
- return true;
- case GetSystemCapabilityID:
- return true;
- case SendHapticDataID:
- return true;
- case SetCloudAppPropertiesID:
- return true;
- case GetCloudAppPropertiesID:
- return true;
- case PublishAppServiceID:
- return true;
- case GetFileID:
- return true;
- case GetAppServiceDataID:
- return true;
- case PerformAppServiceInteractionID:
- return true;
- case UnpublishAppServiceID:
- return true;
- case CloseApplicationID:
- return true;
- case ShowAppMenuID:
- return true;
- case OnHMIStatusID:
- return true;
- case OnAppInterfaceUnregisteredID:
- return true;
- case OnButtonEventID:
- return true;
- case OnButtonPressID:
- return true;
- case OnVehicleDataID:
- return true;
- case OnCommandID:
- return true;
- case OnTBTClientStateID:
- return true;
- case OnDriverDistractionID:
- return true;
- case OnPermissionsChangeID:
- return true;
- case OnAudioPassThruID:
- return true;
- case OnLanguageChangeID:
- return true;
- case OnKeyboardInputID:
- return true;
- case OnTouchEventID:
- return true;
- case OnSystemRequestID:
- return true;
- case OnHashChangeID:
- return true;
- case OnInteriorVehicleDataID:
- return true;
- case OnWayPointChangeID:
- return true;
- case OnRCStatusID:
- return true;
- case OnAppServiceDataID:
- return true;
- case EncodedSyncPDataID:
- return true;
- case SyncPDataID:
- return true;
- case OnEncodedSyncPDataID:
- return true;
- case OnSyncPDataID:
- return true;
- case OnSystemCapabilityUpdatedID:
- return true;
- default:
- return false;
- }
-};
-
-const char* EnumToJsonString(FunctionID val) {
- switch (val) {
- case RegisterAppInterfaceID:
- return "RegisterAppInterface";
- case UnregisterAppInterfaceID:
- return "UnregisterAppInterface";
- case SetGlobalPropertiesID:
- return "SetGlobalProperties";
- case ResetGlobalPropertiesID:
- return "ResetGlobalProperties";
- case AddCommandID:
- return "AddCommand";
- case DeleteCommandID:
- return "DeleteCommand";
- case AddSubMenuID:
- return "AddSubMenu";
- case DeleteSubMenuID:
- return "DeleteSubMenu";
- case CreateInteractionChoiceSetID:
- return "CreateInteractionChoiceSet";
- case PerformInteractionID:
- return "PerformInteraction";
- case DeleteInteractionChoiceSetID:
- return "DeleteInteractionChoiceSet";
- case AlertID:
- return "Alert";
- case ShowID:
- return "Show";
- case SpeakID:
- return "Speak";
- case SetMediaClockTimerID:
- return "SetMediaClockTimer";
- case PerformAudioPassThruID:
- return "PerformAudioPassThru";
- case EndAudioPassThruID:
- return "EndAudioPassThru";
- case SubscribeButtonID:
- return "SubscribeButton";
- case UnsubscribeButtonID:
- return "UnsubscribeButton";
- case SubscribeVehicleDataID:
- return "SubscribeVehicleData";
- case UnsubscribeVehicleDataID:
- return "UnsubscribeVehicleData";
- case GetVehicleDataID:
- return "GetVehicleData";
- case ReadDIDID:
- return "ReadDID";
- case GetDTCsID:
- return "GetDTCs";
- case ScrollableMessageID:
- return "ScrollableMessage";
- case SliderID:
- return "Slider";
- case ShowConstantTBTID:
- return "ShowConstantTBT";
- case AlertManeuverID:
- return "AlertManeuver";
- case UpdateTurnListID:
- return "UpdateTurnList";
- case ChangeRegistrationID:
- return "ChangeRegistration";
- case GenericResponseID:
- return "GenericResponse";
- case PutFileID:
- return "PutFile";
- case DeleteFileID:
- return "DeleteFile";
- case ListFilesID:
- return "ListFiles";
- case SetAppIconID:
- return "SetAppIcon";
- case SetDisplayLayoutID:
- return "SetDisplayLayout";
- case DiagnosticMessageID:
- return "DiagnosticMessage";
- case SystemRequestID:
- return "SystemRequest";
- case SendLocationID:
- return "SendLocation";
- case DialNumberID:
- return "DialNumber";
- case ButtonPressID:
- return "ButtonPress";
- case GetInteriorVehicleDataID:
- return "GetInteriorVehicleData";
- case SetInteriorVehicleDataID:
- return "SetInteriorVehicleData";
- case GetWayPointsID:
- return "GetWayPoints";
- case SubscribeWayPointsID:
- return "SubscribeWayPoints";
- case UnsubscribeWayPointsID:
- return "UnsubscribeWayPoints";
- case GetSystemCapabilityID:
- return "GetSystemCapability";
- case SendHapticDataID:
- return "SendHapticData";
- case SetCloudAppPropertiesID:
- return "SetCloudAppProperties";
- case GetCloudAppPropertiesID:
- return "GetCloudAppProperties";
- case PublishAppServiceID:
- return "PublishAppService";
- case GetFileID:
- return "GetFile";
- case GetAppServiceDataID:
- return "GetAppServiceData";
- case PerformAppServiceInteractionID:
- return "PerformAppServiceInteraction";
- case UnpublishAppServiceID:
- return "UnpublishAppService";
- case CloseApplicationID:
- return "CloseApplication";
- case ShowAppMenuID:
- return "ShowAppMenu";
- case OnHMIStatusID:
- return "OnHMIStatus";
- case OnAppInterfaceUnregisteredID:
- return "OnAppInterfaceUnregistered";
- case OnButtonEventID:
- return "OnButtonEvent";
- case OnButtonPressID:
- return "OnButtonPress";
- case OnVehicleDataID:
- return "OnVehicleData";
- case OnCommandID:
- return "OnCommand";
- case OnTBTClientStateID:
- return "OnTBTClientState";
- case OnDriverDistractionID:
- return "OnDriverDistraction";
- case OnPermissionsChangeID:
- return "OnPermissionsChange";
- case OnAudioPassThruID:
- return "OnAudioPassThru";
- case OnLanguageChangeID:
- return "OnLanguageChange";
- case OnKeyboardInputID:
- return "OnKeyboardInput";
- case OnTouchEventID:
- return "OnTouchEvent";
- case OnSystemRequestID:
- return "OnSystemRequest";
- case OnHashChangeID:
- return "OnHashChange";
- case OnInteriorVehicleDataID:
- return "OnInteriorVehicleData";
- case OnWayPointChangeID:
- return "OnWayPointChange";
- case OnRCStatusID:
- return "OnRCStatus";
- case OnAppServiceDataID:
- return "OnAppServiceData";
- case EncodedSyncPDataID:
- return "EncodedSyncPData";
- case SyncPDataID:
- return "SyncPData";
- case OnEncodedSyncPDataID:
- return "OnEncodedSyncPData";
- case OnSyncPDataID:
- return "OnSyncPData";
- case OnSystemCapabilityUpdatedID:
- return "OnSystemCapabilityUpdated";
- default:
- return "";
- }
-};
-
-bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
- 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 ("ReadDID" == 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 ("ButtonPress" == literal) {
- *result = ButtonPressID;
- return true;
- }
-
- if ("GetInteriorVehicleData" == literal) {
- *result = GetInteriorVehicleDataID;
- return true;
- }
-
- if ("SetInteriorVehicleData" == literal) {
- *result = SetInteriorVehicleDataID;
- return true;
- }
-
- if ("GetWayPoints" == literal) {
- *result = GetWayPointsID;
- return true;
- }
-
- if ("SubscribeWayPoints" == literal) {
- *result = SubscribeWayPointsID;
- return true;
- }
-
- if ("UnsubscribeWayPoints" == literal) {
- *result = UnsubscribeWayPointsID;
- return true;
- }
-
- if ("GetSystemCapability" == literal) {
- *result = GetSystemCapabilityID;
- return true;
- }
-
- if ("SendHapticData" == literal) {
- *result = SendHapticDataID;
- return true;
- }
-
- if ("SetCloudAppProperties" == literal) {
- *result = SetCloudAppPropertiesID;
- return true;
- }
-
- if ("GetCloudAppProperties" == literal) {
- *result = GetCloudAppPropertiesID;
- return true;
- }
-
- if ("PublishAppService" == literal) {
- *result = PublishAppServiceID;
- return true;
- }
-
- if ("GetFile" == literal) {
- *result = GetFileID;
- return true;
- }
-
- if ("GetAppServiceData" == literal) {
- *result = GetAppServiceDataID;
- return true;
- }
-
- if ("PerformAppServiceInteraction" == literal) {
- *result = PerformAppServiceInteractionID;
- return true;
- }
-
- if ("UnpublishAppService" == literal) {
- *result = UnpublishAppServiceID;
- return true;
- }
-
- if ("CloseApplication" == literal) {
- *result = CloseApplicationID;
- return true;
- }
-
- if ("ShowAppMenu" == literal) {
- *result = ShowAppMenuID;
- 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 ("OnInteriorVehicleData" == literal) {
- *result = OnInteriorVehicleDataID;
- return true;
- }
-
- if ("OnWayPointChange" == literal) {
- *result = OnWayPointChangeID;
- return true;
- }
-
- if ("OnRCStatus" == literal) {
- *result = OnRCStatusID;
- return true;
- }
-
- if ("OnAppServiceData" == literal) {
- *result = OnAppServiceDataID;
- return true;
- }
-
- if ("OnSystemCapabilityUpdated" == literal) {
- *result = OnSystemCapabilityUpdatedID;
- 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/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index 7fdfde996c..3029ebb067 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -31,7 +31,6 @@ PolicyBase::~PolicyBase() {}
PolicyBase::PolicyBase(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject))
, priority(impl::ValueMember(value__, "priority")) {}
-
Json::Value PolicyBase::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("priority", priority, &result__);
@@ -280,7 +279,8 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, icon_url(impl::ValueMember(value__, "icon_url"))
, app_service_parameters(impl::ValueMember(value__, "app_services"))
, allow_unknown_rpc_passthrough(
- impl::ValueMember(value__, "allow_unknown_rpc_passthrough")) {}
+ impl::ValueMember(value__, "allow_unknown_rpc_passthrough"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -305,6 +305,8 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("allow_unknown_rpc_passthrough",
allow_unknown_rpc_passthrough,
&result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
+
return result__;
}
@@ -360,6 +362,9 @@ bool ApplicationParams::is_valid() const {
if (!allow_unknown_rpc_passthrough.is_valid()) {
return false;
}
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -422,6 +427,9 @@ bool ApplicationParams::struct_empty() const {
if (allow_unknown_rpc_passthrough.is_initialized()) {
return false;
}
+ if (encryption_required.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -487,6 +495,10 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
allow_unknown_rpc_passthrough.ReportErrors(
&report__->ReportSubobject("allow_unknown_rpc_passthrough"));
}
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -535,6 +547,7 @@ bool RpcParameters::is_valid() const {
if (!parameters.is_valid()) {
return false;
}
+
return Validate();
}
@@ -581,12 +594,14 @@ Rpcs::~Rpcs() {}
Rpcs::Rpcs(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject))
, user_consent_prompt(impl::ValueMember(value__, "user_consent_prompt"))
- , rpcs(impl::ValueMember(value__, "rpcs")) {}
+ , rpcs(impl::ValueMember(value__, "rpcs"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value Rpcs::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("user_consent_prompt", user_consent_prompt, &result__);
impl::WriteJsonField("rpcs", rpcs, &result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
return result__;
}
@@ -597,6 +612,9 @@ bool Rpcs::is_valid() const {
if (!rpcs.is_valid()) {
return false;
}
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -611,7 +629,9 @@ bool Rpcs::struct_empty() const {
if (rpcs.is_initialized()) {
return false;
}
-
+ if (encryption_required.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -626,6 +646,10 @@ void Rpcs::ReportErrors(rpc::ValidationReport* report__) const {
if (!rpcs.is_valid()) {
rpcs.ReportErrors(&report__->ReportSubobject("rpcs"));
}
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
@@ -634,9 +658,60 @@ void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
rpcs.SetPolicyTableType(pt_type);
}
+// EndpointProperties methods
+EndpointProperty::EndpointProperty() : CompositeType(kUninitialized) {}
+
+EndpointProperty::~EndpointProperty() {}
+
+EndpointProperty::EndpointProperty(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , version(impl::ValueMember(value__, "version")) {}
+
+Json::Value EndpointProperty::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("version", version, &result__);
+ return result__;
+}
+
+bool EndpointProperty::is_valid() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool EndpointProperty::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool EndpointProperty::struct_empty() const {
+ if (version.is_initialized()) {
+ return false;
+ }
+
+ return true;
+}
+
+void EndpointProperty::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!version.is_valid()) {
+ version.ReportErrors(&report__->ReportSubobject("version"));
+ }
+}
+
+void EndpointProperty::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ version.SetPolicyTableType(pt_type);
+}
+
// ModuleConfig methods
ModuleConfig::ModuleConfig() : CompositeType(kUninitialized) {}
+const std::string ModuleConfig::kDefaultOemMappingServiceName =
+ "custom_vehicle_data_mapping_url";
+
ModuleConfig::ModuleConfig(
uint8_t exchange_after_x_ignition_cycles,
int64_t exchange_after_x_kilometers,
@@ -644,6 +719,7 @@ ModuleConfig::ModuleConfig(
uint16_t timeout_after_x_seconds,
const SecondsBetweenRetries& seconds_between_retries,
const ServiceEndpoints& endpoints,
+ const ServiceEndpointProperties& endpoint_properties,
const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority)
: CompositeType(kUninitialized)
, exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles)
@@ -652,6 +728,7 @@ ModuleConfig::ModuleConfig(
, timeout_after_x_seconds(timeout_after_x_seconds)
, seconds_between_retries(seconds_between_retries)
, endpoints(endpoints)
+ , endpoint_properties(endpoint_properties)
, notifications_per_minute_by_priority(
notifications_per_minute_by_priority) {}
@@ -672,6 +749,7 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, seconds_between_retries(
impl::ValueMember(value__, "seconds_between_retries"))
, endpoints(impl::ValueMember(value__, "endpoints"))
+ , endpoint_properties(impl::ValueMember(value__, "endpoint_properties"))
, notifications_per_minute_by_priority(
impl::ValueMember(value__, "notifications_per_minute_by_priority"))
, vehicle_make(impl::ValueMember(value__, "vehicle_make"))
@@ -691,6 +769,7 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
timeout_after_x_seconds = from.timeout_after_x_seconds;
seconds_between_retries = from.seconds_between_retries;
endpoints = from.endpoints;
+ endpoint_properties = from.endpoint_properties;
notifications_per_minute_by_priority =
from.notifications_per_minute_by_priority;
@@ -719,6 +798,7 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField(
"seconds_between_retries", seconds_between_retries, &result__);
impl::WriteJsonField("endpoints", endpoints, &result__);
+ impl::WriteJsonField("endpoint_properties", endpoint_properties, &result__);
impl::WriteJsonField("notifications_per_minute_by_priority",
notifications_per_minute_by_priority,
&result__);
@@ -758,6 +838,9 @@ bool ModuleConfig::is_valid() const {
if (!endpoints.is_valid()) {
return false;
}
+ if (!endpoint_properties.is_valid()) {
+ return false;
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
return false;
}
@@ -811,10 +894,15 @@ bool ModuleConfig::struct_empty() const {
if (seconds_between_retries.is_initialized()) {
return false;
}
+
if (endpoints.is_initialized()) {
return false;
}
+ if (endpoint_properties.is_initialized()) {
+ return false;
+ }
+
if (notifications_per_minute_by_priority.is_initialized()) {
return false;
}
@@ -872,6 +960,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
if (!endpoints.is_valid()) {
endpoints.ReportErrors(&report__->ReportSubobject("endpoints"));
}
+ if (!endpoint_properties.is_valid()) {
+ endpoint_properties.ReportErrors(
+ &report__->ReportSubobject("endpoint_properties"));
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
notifications_per_minute_by_priority.ReportErrors(
&report__->ReportSubobject("notifications_per_minute_by_priority"));
@@ -918,6 +1010,7 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
timeout_after_x_seconds.SetPolicyTableType(pt_type);
seconds_between_retries.SetPolicyTableType(pt_type);
endpoints.SetPolicyTableType(pt_type);
+ endpoint_properties.SetPolicyTableType(pt_type);
notifications_per_minute_by_priority.SetPolicyTableType(pt_type);
lock_screen_dismissal_enabled.SetPolicyTableType(pt_type);
vehicle_make.SetPolicyTableType(pt_type);
@@ -1539,6 +1632,414 @@ void DeviceParams::ReportErrors(rpc::ValidationReport* report__) const {
}
}
+// VehicleDataItem methods
+VehicleDataItem::VehicleDataItem() : CompositeType(kUninitialized) {}
+
+VehicleDataItem::VehicleDataItem(const VehicleDataItem& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , name(vehicle_data.name)
+ , type(vehicle_data.type)
+ , key(vehicle_data.key)
+ , mandatory(vehicle_data.mandatory)
+ , params(vehicle_data.params)
+ , array(vehicle_data.array)
+ , since(vehicle_data.since)
+ , until(vehicle_data.until)
+ , removed(vehicle_data.removed)
+ , deprecated(vehicle_data.deprecated)
+ , minvalue(vehicle_data.minvalue)
+ , maxvalue(vehicle_data.maxvalue)
+ , minsize(vehicle_data.minsize)
+ , maxsize(vehicle_data.maxsize)
+ , minlength(vehicle_data.minlength)
+ , maxlength(vehicle_data.maxlength) {}
+
+VehicleDataItem::VehicleDataItem(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , name(impl::ValueMember(value__, "name"))
+ , type(impl::ValueMember(value__, "type"))
+ , key(impl::ValueMember(value__, "key"))
+ , mandatory(impl::ValueMember(value__, "mandatory"))
+ , params(impl::ValueMember(value__, "params"))
+ , array(impl::ValueMember(value__, "array"))
+ , since(impl::ValueMember(value__, "since"))
+ , until(impl::ValueMember(value__, "until"))
+ , removed(impl::ValueMember(value__, "removed"))
+ , deprecated(impl::ValueMember(value__, "deprecated"))
+ , minvalue(impl::ValueMember(value__, "minvalue"))
+ , maxvalue(impl::ValueMember(value__, "maxvalue"))
+ , minsize(impl::ValueMember(value__, "minsize"))
+ , maxsize(impl::ValueMember(value__, "maxsize"))
+ , minlength(impl::ValueMember(value__, "minlength"))
+ , maxlength(impl::ValueMember(value__, "maxlength")) {}
+
+VehicleDataItem::~VehicleDataItem() {}
+
+const std::string VehicleDataItem::kInteger = "Integer";
+const std::string VehicleDataItem::kStruct = "Struct";
+const std::string VehicleDataItem::kString = "String";
+const std::string VehicleDataItem::kFloat = "Float";
+const std::string VehicleDataItem::kDouble = "Double";
+const std::string VehicleDataItem::kBoolean = "Boolean";
+
+const std::vector<std::string> VehicleDataItem::kPODTypes = {
+ kInteger, kFloat, kDouble, kString, kBoolean};
+
+Json::Value VehicleDataItem::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("name", name, &ret);
+ impl::WriteJsonField("type", type, &ret);
+ impl::WriteJsonField("key", key, &ret);
+ impl::WriteJsonField("array", array, &ret);
+ impl::WriteJsonField("mandatory", mandatory, &ret);
+ impl::WriteJsonField("params", params, &ret);
+ impl::WriteJsonField("since", since, &ret);
+ impl::WriteJsonField("until", until, &ret);
+ impl::WriteJsonField("removed", removed, &ret);
+ impl::WriteJsonField("deprecated", deprecated, &ret);
+ impl::WriteJsonField("minvalue", minvalue, &ret);
+ impl::WriteJsonField("maxvalue", maxvalue, &ret);
+ impl::WriteJsonField("minsize", minsize, &ret);
+ impl::WriteJsonField("maxsize", maxsize, &ret);
+ impl::WriteJsonField("minlength", minlength, &ret);
+ impl::WriteJsonField("maxlength", maxlength, &ret);
+ return ret;
+}
+
+bool VehicleDataItem::operator==(const VehicleDataItem& vd) {
+ return (name == vd.name && type == vd.type && key == vd.key &&
+ mandatory == vd.mandatory && params == vd.params &&
+ array == vd.array && since == vd.since && until == vd.until &&
+ removed == vd.removed && deprecated == vd.deprecated &&
+ minvalue == vd.minvalue && maxvalue == vd.maxvalue &&
+ minsize == vd.minsize && maxsize == vd.maxsize &&
+ minlength == vd.minlength && maxlength == vd.maxlength);
+}
+
+bool VehicleDataItem::is_valid() const {
+ if (!name.is_valid()) {
+ return false;
+ }
+ if (!type.is_valid()) {
+ return false;
+ }
+ if (!key.is_valid()) {
+ return false;
+ }
+ if (!array.is_valid()) {
+ return false;
+ }
+ if (!mandatory.is_valid()) {
+ return false;
+ }
+ if (!params.is_valid()) {
+ return false;
+ }
+ if (!since.is_valid()) {
+ return false;
+ }
+ if (!until.is_valid()) {
+ return false;
+ }
+ if (!removed.is_valid()) {
+ return false;
+ }
+ if (!deprecated.is_valid()) {
+ return false;
+ }
+ if (!minvalue.is_valid()) {
+ return false;
+ }
+ if (!maxvalue.is_valid()) {
+ return false;
+ }
+ if (!minsize.is_valid()) {
+ return false;
+ }
+ if (!maxsize.is_valid()) {
+ return false;
+ }
+ if (!minlength.is_valid()) {
+ return false;
+ }
+ if (!maxlength.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleDataItem::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (struct_not_empty());
+}
+
+bool VehicleDataItem::struct_not_empty() const {
+ if (!name.is_initialized()) {
+ return false;
+ }
+ if (!type.is_initialized()) {
+ return false;
+ }
+ if (!key.is_initialized()) {
+ return false;
+ }
+ if (!array.is_initialized()) {
+ return false;
+ }
+ if (!mandatory.is_initialized()) {
+ return false;
+ }
+ if (!params.is_initialized()) {
+ return false;
+ }
+ if (!since.is_initialized()) {
+ return false;
+ }
+ if (!until.is_initialized()) {
+ return false;
+ }
+ if (!removed.is_initialized()) {
+ return false;
+ }
+ if (!deprecated.is_initialized()) {
+ return false;
+ }
+ if (!minvalue.is_initialized()) {
+ return false;
+ }
+ if (!maxvalue.is_initialized()) {
+ return false;
+ }
+ if (!minsize.is_initialized()) {
+ return false;
+ }
+ if (!maxsize.is_initialized()) {
+ return false;
+ }
+ if (!minlength.is_initialized()) {
+ return false;
+ }
+ if (!maxlength.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void VehicleDataItem::ReportErrors(rpc::ValidationReport* report__) const {
+ if (!struct_not_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!name.is_valid()) {
+ name.ReportErrors(&report__->ReportSubobject("name"));
+ }
+ if (!ValidateNaming(std::string(name))) {
+ report__->set_validation_info(
+ "Invalid name values [" + std::string(name) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!type.is_valid()) {
+ type.ReportErrors(&report__->ReportSubobject("type"));
+ }
+ if (type.is_initialized() && !ValidateTypes()) {
+ report__->set_validation_info("Unknown type [" + std::string(name) +
+ "]: '" + std::string(type) + "'.");
+ }
+ if (!key.is_valid()) {
+ key.ReportErrors(&report__->ReportSubobject("key"));
+ }
+ if (!ValidateNaming(std::string(key))) {
+ report__->set_validation_info(
+ "Invalid key values [" + std::string(key) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!array.is_valid()) {
+ array.ReportErrors(&report__->ReportSubobject("array"));
+ }
+ if (!mandatory.is_valid()) {
+ mandatory.ReportErrors(&report__->ReportSubobject("mandatory"));
+ }
+ if (!params.is_valid()) {
+ params.ReportErrors(&report__->ReportSubobject("params"));
+ }
+ if (!since.is_valid()) {
+ since.ReportErrors(&report__->ReportSubobject("since"));
+ }
+ if (!until.is_valid()) {
+ until.ReportErrors(&report__->ReportSubobject("until"));
+ }
+ if (!removed.is_valid()) {
+ removed.ReportErrors(&report__->ReportSubobject("removed"));
+ }
+ if (!deprecated.is_valid()) {
+ deprecated.ReportErrors(&report__->ReportSubobject("deprecated"));
+ }
+ if (!minvalue.is_valid()) {
+ minvalue.ReportErrors(&report__->ReportSubobject("minvalue"));
+ }
+ if (!maxvalue.is_valid()) {
+ maxvalue.ReportErrors(&report__->ReportSubobject("maxvalue"));
+ }
+ if (!minsize.is_valid()) {
+ minsize.ReportErrors(&report__->ReportSubobject("minsize"));
+ }
+ if (!maxsize.is_valid()) {
+ maxsize.ReportErrors(&report__->ReportSubobject("maxsize"));
+ }
+ if (!minlength.is_valid()) {
+ minlength.ReportErrors(&report__->ReportSubobject("minlength"));
+ }
+ if (!maxlength.is_valid()) {
+ maxlength.ReportErrors(&report__->ReportSubobject("maxlength"));
+ }
+}
+
+void VehicleDataItem::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ name.SetPolicyTableType(pt_type);
+ type.SetPolicyTableType(pt_type);
+ key.SetPolicyTableType(pt_type);
+ array.SetPolicyTableType(pt_type);
+ mandatory.SetPolicyTableType(pt_type);
+ params.SetPolicyTableType(pt_type);
+ since.SetPolicyTableType(pt_type);
+ until.SetPolicyTableType(pt_type);
+ removed.SetPolicyTableType(pt_type);
+ deprecated.SetPolicyTableType(pt_type);
+ minvalue.SetPolicyTableType(pt_type);
+ maxvalue.SetPolicyTableType(pt_type);
+ minsize.SetPolicyTableType(pt_type);
+ maxsize.SetPolicyTableType(pt_type);
+ minlength.SetPolicyTableType(pt_type);
+ maxlength.SetPolicyTableType(pt_type);
+}
+
+bool VehicleDataItem::ValidateNaming(std::string str) const {
+ auto contains_spec_chars = [](std::string str) {
+ const auto invalid_chars = "!@#$%^&*";
+ return str.npos != str.find_first_of(invalid_chars);
+ };
+
+ auto contains_spaces = [](std::string str) {
+ const auto found_space =
+ std::find_if(str.begin(), str.end(), [](unsigned char ch) {
+ return std::isspace(ch);
+ });
+
+ return found_space != str.end();
+ };
+
+ auto empty_string = [](std::string str) {
+ str.erase(std::remove_if(str.begin(),
+ str.end(),
+ [](unsigned char ch) { return std::isspace(ch); }),
+ str.end());
+ return str.length() < 1;
+ };
+
+ return !empty_string(str) && !contains_spaces(str) &&
+ !contains_spec_chars(str);
+}
+
+bool VehicleDataItem::ValidateTypes() const {
+ if (VehicleDataItem::kStruct == std::string(type)) {
+ return params.is_initialized() && !(params->empty()) && params.is_valid();
+ }
+ // params should be empty for POD types and for enum values
+ return (!(params.is_initialized()) || params->empty());
+}
+
+bool VehicleDataItem::IsPrimitiveType() const {
+ return helpers::in_range(kPODTypes, std::string(type));
+}
+
+// VehicleData methods
+VehicleData::VehicleData() : CompositeType(kUninitialized) {}
+
+VehicleData::VehicleData(const VehicleData& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , schema_version(vehicle_data.schema_version)
+ , schema_items(vehicle_data.schema_items) {}
+
+VehicleData::VehicleData(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , schema_version(impl::ValueMember(value__, "schema_version"))
+ , schema_items(impl::ValueMember(value__, "schema_items")) {}
+
+VehicleData::~VehicleData() {}
+
+bool VehicleData::is_valid() const {
+ if (!schema_version.is_valid()) {
+ return false;
+ }
+ if (!schema_items.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleData::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool VehicleData::struct_empty() const {
+ if (schema_version.is_initialized()) {
+ return false;
+ }
+ if (schema_items.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+Json::Value VehicleData::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("schema_version", schema_version, &ret);
+ impl::WriteJsonField("schema_items", schema_items, &ret);
+ return ret;
+}
+
+void VehicleData::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ const auto pt_type = GetPolicyTableType();
+ const auto pt_type_str = PolicyTableTypeToString(pt_type);
+ std::string validation_info = "";
+
+ if (PT_SNAPSHOT == pt_type) {
+ if (schema_items.is_initialized()) {
+ validation_info +=
+ "; schema_items " + omitted_validation_info + pt_type_str;
+ }
+ if (!schema_version.is_initialized()) {
+ validation_info +=
+ "; schema_version " + required_validation_info + pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+
+ if (PT_UPDATE == pt_type || PT_PRELOADED == pt_type) {
+ if ((schema_version.is_initialized() && !schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && schema_items.is_initialized())) {
+ validation_info += "; schema_version and schema_items " +
+ required_validation_info + pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+
+ if (!schema_version.is_valid()) {
+ schema_version.ReportErrors(&report__->ReportSubobject("schema_version"));
+ }
+ if (!schema_items.is_valid()) {
+ schema_items.ReportErrors(&report__->ReportSubobject("schema_items"));
+ }
+}
+
+void VehicleData::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ schema_version.SetPolicyTableType(pt_type);
+ schema_items.SetPolicyTableType(pt_type);
+}
+
// PolicyTable methods
PolicyTable::PolicyTable() : CompositeType(kUninitialized) {}
@@ -1565,7 +2066,8 @@ PolicyTable::PolicyTable(const Json::Value* value__)
, module_meta(impl::ValueMember(value__, "module_meta"))
, usage_and_error_counts(
impl::ValueMember(value__, "usage_and_error_counts"))
- , device_data(impl::ValueMember(value__, "device_data")) {}
+ , device_data(impl::ValueMember(value__, "device_data"))
+ , vehicle_data(impl::ValueMember(value__, "vehicle_data")) {}
Json::Value PolicyTable::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -1578,6 +2080,7 @@ Json::Value PolicyTable::ToJsonValue() const {
impl::WriteJsonField(
"usage_and_error_counts", usage_and_error_counts, &result__);
impl::WriteJsonField("device_data", device_data, &result__);
+ impl::WriteJsonField("vehicle_data", vehicle_data, &result__);
return result__;
}
@@ -1603,6 +2106,9 @@ bool PolicyTable::is_valid() const {
if (!device_data.is_valid()) {
return false;
}
+ if (!vehicle_data.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -1635,6 +2141,9 @@ bool PolicyTable::struct_empty() const {
if (device_data.is_initialized()) {
return false;
}
+ if (vehicle_data.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -1677,6 +2186,9 @@ void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const {
if (!device_data.is_valid()) {
device_data.ReportErrors(&report__->ReportSubobject("device_data"));
}
+ if (!vehicle_data.is_valid()) {
+ vehicle_data.ReportErrors(&report__->ReportSubobject("vehicle_data"));
+ }
}
void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
@@ -1688,6 +2200,7 @@ void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
module_meta.SetPolicyTableType(pt_type);
usage_and_error_counts.SetPolicyTableType(pt_type);
device_data.SetPolicyTableType(pt_type);
+ vehicle_data.SetPolicyTableType(pt_type);
}
// Table methods
diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc
index 059c18d00e..14b6d657c2 100644
--- a/src/components/policy/policy_regular/src/policy_table/validation.cc
+++ b/src/components/policy/policy_regular/src/policy_table/validation.cc
@@ -196,6 +196,14 @@ bool Rpcs::Validate() const {
return true;
}
+bool EndpointProperty::Validate() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+
+ return true;
+}
+
bool ModuleConfig::Validate() const {
if (PT_PRELOADED == GetPolicyTableType()) {
if (vehicle_make.is_initialized()) {
@@ -221,6 +229,14 @@ bool ModuleConfig::Validate() const {
}
}
+ if (endpoint_properties.is_initialized()) {
+ const auto& endpoint_property =
+ endpoint_properties->find(kDefaultOemMappingServiceName);
+ if (endpoint_properties->end() != endpoint_property) {
+ return (*endpoint_property).second.version.is_initialized();
+ }
+ }
+
return true;
}
@@ -268,6 +284,39 @@ bool DeviceParams::Validate() const {
return true;
}
+bool VehicleDataItem::Validate() const {
+ if (!ValidateNaming(std::string(name))) {
+ return false;
+ };
+
+ if (!ValidateNaming(std::string(key))) {
+ return false;
+ };
+
+ if (!ValidateTypes()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Unknown type: " << std::string(type) << " of " << std::string(key));
+ return false;
+ }
+ return true;
+}
+
+bool VehicleData::Validate() const {
+ const PolicyTableType policy_table_type = GetPolicyTableType();
+ bool result = true;
+ if (PT_SNAPSHOT == policy_table_type) {
+ result =
+ (!schema_items.is_initialized()) && schema_version.is_initialized();
+ }
+ if (PT_UPDATE == policy_table_type || PT_PRELOADED == policy_table_type) {
+ result =
+ (schema_version.is_initialized() && schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && !schema_items.is_initialized());
+ }
+ return result;
+}
+
bool PolicyTable::Validate() const {
const PolicyTableType policy_table_type = GetPolicyTableType();