summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Galiuzov <AGaliuzov@luxoft.com>2015-04-02 15:26:40 +0300
committerAndrey Oleynik <aoleynik@luxoft.com>2016-05-13 17:42:46 +0300
commit004a16c580640557e6aabb817ca68ba25d94fb56 (patch)
tree23ee1dc1d98a0a0df59e5a6eb61eb8ac4c4b043f
parent8766c99f18b785c8e93d0cac0938a836b02ed060 (diff)
downloadsdl_core-004a16c580640557e6aabb817ca68ba25d94fb56.tar.gz
Updates PolicyManager in order to properly support certificate field
Also adds some extra logic to support proper update of ModuleConfigs field. Originally changes resolved APPLINK-11891. Closes-bug: APPLINK-24306
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/types.cc818
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/types.h602
-rw-r--r--src/components/policy/src/policy/src/cache_manager.cc477
-rw-r--r--src/components/policy/src/policy/src/sql_pt_queries.cc992
-rw-r--r--src/components/policy/src/policy/src/sql_pt_representation.cc318
5 files changed, 1611 insertions, 1596 deletions
diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.cc b/src/components/policy/src/policy/policy_table/table_struct/types.cc
index fb1daf2b33..33fdf83eec 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/types.cc
+++ b/src/components/policy/src/policy/policy_table/table_struct/types.cc
@@ -5,234 +5,218 @@
namespace rpc {
namespace policy_table_interface_base {
- std::string PolicyTableTypeToString(const PolicyTableType pt_type) {
- switch (pt_type) {
- case PT_PRELOADED: {
- return "PT_PRELOADED";
- }
- case PT_UPDATE: {
- return "PT_UPDATE";
- }
- case PT_SNAPSHOT: {
- return "PT_SNAPSHOT";
- }
- default :{
- return "INVALID_PT_TYPE";
- }
- }
+std::string PolicyTableTypeToString(const PolicyTableType pt_type) {
+ switch (pt_type) {
+ case PT_PRELOADED: {
+ return "PT_PRELOADED";
}
-
- // PolicyBase methods
- PolicyBase::PolicyBase()
- : CompositeType(kUninitialized) {
+ case PT_UPDATE: {
+ return "PT_UPDATE";
}
- PolicyBase::PolicyBase(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
- : CompositeType(kUninitialized),
- groups(groups),
- priority(priority),
- default_hmi(default_hmi),
- keep_context(keep_context),
- steal_focus(steal_focus) {
+ case PT_SNAPSHOT: {
+ return "PT_SNAPSHOT";
}
- PolicyBase::~PolicyBase() {
+ default: { return "INVALID_PT_TYPE"; }
}
- PolicyBase::PolicyBase(const Json::Value* value__)
+}
+
+// PolicyBase methods
+PolicyBase::PolicyBase() : CompositeType(kUninitialized) {}
+PolicyBase::PolicyBase(const Strings &groups, Priority priority,
+ HmiLevel default_hmi, bool keep_context,
+ bool steal_focus)
+ : CompositeType(kUninitialized), groups(groups), priority(priority),
+ default_hmi(default_hmi), keep_context(keep_context),
+ steal_focus(steal_focus) {}
+PolicyBase::~PolicyBase() {}
+PolicyBase::PolicyBase(const Json::Value *value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject)),
groups(impl::ValueMember(value__, "groups")),
preconsented_groups(impl::ValueMember(value__, "preconsented_groups")),
priority(impl::ValueMember(value__, "priority")),
default_hmi(impl::ValueMember(value__, "default_hmi")),
keep_context(impl::ValueMember(value__, "keep_context")),
- steal_focus(impl::ValueMember(value__, "steal_focus")) {
- }
- Json::Value PolicyBase::ToJsonValue() const {
- Json::Value result__(Json::objectValue);
- impl::WriteJsonField("groups", groups, &result__);
- impl::WriteJsonField("preconsented_groups", preconsented_groups, &result__);
- impl::WriteJsonField("priority", priority, &result__);
- impl::WriteJsonField("default_hmi", default_hmi, &result__);
- impl::WriteJsonField("keep_context", keep_context, &result__);
- impl::WriteJsonField("steal_focus", steal_focus, &result__);
- return result__;
- }
- bool PolicyBase::is_valid() const {
- if (!groups.is_valid()) {
- return false;
- }
- if (!preconsented_groups.is_valid()) {
- return false;
- }
- if (!priority.is_valid()) {
- return false;
- }
- if (!default_hmi.is_valid()) {
- return false;
- }
- if (!keep_context.is_valid()) {
- return false;
- }
- if (!steal_focus.is_valid()) {
- return false;
- }
- return Validate();
+ steal_focus(impl::ValueMember(value__, "steal_focus")) {}
+Json::Value PolicyBase::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("groups", groups, &result__);
+ impl::WriteJsonField("preconsented_groups", preconsented_groups, &result__);
+ impl::WriteJsonField("priority", priority, &result__);
+ impl::WriteJsonField("default_hmi", default_hmi, &result__);
+ impl::WriteJsonField("keep_context", keep_context, &result__);
+ impl::WriteJsonField("steal_focus", steal_focus, &result__);
+ return result__;
+}
+bool PolicyBase::is_valid() const {
+ if (!groups.is_valid()) {
+ return false;
}
- bool PolicyBase::is_initialized() const {
- return (initialization_state__ != kUninitialized) || (!struct_empty());
+ if (!preconsented_groups.is_valid()) {
+ return false;
}
- bool PolicyBase::struct_empty() const {
- if (groups.is_initialized()) {
- return false;
- }
- if (preconsented_groups.is_initialized()) {
- return false;
- }
- if (priority.is_initialized()) {
- return false;
- }
- if (default_hmi.is_initialized()) {
- return false;
- }
- if (keep_context.is_initialized()) {
- return false;
- }
- if (steal_focus.is_initialized()) {
- return false;
- }
- return true;
+ if (!priority.is_valid()) {
+ return false;
}
- void PolicyBase::ReportErrors(rpc::ValidationReport* report__) const {
- if (struct_empty()) {
- rpc::CompositeType::ReportErrors(report__);
- }
- if (!groups.is_valid()) {
- groups.ReportErrors(&report__->ReportSubobject("groups"));
- }
- if (!preconsented_groups.is_valid()) {
- preconsented_groups.ReportErrors(&report__->ReportSubobject("preconsented_groups"));
- }
- if (!priority.is_valid()) {
- priority.ReportErrors(&report__->ReportSubobject("priority"));
- }
- if (!default_hmi.is_valid()) {
- default_hmi.ReportErrors(&report__->ReportSubobject("default_hmi"));
- }
- if (!keep_context.is_valid()) {
- keep_context.ReportErrors(&report__->ReportSubobject("keep_context"));
- }
- if (!steal_focus.is_valid()) {
- steal_focus.ReportErrors(&report__->ReportSubobject("steal_focus"));
- }
+ if (!default_hmi.is_valid()) {
+ return false;
}
-
- void PolicyBase::SetPolicyTableType(PolicyTableType pt_type) {
- CompositeType::SetPolicyTableType(pt_type);
- groups.SetPolicyTableType(pt_type);
- priority.SetPolicyTableType(pt_type);
+ if (!keep_context.is_valid()) {
+ return false;
}
-
- // DevicePolicy methods
- DevicePolicy::DevicePolicy()
- : PolicyBase() {
+ if (!steal_focus.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+bool PolicyBase::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+bool PolicyBase::struct_empty() const {
+ if (groups.is_initialized()) {
+ return false;
}
- DevicePolicy::DevicePolicy(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
- : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {
+ if (preconsented_groups.is_initialized()) {
+ return false;
}
- DevicePolicy::~DevicePolicy() {
+ if (priority.is_initialized()) {
+ return false;
}
- DevicePolicy::DevicePolicy(const Json::Value* value__)
- : PolicyBase(value__) {
+ if (default_hmi.is_initialized()) {
+ return false;
}
-
- // AppPoliciesSection methods
- ApplicationPoliciesSection::ApplicationPoliciesSection()
- : CompositeType(kUninitialized) {
+ if (keep_context.is_initialized()) {
+ return false;
}
- ApplicationPoliciesSection::ApplicationPoliciesSection(const ApplicationPolicies& apps, const DevicePolicy& device)
- : CompositeType(kUninitialized),
- apps(apps),
- device(device) {
+ if (steal_focus.is_initialized()) {
+ return false;
}
- ApplicationPoliciesSection::~ApplicationPoliciesSection() {
+ return true;
+}
+void PolicyBase::ReportErrors(rpc::ValidationReport *report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
}
- ApplicationPoliciesSection::ApplicationPoliciesSection(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- apps(value__),
- device(impl::ValueMember(value__, "device")) {
- // Since "device" is moved to separate struct, we have to delete it from
- // parsed apps to avoid validation issues due to possible wrong params in
- // device section
- apps.erase("device");
- }
- Json::Value ApplicationPoliciesSection::ToJsonValue() const {
- Json::Value result__(Json::objectValue);
- result__ = apps.ToJsonValue();
- impl::WriteJsonField("device", device, &result__);
- return result__;
- }
- bool ApplicationPoliciesSection::is_valid() const {
- if (!device.is_valid()) {
- return false;
- }
- if (!apps.is_valid()) {
- return false;
- }
- return Validate();
+ if (!groups.is_valid()) {
+ groups.ReportErrors(&report__->ReportSubobject("groups"));
}
- bool ApplicationPoliciesSection::is_initialized() const {
- return (initialization_state__ != kUninitialized) || (!struct_empty());
+ if (!preconsented_groups.is_valid()) {
+ preconsented_groups.ReportErrors(
+ &report__->ReportSubobject("preconsented_groups"));
}
- bool ApplicationPoliciesSection::struct_empty() const {
- if (device.is_initialized()) {
- return false;
- }
- if (apps.is_initialized()) {
- return false;
- }
- return true;
+ if (!priority.is_valid()) {
+ priority.ReportErrors(&report__->ReportSubobject("priority"));
}
- void ApplicationPoliciesSection::ReportErrors(rpc::ValidationReport* report__) const {
- if (struct_empty()) {
- rpc::CompositeType::ReportErrors(report__);
- }
- if (!device.is_valid()) {
- device.ReportErrors(&report__->ReportSubobject("device"));
- }
- if (!apps.is_valid()) {
- apps.ReportErrors(&report__->ReportSubobject("apps"));
- }
+ if (!default_hmi.is_valid()) {
+ default_hmi.ReportErrors(&report__->ReportSubobject("default_hmi"));
}
-
- void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
- CompositeType::SetPolicyTableType(pt_type);
- device.SetPolicyTableType(pt_type);
- apps.SetPolicyTableType(pt_type);
+ if (!keep_context.is_valid()) {
+ keep_context.ReportErrors(&report__->ReportSubobject("keep_context"));
}
+ if (!steal_focus.is_valid()) {
+ steal_focus.ReportErrors(&report__->ReportSubobject("steal_focus"));
+ }
+}
-// ApplicationParams methods
-ApplicationParams::ApplicationParams()
- : PolicyBase() {
+void PolicyBase::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ groups.SetPolicyTableType(pt_type);
+ priority.SetPolicyTableType(pt_type);
+}
+
+// DevicePolicy methods
+DevicePolicy::DevicePolicy() : PolicyBase() {}
+DevicePolicy::DevicePolicy(const Strings &groups, Priority priority,
+ HmiLevel default_hmi, bool keep_context,
+ bool steal_focus)
+ : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {}
+DevicePolicy::~DevicePolicy() {}
+DevicePolicy::DevicePolicy(const Json::Value *value__) : PolicyBase(value__) {}
+
+// AppPoliciesSection methods
+ApplicationPoliciesSection::ApplicationPoliciesSection()
+ : CompositeType(kUninitialized) {}
+ApplicationPoliciesSection::ApplicationPoliciesSection(
+ const ApplicationPolicies &apps, const DevicePolicy &device)
+ : CompositeType(kUninitialized), apps(apps), device(device) {}
+ApplicationPoliciesSection::~ApplicationPoliciesSection() {}
+ApplicationPoliciesSection::ApplicationPoliciesSection(
+ const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)), apps(value__),
+ device(impl::ValueMember(value__, "device")) {
+ // Since "device" is moved to separate struct, we have to delete it from
+ // parsed apps to avoid validation issues due to possible wrong params in
+ // device section
+ apps.erase("device");
}
-ApplicationParams::ApplicationParams(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
- : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {
+Json::Value ApplicationPoliciesSection::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ result__ = apps.ToJsonValue();
+ impl::WriteJsonField("device", device, &result__);
+ return result__;
}
-ApplicationParams::~ApplicationParams() {
+bool ApplicationPoliciesSection::is_valid() const {
+ if (!device.is_valid()) {
+ return false;
+ }
+ if (!apps.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+bool ApplicationPoliciesSection::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+bool ApplicationPoliciesSection::struct_empty() const {
+ if (device.is_initialized()) {
+ return false;
+ }
+ if (apps.is_initialized()) {
+ return false;
+ }
+ return true;
}
-ApplicationParams::ApplicationParams(const Json::Value* value__)
- : PolicyBase(value__),
- nicknames(impl::ValueMember(value__, "nicknames")),
- AppHMIType(impl::ValueMember(value__, "AppHMIType")),
- RequestType(impl::ValueMember(value__, "RequestType")),
- memory_kb(impl::ValueMember(value__, "memory_kb"), 0),
- heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")),
- certificate(impl::ValueMember(value__, "certificate"), "not_specified") {
+void ApplicationPoliciesSection::ReportErrors(
+ rpc::ValidationReport *report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!device.is_valid()) {
+ device.ReportErrors(&report__->ReportSubobject("device"));
+ }
+ if (!apps.is_valid()) {
+ apps.ReportErrors(&report__->ReportSubobject("apps"));
+ }
}
+
+void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ device.SetPolicyTableType(pt_type);
+ apps.SetPolicyTableType(pt_type);
+}
+
+// ApplicationParams methods
+ApplicationParams::ApplicationParams() : PolicyBase() {}
+ApplicationParams::ApplicationParams(const Strings &groups, Priority priority,
+ HmiLevel default_hmi, bool keep_context,
+ bool steal_focus)
+ : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {}
+ApplicationParams::~ApplicationParams() {}
+ApplicationParams::ApplicationParams(const Json::Value *value__)
+ : PolicyBase(value__), nicknames(impl::ValueMember(value__, "nicknames")),
+ AppHMIType(impl::ValueMember(value__, "AppHMIType")),
+ RequestType(impl::ValueMember(value__, "RequestType")),
+ memory_kb(impl::ValueMember(value__, "memory_kb"), 0),
+ heart_beat_timeout_ms(
+ impl::ValueMember(value__, "heart_beat_timeout_ms")),
+ certificate(impl::ValueMember(value__, "certificate"), "not_specified") {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
impl::WriteJsonField("nicknames", nicknames, &result__);
impl::WriteJsonField("AppHMIType", AppHMIType, &result__);
impl::WriteJsonField("RequestType", RequestType, &result__);
impl::WriteJsonField("memory_kb", memory_kb, &result__);
- impl::WriteJsonField("heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
+ impl::WriteJsonField("heart_beat_timeout_ms", heart_beat_timeout_ms,
+ &result__);
impl::WriteJsonField("certificate", certificate, &result__);
return result__;
}
@@ -286,7 +270,7 @@ bool ApplicationParams::struct_empty() const {
}
return true;
}
-void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
+void ApplicationParams::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
@@ -297,7 +281,8 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
nicknames.ReportErrors(&report__->ReportSubobject("nicknames"));
}
if (!preconsented_groups.is_valid()) {
- preconsented_groups.ReportErrors(&report__->ReportSubobject("preconsented_groups"));
+ preconsented_groups.ReportErrors(
+ &report__->ReportSubobject("preconsented_groups"));
}
if (!AppHMIType.is_valid()) {
AppHMIType.ReportErrors(&report__->ReportSubobject("AppHMIType"));
@@ -321,7 +306,8 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
memory_kb.ReportErrors(&report__->ReportSubobject("memory_kb"));
}
if (!heart_beat_timeout_ms.is_valid()) {
- heart_beat_timeout_ms.ReportErrors(&report__->ReportSubobject("heart_beat_timeout_ms"));
+ heart_beat_timeout_ms.ReportErrors(
+ &report__->ReportSubobject("heart_beat_timeout_ms"));
}
if (!certificate.is_valid()) {
certificate.ReportErrors(&report__->ReportSubobject("certificate"));
@@ -337,20 +323,14 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
certificate.SetPolicyTableType(pt_type);
}
// RpcParameters methods
-RpcParameters::RpcParameters()
- : CompositeType(kUninitialized) {
-}
-RpcParameters::RpcParameters(const HmiLevels& hmi_levels)
- : CompositeType(kUninitialized),
- hmi_levels(hmi_levels) {
-}
-RpcParameters::~RpcParameters() {
-}
-RpcParameters::RpcParameters(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- hmi_levels(impl::ValueMember(value__, "hmi_levels")),
- parameters(impl::ValueMember(value__, "parameters")) {
-}
+RpcParameters::RpcParameters() : CompositeType(kUninitialized) {}
+RpcParameters::RpcParameters(const HmiLevels &hmi_levels)
+ : CompositeType(kUninitialized), hmi_levels(hmi_levels) {}
+RpcParameters::~RpcParameters() {}
+RpcParameters::RpcParameters(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ hmi_levels(impl::ValueMember(value__, "hmi_levels")),
+ parameters(impl::ValueMember(value__, "parameters")) {}
Json::Value RpcParameters::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("hmi_levels", hmi_levels, &result__);
@@ -379,7 +359,7 @@ bool RpcParameters::struct_empty() const {
return true;
}
-void RpcParameters::ReportErrors(rpc::ValidationReport* report__) const {
+void RpcParameters::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
@@ -398,20 +378,13 @@ void RpcParameters::SetPolicyTableType(PolicyTableType pt_type) {
}
// Rpcs methods
-Rpcs::Rpcs()
- : CompositeType(kUninitialized) {
-}
-Rpcs::Rpcs(const Rpc& rpcs)
- : CompositeType(kUninitialized),
- rpcs(rpcs) {
-}
-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::Rpcs() : CompositeType(kUninitialized) {}
+Rpcs::Rpcs(const Rpc &rpcs) : CompositeType(kUninitialized), rpcs(rpcs) {}
+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")) {}
Json::Value Rpcs::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("user_consent_prompt", user_consent_prompt, &result__);
@@ -440,12 +413,13 @@ bool Rpcs::struct_empty() const {
return true;
}
-void Rpcs::ReportErrors(rpc::ValidationReport* report__) const {
+void Rpcs::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
if (!user_consent_prompt.is_valid()) {
- user_consent_prompt.ReportErrors(&report__->ReportSubobject("user_consent_prompt"));
+ user_consent_prompt.ReportErrors(
+ &report__->ReportSubobject("user_consent_prompt"));
}
if (!rpcs.is_valid()) {
rpcs.ReportErrors(&report__->ReportSubobject("rpcs"));
@@ -459,72 +433,86 @@ void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
}
// ModuleConfig methods
-ModuleConfig::ModuleConfig()
- : CompositeType(kUninitialized) {
-}
-ModuleConfig::ModuleConfig(uint8_t exchange_after_x_ignition_cycles, int64_t exchange_after_x_kilometers, uint8_t exchange_after_x_days, uint16_t timeout_after_x_seconds, const SecondsBetweenRetries& seconds_between_retries, const ServiceEndpoints& endpoints, const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority)
- : CompositeType(kUninitialized),
- exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles),
- exchange_after_x_kilometers(exchange_after_x_kilometers),
- exchange_after_x_days(exchange_after_x_days),
- timeout_after_x_seconds(timeout_after_x_seconds),
- seconds_between_retries(seconds_between_retries),
- endpoints(endpoints),
- notifications_per_minute_by_priority(notifications_per_minute_by_priority) {
-}
-ModuleConfig::~ModuleConfig() {
-}
-ModuleConfig::ModuleConfig(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- device_certificates(impl::ValueMember(value__, "device_certificates")),
- preloaded_pt(impl::ValueMember(value__, "preloaded_pt")),
- exchange_after_x_ignition_cycles(impl::ValueMember(value__, "exchange_after_x_ignition_cycles")),
- exchange_after_x_kilometers(impl::ValueMember(value__, "exchange_after_x_kilometers")),
- exchange_after_x_days(impl::ValueMember(value__, "exchange_after_x_days")),
- timeout_after_x_seconds(impl::ValueMember(value__, "timeout_after_x_seconds")),
- seconds_between_retries(impl::ValueMember(value__, "seconds_between_retries")),
- endpoints(impl::ValueMember(value__, "endpoints")),
- notifications_per_minute_by_priority(impl::ValueMember(value__, "notifications_per_minute_by_priority")),
- vehicle_make(impl::ValueMember(value__, "vehicle_make")),
- vehicle_model(impl::ValueMember(value__, "vehicle_model")),
- vehicle_year(impl::ValueMember(value__, "vehicle_year")) {
-}
+ModuleConfig::ModuleConfig() : CompositeType(kUninitialized) {}
+ModuleConfig::ModuleConfig(
+ uint8_t exchange_after_x_ignition_cycles,
+ int64_t exchange_after_x_kilometers, uint8_t exchange_after_x_days,
+ uint16_t timeout_after_x_seconds,
+ const SecondsBetweenRetries &seconds_between_retries,
+ const ServiceEndpoints &endpoints,
+ const NumberOfNotificationsPerMinute &notifications_per_minute_by_priority)
+ : CompositeType(kUninitialized),
+ exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles),
+ exchange_after_x_kilometers(exchange_after_x_kilometers),
+ exchange_after_x_days(exchange_after_x_days),
+ timeout_after_x_seconds(timeout_after_x_seconds),
+ seconds_between_retries(seconds_between_retries), endpoints(endpoints),
+ notifications_per_minute_by_priority(
+ notifications_per_minute_by_priority) {}
+ModuleConfig::~ModuleConfig() {}
+ModuleConfig::ModuleConfig(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ preloaded_pt(impl::ValueMember(value__, "preloaded_pt")),
+ exchange_after_x_ignition_cycles(
+ impl::ValueMember(value__, "exchange_after_x_ignition_cycles")),
+ exchange_after_x_kilometers(
+ impl::ValueMember(value__, "exchange_after_x_kilometers")),
+ exchange_after_x_days(
+ impl::ValueMember(value__, "exchange_after_x_days")),
+ timeout_after_x_seconds(
+ impl::ValueMember(value__, "timeout_after_x_seconds")),
+ seconds_between_retries(
+ impl::ValueMember(value__, "seconds_between_retries")),
+ endpoints(impl::ValueMember(value__, "endpoints")),
+ notifications_per_minute_by_priority(
+ impl::ValueMember(value__, "notifications_per_minute_by_priority")),
+ vehicle_make(impl::ValueMember(value__, "vehicle_make")),
+ vehicle_model(impl::ValueMember(value__, "vehicle_model")),
+ vehicle_year(impl::ValueMember(value__, "vehicle_year")),
+ certificate(impl::ValueMember(value__, "certificate")) {}
-void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
-// device_certificates = from.device_certificates; // According to the requirements this is optional.
+void ModuleConfig::SafeCopyFrom(const ModuleConfig &from) {
+ // device_certificates = from.device_certificates; // According to the
+ // requirements this is optional.
exchange_after_x_ignition_cycles = from.exchange_after_x_ignition_cycles;
exchange_after_x_kilometers = from.exchange_after_x_kilometers;
exchange_after_x_days = from.exchange_after_x_days;
timeout_after_x_seconds = from.timeout_after_x_seconds;
seconds_between_retries = from.seconds_between_retries;
endpoints = from.endpoints;
- notifications_per_minute_by_priority = from.notifications_per_minute_by_priority;
+ notifications_per_minute_by_priority =
+ from.notifications_per_minute_by_priority;
vehicle_make.assign_if_valid(from.vehicle_make);
vehicle_model.assign_if_valid(from.vehicle_model);
vehicle_year.assign_if_valid(from.vehicle_year);
- certificate .assign_if_valid(from.certificate);
-
+ certificate.assign_if_valid(from.certificate);
}
Json::Value ModuleConfig::ToJsonValue() const {
Json::Value result__(Json::objectValue);
- impl::WriteJsonField("device_certificates", device_certificates, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__);
- impl::WriteJsonField("exchange_after_x_ignition_cycles", exchange_after_x_ignition_cycles, &result__);
- impl::WriteJsonField("exchange_after_x_kilometers", exchange_after_x_kilometers, &result__);
- impl::WriteJsonField("exchange_after_x_days", exchange_after_x_days, &result__);
- impl::WriteJsonField("timeout_after_x_seconds", timeout_after_x_seconds, &result__);
- impl::WriteJsonField("seconds_between_retries", seconds_between_retries, &result__);
+ impl::WriteJsonField("exchange_after_x_ignition_cycles",
+ exchange_after_x_ignition_cycles, &result__);
+ impl::WriteJsonField("exchange_after_x_kilometers",
+ exchange_after_x_kilometers, &result__);
+ impl::WriteJsonField("exchange_after_x_days", exchange_after_x_days,
+ &result__);
+ impl::WriteJsonField("timeout_after_x_seconds", timeout_after_x_seconds,
+ &result__);
+ impl::WriteJsonField("seconds_between_retries", seconds_between_retries,
+ &result__);
impl::WriteJsonField("endpoints", endpoints, &result__);
- impl::WriteJsonField("notifications_per_minute_by_priority", notifications_per_minute_by_priority, &result__);
+ impl::WriteJsonField("notifications_per_minute_by_priority",
+ notifications_per_minute_by_priority, &result__);
impl::WriteJsonField("vehicle_make", vehicle_make, &result__);
impl::WriteJsonField("vehicle_model", vehicle_model, &result__);
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
return result__;
}
bool ModuleConfig::is_valid() const {
- if (!device_certificates.is_valid()) {
+ if (!certificate.is_valid()) {
return false;
}
if (!preloaded_pt.is_valid()) {
@@ -566,7 +554,7 @@ bool ModuleConfig::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
bool ModuleConfig::struct_empty() const {
- if (device_certificates.is_initialized()) {
+ if (certificate.is_initialized()) {
return false;
}
if (preloaded_pt.is_initialized()) {
@@ -610,36 +598,42 @@ bool ModuleConfig::struct_empty() const {
return true;
}
-void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
+void ModuleConfig::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
- if (!device_certificates.is_valid()) {
- device_certificates.ReportErrors(&report__->ReportSubobject("device_certificates"));
+ if (!certificate.is_valid()) {
+ certificate.ReportErrors(&report__->ReportSubobject("certificate"));
}
if (!preloaded_pt.is_valid()) {
preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt"));
}
if (!exchange_after_x_ignition_cycles.is_valid()) {
- exchange_after_x_ignition_cycles.ReportErrors(&report__->ReportSubobject("exchange_after_x_ignition_cycles"));
+ exchange_after_x_ignition_cycles.ReportErrors(
+ &report__->ReportSubobject("exchange_after_x_ignition_cycles"));
}
if (!exchange_after_x_kilometers.is_valid()) {
- exchange_after_x_kilometers.ReportErrors(&report__->ReportSubobject("exchange_after_x_kilometers"));
+ exchange_after_x_kilometers.ReportErrors(
+ &report__->ReportSubobject("exchange_after_x_kilometers"));
}
if (!exchange_after_x_days.is_valid()) {
- exchange_after_x_days.ReportErrors(&report__->ReportSubobject("exchange_after_x_days"));
+ exchange_after_x_days.ReportErrors(
+ &report__->ReportSubobject("exchange_after_x_days"));
}
if (!timeout_after_x_seconds.is_valid()) {
- timeout_after_x_seconds.ReportErrors(&report__->ReportSubobject("timeout_after_x_seconds"));
+ timeout_after_x_seconds.ReportErrors(
+ &report__->ReportSubobject("timeout_after_x_seconds"));
}
if (!seconds_between_retries.is_valid()) {
- seconds_between_retries.ReportErrors(&report__->ReportSubobject("seconds_between_retries"));
+ seconds_between_retries.ReportErrors(
+ &report__->ReportSubobject("seconds_between_retries"));
}
if (!endpoints.is_valid()) {
endpoints.ReportErrors(&report__->ReportSubobject("endpoints"));
}
if (!notifications_per_minute_by_priority.is_valid()) {
- notifications_per_minute_by_priority.ReportErrors(&report__->ReportSubobject("notifications_per_minute_by_priority"));
+ notifications_per_minute_by_priority.ReportErrors(
+ &report__->ReportSubobject("notifications_per_minute_by_priority"));
}
if (!vehicle_make.is_valid()) {
vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make"));
@@ -651,9 +645,9 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
vehicle_year.ReportErrors(&report__->ReportSubobject("vehicle_year"));
}
if (PT_PRELOADED == GetPolicyTableType()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
- rpc::ValidationReport* ommited_field_report;
+ std::string validation_info =
+ ommited_validation_info + PolicyTableTypeToString(GetPolicyTableType());
+ rpc::ValidationReport *ommited_field_report;
if (vehicle_make.is_initialized()) {
ommited_field_report = &report__->ReportSubobject("vehicle_make");
ommited_field_report->set_validation_info(validation_info);
@@ -671,7 +665,7 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
CompositeType::SetPolicyTableType(pt_type);
- device_certificates.SetPolicyTableType(pt_type);
+ certificate.SetPolicyTableType(pt_type);
preloaded_pt.SetPolicyTableType(pt_type);
exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type);
exchange_after_x_kilometers.SetPolicyTableType(pt_type);
@@ -686,19 +680,15 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
}
// MessageString methods
-MessageString::MessageString()
- : CompositeType(kUninitialized) {
-}
-MessageString::~MessageString() {
-}
-MessageString::MessageString(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- line1(impl::ValueMember(value__, "line1")),
- line2(impl::ValueMember(value__, "line2")),
- tts(impl::ValueMember(value__, "tts")),
- label(impl::ValueMember(value__, "label")),
- textBody(impl::ValueMember(value__, "textBody")) {
-}
+MessageString::MessageString() : CompositeType(kUninitialized) {}
+MessageString::~MessageString() {}
+MessageString::MessageString(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ line1(impl::ValueMember(value__, "line1")),
+ line2(impl::ValueMember(value__, "line2")),
+ tts(impl::ValueMember(value__, "tts")),
+ label(impl::ValueMember(value__, "label")),
+ textBody(impl::ValueMember(value__, "textBody")) {}
Json::Value MessageString::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("line1", line1, &result__);
@@ -752,7 +742,7 @@ bool MessageString::struct_empty() const {
}
return true;
}
-void MessageString::ReportErrors(rpc::ValidationReport* report__) const {
+void MessageString::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
@@ -783,19 +773,13 @@ void MessageString::SetPolicyTableType(PolicyTableType pt_type) {
}
// MessageLanguages methods
-MessageLanguages::MessageLanguages()
- : CompositeType(kUninitialized) {
-}
-MessageLanguages::MessageLanguages(const Languages& languages)
- : CompositeType(kUninitialized),
- languages(languages) {
-}
-MessageLanguages::~MessageLanguages() {
-}
-MessageLanguages::MessageLanguages(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- languages(impl::ValueMember(value__, "languages")) {
-}
+MessageLanguages::MessageLanguages() : CompositeType(kUninitialized) {}
+MessageLanguages::MessageLanguages(const Languages &languages)
+ : CompositeType(kUninitialized), languages(languages) {}
+MessageLanguages::~MessageLanguages() {}
+MessageLanguages::MessageLanguages(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ languages(impl::ValueMember(value__, "languages")) {}
Json::Value MessageLanguages::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("languages", languages, &result__);
@@ -817,15 +801,17 @@ bool MessageLanguages::struct_empty() const {
return true;
}
-void MessageLanguages::ReportErrors(rpc::ValidationReport* report__) const {
+void MessageLanguages::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
if (PT_SNAPSHOT == GetPolicyTableType()) {
if (languages.is_initialized()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
- report__->ReportSubobject("languages").set_validation_info(validation_info);
+ std::string validation_info =
+ ommited_validation_info +
+ PolicyTableTypeToString(GetPolicyTableType());
+ report__->ReportSubobject("languages")
+ .set_validation_info(validation_info);
}
}
if (!languages.is_valid()) {
@@ -840,19 +826,14 @@ void MessageLanguages::SetPolicyTableType(PolicyTableType pt_type) {
// ConsumerFriendlyMessages methods
ConsumerFriendlyMessages::ConsumerFriendlyMessages()
- : CompositeType(kUninitialized) {
-}
-ConsumerFriendlyMessages::ConsumerFriendlyMessages(const std::string& version)
- : CompositeType(kUninitialized),
- version(version) {
-}
-ConsumerFriendlyMessages::~ConsumerFriendlyMessages() {
-}
-ConsumerFriendlyMessages::ConsumerFriendlyMessages(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- version(impl::ValueMember(value__, "version")),
- messages(impl::ValueMember(value__, "messages")) {
-}
+ : CompositeType(kUninitialized) {}
+ConsumerFriendlyMessages::ConsumerFriendlyMessages(const std::string &version)
+ : CompositeType(kUninitialized), version(version) {}
+ConsumerFriendlyMessages::~ConsumerFriendlyMessages() {}
+ConsumerFriendlyMessages::ConsumerFriendlyMessages(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ version(impl::ValueMember(value__, "version")),
+ messages(impl::ValueMember(value__, "messages")) {}
Json::Value ConsumerFriendlyMessages::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("version", version, &result__);
@@ -881,7 +862,8 @@ bool ConsumerFriendlyMessages::struct_empty() const {
return true;
}
-void ConsumerFriendlyMessages::ReportErrors(rpc::ValidationReport* report__) const {
+void ConsumerFriendlyMessages::ReportErrors(
+ rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
@@ -890,9 +872,11 @@ void ConsumerFriendlyMessages::ReportErrors(rpc::ValidationReport* report__) con
}
if (PT_SNAPSHOT == GetPolicyTableType()) {
if (messages.is_initialized()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
- report__->ReportSubobject("messages").set_validation_info(validation_info);
+ std::string validation_info =
+ ommited_validation_info +
+ PolicyTableTypeToString(GetPolicyTableType());
+ report__->ReportSubobject("messages")
+ .set_validation_info(validation_info);
}
}
if (!messages.is_valid()) {
@@ -907,14 +891,10 @@ void ConsumerFriendlyMessages::SetPolicyTableType(PolicyTableType pt_type) {
}
// ModuleMeta methods
-ModuleMeta::ModuleMeta()
- : CompositeType(kUninitialized) {
-}
-ModuleMeta::~ModuleMeta() {
-}
-ModuleMeta::ModuleMeta(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)) {
-}
+ModuleMeta::ModuleMeta() : CompositeType(kUninitialized) {}
+ModuleMeta::~ModuleMeta() {}
+ModuleMeta::ModuleMeta(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)) {}
Json::Value ModuleMeta::ToJsonValue() const {
Json::Value result__(Json::objectValue);
return result__;
@@ -928,24 +908,18 @@ bool ModuleMeta::is_valid() const {
bool ModuleMeta::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
-bool ModuleMeta::struct_empty() const {
- return true;
-}
-void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const {
+bool ModuleMeta::struct_empty() const { return true; }
+void ModuleMeta::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
}
// AppLevel methods
-AppLevel::AppLevel()
- : CompositeType(kUninitialized) {
-}
-AppLevel::~AppLevel() {
-}
-AppLevel::AppLevel(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)) {
-}
+AppLevel::AppLevel() : CompositeType(kUninitialized) {}
+AppLevel::~AppLevel() {}
+AppLevel::AppLevel(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)) {}
Json::Value AppLevel::ToJsonValue() const {
Json::Value result__(Json::objectValue);
return result__;
@@ -959,32 +933,26 @@ bool AppLevel::is_valid() const {
bool AppLevel::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
-bool AppLevel::struct_empty() const {
- return true;
-}
-void AppLevel::ReportErrors(rpc::ValidationReport* report__) const {
+bool AppLevel::struct_empty() const { return true; }
+void AppLevel::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
if (PT_PRELOADED == GetPolicyTableType() ||
PT_UPDATE == GetPolicyTableType()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
+ std::string validation_info =
+ ommited_validation_info + PolicyTableTypeToString(GetPolicyTableType());
report__->set_validation_info(validation_info);
}
}
// UsageAndErrorCounts methods
-UsageAndErrorCounts::UsageAndErrorCounts()
- : CompositeType(kUninitialized) {
-}
+UsageAndErrorCounts::UsageAndErrorCounts() : CompositeType(kUninitialized) {}
-UsageAndErrorCounts::~UsageAndErrorCounts() {
-}
-UsageAndErrorCounts::UsageAndErrorCounts(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- app_level(impl::ValueMember(value__, "app_level")) {
-}
+UsageAndErrorCounts::~UsageAndErrorCounts() {}
+UsageAndErrorCounts::UsageAndErrorCounts(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ app_level(impl::ValueMember(value__, "app_level")) {}
Json::Value UsageAndErrorCounts::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("app_level", app_level, &result__);
@@ -1008,14 +976,14 @@ bool UsageAndErrorCounts::struct_empty() const {
}
return true;
}
-void UsageAndErrorCounts::ReportErrors(rpc::ValidationReport* report__) const {
+void UsageAndErrorCounts::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
if (PT_PRELOADED == GetPolicyTableType() ||
PT_UPDATE == GetPolicyTableType()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
+ std::string validation_info =
+ ommited_validation_info + PolicyTableTypeToString(GetPolicyTableType());
report__->set_validation_info(validation_info);
}
if (!app_level.is_valid()) {
@@ -1029,14 +997,10 @@ void UsageAndErrorCounts::SetPolicyTableType(PolicyTableType pt_type) {
}
// DeviceParams methods
-DeviceParams::DeviceParams()
- : CompositeType(kUninitialized) {
-}
-DeviceParams::~DeviceParams() {
-}
-DeviceParams::DeviceParams(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)) {
-}
+DeviceParams::DeviceParams() : CompositeType(kUninitialized) {}
+DeviceParams::~DeviceParams() {}
+DeviceParams::DeviceParams(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)) {}
Json::Value DeviceParams::ToJsonValue() const {
Json::Value result__(Json::objectValue);
return result__;
@@ -1050,46 +1014,46 @@ bool DeviceParams::is_valid() const {
bool DeviceParams::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
-bool DeviceParams::struct_empty() const {
- return true;
-}
-void DeviceParams::ReportErrors(rpc::ValidationReport* report__) const {
+bool DeviceParams::struct_empty() const { return true; }
+void DeviceParams::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
}
// PolicyTable methods
-PolicyTable::PolicyTable()
- : CompositeType(kUninitialized) {
-}
-PolicyTable::PolicyTable(const ApplicationPoliciesSection& app_policies_section, const FunctionalGroupings& functional_groupings, const ConsumerFriendlyMessages& consumer_friendly_messages, const ModuleConfig& module_config)
- : CompositeType(kUninitialized),
- app_policies_section(app_policies_section),
- functional_groupings(functional_groupings),
- consumer_friendly_messages(consumer_friendly_messages),
- module_config(module_config) {
-}
-PolicyTable::~PolicyTable() {
-}
-PolicyTable::PolicyTable(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- app_policies_section(impl::ValueMember(value__, "app_policies")),
- functional_groupings(impl::ValueMember(value__, "functional_groupings")),
- consumer_friendly_messages(impl::ValueMember(value__, "consumer_friendly_messages")),
- module_config(impl::ValueMember(value__, "module_config")),
- 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")) {
-}
+PolicyTable::PolicyTable() : CompositeType(kUninitialized) {}
+PolicyTable::PolicyTable(
+ const ApplicationPoliciesSection &app_policies_section,
+ const FunctionalGroupings &functional_groupings,
+ const ConsumerFriendlyMessages &consumer_friendly_messages,
+ const ModuleConfig &module_config)
+ : CompositeType(kUninitialized), app_policies_section(app_policies_section),
+ functional_groupings(functional_groupings),
+ consumer_friendly_messages(consumer_friendly_messages),
+ module_config(module_config) {}
+PolicyTable::~PolicyTable() {}
+PolicyTable::PolicyTable(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ app_policies_section(impl::ValueMember(value__, "app_policies")),
+ functional_groupings(impl::ValueMember(value__, "functional_groupings")),
+ consumer_friendly_messages(
+ impl::ValueMember(value__, "consumer_friendly_messages")),
+ module_config(impl::ValueMember(value__, "module_config")),
+ 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")) {}
Json::Value PolicyTable::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("app_policies", app_policies_section, &result__);
impl::WriteJsonField("functional_groupings", functional_groupings, &result__);
- impl::WriteJsonField("consumer_friendly_messages", consumer_friendly_messages, &result__);
+ impl::WriteJsonField("consumer_friendly_messages", consumer_friendly_messages,
+ &result__);
impl::WriteJsonField("module_config", module_config, &result__);
impl::WriteJsonField("module_meta", module_meta, &result__);
- impl::WriteJsonField("usage_and_error_counts", usage_and_error_counts, &result__);
+ impl::WriteJsonField("usage_and_error_counts", usage_and_error_counts,
+ &result__);
impl::WriteJsonField("device_data", device_data, &result__);
return result__;
}
@@ -1147,27 +1111,31 @@ bool PolicyTable::struct_empty() const {
}
return true;
}
-void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const {
+void PolicyTable::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
if (PT_PRELOADED == GetPolicyTableType() ||
PT_UPDATE == GetPolicyTableType()) {
- std::string validation_info = ommited_validation_info +
- PolicyTableTypeToString(GetPolicyTableType());
+ std::string validation_info =
+ ommited_validation_info + PolicyTableTypeToString(GetPolicyTableType());
if (device_data.is_initialized()) {
- report__->ReportSubobject("device_data").set_validation_info(validation_info);
+ report__->ReportSubobject("device_data")
+ .set_validation_info(validation_info);
}
}
if (!app_policies_section.is_valid()) {
- app_policies_section.ReportErrors(&report__->ReportSubobject("app_policies"));
+ app_policies_section.ReportErrors(
+ &report__->ReportSubobject("app_policies"));
}
if (!functional_groupings.is_valid()) {
- functional_groupings.ReportErrors(&report__->ReportSubobject("functional_groupings"));
+ functional_groupings.ReportErrors(
+ &report__->ReportSubobject("functional_groupings"));
}
if (!consumer_friendly_messages.is_valid()) {
- consumer_friendly_messages.ReportErrors(&report__->ReportSubobject("consumer_friendly_messages"));
+ consumer_friendly_messages.ReportErrors(
+ &report__->ReportSubobject("consumer_friendly_messages"));
}
if (!module_config.is_valid()) {
module_config.ReportErrors(&report__->ReportSubobject("module_config"));
@@ -1176,7 +1144,8 @@ void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const {
module_meta.ReportErrors(&report__->ReportSubobject("module_meta"));
}
if (!usage_and_error_counts.is_valid()) {
- usage_and_error_counts.ReportErrors(&report__->ReportSubobject("usage_and_error_counts"));
+ usage_and_error_counts.ReportErrors(
+ &report__->ReportSubobject("usage_and_error_counts"));
}
if (!device_data.is_valid()) {
device_data.ReportErrors(&report__->ReportSubobject("device_data"));
@@ -1195,19 +1164,13 @@ void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
}
// Table methods
-Table::Table()
- : CompositeType(kUninitialized) {
-}
-Table::Table(const PolicyTable& policy_table)
- : CompositeType(kUninitialized),
- policy_table(policy_table) {
-}
-Table::~Table() {
-}
-Table::Table(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)),
- policy_table(impl::ValueMember(value__, "policy_table")) {
-}
+Table::Table() : CompositeType(kUninitialized) {}
+Table::Table(const PolicyTable &policy_table)
+ : CompositeType(kUninitialized), policy_table(policy_table) {}
+Table::~Table() {}
+Table::Table(const Json::Value *value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ policy_table(impl::ValueMember(value__, "policy_table")) {}
Json::Value Table::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("policy_table", policy_table, &result__);
@@ -1228,7 +1191,7 @@ bool Table::struct_empty() const {
}
return true;
}
-void Table::ReportErrors(rpc::ValidationReport* report__) const {
+void Table::ReportErrors(rpc::ValidationReport *report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
@@ -1242,6 +1205,5 @@ void Table::SetPolicyTableType(PolicyTableType pt_type) {
policy_table.SetPolicyTableType(pt_type);
}
-} // namespace policy_table_interface_base
-} // namespace rpc
-
+} // namespace policy_table_interface_base
+} // namespace rpc
diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.h b/src/components/policy/src/policy/policy_table/table_struct/types.h
index a7b0e2d492..1a77590ef0 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/types.h
+++ b/src/components/policy/src/policy/policy_table/table_struct/types.h
@@ -5,7 +5,7 @@
#include "rpc_base/rpc_message.h"
namespace Json {
class Value;
-} // namespace Json
+} // namespace Json
namespace rpc {
namespace policy_table_interface_base {
struct AppLevel;
@@ -15,354 +15,390 @@ struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
-} // namespace policy_table_interface_base
-} // namespace rpc
-
+} // namespace policy_table_interface_base
+} // namespace rpc
namespace rpc {
namespace policy_table_interface_base {
-typedef Array< String<1, 255>, 0, 255 > Strings;
+typedef Array<String<1, 255>, 0, 255> Strings;
-typedef Array< Enum<AppHMIType>, 0, 255 > AppHMITypes;
+typedef Array<Enum<AppHMIType>, 0, 255> AppHMITypes;
-typedef Array< Enum<HmiLevel>, 0, 4 > HmiLevels;
+typedef Array<Enum<HmiLevel>, 0, 4> HmiLevels;
-typedef Array< Enum<Parameter>, 0, 24 > Parameters;
+typedef Array<Enum<Parameter>, 0, 24> Parameters;
-typedef Map< RpcParameters, 0, 50 > Rpc;
+typedef Map<RpcParameters, 0, 50> Rpc;
-typedef Array< String<10, 255>, 1, 255 > URL;
+typedef Array<String<10, 255>, 1, 255> URL;
-typedef Map< URL, 1, 255 > URLList;
+typedef Map<URL, 1, 255> URLList;
-typedef Map< URLList, 1, 255 > ServiceEndpoints;
+typedef Map<URLList, 1, 255> ServiceEndpoints;
-typedef Map< Integer<uint8_t, 0, 255>, 0, 6 > NumberOfNotificationsPerMinute;
+typedef Map<Integer<uint8_t, 0, 255>, 0, 6> NumberOfNotificationsPerMinute;
-typedef Array< Integer<uint16_t, 1, 1000>, 0, 10 > SecondsBetweenRetries;
+typedef Array<Integer<uint16_t, 1, 1000>, 0, 10> SecondsBetweenRetries;
-typedef Map< MessageString, 0, 500 > Languages;
+typedef Map<MessageString, 0, 500> Languages;
-typedef Map< MessageLanguages, 0, 255 > Messages;
+typedef Map<MessageLanguages, 0, 255> Messages;
-typedef Map< AppLevel, 0, 255 > AppLevels;
+typedef Map<AppLevel, 0, 255> AppLevels;
-typedef Map< Stringifyable < Nullable< ApplicationParams > >, 1, 1000 > ApplicationPolicies;
+typedef Map<Stringifyable<Nullable<ApplicationParams>>, 1, 1000>
+ ApplicationPolicies;
-typedef Map< Rpcs, 1, 255 > FunctionalGroupings;
+typedef Map<Rpcs, 1, 255> FunctionalGroupings;
-typedef Map< DeviceParams, 0, 255 > DeviceData;
+typedef Map<DeviceParams, 0, 255> DeviceData;
-typedef Array< Enum<RequestType>, 0, 255 > RequestTypes;
+typedef Array<Enum<RequestType>, 0, 255> RequestTypes;
struct PolicyBase : CompositeType {
- public:
- Strings groups;
- Optional< Strings > preconsented_groups;
- Enum<Priority> priority;
- Enum<HmiLevel> default_hmi;
- Boolean keep_context;
- Boolean steal_focus;
- public:
- PolicyBase();
- PolicyBase(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
- virtual ~PolicyBase();
- explicit PolicyBase(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Strings groups;
+ Optional<Strings> preconsented_groups;
+ Enum<Priority> priority;
+ Enum<HmiLevel> default_hmi;
+ Boolean keep_context;
+ Boolean steal_focus;
+
+public:
+ PolicyBase();
+ PolicyBase(const Strings &groups, Priority priority, HmiLevel default_hmi,
+ bool keep_context, bool steal_focus);
+ virtual ~PolicyBase();
+ explicit PolicyBase(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct DevicePolicy : PolicyBase {
- public:
- DevicePolicy();
- DevicePolicy(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
- ~DevicePolicy();
- explicit DevicePolicy(const Json::Value* value__);
+public:
+ DevicePolicy();
+ DevicePolicy(const Strings &groups, Priority priority, HmiLevel default_hmi,
+ bool keep_context, bool steal_focus);
+ ~DevicePolicy();
+ explicit DevicePolicy(const Json::Value *value__);
};
struct ApplicationParams : PolicyBase {
- public:
- Optional< Strings > nicknames;
- Optional< AppHMITypes > AppHMIType;
- Optional< RequestTypes > RequestType;
- Optional< Integer<uint16_t, 0, 65225> > memory_kb;
- Optional< Integer<uint16_t, 0, 65225> > heart_beat_timeout_ms;
- Optional< String<0, 255> > certificate;
- public:
- ApplicationParams();
- ApplicationParams(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
- ~ApplicationParams();
- explicit ApplicationParams(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Optional<Strings> nicknames;
+ Optional<AppHMITypes> AppHMIType;
+ Optional<RequestTypes> RequestType;
+ Optional<Integer<uint16_t, 0, 65225>> memory_kb;
+ Optional<Integer<uint16_t, 0, 65225>> heart_beat_timeout_ms;
+ Optional<String<0, 255>> certificate;
+
+public:
+ ApplicationParams();
+ ApplicationParams(const Strings &groups, Priority priority,
+ HmiLevel default_hmi, bool keep_context, bool steal_focus);
+ ~ApplicationParams();
+ explicit ApplicationParams(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct ApplicationPoliciesSection : CompositeType {
- public:
- mutable ApplicationPolicies apps;
- DevicePolicy device;
- public:
- ApplicationPoliciesSection();
- ApplicationPoliciesSection(const ApplicationPolicies& apps, const DevicePolicy& device);
- ~ApplicationPoliciesSection();
- explicit ApplicationPoliciesSection(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ mutable ApplicationPolicies apps;
+ DevicePolicy device;
+
+public:
+ ApplicationPoliciesSection();
+ ApplicationPoliciesSection(const ApplicationPolicies &apps,
+ const DevicePolicy &device);
+ ~ApplicationPoliciesSection();
+ explicit ApplicationPoliciesSection(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct RpcParameters : CompositeType {
- public:
- HmiLevels hmi_levels;
- Optional< Parameters > parameters;
- public:
- RpcParameters();
- explicit RpcParameters(const HmiLevels& hmi_levels);
- ~RpcParameters();
- explicit RpcParameters(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ HmiLevels hmi_levels;
+ Optional<Parameters> parameters;
+
+public:
+ RpcParameters();
+ explicit RpcParameters(const HmiLevels &hmi_levels);
+ ~RpcParameters();
+ explicit RpcParameters(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct Rpcs : CompositeType {
- public:
- Optional< String<1, 255> > user_consent_prompt;
- Nullable< Rpc > rpcs;
- public:
- Rpcs();
- explicit Rpcs(const Rpc& rpcs);
- ~Rpcs();
- explicit Rpcs(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Optional<String<1, 255>> user_consent_prompt;
+ Nullable<Rpc> rpcs;
+
+public:
+ Rpcs();
+ explicit Rpcs(const Rpc &rpcs);
+ ~Rpcs();
+ explicit Rpcs(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct ModuleConfig : CompositeType {
- public:
- Optional< Map< String<0, 100>, 0, 255 > > device_certificates;
- Optional< Boolean > preloaded_pt;
- Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles;
- Integer<int64_t, 0, 4294967296ll> exchange_after_x_kilometers;
- Integer<uint8_t, 0, 255> exchange_after_x_days;
- Integer<uint16_t, 0, 65535> timeout_after_x_seconds;
- SecondsBetweenRetries seconds_between_retries;
- ServiceEndpoints endpoints;
- NumberOfNotificationsPerMinute notifications_per_minute_by_priority;
- Optional< String<1, 100> > vehicle_make;
- Optional< String<1, 100> > vehicle_model;
- Optional< String<4, 4> > vehicle_year;
- Optional< String<0, 65535> > certificate;
- public:
- ModuleConfig();
- ModuleConfig(uint8_t exchange_after_x_ignition_cycles, int64_t exchange_after_x_kilometers, uint8_t exchange_after_x_days, uint16_t timeout_after_x_seconds, const SecondsBetweenRetries& seconds_between_retries, const ServiceEndpoints& endpoints, const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority);
- ~ModuleConfig();
- explicit ModuleConfig(const Json::Value* value__);
- void SafeCopyFrom(const ModuleConfig& from);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Optional<Boolean> preloaded_pt;
+ Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles;
+ Integer<int64_t, 0, 4294967296ll> exchange_after_x_kilometers;
+ Integer<uint8_t, 0, 255> exchange_after_x_days;
+ Integer<uint16_t, 0, 65535> timeout_after_x_seconds;
+ SecondsBetweenRetries seconds_between_retries;
+ ServiceEndpoints endpoints;
+ NumberOfNotificationsPerMinute notifications_per_minute_by_priority;
+ Optional<String<1, 100>> vehicle_make;
+ Optional<String<1, 100>> vehicle_model;
+ Optional<String<4, 4>> vehicle_year;
+ Optional<String<0, 65535>> certificate;
+
+public:
+ ModuleConfig();
+ ModuleConfig(uint8_t exchange_after_x_ignition_cycles,
+ int64_t exchange_after_x_kilometers,
+ uint8_t exchange_after_x_days, uint16_t timeout_after_x_seconds,
+ const SecondsBetweenRetries &seconds_between_retries,
+ const ServiceEndpoints &endpoints,
+ const NumberOfNotificationsPerMinute &
+ notifications_per_minute_by_priority);
+ ~ModuleConfig();
+ explicit ModuleConfig(const Json::Value *value__);
+ void SafeCopyFrom(const ModuleConfig &from);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct MessageString : CompositeType {
- public:
- Optional< String<1, 65535> > line1;
- Optional< String<1, 65535> > line2;
- Optional< String<1, 65535> > tts;
- Optional< String<1, 65535> > label;
- Optional< String<1, 65535> > textBody;
- public:
- MessageString();
- ~MessageString();
- explicit MessageString(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Optional<String<1, 65535>> line1;
+ Optional<String<1, 65535>> line2;
+ Optional<String<1, 65535>> tts;
+ Optional<String<1, 65535>> label;
+ Optional<String<1, 65535>> textBody;
+
+public:
+ MessageString();
+ ~MessageString();
+ explicit MessageString(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct MessageLanguages : CompositeType {
- public:
- Languages languages;
- public:
- MessageLanguages();
- explicit MessageLanguages(const Languages& languages);
- ~MessageLanguages();
- explicit MessageLanguages(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Languages languages;
+
+public:
+ MessageLanguages();
+ explicit MessageLanguages(const Languages &languages);
+ ~MessageLanguages();
+ explicit MessageLanguages(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct ConsumerFriendlyMessages : CompositeType {
- public:
- String<1, 100> version;
- Optional< Messages > messages;
- public:
- ConsumerFriendlyMessages();
- explicit ConsumerFriendlyMessages(const std::string& version);
- ~ConsumerFriendlyMessages();
- explicit ConsumerFriendlyMessages(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ String<1, 100> version;
+ Optional<Messages> messages;
+
+public:
+ ConsumerFriendlyMessages();
+ explicit ConsumerFriendlyMessages(const std::string &version);
+ ~ConsumerFriendlyMessages();
+ explicit ConsumerFriendlyMessages(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct ModuleMeta : CompositeType {
- public:
- public:
- ModuleMeta();
- ~ModuleMeta();
- explicit ModuleMeta(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- private:
- bool Validate() const;
+public:
+public:
+ ModuleMeta();
+ ~ModuleMeta();
+ explicit ModuleMeta(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+
+private:
+ bool Validate() const;
};
struct AppLevel : CompositeType {
- public:
- public:
- AppLevel();
- ~AppLevel();
- explicit AppLevel(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- private:
- bool Validate() const;
+public:
+public:
+ AppLevel();
+ ~AppLevel();
+ explicit AppLevel(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+
+private:
+ bool Validate() const;
};
struct UsageAndErrorCounts : CompositeType {
- public:
- Optional< AppLevels > app_level;
- public:
- UsageAndErrorCounts();
- ~UsageAndErrorCounts();
- explicit UsageAndErrorCounts(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ Optional<AppLevels> app_level;
+
+public:
+ UsageAndErrorCounts();
+ ~UsageAndErrorCounts();
+ explicit UsageAndErrorCounts(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct DeviceParams : CompositeType {
- public:
- public:
- DeviceParams();
- ~DeviceParams();
- explicit DeviceParams(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- private:
- bool Validate() const;
+public:
+public:
+ DeviceParams();
+ ~DeviceParams();
+ explicit DeviceParams(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+
+private:
+ bool Validate() const;
};
struct PolicyTable : CompositeType {
- public:
- ApplicationPoliciesSection app_policies_section;
- FunctionalGroupings functional_groupings;
- Optional < ConsumerFriendlyMessages > consumer_friendly_messages;
- ModuleConfig module_config;
- Optional< ModuleMeta > module_meta;
- Optional< UsageAndErrorCounts > usage_and_error_counts;
- Optional< DeviceData > device_data;
- public:
- PolicyTable();
- PolicyTable(const ApplicationPoliciesSection& app_policies_section,
- const FunctionalGroupings& functional_groupings,
- const ConsumerFriendlyMessages& consumer_friendly_messages,
- const ModuleConfig& module_config);
- ~PolicyTable();
- explicit PolicyTable(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ ApplicationPoliciesSection app_policies_section;
+ FunctionalGroupings functional_groupings;
+ Optional<ConsumerFriendlyMessages> consumer_friendly_messages;
+ ModuleConfig module_config;
+ Optional<ModuleMeta> module_meta;
+ Optional<UsageAndErrorCounts> usage_and_error_counts;
+ Optional<DeviceData> device_data;
+
+public:
+ PolicyTable();
+ PolicyTable(const ApplicationPoliciesSection &app_policies_section,
+ const FunctionalGroupings &functional_groupings,
+ const ConsumerFriendlyMessages &consumer_friendly_messages,
+ const ModuleConfig &module_config);
+ ~PolicyTable();
+ explicit PolicyTable(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
struct Table : CompositeType {
- public:
- PolicyTable policy_table;
- public:
- Table();
- explicit Table(const PolicyTable& policy_table);
- ~Table();
- explicit Table(const Json::Value* value__);
- Json::Value ToJsonValue() const;
- bool is_valid() const;
- bool is_initialized() const;
- bool struct_empty() const;
- void ReportErrors(rpc::ValidationReport* report__) const;
- virtual void SetPolicyTableType(PolicyTableType pt_type);
- private:
- bool Validate() const;
+public:
+ PolicyTable policy_table;
+
+public:
+ Table();
+ explicit Table(const PolicyTable &policy_table);
+ ~Table();
+ explicit Table(const Json::Value *value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport *report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+private:
+ bool Validate() const;
};
-} // namespace policy_table_interface_base
-} // namespace rpc
+} // namespace policy_table_interface_base
+} // namespace rpc
-#endif // POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_
+#endif // POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc
index b679f27c15..7b2cc5a6fa 100644
--- a/src/components/policy/src/policy/src/cache_manager.cc
+++ b/src/components/policy/src/policy/src/cache_manager.cc
@@ -43,7 +43,7 @@
#include "json/writer.h"
#include "utils/logger.h"
-# include "policy/sql_pt_representation.h"
+#include "policy/sql_pt_representation.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -51,38 +51,35 @@ namespace policy {
CREATE_LOGGERPTR_GLOBAL(logger_, "CacheManager")
-#define CACHE_MANAGER_CHECK(return_value) {\
- if (!pt_) {\
- LOG4CXX_WARN(logger_, "The cache manager is not initialized");\
- return return_value;\
- }\
-}
+#define CACHE_MANAGER_CHECK(return_value) \
+ { \
+ if (!pt_) { \
+ LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
+ return return_value; \
+ } \
+ }
-#define CACHE_MANAGER_CHECK_VOID() {\
- if (!pt_) {\
- LOG4CXX_WARN(logger_, "The cache manager is not initialized");\
- return;\
- }\
-}
+#define CACHE_MANAGER_CHECK_VOID() \
+ { \
+ if (!pt_) { \
+ LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \
+ return; \
+ } \
+ }
struct LanguageFinder {
- LanguageFinder(const std::string& language):
- language_(language) {
- }
- bool operator()(const policy_table::Languages::value_type& lang) const {
+ LanguageFinder(const std::string &language) : language_(language) {}
+ bool operator()(const policy_table::Languages::value_type &lang) const {
return !strcasecmp(language_.c_str(), lang.first.c_str());
}
private:
- const std::string& language_;
+ const std::string &language_;
};
CacheManager::CacheManager()
- : CacheManagerInterface(),
- backup_(
- new SQLPTRepresentation()
- ),
- update_required(false) {
+ : CacheManagerInterface(), backup_(new SQLPTRepresentation()),
+ update_required(false) {
LOG4CXX_AUTO_TRACE(logger_);
backuper_ = new BackgroundBackuper(this);
@@ -108,9 +105,10 @@ uint16_t CacheManager::HeartBeatTimeout(const std::string &app_id) const {
CACHE_MANAGER_CHECK(0);
uint16_t result = 0;
if (AppExists(app_id)) {
- if (pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms
- .is_initialized()) {
- result = *(pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms);
+ if (pt_->policy_table.app_policies_section.apps[app_id]
+ .heart_beat_timeout_ms.is_initialized()) {
+ result = *(pt_->policy_table.app_policies_section.apps[app_id]
+ .heart_beat_timeout_ms);
}
}
return result;
@@ -123,7 +121,7 @@ bool CacheManager::CanAppStealFocus(const std::string &app_id) {
}
bool CacheManager::GetDefaultHMI(const std::string &app_id,
- std::string& default_hmi) {
+ std::string &default_hmi) {
CACHE_MANAGER_CHECK(false);
bool result = true;
return result;
@@ -131,35 +129,33 @@ bool CacheManager::GetDefaultHMI(const std::string &app_id,
bool CacheManager::ResetUserConsent() {
CACHE_MANAGER_CHECK(false);
- sync_primitives::AutoLock lock (cache_lock_);
+ sync_primitives::AutoLock lock(cache_lock_);
return true;
}
-
bool CacheManager::GetUserPermissionsForDevice(const std::string &device_id,
- StringArray& consented_groups,
- StringArray& disallowed_groups) {
+ StringArray &consented_groups,
+ StringArray &disallowed_groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
return true;
}
-void CacheManager::GetAllAppGroups(const std::string& app_id,
- FunctionalGroupIDs& all_group_ids) {
+void CacheManager::GetAllAppGroups(const std::string &app_id,
+ FunctionalGroupIDs &all_group_ids) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
if (kDeviceId == app_id) {
- policy_table::DevicePolicy& device =
+ policy_table::DevicePolicy &device =
pt_->policy_table.app_policies_section.device;
policy_table::Strings::const_iterator iter = device.groups.begin();
policy_table::Strings::const_iterator iter_end = device.groups.end();
for (; iter != iter_end; ++iter) {
- const uint32_t group_id =
- static_cast<uint32_t> ((GenerateHash(*iter)));
+ const uint32_t group_id = static_cast<uint32_t>((GenerateHash(*iter)));
all_group_ids.push_back(group_id);
}
@@ -176,15 +172,14 @@ void CacheManager::GetAllAppGroups(const std::string& app_id,
(*app_params_iter).second.groups.end();
for (; iter != iter_end; ++iter) {
- const uint32_t group_id =
- static_cast<uint32_t> ((GenerateHash(*iter)));
+ const uint32_t group_id = static_cast<uint32_t>((GenerateHash(*iter)));
all_group_ids.push_back(group_id);
}
}
}
-void CacheManager::GetPreConsentedGroups(const std::string &app_id,
- FunctionalGroupIDs& preconsented_groups) {
+void CacheManager::GetPreConsentedGroups(
+ const std::string &app_id, FunctionalGroupIDs &preconsented_groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
@@ -192,26 +187,26 @@ void CacheManager::GetPreConsentedGroups(const std::string &app_id,
void CacheManager::GetConsentedGroups(const std::string &device_id,
const std::string &app_id,
- FunctionalGroupIDs& allowed_groups,
- FunctionalGroupIDs& disallowed_groups) {
+ FunctionalGroupIDs &allowed_groups,
+ FunctionalGroupIDs &disallowed_groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
}
-void CacheManager::GetUnconsentedGroups(const std::string& device_id,
- const std::string& policy_app_id,
- FunctionalGroupIDs& unconsented_groups) {
+void CacheManager::GetUnconsentedGroups(
+ const std::string &device_id, const std::string &policy_app_id,
+ FunctionalGroupIDs &unconsented_groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
}
-void CacheManager::RemoveAppConsentForGroup(const std::string& app_id,
- const std::string& group_name) {
+void CacheManager::RemoveAppConsentForGroup(const std::string &app_id,
+ const std::string &group_name) {
CACHE_MANAGER_CHECK_VOID();
}
-bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
+bool CacheManager::ApplyUpdate(const policy_table::Table &update_pt) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -223,18 +218,21 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
policy_table::ApplicationPolicies::const_iterator iter_end =
update_pt.policy_table.app_policies_section.apps.end();
- for (;iter != iter_end; ++iter) {
+ for (; iter != iter_end; ++iter) {
if (iter->second.is_null()) {
pt_->policy_table.app_policies_section.apps[iter->first].set_to_null();
- pt_->policy_table.app_policies_section.apps[iter->first].set_to_string("");
+ pt_->policy_table.app_policies_section.apps[iter->first].set_to_string(
+ "");
} else if (policy::kDefaultId == (iter->second).get_string()) {
- policy_table::ApplicationPolicies::const_iterator iter_default =
- update_pt.policy_table.app_policies_section.apps.find(kDefaultId);
- if (update_pt.policy_table.app_policies_section.apps.end() == iter_default) {
- LOG4CXX_ERROR(logger_, "The default section was not found in PTU");
- continue;
- }
- pt_->policy_table.app_policies_section.apps[iter->first] = iter_default->second;
+ policy_table::ApplicationPolicies::const_iterator iter_default =
+ update_pt.policy_table.app_policies_section.apps.find(kDefaultId);
+ if (update_pt.policy_table.app_policies_section.apps.end() ==
+ iter_default) {
+ LOG4CXX_ERROR(logger_, "The default section was not found in PTU");
+ continue;
+ }
+ pt_->policy_table.app_policies_section.apps[iter->first] =
+ iter_default->second;
} else {
pt_->policy_table.app_policies_section.apps[iter->first] = iter->second;
}
@@ -243,17 +241,19 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
pt_->policy_table.app_policies_section.device =
update_pt.policy_table.app_policies_section.device;
- pt_->policy_table.module_config.SafeCopyFrom(update_pt.policy_table.module_config);
+ pt_->policy_table.module_config.SafeCopyFrom(
+ update_pt.policy_table.module_config);
pt_->policy_table.consumer_friendly_messages.assign_if_valid(
- update_pt.policy_table.consumer_friendly_messages);
+ update_pt.policy_table.consumer_friendly_messages);
ResetCalculatedPermissions();
Backup();
return true;
}
-void CacheManager::GetHMIAppTypeAfterUpdate(std::map<std::string, StringArray>& app_hmi_types) {
+void CacheManager::GetHMIAppTypeAfterUpdate(
+ std::map<std::string, StringArray> &app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
policy_table::ApplicationPolicies::const_iterator policy_iter_begin =
@@ -261,14 +261,16 @@ void CacheManager::GetHMIAppTypeAfterUpdate(std::map<std::string, StringArray>&
policy_table::ApplicationPolicies::const_iterator policy_iter_end =
pt_->policy_table.app_policies_section.apps.end();
std::vector<std::string> transform_app_hmi_types;
- for(; policy_iter_begin != policy_iter_end; ++policy_iter_begin) {
- const policy_table::ApplicationParams& app_params = (*policy_iter_begin).second;
- if(app_params.AppHMIType.is_initialized()) {
- if(!(transform_app_hmi_types.empty())) {
+ for (; policy_iter_begin != policy_iter_end; ++policy_iter_begin) {
+ const policy_table::ApplicationParams &app_params =
+ (*policy_iter_begin).second;
+ if (app_params.AppHMIType.is_initialized()) {
+ if (!(transform_app_hmi_types.empty())) {
transform_app_hmi_types.clear();
}
- std::transform(app_params.AppHMIType->begin(), app_params.AppHMIType->end(),
- std::back_inserter(transform_app_hmi_types), AppHMITypeToString());
+ std::transform(
+ app_params.AppHMIType->begin(), app_params.AppHMIType->end(),
+ std::back_inserter(transform_app_hmi_types), AppHMITypeToString());
app_hmi_types[(*policy_iter_begin).first] = transform_app_hmi_types;
}
}
@@ -281,9 +283,9 @@ void CacheManager::Backup() {
}
std::string CacheManager::currentDateTime() {
- time_t now = time(0);
- struct tm tstruct;
- char buf[80];
+ time_t now = time(0);
+ struct tm tstruct;
+ char buf[80];
tstruct = *localtime(&now);
// ISO_8601 format is expected, e.g. “2000-01-01T12:18:53Z”
strftime(buf, sizeof(buf), "%Y-%m-%dT%XZ", &tstruct);
@@ -292,7 +294,7 @@ std::string CacheManager::currentDateTime() {
bool CacheManager::GetPermissionsForApp(const std::string &device_id,
const std::string &app_id,
- FunctionalIdType& group_types) {
+ FunctionalIdType &group_types) {
LOG4CXX_AUTO_TRACE(logger_);
GetAllAppGroups(app_id, group_types[kTypeGeneral]);
@@ -302,21 +304,17 @@ bool CacheManager::GetPermissionsForApp(const std::string &device_id,
}
bool CacheManager::GetDeviceGroupsFromPolicies(
- policy_table::Strings& groups,
- policy_table::Strings& preconsented_groups) {
+ policy_table::Strings &groups, policy_table::Strings &preconsented_groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
return true;
}
-bool CacheManager::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,
- const std::string &connection_type) {
+bool CacheManager::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, const std::string &connection_type) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -326,8 +324,7 @@ bool CacheManager::SetDeviceData(const std::string &device_id,
}
bool CacheManager::SetUserPermissionsForDevice(
- const std::string &device_id,
- const StringArray &consented_groups,
+ const std::string &device_id, const StringArray &consented_groups,
const StringArray &disallowed_groups) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -346,7 +343,7 @@ bool CacheManager::ReactOnUserDevConsentForApp(const std::string &app_id,
}
void CacheManager::GetGroupNameByHashID(const int32_t group_id,
- std::string& group_name) {
+ std::string &group_name) {
CACHE_MANAGER_CHECK_VOID();
policy_table::FunctionalGroupings::const_iterator fg_iter =
@@ -371,16 +368,14 @@ bool CacheManager::SetUserPermissionsForApp(
return true;
}
-bool CacheManager::UpdateRequired() const {
- return update_required;
-}
+bool CacheManager::UpdateRequired() const { return update_required; }
void CacheManager::SaveUpdateRequired(bool status) {
update_required = status;
Backup();
}
-bool CacheManager::IsApplicationRevoked(const std::string& app_id) const {
+bool CacheManager::IsApplicationRevoked(const std::string &app_id) const {
CACHE_MANAGER_CHECK(false);
bool is_revoked = false;
if (pt_->policy_table.app_policies_section.apps.end() !=
@@ -401,7 +396,7 @@ void CacheManager::CheckPermissions(const PTString &app_id,
if (pt_->policy_table.app_policies_section.apps.end() ==
pt_->policy_table.app_policies_section.apps.find(app_id)) {
LOG4CXX_ERROR(logger_, "Application id " << app_id
- << " was not found in policy DB.");
+ << " was not found in policy DB.");
return;
}
@@ -414,9 +409,10 @@ void CacheManager::CheckPermissions(const PTString &app_id,
policy_table::FunctionalGroupings::const_iterator concrete_group;
for (; app_groups_iter != app_groups_iter_end; ++app_groups_iter) {
- concrete_group = pt_->policy_table.functional_groupings.find(*app_groups_iter);
+ concrete_group =
+ pt_->policy_table.functional_groupings.find(*app_groups_iter);
if (pt_->policy_table.functional_groupings.end() != concrete_group) {
- const policy_table::Rpcs& rpcs = concrete_group->second;
+ const policy_table::Rpcs &rpcs = concrete_group->second;
policy_table::Rpc::const_iterator rpc_iter = rpcs.rpcs.find(rpc);
if (rpcs.rpcs.end() != rpc_iter) {
@@ -427,7 +423,7 @@ void CacheManager::CheckPermissions(const PTString &app_id,
policy_table::HmiLevels::const_iterator hmi_iter =
std::find(rpc_param.hmi_levels.begin(), rpc_param.hmi_levels.end(),
- hmi_level_e);
+ hmi_level_e);
if (rpc_param.hmi_levels.end() != hmi_iter) {
result.hmi_level_permitted = PermitResult::kRpcAllowed;
@@ -437,9 +433,9 @@ void CacheManager::CheckPermissions(const PTString &app_id,
policy_table::Parameters::const_iterator params_iter_end =
rpc_param.parameters->end();
- for (;params_iter != params_iter_end; ++params_iter) {
+ for (; params_iter != params_iter_end; ++params_iter) {
result.list_of_allowed_params.push_back(
- policy_table::EnumToJsonString(*params_iter));
+ policy_table::EnumToJsonString(*params_iter));
}
}
}
@@ -455,24 +451,24 @@ bool CacheManager::IsPTPreloaded() {
int CacheManager::IgnitionCyclesBeforeExchange() {
CACHE_MANAGER_CHECK(0);
const uint8_t limit = std::max(
- static_cast<int>(
- pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0);
+ static_cast<int>(
+ pt_->policy_table.module_config.exchange_after_x_ignition_cycles),
+ 0);
LOG4CXX_DEBUG(logger_, "IgnitionCyclesBeforeExchange limit:" << limit);
uint8_t current = 0;
-
return std::max(limit - current, 0);
}
int CacheManager::KilometersBeforeExchange(int current) {
CACHE_MANAGER_CHECK(0);
- const int limit = std::max(
- static_cast<int>(
- pt_->policy_table.module_config.exchange_after_x_kilometers), 0);
+ const int limit =
+ std::max(static_cast<int>(
+ pt_->policy_table.module_config.exchange_after_x_kilometers),
+ 0);
LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit);
int last = 0;
-
const int actual = std::max((current - last), 0);
LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual);
return std::max(limit - actual, 0);
@@ -488,12 +484,11 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate(int kilometers,
int CacheManager::DaysBeforeExchange(int current) {
CACHE_MANAGER_CHECK(0);
const uint8_t limit = std::max(
- static_cast<int>(
- pt_->policy_table.module_config.exchange_after_x_days), 0);
+ static_cast<int>(pt_->policy_table.module_config.exchange_after_x_days),
+ 0);
LOG4CXX_DEBUG(logger_, "DaysBeforeExchange limit:" << limit);
uint8_t last = 0;
-
const uint8_t actaul = std::max((current - last), 0);
LOG4CXX_DEBUG(logger_, "DaysBeforeExchange actual:" << actaul);
return std::max(limit - actaul, 0);
@@ -514,17 +509,17 @@ int CacheManager::TimeoutResponse() {
return pt_->policy_table.module_config.timeout_after_x_seconds;
}
-bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
+bool CacheManager::SecondsBetweenRetries(std::vector<int> &seconds) {
CACHE_MANAGER_CHECK(false);
rpc::policy_table_interface_base::SecondsBetweenRetries::iterator iter =
- pt_->policy_table.module_config.seconds_between_retries.begin();
+ pt_->policy_table.module_config.seconds_between_retries.begin();
rpc::policy_table_interface_base::SecondsBetweenRetries::iterator iter_end =
- pt_->policy_table.module_config.seconds_between_retries.end();
+ pt_->policy_table.module_config.seconds_between_retries.end();
const std::size_t size =
pt_->policy_table.module_config.seconds_between_retries.size();
seconds.reserve(size);
- for (;iter != iter_end; ++iter) {
+ for (; iter != iter_end; ++iter) {
seconds.push_back(*iter);
}
return true;
@@ -535,8 +530,9 @@ VehicleData CacheManager::GetVehicleData() {
return VehicleData();
}
-std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
- const std::vector<std::string> &msg_codes, const std::string &language) {
+std::vector<UserFriendlyMessage>
+CacheManager::GetUserFriendlyMsg(const std::vector<std::string> &msg_codes,
+ const std::string &language) {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
@@ -554,25 +550,24 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
// If message has no records with required language, fallback language
// should be used instead.
LanguageFinder finder(language);
- policy_table::Languages::const_iterator it_language =
- std::find_if(msg_languages.languages.begin(),
- msg_languages.languages.end(),
- finder);
+ policy_table::Languages::const_iterator it_language = std::find_if(
+ msg_languages.languages.begin(), msg_languages.languages.end(), finder);
if (msg_languages.languages.end() == it_language) {
- LOG4CXX_WARN(logger_, "Language " << language <<
- " haven't been found for message code: " << *it);
+ LOG4CXX_WARN(logger_,
+ "Language "
+ << language
+ << " haven't been found for message code: " << *it);
LanguageFinder fallback_language_finder("en-us");
policy_table::Languages::const_iterator it_fallback_language =
std::find_if(msg_languages.languages.begin(),
- msg_languages.languages.end(),
- fallback_language_finder);
+ msg_languages.languages.end(), fallback_language_finder);
if (msg_languages.languages.end() == it_fallback_language) {
- LOG4CXX_ERROR(logger_, "No fallback language found for message code: "
- << *it);
+ LOG4CXX_ERROR(logger_,
+ "No fallback language found for message code: " << *it);
continue;
}
@@ -588,8 +583,8 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
return result;
}
-void CacheManager::GetServiceUrls(const std::string& service_type,
- EndpointUrls& end_points) {
+void CacheManager::GetServiceUrls(const std::string &service_type,
+ EndpointUrls &end_points) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
std::string search_value;
@@ -603,13 +598,15 @@ void CacheManager::GetServiceUrls(const std::string& service_type,
pt_->policy_table.module_config.endpoints.find(search_value);
if (pt_->policy_table.module_config.endpoints.end() != iter) {
- policy_table::URLList::const_iterator url_list_iter = (*iter).second.begin();
- policy_table::URLList::const_iterator url_list_iter_end = (*iter).second.end();
+ policy_table::URLList::const_iterator url_list_iter =
+ (*iter).second.begin();
+ policy_table::URLList::const_iterator url_list_iter_end =
+ (*iter).second.end();
for (; url_list_iter != url_list_iter_end; ++url_list_iter) {
EndpointData data;
data.app_id = (*url_list_iter).first;
std::copy((*url_list_iter).second.begin(), (*url_list_iter).second.end(),
- std::back_inserter(data.url));
+ std::back_inserter(data.url));
end_points.push_back(data);
}
@@ -620,19 +617,20 @@ std::string CacheManager::GetLockScreenIconUrl() const {
if (backup_) {
return backup_->GetLockScreenIconUrl();
}
- return std::string ("");
+ return std::string("");
}
int CacheManager::GetNotificationsNumber(const std::string &priority) {
CACHE_MANAGER_CHECK(0);
typedef rpc::policy_table_interface_base::NumberOfNotificationsPerMinute NNPM;
- const NNPM& nnpm =
+ const NNPM &nnpm =
pt_->policy_table.module_config.notifications_per_minute_by_priority;
NNPM::const_iterator priority_iter = nnpm.find(priority);
- const int result = (nnpm.end() != priority_iter ? (*priority_iter).second : 0);
+ const int result =
+ (nnpm.end() != priority_iter ? (*priority_iter).second : 0);
return result;
}
@@ -641,11 +639,11 @@ bool CacheManager::GetPriority(const std::string &policy_app_id,
CACHE_MANAGER_CHECK(false);
if (kDeviceId == policy_app_id) {
priority = EnumToJsonString(
- pt_->policy_table.app_policies_section.device.priority);
+ pt_->policy_table.app_policies_section.device.priority);
return true;
}
- const policy_table::ApplicationPolicies& policies =
+ const policy_table::ApplicationPolicies &policies =
pt_->policy_table.app_policies_section.apps;
policy_table::ApplicationPolicies::const_iterator policy_iter =
@@ -695,28 +693,31 @@ void CacheManager::PersistData() {
if (copy_pt.policy_table.app_policies_section.apps.end() !=
copy_pt.policy_table.app_policies_section.apps.find(app_id)) {
- is_revoked = copy_pt.policy_table.app_policies_section.apps[app_id].is_null();
+ is_revoked =
+ copy_pt.policy_table.app_policies_section.apps[app_id].is_null();
}
- is_default_policy = copy_pt.policy_table.app_policies_section.apps.end() !=
- copy_pt.policy_table.app_policies_section.apps.find(app_id) &&
+ is_default_policy =
+ copy_pt.policy_table.app_policies_section.apps.end() !=
+ copy_pt.policy_table.app_policies_section.apps.find(app_id) &&
policy::kDefaultId ==
- copy_pt.policy_table.app_policies_section.apps[app_id].get_string();
+ copy_pt.policy_table.app_policies_section.apps[app_id]
+ .get_string();
// TODO(AOleynik): Remove this field from DB
- is_predata_policy = copy_pt.policy_table.app_policies_section.apps.end() !=
- copy_pt.policy_table.app_policies_section.apps.find(app_id) &&
+ is_predata_policy =
+ copy_pt.policy_table.app_policies_section.apps.end() !=
+ copy_pt.policy_table.app_policies_section.apps.find(app_id) &&
policy::kPreDataConsentId ==
- copy_pt.policy_table.app_policies_section.apps[app_id].get_string();
+ copy_pt.policy_table.app_policies_section.apps[app_id]
+ .get_string();
- backup_->SaveApplicationCustomData(app_id,
- is_revoked,
- is_default_policy,
- is_predata_policy);
+ backup_->SaveApplicationCustomData(
+ app_id, is_revoked, is_default_policy, is_predata_policy);
is_revoked = false;
}
- // In case of extended policy the meta info should be backuped as well.
+ // In case of extended policy the meta info should be backuped as well.
backup_->WriteDb();
}
}
@@ -728,22 +729,20 @@ void CacheManager::ResetCalculatedPermissions() {
calculated_permissions_.clear();
}
-void CacheManager::AddCalculatedPermissions(
- const std::string& device_id,
- const std::string& policy_app_id,
- const Permissions& permissions) {
- LOG4CXX_DEBUG(logger_, "AddCalculatedPermissions for device: " << device_id
- << " and app: " << policy_app_id);
+void CacheManager::AddCalculatedPermissions(const std::string &device_id,
+ const std::string &policy_app_id,
+ const Permissions &permissions) {
+ LOG4CXX_DEBUG(logger_, "AddCalculatedPermissions for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_[device_id][policy_app_id] = permissions;
}
-bool CacheManager::IsPermissionsCalculated(
- const std::string& device_id,
- const std::string& policy_app_id,
- Permissions& permission) {
- LOG4CXX_DEBUG(logger_, "IsPermissionsCalculated for device: " << device_id
- << " and app: " << policy_app_id);
+bool CacheManager::IsPermissionsCalculated(const std::string &device_id,
+ const std::string &policy_app_id,
+ Permissions &permission) {
+ LOG4CXX_DEBUG(logger_, "IsPermissionsCalculated for device: "
+ << device_id << " and app: " << policy_app_id);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
CalculatedPermissions::const_iterator it =
calculated_permissions_.find(device_id);
@@ -763,10 +762,10 @@ bool CacheManager::IsPermissionsCalculated(
return false;
}
-bool policy::CacheManager::IsNumberService(const std::string& input,
- std::string& output) const {
- const char* input_value = input.c_str();
- char* endptr;
+bool policy::CacheManager::IsNumberService(const std::string &input,
+ std::string &output) const {
+ const char *input_value = input.c_str();
+ char *endptr;
const int base = 10;
errno = 0;
uint32_t service_value = strtoul(input_value, &endptr, base);
@@ -778,16 +777,15 @@ bool policy::CacheManager::IsNumberService(const std::string& input,
output = input;
if (service_value <= 9) {
- output.insert(0,"0x0", 3);
+ output.insert(0, "0x0", 3);
} else {
- output.insert(0,"0x", 2);
+ output.insert(0, "0x", 2);
}
return true;
}
-utils::SharedPtr<policy_table::Table>
-CacheManager::GenerateSnapshot() {
+utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() {
CACHE_MANAGER_CHECK(snapshot_);
sync_primitives::AutoLock lock(cache_lock_);
@@ -810,9 +808,9 @@ CacheManager::GenerateSnapshot() {
return snapshot_;
}
-bool CacheManager::GetInitialAppData(const std::string& app_id,
- StringArray& nicknames,
- StringArray& app_hmi_types) {
+bool CacheManager::GetInitialAppData(const std::string &app_id,
+ StringArray &nicknames,
+ StringArray &app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
@@ -820,7 +818,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id,
pt_->policy_table.app_policies_section.apps.find(app_id);
if (pt_->policy_table.app_policies_section.apps.end() != policy_iter) {
- const policy_table::ApplicationParams& app_params = (*policy_iter).second;
+ const policy_table::ApplicationParams &app_params = (*policy_iter).second;
std::copy(app_params.nicknames->begin(), app_params.nicknames->end(),
std::back_inserter(nicknames));
@@ -832,19 +830,19 @@ bool CacheManager::GetInitialAppData(const std::string& app_id,
}
bool CacheManager::GetFunctionalGroupings(
- policy_table::FunctionalGroupings& groups) {
+ policy_table::FunctionalGroupings &groups) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
- const policy_table::FunctionalGroupings& f_groupings =
- pt_->policy_table.functional_groupings;
+ const policy_table::FunctionalGroupings &f_groupings =
+ pt_->policy_table.functional_groupings;
groups.insert(f_groupings.begin(), f_groupings.end());
return true;
}
-int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id,
- const std::string& device_id) {
+int CacheManager::CountUnconsentedGroups(const std::string &policy_app_id,
+ const std::string &device_id) {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK(false);
LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id);
@@ -888,9 +886,10 @@ bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames &names) {
for (; iter != iter_end; ++iter) {
const int32_t id = GenerateHash((*iter).first);
std::pair<std::string, std::string> value =
- std::make_pair( *(*iter).second.user_consent_prompt, (*iter).first);
+ std::make_pair(*(*iter).second.user_consent_prompt, (*iter).first);
- names.insert(std::pair<uint32_t, std::pair<std::string, std::string> >(id, value));
+ names.insert(
+ std::pair<uint32_t, std::pair<std::string, std::string>>(id, value));
}
return true;
}
@@ -920,8 +919,7 @@ void CacheManager::Set(const std::string &app_id,
}
void CacheManager::Add(const std::string &app_id,
- usage_statistics::AppStopwatchId type,
- int seconds) {
+ usage_statistics::AppStopwatchId type, int seconds) {
CACHE_MANAGER_CHECK_VOID();
Backup();
}
@@ -945,23 +943,24 @@ bool CacheManager::SetDefaultPolicy(const std::string &app_id) {
return true;
}
-bool CacheManager::IsDefaultPolicy(const std::string& app_id) {
+bool CacheManager::IsDefaultPolicy(const std::string &app_id) {
CACHE_MANAGER_CHECK(false);
const bool result =
pt_->policy_table.app_policies_section.apps.end() !=
- pt_->policy_table.app_policies_section.apps.find(app_id) &&
+ pt_->policy_table.app_policies_section.apps.find(app_id) &&
policy::kDefaultId ==
- pt_->policy_table.app_policies_section.apps[app_id].get_string();
+ pt_->policy_table.app_policies_section.apps[app_id].get_string();
return result;
}
-bool CacheManager::SetIsDefault(const std::string& app_id) {
+bool CacheManager::SetIsDefault(const std::string &app_id) {
CACHE_MANAGER_CHECK(false);
policy_table::ApplicationPolicies::const_iterator iter =
pt_->policy_table.app_policies_section.apps.find(app_id);
if (pt_->policy_table.app_policies_section.apps.end() != iter) {
- pt_->policy_table.app_policies_section.apps[app_id].set_to_string(kDefaultId);
+ pt_->policy_table.app_policies_section.apps[app_id].set_to_string(
+ kDefaultId);
}
return true;
}
@@ -973,14 +972,16 @@ bool CacheManager::SetPredataPolicy(const std::string &app_id) {
if (pt_->policy_table.app_policies_section.apps.end() == iter) {
LOG4CXX_ERROR(logger_, "Could not set " << kPreDataConsentId
- << " permissions for app " << app_id);
+ << " permissions for app "
+ << app_id);
return false;
}
pt_->policy_table.app_policies_section.apps[app_id] =
pt_->policy_table.app_policies_section.apps[kPreDataConsentId];
- pt_->policy_table.app_policies_section.apps[app_id].set_to_string(kPreDataConsentId);
+ pt_->policy_table.app_policies_section.apps[app_id].set_to_string(
+ kPreDataConsentId);
Backup();
return true;
@@ -989,16 +990,14 @@ bool CacheManager::SetPredataPolicy(const std::string &app_id) {
bool CacheManager::IsPredataPolicy(const std::string &app_id) {
// TODO(AOleynik): Maybe change for comparison with pre_DataConsent
// permissions or check string value from get_string()
- policy_table::ApplicationParams& pre_data_app =
- pt_->policy_table.app_policies_section.apps[kPreDataConsentId];
- policy_table::ApplicationParams& specific_app =
- pt_->policy_table.app_policies_section.apps[app_id];
+ policy_table::ApplicationParams &pre_data_app =
+ pt_->policy_table.app_policies_section.apps[kPreDataConsentId];
+ policy_table::ApplicationParams &specific_app =
+ pt_->policy_table.app_policies_section.apps[app_id];
policy_table::Strings res;
- std::set_intersection(pre_data_app.groups.begin(),
- pre_data_app.groups.end(),
- specific_app.groups.begin(),
- specific_app.groups.end(),
+ std::set_intersection(pre_data_app.groups.begin(), pre_data_app.groups.end(),
+ specific_app.groups.begin(), specific_app.groups.end(),
std::back_inserter(res));
bool is_marked_as_predata =
@@ -1009,13 +1008,12 @@ bool CacheManager::IsPredataPolicy(const std::string &app_id) {
}
bool CacheManager::SetUnpairedDevice(const std::string &device_id,
- bool unpaired) {
- const bool result =
- pt_->policy_table.device_data->end() !=
- pt_->policy_table.device_data->find(device_id);
+ bool unpaired) {
+ const bool result = pt_->policy_table.device_data->end() !=
+ pt_->policy_table.device_data->find(device_id);
if (!result) {
LOG4CXX_DEBUG(logger_, "Couldn't set unpaired flag for device id "
- << device_id << " , since it wasn't found.");
+ << device_id << " , since it wasn't found.");
return false;
}
@@ -1025,18 +1023,19 @@ bool CacheManager::SetUnpairedDevice(const std::string &device_id,
LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id);
} else {
is_unpaired_.erase(device_id);
- LOG4CXX_DEBUG(logger_, "Unpaired flag was removed for device id " << device_id);
+ LOG4CXX_DEBUG(logger_, "Unpaired flag was removed for device id "
+ << device_id);
}
return result;
}
-bool CacheManager::SetVINValue(const std::string& value) {
+bool CacheManager::SetVINValue(const std::string &value) {
CACHE_MANAGER_CHECK(false);
Backup();
return true;
}
-bool CacheManager::IsApplicationRepresented(const std::string& app_id) const {
+bool CacheManager::IsApplicationRepresented(const std::string &app_id) const {
CACHE_MANAGER_CHECK(false);
if (kDeviceId == app_id) {
return true;
@@ -1046,42 +1045,41 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const {
return pt_->policy_table.app_policies_section.apps.end() != iter;
}
-bool CacheManager::Init(const std::string& file_name) {
+bool CacheManager::Init(const std::string &file_name) {
LOG4CXX_AUTO_TRACE(logger_);
InitResult init_result = backup_->Init();
bool result = true;
switch (init_result) {
- case InitResult::EXISTS: {
- LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly.");
- result = LoadFromBackup();
- } break;
- case InitResult::SUCCESS: {
- LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
- result = LoadFromFile(file_name);
-
- utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot();
- result &= snapshot->is_valid();
- LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: "
- << std::boolalpha << result);
- if(!result) {
- rpc::ValidationReport report("policy_table");
- snapshot->ReportErrors(&report);
- }
+ case InitResult::EXISTS: {
+ LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly.");
+ result = LoadFromBackup();
+ } break;
+ case InitResult::SUCCESS: {
+ LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
+ result = LoadFromFile(file_name);
+
+ utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot();
+ result &= snapshot->is_valid();
+ LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " << std::boolalpha
+ << result);
+ if (!result) {
+ rpc::ValidationReport report("policy_table");
+ snapshot->ReportErrors(&report);
+ }
- } break;
- default: {
- result = false;
- LOG4CXX_ERROR(logger_, "Failed to init policy table.");
- } break;
+ } break;
+ default: {
+ result = false;
+ LOG4CXX_ERROR(logger_, "Failed to init policy table.");
+ } break;
}
return result;
}
-void CacheManager::FillDeviceSpecificData() {
-}
+void CacheManager::FillDeviceSpecificData() {}
bool CacheManager::LoadFromBackup() {
sync_primitives::AutoLock lock(cache_lock_);
@@ -1093,7 +1091,7 @@ bool CacheManager::LoadFromBackup() {
return true;
}
-bool CacheManager::LoadFromFile(const std::string& file_name) {
+bool CacheManager::LoadFromFile(const std::string &file_name) {
LOG4CXX_AUTO_TRACE(logger_);
BinaryMessage json_string;
if (!file_system::ReadBinaryFile(file_name, json_string)) {
@@ -1105,9 +1103,8 @@ bool CacheManager::LoadFromFile(const std::string& file_name) {
Json::Reader reader(Json::Features::strictMode());
std::string json(json_string.begin(), json_string.end());
if (!reader.parse(json.c_str(), value)) {
- LOG4CXX_FATAL(
- logger_,
- "Preloaded PT is corrupted: " << reader.getFormattedErrorMessages());
+ LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted: "
+ << reader.getFormattedErrorMessages());
return false;
}
@@ -1127,13 +1124,13 @@ bool CacheManager::LoadFromFile(const std::string& file_name) {
} else {
rpc::ValidationReport report("policy_table");
pt_->ReportErrors(&report);
- LOG4CXX_FATAL(logger_,
- "Parsed table is not valid " << rpc::PrettyFormat(report));
+ LOG4CXX_FATAL(logger_, "Parsed table is not valid "
+ << rpc::PrettyFormat(report));
return false;
}
}
-bool CacheManager::ResetPT(const std::string& file_name) {
+bool CacheManager::ResetPT(const std::string &file_name) {
bool result = true;
Backup();
return result;
@@ -1149,14 +1146,14 @@ bool CacheManager::AppExists(const std::string &app_id) const {
return pt_->policy_table.app_policies_section.apps.end() != policy_iter;
}
-int32_t CacheManager::GenerateHash(const std::string& str_to_hash) {
+int32_t CacheManager::GenerateHash(const std::string &str_to_hash) {
uint32_t hash = 5381U;
std::string::const_iterator it = str_to_hash.begin();
std::string::const_iterator it_end = str_to_hash.end();
- for (;it != it_end; ++it) {
- hash = ((hash << 5) + hash) + (*it);
+ for (; it != it_end; ++it) {
+ hash = ((hash << 5) + hash) + (*it);
}
// Reset sign bit in case it has been set.
@@ -1166,30 +1163,30 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) {
}
void CacheManager::GetAppRequestTypes(
- const std::string& policy_app_id,
- std::vector<std::string>& request_types) const {
+ const std::string &policy_app_id,
+ std::vector<std::string> &request_types) const {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
policy_table::ApplicationPolicies::iterator policy_iter =
pt_->policy_table.app_policies_section.apps.find(policy_app_id);
if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) {
LOG4CXX_DEBUG(logger_, "Can't find request types for app_id "
- << policy_app_id);
+ << policy_app_id);
return;
}
policy_table::RequestTypes::iterator it_request_type =
policy_iter->second.RequestType->begin();
- for (;it_request_type != policy_iter->second.RequestType->end();
+ for (; it_request_type != policy_iter->second.RequestType->end();
++it_request_type) {
request_types.push_back(EnumToJsonString(*it_request_type));
}
return;
}
-CacheManager::BackgroundBackuper::BackgroundBackuper(CacheManager* cache_manager)
- : cache_manager_(cache_manager),
- stop_flag_(false),
- new_data_available_(false) {
+CacheManager::BackgroundBackuper::BackgroundBackuper(
+ CacheManager *cache_manager)
+ : cache_manager_(cache_manager), stop_flag_(false),
+ new_data_available_(false) {
LOG4CXX_AUTO_TRACE(logger_);
}
@@ -1237,4 +1234,4 @@ void CacheManager::BackgroundBackuper::DoBackup() {
backup_notifier_.NotifyOne();
}
-} // namespace policy
+} // namespace policy
diff --git a/src/components/policy/src/policy/src/sql_pt_queries.cc b/src/components/policy/src/policy/src/sql_pt_queries.cc
index efc2d60c2f..86b70bebd4 100644
--- a/src/components/policy/src/policy/src/sql_pt_queries.cc
+++ b/src/components/policy/src/policy/src/sql_pt_queries.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, " Ford Motor Company
All rights reserved.
@@ -38,483 +38,506 @@ namespace sql_pt {
const std::string kSelectPriority =
"SELECT `priority_value` FROM `application` WHERE `id` = ? LIMIT 1";
const std::string kCreateSchema =
- "BEGIN; "
- "CREATE TABLE IF NOT EXISTS `device`( "
- " `id` VARCHAR(100) PRIMARY KEY NOT NULL, "
- " `hardware` VARCHAR(45), "
- " `firmware_rev` VARCHAR(45), "
- " `os` VARCHAR(45), "
- " `os_version` VARCHAR(45), "
- " `carrier` VARCHAR(45), "
- " `max_number_rfcom_ports` INTEGER,"
- " `connection_type` VARCHAR(45), "
- " `unpaired` BOOL "
- "); "
- "CREATE TABLE IF NOT EXISTS `usage_and_error_count`( "
- " `count_of_iap_buffer_full` INTEGER, "
- " `count_sync_out_of_memory` INTEGER, "
- " `count_of_sync_reboots` INTEGER "
- "); "
- "CREATE TABLE IF NOT EXISTS `module_meta`( "
- " `ccpu_version` VARCHAR(45), "
- " `language` VARCHAR(45), "
- " `wers_country_code` VARCHAR(45), "
- " `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0, "
- " `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, "
- " `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, "
- " `vin` VARCHAR(45),"
- " `flag_update_required` BOOL NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `module_config`( "
- " `preloaded_pt` BOOL NOT NULL, "
- " `is_first_run` BOOL NOT NULL, "
- " `exchange_after_x_ignition_cycles` INTEGER NOT NULL, "
- " `exchange_after_x_kilometers` INTEGER NOT NULL, "
- " `exchange_after_x_days` INTEGER NOT NULL, "
- " `timeout_after_x_seconds` INTEGER NOT NULL, "
- " `vehicle_make` VARCHAR(45), "
- " `vehicle_model` VARCHAR(45), "
- " `vehicle_year` VARCHAR(4) "
- "); "
- "CREATE TABLE IF NOT EXISTS `functional_group`( "
- " `id` INTEGER PRIMARY KEY NOT NULL, "
- " `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE, "
- " `name` VARCHAR(100) NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `priority`( "
- " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `hmi_level`( "
- " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
- " `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
- " `value` INTEGER NOT NULL, "
- " CONSTRAINT `fk_notifications_by_priority_priority1` "
- " FOREIGN KEY(`priority_value`) "
- " REFERENCES `priority`(`value`) "
- "); "
- "CREATE INDEX IF NOT EXISTS "
- "`notifications_by_priority.fk_notifications_by_priority_priority1_idx` "
- " ON `notifications_by_priority`(`priority_value`); "
- "CREATE TABLE IF NOT EXISTS `language`( "
- " `code` VARCHAR(25) PRIMARY KEY NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `message_type`( "
- " `name` VARCHAR(45) PRIMARY KEY NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `version`( "
- " `number` VARCHAR(45) NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `rpc`( "
- " `id` INTEGER PRIMARY KEY NOT NULL, "
- " `name` VARCHAR(45) NOT NULL, "
- " `parameter` VARCHAR(45), "
- " `hmi_level_value` VARCHAR(45) NOT NULL, "
- " `functional_group_id` INTEGER NOT NULL, "
- " CONSTRAINT `fk_rpc_hmi_level1` "
- " FOREIGN KEY(`hmi_level_value`) "
- " REFERENCES `hmi_level`(`value`), "
- " CONSTRAINT `fk_rpc_functional_group1` "
- " FOREIGN KEY(`functional_group_id`) "
- " REFERENCES `functional_group`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_hmi_level1_idx` "
- " ON `rpc`(`hmi_level_value`); "
- "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_functional_group1_idx` "
- " ON `rpc`(`functional_group_id`); "
- "CREATE INDEX `rpc.select_rpc_name_hmi_level` "
- " ON `rpc`(`name`,`hmi_level_value`);"
- "CREATE TABLE IF NOT EXISTS `application`( "
- " `id` VARCHAR(45) PRIMARY KEY NOT NULL, "
- " `keep_context` BOOLEAN, "
- " `steal_focus` BOOLEAN, "
- " `default_hmi` VARCHAR(45), "
- " `priority_value` VARCHAR(45), "
- " `is_revoked` BOOLEAN, "
- " `is_default` BOOLEAN, "
- " `is_predata` BOOLEAN, "
- " `memory_kb` INTEGER NOT NULL, "
- " `heart_beat_timeout_ms` INTEGER NOT NULL, "
- " `certificate` VARCHAR(45), "
- " CONSTRAINT `fk_application_hmi_level1` "
- " FOREIGN KEY(`default_hmi`) "
- " REFERENCES `hmi_level`(`value`), "
- " CONSTRAINT `fk_application_priorities1` "
- " FOREIGN KEY(`priority_value`) "
- " REFERENCES `priority`(`value`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
- " ON `application`(`default_hmi`); "
- "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
- " ON `application`(`priority_value`); "
- "CREATE TABLE IF NOT EXISTS `app_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
- " `functional_group_id` INTEGER NOT NULL, "
- " PRIMARY KEY(`application_id`,`functional_group_id`), "
- " CONSTRAINT `fk_application_has_functional_group_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`), "
- " CONSTRAINT `fk_application_has_functional_group_functional_group1` "
- " FOREIGN KEY(`functional_group_id`) "
- " REFERENCES `functional_group`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx` "
- " ON `app_group`(`functional_group_id`); "
- "CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_application1_idx` "
- " ON `app_group`(`application_id`); "
- "CREATE TABLE IF NOT EXISTS `preconsented_group`( "
- " `application_id` VARCHAR(45) NOT NULL, "
- " `functional_group_id` INTEGER NOT NULL, "
- " PRIMARY KEY(`application_id`,`functional_group_id`), "
- " CONSTRAINT `fk_application_has_functional_group_application2` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`), "
- " CONSTRAINT `fk_application_has_functional_group_functional_group2` "
- " FOREIGN KEY(`functional_group_id`) "
- " REFERENCES `functional_group`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS "
- "`preconsented_group.fk_application_has_functional_group_functional_group2_idx` "
- " ON `preconsented_group`(`functional_group_id`); "
- "CREATE INDEX IF NOT EXISTS "
- "`preconsented_group.fk_application_has_functional_group_application2_idx` "
- " ON `preconsented_group`(`application_id`); "
- "CREATE TABLE IF NOT EXISTS `seconds_between_retry`( "
- " `index` INTEGER PRIMARY KEY NOT NULL, "
- " `value` INTEGER NOT NULL "
- "); "
- "CREATE TABLE IF NOT EXISTS `device_consent_group`( "
- " `device_id` VARCHAR(100) NOT NULL, "
- " `functional_group_id` INTEGER NOT NULL, "
- " `is_consented` BOOL NOT NULL, "
- " `input` VARCHAR(45), "
- " `time_stamp` VARCHAR(45), "
- " PRIMARY KEY(`device_id`,`functional_group_id`), "
- " CONSTRAINT `fk_device_has_functional_group_device1` "
- " FOREIGN KEY(`device_id`) "
- " REFERENCES `device`(`id`), "
- " CONSTRAINT `fk_device_has_functional_group_functional_group1` "
- " FOREIGN KEY(`functional_group_id`) "
- " REFERENCES `functional_group`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS "
- "`device_consent_group.fk_device_has_functional_group_functional_group1_idx` "
- " ON `device_consent_group`(`functional_group_id`); "
- "CREATE INDEX IF NOT EXISTS "
- "`device_consent_group.fk_device_has_functional_group_device1_idx` "
- " ON `device_consent_group`(`device_id`); "
- "CREATE TABLE IF NOT EXISTS `app_level`( "
- " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, "
- " `minutes_in_hmi_full` INTEGER DEFAULT 0, "
- " `minutes_in_hmi_limited` INTEGER DEFAULT 0, "
- " `minutes_in_hmi_background` INTEGER DEFAULT 0, "
- " `minutes_in_hmi_none` INTEGER DEFAULT 0, "
- " `count_of_user_selections` INTEGER DEFAULT 0, "
- " `count_of_rejections_sync_out_of_memory` INTEGER DEFAULT 0, "
- " `count_of_rejections_nickname_mismatch` INTEGER DEFAULT 0, "
- " `count_of_rejections_duplicate_name` INTEGER DEFAULT 0, "
- " `count_of_rejected_rpcs_calls` INTEGER DEFAULT 0, "
- " `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0, "
- " `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0, "
- " `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0, "
- " `app_registration_language_gui` VARCHAR(25), "
- " `app_registration_language_vui` VARCHAR(25), "
- " CONSTRAINT `fk_app_levels_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`), "
- " CONSTRAINT `fk_app_level_language1` "
- " FOREIGN KEY(`app_registration_language_gui`) "
- " REFERENCES `language`(`code`), "
- " CONSTRAINT `fk_app_level_language2` "
- " FOREIGN KEY(`app_registration_language_vui`) "
- " REFERENCES `language`(`code`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` "
- " ON `app_level`(`application_id`); "
- "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` "
- " ON `app_level`(`app_registration_language_gui`); "
- "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` "
- " ON `app_level`(`app_registration_language_vui`); "
- "CREATE TABLE IF NOT EXISTS `nickname`( "
- " `name` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
- " PRIMARY KEY(`name`,`application_id`), "
- " CONSTRAINT `fk_nickname_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` "
- " ON `nickname`(`application_id`); "
- "CREATE TABLE IF NOT EXISTS `app_type`( "
- " `name` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
- " PRIMARY KEY(`name`,`application_id`), "
- " CONSTRAINT `fk_app_type_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`) "
- "); "
- "CREATE TABLE IF NOT EXISTS `request_type`( "
- " `request_type` VARCHAR(50) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
- " PRIMARY KEY(`request_type`,`application_id`), "
- " CONSTRAINT `fk_app_type_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
- " ON `app_type`(`application_id`); "
- "CREATE TABLE IF NOT EXISTS `consent_group`( "
- " `device_id` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
- " `functional_group_id` INTEGER NOT NULL, "
- " `is_consented` BOOL NOT NULL, "
- " `input` VARCHAR(45), "
- " `time_stamp` VARCHAR(45), "
- " PRIMARY KEY(`application_id`,`functional_group_id`,`device_id`), "
- " CONSTRAINT `fk_consent_group_device1` "
- " FOREIGN KEY(`device_id`) "
- " REFERENCES `device`(`id`), "
- " CONSTRAINT `fk_consent_group_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`), "
- " CONSTRAINT `fk_consent_group_functional_group1` "
- " FOREIGN KEY(`functional_group_id`) "
- " REFERENCES `functional_group`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS "
- "`consent_group.fk_consent_group_device1_idx` "
- " ON `device_consent_group`(`device_id`); "
- "CREATE INDEX IF NOT EXISTS `consent_group.fk_consent_group_functional_group1_idx` "
- " ON `consent_group`(`functional_group_id`); "
- "CREATE TABLE IF NOT EXISTS `endpoint`( "
- " `service` VARCHAR(100) NOT NULL, "
- " `url` VARCHAR(100) NOT NULL, "
- " `application_id` VARCHAR(45) NOT NULL, "
- " CONSTRAINT `fk_endpoint_application1` "
- " FOREIGN KEY(`application_id`) "
- " REFERENCES `application`(`id`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
- " ON `endpoint`(`application_id`); "
- "CREATE TABLE IF NOT EXISTS `message`( "
- " `id` INTEGER PRIMARY KEY NOT NULL, "
- " `tts` TEXT, "
- " `label` TEXT, "
- " `line1` TEXT, "
- " `line2` TEXT, "
- " `textBody` TEXT, "
- " `language_code` VARCHAR(25) NOT NULL, "
- " `message_type_name` VARCHAR(45) NOT NULL, "
- " CONSTRAINT `fk_messages_languages1` "
- " FOREIGN KEY(`language_code`) "
- " REFERENCES `language`(`code`), "
- " CONSTRAINT `fk_message_consumer_friendly_messages1` "
- " FOREIGN KEY(`message_type_name`) "
- " REFERENCES `message_type`(`name`) "
- "); "
- "CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` "
- " ON `message`(`language_code`);"
- "CREATE INDEX IF NOT EXISTS `message.fk_message_consumer_friendly_messages1_idx` "
- " ON `message`(`message_type_name`);"
- "COMMIT;";
+ "BEGIN; "
+ "CREATE TABLE IF NOT EXISTS `device`( "
+ " `id` VARCHAR(100) PRIMARY KEY NOT NULL, "
+ " `hardware` VARCHAR(45), "
+ " `firmware_rev` VARCHAR(45), "
+ " `os` VARCHAR(45), "
+ " `os_version` VARCHAR(45), "
+ " `carrier` VARCHAR(45), "
+ " `max_number_rfcom_ports` INTEGER,"
+ " `connection_type` VARCHAR(45), "
+ " `unpaired` BOOL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `usage_and_error_count`( "
+ " `count_of_iap_buffer_full` INTEGER, "
+ " `count_sync_out_of_memory` INTEGER, "
+ " `count_of_sync_reboots` INTEGER "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `module_meta`( "
+ " `ccpu_version` VARCHAR(45), "
+ " `language` VARCHAR(45), "
+ " `wers_country_code` VARCHAR(45), "
+ " `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0, "
+ " `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, "
+ " `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, "
+ " `vin` VARCHAR(45),"
+ " `flag_update_required` BOOL NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `module_config`( "
+ " `preloaded_pt` BOOL NOT NULL, "
+ " `is_first_run` BOOL NOT NULL, "
+ " `exchange_after_x_ignition_cycles` INTEGER NOT NULL, "
+ " `exchange_after_x_kilometers` INTEGER NOT NULL, "
+ " `exchange_after_x_days` INTEGER NOT NULL, "
+ " `timeout_after_x_seconds` INTEGER NOT NULL, "
+ " `vehicle_make` VARCHAR(45), "
+ " `vehicle_model` VARCHAR(45), "
+ " `vehicle_year` VARCHAR(4), "
+ " `certificate` VARCHAR (45) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `functional_group`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE, "
+ " `name` VARCHAR(100) NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `priority`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `hmi_level`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
+ " `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `value` INTEGER NOT NULL, "
+ " CONSTRAINT `fk_notifications_by_priority_priority1` "
+ " FOREIGN KEY(`priority_value`) "
+ " REFERENCES `priority`(`value`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`notifications_by_priority.fk_notifications_by_priority_priority1_idx` "
+ " ON `notifications_by_priority`(`priority_value`); "
+ "CREATE TABLE IF NOT EXISTS `language`( "
+ " `code` VARCHAR(25) PRIMARY KEY NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `message_type`( "
+ " `name` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `version`( "
+ " `number` VARCHAR(45) NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `rpc`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `name` VARCHAR(45) NOT NULL, "
+ " `parameter` VARCHAR(45), "
+ " `hmi_level_value` VARCHAR(45) NOT NULL, "
+ " `functional_group_id` INTEGER NOT NULL, "
+ " CONSTRAINT `fk_rpc_hmi_level1` "
+ " FOREIGN KEY(`hmi_level_value`) "
+ " REFERENCES `hmi_level`(`value`), "
+ " CONSTRAINT `fk_rpc_functional_group1` "
+ " FOREIGN KEY(`functional_group_id`) "
+ " REFERENCES `functional_group`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_hmi_level1_idx` "
+ " ON `rpc`(`hmi_level_value`); "
+ "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_functional_group1_idx` "
+ " ON `rpc`(`functional_group_id`); "
+ "CREATE INDEX `rpc.select_rpc_name_hmi_level` "
+ " ON `rpc`(`name`,`hmi_level_value`);"
+ "CREATE TABLE IF NOT EXISTS `application`( "
+ " `id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `keep_context` BOOLEAN, "
+ " `steal_focus` BOOLEAN, "
+ " `default_hmi` VARCHAR(45), "
+ " `priority_value` VARCHAR(45), "
+ " `is_revoked` BOOLEAN, "
+ " `is_default` BOOLEAN, "
+ " `is_predata` BOOLEAN, "
+ " `memory_kb` INTEGER NOT NULL, "
+ " `heart_beat_timeout_ms` INTEGER NOT NULL, "
+ " `certificate` VARCHAR(45), "
+ " CONSTRAINT `fk_application_hmi_level1` "
+ " FOREIGN KEY(`default_hmi`) "
+ " REFERENCES `hmi_level`(`value`), "
+ " CONSTRAINT `fk_application_priorities1` "
+ " FOREIGN KEY(`priority_value`) "
+ " REFERENCES `priority`(`value`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
+ " ON `application`(`default_hmi`); "
+ "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
+ " ON `application`(`priority_value`); "
+ "CREATE TABLE IF NOT EXISTS `app_group`( "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " `functional_group_id` INTEGER NOT NULL, "
+ " PRIMARY KEY(`application_id`,`functional_group_id`), "
+ " CONSTRAINT `fk_application_has_functional_group_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`), "
+ " CONSTRAINT `fk_application_has_functional_group_functional_group1` "
+ " FOREIGN KEY(`functional_group_id`) "
+ " REFERENCES `functional_group`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`app_group.fk_application_has_functional_group_functional_group1_idx` "
+ " ON `app_group`(`functional_group_id`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`app_group.fk_application_has_functional_group_application1_idx` "
+ " ON `app_group`(`application_id`); "
+ "CREATE TABLE IF NOT EXISTS `preconsented_group`( "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " `functional_group_id` INTEGER NOT NULL, "
+ " PRIMARY KEY(`application_id`,`functional_group_id`), "
+ " CONSTRAINT `fk_application_has_functional_group_application2` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`), "
+ " CONSTRAINT `fk_application_has_functional_group_functional_group2` "
+ " FOREIGN KEY(`functional_group_id`) "
+ " REFERENCES `functional_group`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`preconsented_group.fk_application_has_functional_group_functional_group2_"
+ "idx` "
+ " ON `preconsented_group`(`functional_group_id`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`preconsented_group.fk_application_has_functional_group_application2_idx` "
+ " ON `preconsented_group`(`application_id`); "
+ "CREATE TABLE IF NOT EXISTS `seconds_between_retry`( "
+ " `index` INTEGER PRIMARY KEY NOT NULL, "
+ " `value` INTEGER NOT NULL "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `device_consent_group`( "
+ " `device_id` VARCHAR(100) NOT NULL, "
+ " `functional_group_id` INTEGER NOT NULL, "
+ " `is_consented` BOOL NOT NULL, "
+ " `input` VARCHAR(45), "
+ " `time_stamp` VARCHAR(45), "
+ " PRIMARY KEY(`device_id`,`functional_group_id`), "
+ " CONSTRAINT `fk_device_has_functional_group_device1` "
+ " FOREIGN KEY(`device_id`) "
+ " REFERENCES `device`(`id`), "
+ " CONSTRAINT `fk_device_has_functional_group_functional_group1` "
+ " FOREIGN KEY(`functional_group_id`) "
+ " REFERENCES `functional_group`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`device_consent_group.fk_device_has_functional_group_functional_group1_"
+ "idx` "
+ " ON `device_consent_group`(`functional_group_id`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`device_consent_group.fk_device_has_functional_group_device1_idx` "
+ " ON `device_consent_group`(`device_id`); "
+ "CREATE TABLE IF NOT EXISTS `app_level`( "
+ " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, "
+ " `minutes_in_hmi_full` INTEGER DEFAULT 0, "
+ " `minutes_in_hmi_limited` INTEGER DEFAULT 0, "
+ " `minutes_in_hmi_background` INTEGER DEFAULT 0, "
+ " `minutes_in_hmi_none` INTEGER DEFAULT 0, "
+ " `count_of_user_selections` INTEGER DEFAULT 0, "
+ " `count_of_rejections_sync_out_of_memory` INTEGER DEFAULT 0, "
+ " `count_of_rejections_nickname_mismatch` INTEGER DEFAULT 0, "
+ " `count_of_rejections_duplicate_name` INTEGER DEFAULT 0, "
+ " `count_of_rejected_rpcs_calls` INTEGER DEFAULT 0, "
+ " `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0, "
+ " `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0, "
+ " `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0, "
+ " `app_registration_language_gui` VARCHAR(25), "
+ " `app_registration_language_vui` VARCHAR(25), "
+ " CONSTRAINT `fk_app_levels_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`), "
+ " CONSTRAINT `fk_app_level_language1` "
+ " FOREIGN KEY(`app_registration_language_gui`) "
+ " REFERENCES `language`(`code`), "
+ " CONSTRAINT `fk_app_level_language2` "
+ " FOREIGN KEY(`app_registration_language_vui`) "
+ " REFERENCES `language`(`code`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` "
+ " ON `app_level`(`application_id`); "
+ "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` "
+ " ON `app_level`(`app_registration_language_gui`); "
+ "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` "
+ " ON `app_level`(`app_registration_language_vui`); "
+ "CREATE TABLE IF NOT EXISTS `nickname`( "
+ " `name` VARCHAR(100) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " PRIMARY KEY(`name`,`application_id`), "
+ " CONSTRAINT `fk_nickname_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` "
+ " ON `nickname`(`application_id`); "
+ "CREATE TABLE IF NOT EXISTS `app_type`( "
+ " `name` VARCHAR(50) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " PRIMARY KEY(`name`,`application_id`), "
+ " CONSTRAINT `fk_app_type_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `request_type`( "
+ " `request_type` VARCHAR(50) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " PRIMARY KEY(`request_type`,`application_id`), "
+ " CONSTRAINT `fk_app_type_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
+ " ON `app_type`(`application_id`); "
+ "CREATE TABLE IF NOT EXISTS `consent_group`( "
+ " `device_id` VARCHAR(100) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " `functional_group_id` INTEGER NOT NULL, "
+ " `is_consented` BOOL NOT NULL, "
+ " `input` VARCHAR(45), "
+ " `time_stamp` VARCHAR(45), "
+ " PRIMARY KEY(`application_id`,`functional_group_id`,`device_id`), "
+ " CONSTRAINT `fk_consent_group_device1` "
+ " FOREIGN KEY(`device_id`) "
+ " REFERENCES `device`(`id`), "
+ " CONSTRAINT `fk_consent_group_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`), "
+ " CONSTRAINT `fk_consent_group_functional_group1` "
+ " FOREIGN KEY(`functional_group_id`) "
+ " REFERENCES `functional_group`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`consent_group.fk_consent_group_device1_idx` "
+ " ON `device_consent_group`(`device_id`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`consent_group.fk_consent_group_functional_group1_idx` "
+ " ON `consent_group`(`functional_group_id`); "
+ "CREATE TABLE IF NOT EXISTS `endpoint`( "
+ " `service` VARCHAR(100) NOT NULL, "
+ " `url` VARCHAR(100) NOT NULL, "
+ " `application_id` VARCHAR(45) NOT NULL, "
+ " CONSTRAINT `fk_endpoint_application1` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
+ " ON `endpoint`(`application_id`); "
+ "CREATE TABLE IF NOT EXISTS `message`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `tts` TEXT, "
+ " `label` TEXT, "
+ " `line1` TEXT, "
+ " `line2` TEXT, "
+ " `textBody` TEXT, "
+ " `language_code` VARCHAR(25) NOT NULL, "
+ " `message_type_name` VARCHAR(45) NOT NULL, "
+ " CONSTRAINT `fk_messages_languages1` "
+ " FOREIGN KEY(`language_code`) "
+ " REFERENCES `language`(`code`), "
+ " CONSTRAINT `fk_message_consumer_friendly_messages1` "
+ " FOREIGN KEY(`message_type_name`) "
+ " REFERENCES `message_type`(`name`) "
+ "); "
+ "CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` "
+ " ON `message`(`language_code`);"
+ "CREATE INDEX IF NOT EXISTS "
+ "`message.fk_message_consumer_friendly_messages1_idx` "
+ " ON `message`(`message_type_name`);"
+ "COMMIT;";
const std::string kInsertInitData =
- "INSERT OR IGNORE INTO `usage_and_error_count` ( "
- " `count_of_iap_buffer_full`, `count_sync_out_of_memory`, "
- " `count_of_sync_reboots`) VALUES (0, 0, 0); "
- "INSERT OR IGNORE INTO `module_meta` (`pt_exchanged_at_odometer_x`, "
- " `pt_exchanged_x_days_after_epoch`, `ignition_cycles_since_last_exchange`,"
- " `flag_update_required`) "
- " VALUES (0, 0, 0, 0); "
- "INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
- " `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
- " `exchange_after_x_days`, `timeout_after_x_seconds`) "
- " VALUES(1, 0, 0, 0, 0, 0); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('COMMUNICATION'); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NORMAL'); "
- "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NONE'); "
- "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('FULL'); "
- "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
- "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
- "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
- "INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
- "";
+ "INSERT OR IGNORE INTO `usage_and_error_count` ( "
+ " `count_of_iap_buffer_full`, `count_sync_out_of_memory`, "
+ " `count_of_sync_reboots`) VALUES (0, 0, 0); "
+ "INSERT OR IGNORE INTO `module_meta` (`pt_exchanged_at_odometer_x`, "
+ " `pt_exchanged_x_days_after_epoch`, "
+ "`ignition_cycles_since_last_exchange`,"
+ " `flag_update_required`) "
+ " VALUES (0, 0, 0, 0); "
+ "INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
+ " `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
+ " `exchange_after_x_days`, `timeout_after_x_seconds`) "
+ " VALUES(1, 0, 0, 0, 0, 0); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('COMMUNICATION'); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NORMAL'); "
+ "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('FULL'); "
+ "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
+ "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
+ "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
+ "";
const std::string kDropSchema =
- "BEGIN; "
- "DROP INDEX IF EXISTS `message.fk_messages_languages1_idx`; "
- "DROP INDEX IF EXISTS `message.fk_message_consumer_friendly_messages1_idx`; "
- "DROP TABLE IF EXISTS `message`; "
- "DROP INDEX IF EXISTS `endpoint.fk_endpoint_application1_idx`; "
- "DROP TABLE IF EXISTS `endpoint`; "
- "DROP INDEX IF EXISTS `consent_group.fk_consent_group_device1_idx`; "
- "DROP INDEX IF EXISTS `consent_group.fk_consent_group_functional_group1_idx`; "
- "DROP TABLE IF EXISTS `consent_group`; "
- "DROP INDEX IF EXISTS `app_type.fk_app_type_application1_idx`; "
- "DROP TABLE IF EXISTS `app_type`; "
- "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
- "DROP TABLE IF EXISTS `nickname`; "
- "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
- "DROP INDEX IF EXISTS `app_level.fk_app_level_language1_idx`; "
- "DROP INDEX IF EXISTS `app_level.fk_app_levels_application1_idx`; "
- "DROP TABLE IF EXISTS `app_level`; "
- "DROP INDEX IF EXISTS `device_consent_group.fk_device_has_functional_group_device1_idx`; "
- "DROP INDEX IF EXISTS `device_consent_group.fk_device_has_functional_group_functional_group1_idx`; "
- "DROP TABLE IF EXISTS `device_consent_group`; "
- "DROP TABLE IF EXISTS `seconds_between_retry`; "
- "DROP INDEX IF EXISTS `preconsented_group.fk_application_has_functional_group_application2_idx`; "
- "DROP INDEX IF EXISTS `preconsented_group.fk_application_has_functional_group_functional_group2_idx`; "
- "DROP TABLE IF EXISTS `preconsented_group`; "
- "DROP INDEX IF EXISTS `app_group.fk_application_has_functional_group_application1_idx`; "
- "DROP INDEX IF EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx`; "
- "DROP TABLE IF EXISTS `app_group`; "
- "DROP INDEX IF EXISTS `application.fk_application_priorities1_idx`; "
- "DROP INDEX IF EXISTS `application.fk_application_hmi_level1_idx`; "
- "DROP TABLE IF EXISTS `application`; "
- "DROP INDEX IF EXISTS `rpc.select_rpc_name_hmi_level`; "
- "DROP INDEX IF EXISTS `rpc.fk_rpc_functional_group1_idx`; "
- "DROP INDEX IF EXISTS `rpc.fk_rpc_hmi_level1_idx`; "
- "DROP TABLE IF EXISTS `rpc`; "
- "DROP TABLE IF EXISTS `version`; "
- "DROP TABLE IF EXISTS `message_type`; "
- "DROP TABLE IF EXISTS `language`; "
- "DROP INDEX IF EXISTS `notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
- "DROP TABLE IF EXISTS `notifications_by_priority`; "
- "DROP TABLE IF EXISTS `hmi_level`; "
- "DROP TABLE IF EXISTS `priority`; "
- "DROP TABLE IF EXISTS `functional_group`; "
- "DROP TABLE IF EXISTS `module_config`; "
- "DROP TABLE IF EXISTS `module_meta`; "
- "DROP TABLE IF EXISTS `usage_and_error_count`; "
- "DROP TABLE IF EXISTS `device`; "
- "COMMIT; "
- "VACUUM;";
-
-const std::string kDeleteData =
- "BEGIN; "
- "DELETE FROM `message`; "
- "DELETE FROM `endpoint`; "
- "DELETE FROM `consent_group`; "
- "DELETE FROM `app_type`; "
- "DELETE FROM `nickname`; "
- "DELETE FROM `app_level`; "
- "DELETE FROM `device_consent_group`; "
- "DELETE FROM `seconds_between_retry`; "
- "DELETE FROM `preconsented_group`; "
- "DELETE FROM `app_group`; "
- "DELETE FROM `application`; "
- "DELETE FROM `rpc`; "
- "DELETE FROM `version`; "
- "DELETE FROM `message_type`; "
- "DELETE FROM `language`; "
- "DELETE FROM `notifications_by_priority`; "
- "DELETE FROM `hmi_level`; "
- "DELETE FROM `priority`; "
- "DELETE FROM `functional_group`; "
- "DELETE FROM `module_config`; "
- "DELETE FROM `module_meta`; "
- "DELETE FROM `usage_and_error_count`; "
- "DELETE FROM `device`; "
- "COMMIT; "
- "VACUUM;";
+ "BEGIN; "
+ "DROP INDEX IF EXISTS `message.fk_messages_languages1_idx`; "
+ "DROP INDEX IF EXISTS "
+ "`message.fk_message_consumer_friendly_messages1_idx`; "
+ "DROP TABLE IF EXISTS `message`; "
+ "DROP INDEX IF EXISTS `endpoint.fk_endpoint_application1_idx`; "
+ "DROP TABLE IF EXISTS `endpoint`; "
+ "DROP INDEX IF EXISTS `consent_group.fk_consent_group_device1_idx`; "
+ "DROP INDEX IF EXISTS "
+ "`consent_group.fk_consent_group_functional_group1_idx`; "
+ "DROP TABLE IF EXISTS `consent_group`; "
+ "DROP INDEX IF EXISTS `app_type.fk_app_type_application1_idx`; "
+ "DROP TABLE IF EXISTS `app_type`; "
+ "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
+ "DROP TABLE IF EXISTS `nickname`; "
+ "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
+ "DROP INDEX IF EXISTS `app_level.fk_app_level_language1_idx`; "
+ "DROP INDEX IF EXISTS `app_level.fk_app_levels_application1_idx`; "
+ "DROP TABLE IF EXISTS `app_level`; "
+ "DROP INDEX IF EXISTS "
+ "`device_consent_group.fk_device_has_functional_group_device1_idx`; "
+ "DROP INDEX IF EXISTS "
+ "`device_consent_group.fk_device_has_functional_group_functional_group1_"
+ "idx`; "
+ "DROP TABLE IF EXISTS `device_consent_group`; "
+ "DROP TABLE IF EXISTS `seconds_between_retry`; "
+ "DROP INDEX IF EXISTS "
+ "`preconsented_group.fk_application_has_functional_group_application2_idx`;"
+ " "
+ "DROP INDEX IF EXISTS "
+ "`preconsented_group.fk_application_has_functional_group_functional_group2_"
+ "idx`; "
+ "DROP TABLE IF EXISTS `preconsented_group`; "
+ "DROP INDEX IF EXISTS "
+ "`app_group.fk_application_has_functional_group_application1_idx`; "
+ "DROP INDEX IF EXISTS "
+ "`app_group.fk_application_has_functional_group_functional_group1_idx`; "
+ "DROP TABLE IF EXISTS `app_group`; "
+ "DROP INDEX IF EXISTS `application.fk_application_priorities1_idx`; "
+ "DROP INDEX IF EXISTS `application.fk_application_hmi_level1_idx`; "
+ "DROP TABLE IF EXISTS `application`; "
+ "DROP INDEX IF EXISTS `rpc.select_rpc_name_hmi_level`; "
+ "DROP INDEX IF EXISTS `rpc.fk_rpc_functional_group1_idx`; "
+ "DROP INDEX IF EXISTS `rpc.fk_rpc_hmi_level1_idx`; "
+ "DROP TABLE IF EXISTS `rpc`; "
+ "DROP TABLE IF EXISTS `version`; "
+ "DROP TABLE IF EXISTS `message_type`; "
+ "DROP TABLE IF EXISTS `language`; "
+ "DROP INDEX IF EXISTS "
+ "`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
+ "DROP TABLE IF EXISTS `notifications_by_priority`; "
+ "DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `priority`; "
+ "DROP TABLE IF EXISTS `functional_group`; "
+ "DROP TABLE IF EXISTS `module_config`; "
+ "DROP TABLE IF EXISTS `module_meta`; "
+ "DROP TABLE IF EXISTS `usage_and_error_count`; "
+ "DROP TABLE IF EXISTS `device`; "
+ "COMMIT; "
+ "VACUUM;";
+
+const std::string kDeleteData = "BEGIN; "
+ "DELETE FROM `message`; "
+ "DELETE FROM `endpoint`; "
+ "DELETE FROM `consent_group`; "
+ "DELETE FROM `app_type`; "
+ "DELETE FROM `nickname`; "
+ "DELETE FROM `app_level`; "
+ "DELETE FROM `device_consent_group`; "
+ "DELETE FROM `seconds_between_retry`; "
+ "DELETE FROM `preconsented_group`; "
+ "DELETE FROM `app_group`; "
+ "DELETE FROM `application`; "
+ "DELETE FROM `rpc`; "
+ "DELETE FROM `version`; "
+ "DELETE FROM `message_type`; "
+ "DELETE FROM `language`; "
+ "DELETE FROM `notifications_by_priority`; "
+ "DELETE FROM `hmi_level`; "
+ "DELETE FROM `priority`; "
+ "DELETE FROM `functional_group`; "
+ "DELETE FROM `module_config`; "
+ "DELETE FROM `module_meta`; "
+ "DELETE FROM `usage_and_error_count`; "
+ "DELETE FROM `device`; "
+ "COMMIT; "
+ "VACUUM;";
const std::string kCheckDBIntegrity = "PRAGMA integrity_check";
const std::string kCheckPgNumber = "PRAGMA page_count";
const std::string kSelectRpc =
- "SELECT DISTINCT `rpc`.`parameter` FROM `rpc` "
- " JOIN `app_group` AS `g` ON (`g`.`functional_group_id` = `rpc`.`functional_group_id` "
- " AND (`g`.`application_id` = ?)) "
- "WHERE `rpc`.`hmi_level_value` = ? AND `rpc`.`name` = ?";
+ "SELECT DISTINCT `rpc`.`parameter` FROM `rpc` "
+ " JOIN `app_group` AS `g` ON (`g`.`functional_group_id` = "
+ "`rpc`.`functional_group_id` "
+ " AND (`g`.`application_id` = ?)) "
+ "WHERE `rpc`.`hmi_level_value` = ? AND `rpc`.`name` = ?";
const std::string kSelectPreloaded =
- "SELECT `preloaded_pt` FROM `module_config` "
- "WHERE `preloaded_pt` = 1 LIMIT 1";
+ "SELECT `preloaded_pt` FROM `module_config` "
+ "WHERE `preloaded_pt` = 1 LIMIT 1";
const std::string kUpdatePreloaded =
- "UPDATE `module_config` SET `preloaded_pt` = ?";
+ "UPDATE `module_config` SET `preloaded_pt` = ?";
-const std::string kIsFirstRun =
- "SELECT `is_first_run` FROM `module_config` ";
+const std::string kIsFirstRun = "SELECT `is_first_run` FROM `module_config` ";
const std::string kSetNotFirstRun =
- "UPDATE `module_config` SET `is_first_run`= 0 ";
+ "UPDATE `module_config` SET `is_first_run`= 0 ";
const std::string kSelectEndpoint =
- "SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
+ "SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
const std::string kSelectLockScreenIcon =
- "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
+ "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
const std::string kInsertFunctionalGroup =
- "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`) "
- " VALUES (?, ?, ?)";
+ "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`) "
+ " VALUES (?, ?, ?)";
const std::string kInsertRpc =
- "INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
- " VALUES (?, ?, ?)";
+ "INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
+ " VALUES (?, ?, ?)";
-const std::string kInsertRpcWithParameter =
- "INSERT INTO `rpc` (`name`, `hmi_level_value`, `parameter`, `functional_group_id`) "
- " VALUES (?, ?, ?, ?)";
+const std::string kInsertRpcWithParameter = "INSERT INTO `rpc` (`name`, "
+ "`hmi_level_value`, `parameter`, "
+ "`functional_group_id`) "
+ " VALUES (?, ?, ?, ?)";
const std::string kInsertApplication =
- "INSERT OR IGNORE INTO `application` (`id`, `priority_value`, `is_revoked`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate`) VALUES (?,?,?,?,?,?)";
+ "INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
+ "`is_revoked`, `memory_kb`,"
+ " `heart_beat_timeout_ms`, `certificate`) VALUES (?,?,?,?,?,?)";
const std::string kInsertAppGroup =
- "INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
- " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1";
+ "INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
+ " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1";
const std::string kInsertNickname =
- "INSERT OR IGNORE INTO `nickname` (`application_id`, `name`) VALUES (?, ?)";
+ "INSERT OR IGNORE INTO `nickname` (`application_id`, `name`) VALUES (?, ?)";
const std::string kInsertAppType =
- "INSERT OR IGNORE INTO `app_type` (`application_id`, `name`) VALUES (?, ?)";
+ "INSERT OR IGNORE INTO `app_type` (`application_id`, `name`) VALUES (?, ?)";
-const std::string kInsertRequestType =
- "INSERT OR IGNORE INTO `request_type` (`application_id`, `request_type`) VALUES (?, ?)";
+const std::string kInsertRequestType = "INSERT OR IGNORE INTO `request_type` "
+ "(`application_id`, `request_type`) "
+ "VALUES (?, ?)";
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
const std::string kInsertMessageType =
- "INSERT OR IGNORE INTO `message_type` (`name`) VALUES (?)";
+ "INSERT OR IGNORE INTO `message_type` (`name`) VALUES (?)";
const std::string kInsertLanguage =
- "INSERT OR IGNORE INTO `language` (`code`) VALUES (?)";
+ "INSERT OR IGNORE INTO `language` (`code`) VALUES (?)";
const std::string kInsertMessageString =
- "INSERT INTO `message` (`tts`, `label`, `line1`, `line2`, `language_code`, "
- " `message_type_name`, `textBody`) VALUES (?, ?, ?, ?, ?, ?, ?)";
+ "INSERT INTO `message` (`tts`, `label`, `line1`, `line2`, `language_code`, "
+ " `message_type_name`, `textBody`) VALUES (?, ?, ?, ?, ?, ?, ?)";
const std::string kUpdateModuleConfig =
- "UPDATE `module_config` SET `preloaded_pt` = ?, "
- " `exchange_after_x_ignition_cycles` = ?,"
- " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
- " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, "
- " `vehicle_model` = ?, `vehicle_year` = ?";
+ "UPDATE `module_config` SET `preloaded_pt` = ?, "
+ " `exchange_after_x_ignition_cycles` = ?,"
+ " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
+ " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, "
+ " `vehicle_model` = ?, `vehicle_year` = ?, `certificate` = ?";
const std::string kInsertEndpoint =
- "INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
- " VALUES (?, ?, ?)";
+ "INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
+ " VALUES (?, ?, ?)";
const std::string kInsertSecondsBetweenRetry =
- "INSERT INTO `seconds_between_retry` (`index`, `value`) VALUES (?, ?)";
+ "INSERT INTO `seconds_between_retry` (`index`, `value`) VALUES (?, ?)";
const std::string kInsertNotificationsByPriority =
- "INSERT OR REPLACE INTO `notifications_by_priority` (`priority_value`, `value`) "
- " VALUES (?, ?)";
+ "INSERT OR REPLACE INTO `notifications_by_priority` (`priority_value`, "
+ "`value`) "
+ " VALUES (?, ?)";
const std::string kInsertDeviceData =
- "INSERT OR IGNORE INTO `device` (`id`) VALUES (?)";
+ "INSERT OR IGNORE INTO `device` (`id`) VALUES (?)";
const std::string kInsertAppLevel =
- "INSERT INTO `app_level` (`application_id`, `minutes_in_hmi_full`,"
+ "INSERT INTO `app_level` (`application_id`, `minutes_in_hmi_full`,"
"`minutes_in_hmi_limited` ,`minutes_in_hmi_background`,"
"`minutes_in_hmi_none`,`count_of_user_selections`,"
"`count_of_rejections_sync_out_of_memory`,"
@@ -525,7 +548,7 @@ const std::string kInsertAppLevel =
"`app_registration_language_vui`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kDeleteSecondsBetweenRetries =
- "DELETE FROM `seconds_between_retry`";
+ "DELETE FROM `seconds_between_retry`";
const std::string kDeleteEndpoint = "DELETE FROM `endpoint`";
@@ -540,17 +563,17 @@ const std::string kDeleteRpc = "DELETE FROM `rpc`";
const std::string kDeleteAppGroup = "DELETE FROM `app_group`";
const std::string kSelectModuleConfig =
- "SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
- " `exchange_after_x_kilometers`, `exchange_after_x_days`, "
- " `timeout_after_x_seconds`, `vehicle_make`,"
- " `vehicle_model`, `vehicle_year` "
- " FROM `module_config`";
+ "SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
+ " `exchange_after_x_kilometers`, `exchange_after_x_days`, "
+ " `timeout_after_x_seconds`, `vehicle_make`,"
+ " `vehicle_model`, `vehicle_year`, `certificate` "
+ " FROM `module_config`";
const std::string kSelectEndpoints =
- "SELECT `url`, `service`, `application_id` FROM `endpoint` ";
+ "SELECT `url`, `service`, `application_id` FROM `endpoint` ";
const std::string kSelectNotificationsPerMin =
- "SELECT `priority_value`, `value` FROM notifications_by_priority";
+ "SELECT `priority_value`, `value` FROM notifications_by_priority";
const std::string kSelectNotificationsPerPriority =
"SELECT `value` FROM notifications_by_priority WHERE `priority_value` = ? ";
@@ -560,23 +583,25 @@ const std::string kSelectAppLevels = "SELECT `application_id` FROM `app_level`";
const std::string kSelectDeviceData = "SELECT * FROM `device`";
const std::string kSelectFunctionalGroups =
- "SELECT `id`,`name`, `user_consent_prompt` "
- "FROM `functional_group`";
+ "SELECT `id`,`name`, `user_consent_prompt` "
+ "FROM `functional_group`";
const std::string kSelectAllRpcs =
- "SELECT `name`, `hmi_level_value`, `parameter` "
- "FROM `rpc` WHERE `functional_group_id` = ? ";
+ "SELECT `name`, `hmi_level_value`, `parameter` "
+ "FROM `rpc` WHERE `functional_group_id` = ? ";
const std::string kSelectUserMsgsVersion =
- "SELECT DISTINCT `number` FROM `version`";
+ "SELECT DISTINCT `number` FROM `version`";
-const std::string kSelectAppPolicies = "SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms`, `certificate` FROM `application`";
+const std::string kSelectAppPolicies =
+ "SELECT `id`, `priority_value`, `memory_kb`, "
+ " `heart_beat_timeout_ms`, `certificate` FROM `application`";
-const std::string kSelectAppGroups = "SELECT `f`.`name` FROM `app_group` AS `a`"
- " LEFT JOIN `functional_group` AS `f` "
- " ON (`f`.`id` = `a`.`functional_group_id`)"
- " WHERE `a`.`application_id` = ?";
+const std::string kSelectAppGroups =
+ "SELECT `f`.`name` FROM `app_group` AS `a`"
+ " LEFT JOIN `functional_group` AS `f` "
+ " ON (`f`.`id` = `a`.`functional_group_id`)"
+ " WHERE `a`.`application_id` = ?";
const std::string kSelectNicknames = "SELECT DISTINCT `name` FROM `nickname` "
"WHERE `application_id` = ?";
@@ -584,85 +609,88 @@ const std::string kSelectNicknames = "SELECT DISTINCT `name` FROM `nickname` "
const std::string kSelectAppTypes = "SELECT DISTINCT `name` FROM `app_type` "
"WHERE `application_id` = ?";
-const std::string kSelectRequestTypes =
- "SELECT DISTINCT `request_type` FROM `request_type` WHERE `application_id` = ?";
+const std::string kSelectRequestTypes = "SELECT DISTINCT `request_type` FROM "
+ "`request_type` WHERE `application_id` "
+ "= ?";
const std::string kSelectSecondsBetweenRetries =
- "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
+ "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
const std::string kSelectIgnitionCycles =
- "SELECT `c`.`exchange_after_x_ignition_cycles`, "
- " `m`.`ignition_cycles_since_last_exchange` "
- " FROM `module_config` AS `c`, `module_meta` AS `m` "
- "LIMIT 1";
+ "SELECT `c`.`exchange_after_x_ignition_cycles`, "
+ " `m`.`ignition_cycles_since_last_exchange` "
+ " FROM `module_config` AS `c`, `module_meta` AS `m` "
+ "LIMIT 1";
const std::string kSelectKilometers =
- "SELECT `c`.`exchange_after_x_kilometers`, "
- " `m`.`pt_exchanged_at_odometer_x` "
- " FROM `module_config` AS `c`, `module_meta` AS `m` "
- "LIMIT 1";
+ "SELECT `c`.`exchange_after_x_kilometers`, "
+ " `m`.`pt_exchanged_at_odometer_x` "
+ " FROM `module_config` AS `c`, `module_meta` AS `m` "
+ "LIMIT 1";
-const std::string kSelectDays = "SELECT `c`.`exchange_after_x_days`, "
- " `m`.`pt_exchanged_x_days_after_epoch` "
- " FROM `module_config` AS `c`, `module_meta` AS `m` "
- "LIMIT 1";
+const std::string kSelectDays =
+ "SELECT `c`.`exchange_after_x_days`, "
+ " `m`.`pt_exchanged_x_days_after_epoch` "
+ " FROM `module_config` AS `c`, `module_meta` AS `m` "
+ "LIMIT 1";
const std::string kIncrementIgnitionCycles =
- "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 1 + "
- " `ignition_cycles_since_last_exchange`";
+ "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 1 + "
+ " `ignition_cycles_since_last_exchange`";
const std::string kResetIgnitionCycles =
- "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 0";
+ "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 0";
const std::string kSelectTimeoutResponse =
- "SELECT `timeout_after_x_seconds` FROM `module_config` LIMIT 1";
+ "SELECT `timeout_after_x_seconds` FROM `module_config` LIMIT 1";
const std::string kUpdateFlagUpdateRequired =
- "UPDATE `module_meta` SET `flag_update_required` = ?";
+ "UPDATE `module_meta` SET `flag_update_required` = ?";
const std::string kSelectFlagUpdateRequired =
- "SELECT `flag_update_required` FROM `module_meta` LIMIT 1";
+ "SELECT `flag_update_required` FROM `module_meta` LIMIT 1";
const std::string kUpdateCountersSuccessfulUpdate =
- "UPDATE `module_meta` SET `pt_exchanged_at_odometer_x` = ?,"
- "`pt_exchanged_x_days_after_epoch` = ?";
+ "UPDATE `module_meta` SET `pt_exchanged_at_odometer_x` = ?,"
+ "`pt_exchanged_x_days_after_epoch` = ?";
const std::string kDeleteApplication = "DELETE FROM `application`";
const std::string kDeleteRequestType = "DELETE FROM `request_type`";
const std::string kSelectApplicationRevoked =
- "SELECT `is_revoked` FROM `application` WHERE `id` = ?";
+ "SELECT `is_revoked` FROM `application` WHERE `id` = ?";
const std::string kUpdateApplicationCustomData =
- "UPDATE `application` SET `is_revoked` = ?, `is_default` = ?,"
- "`is_predata` = ? WHERE `id` = ?";
+ "UPDATE `application` SET `is_revoked` = ?, `is_default` = ?,"
+ "`is_predata` = ? WHERE `id` = ?";
const std::string kSelectApplicationRepresented =
- "SELECT COUNT(`id`) FROM `application` WHERE `id` = ?";
+ "SELECT COUNT(`id`) FROM `application` WHERE `id` = ?";
const std::string kSelectApplicationIsDefault =
- "SELECT `is_default` FROM `application` WHERE `id` = ?";
+ "SELECT `is_default` FROM `application` WHERE `id` = ?";
const std::string kUpdateIsDefault =
- "UPDATE `application` SET `is_default` = ? WHERE `id` = ?";
+ "UPDATE `application` SET `is_default` = ? WHERE `id` = ?";
const std::string kDeleteDevice = "DELETE FROM `device` WHERE `id` = ?";
const std::string kDeleteAppGroupByApplicationId =
- "DELETE FROM `app_group` WHERE `application_id` = ?";
+ "DELETE FROM `app_group` WHERE `application_id` = ?";
const std::string kInsertApplicationFull =
- "INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, `is_predata`, "
- " `memory_kb`, `heart_beat_timeout_ms`, `certificate`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ "INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, "
+ " `memory_kb`, `heart_beat_timeout_ms`, `certificate`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
- "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
- " `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = ?";
-
-} // namespace sql_pt
-} // namespace policy
+ "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
+ " `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
+ " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = "
+ "?";
+} // namespace sql_pt
+} // namespace policy
diff --git a/src/components/policy/src/policy/src/sql_pt_representation.cc b/src/components/policy/src/policy/src/sql_pt_representation.cc
index 47eae02dd7..9fd1f53782 100644
--- a/src/components/policy/src/policy/src/sql_pt_representation.cc
+++ b/src/components/policy/src/policy/src/sql_pt_representation.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -49,7 +49,7 @@ namespace policy {
CREATE_LOGGERPTR_GLOBAL(logger_, "SQLPTRepresentation")
namespace {
-template<typename T, typename K> void InsertUnique(K value, T* array) {
+template <typename T, typename K> void InsertUnique(K value, T *array) {
uint32_t i = 0;
for (; i < array->size() && array->at(i) != value; ++i) {
continue;
@@ -58,18 +58,18 @@ template<typename T, typename K> void InsertUnique(K value, T* array) {
array->push_back(value);
}
}
-} // namespace
+} // namespace
const std::string SQLPTRepresentation::kDatabaseName = "policy";
SQLPTRepresentation::SQLPTRepresentation()
- : db_(new dbms::SQLDatabase(kDatabaseName)) {
+ : db_(new dbms::SQLDatabase(kDatabaseName)) {
#ifndef __QNX__
std::string path = profile::Profile::instance()->app_storage_folder();
if (!path.empty()) {
db_->set_path(path + "/");
}
-#endif // __QNX__
+#endif // __QNX__
}
SQLPTRepresentation::~SQLPTRepresentation() {
@@ -77,16 +77,15 @@ SQLPTRepresentation::~SQLPTRepresentation() {
delete db_;
}
-void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
- const PTString& hmi_level,
- const PTString& rpc,
- CheckPermissionResult& result) {
+void SQLPTRepresentation::CheckPermissions(const PTString &app_id,
+ const PTString &hmi_level,
+ const PTString &rpc,
+ CheckPermissionResult &result) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect select statement from rpcs" << query.LastError().text());
+ LOG4CXX_WARN(logger_, "Incorrect select statement from rpcs"
+ << query.LastError().text());
return;
}
query.Bind(0, app_id);
@@ -95,11 +94,10 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
bool ret = query.Next();
result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed;
- LOG4CXX_INFO(
- logger_,
- "Level is "
- << (result.hmi_level_permitted == kRpcAllowed ? "permitted"
- : "not permitted"));
+ LOG4CXX_INFO(logger_, "Level is "
+ << (result.hmi_level_permitted == kRpcAllowed
+ ? "permitted"
+ : "not permitted"));
std::string parameter;
while (ret) {
if (!query.IsNull(0)) {
@@ -140,8 +138,8 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) {
int limit = query.GetInteger(0);
int last = query.GetInteger(1);
- if (limit < 0 || last < 0 || current < 0 || current < last
- || limit < (current - last)) {
+ if (limit < 0 || last < 0 || current < 0 || current < last ||
+ limit < (current - last)) {
return 0;
}
@@ -149,7 +147,7 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) {
}
bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
- int kilometers, int days_after_epoch) {
+ int kilometers, int days_after_epoch) {
LOG4CXX_AUTO_TRACE(logger_);
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) {
@@ -179,8 +177,8 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) {
return limit;
}
- if (limit < 0 || last < 0 || current < 0 || current < last
- || limit < (current - last)) {
+ if (limit < 0 || last < 0 || current < 0 || current < last ||
+ limit < (current - last)) {
return 0;
}
@@ -197,7 +195,7 @@ int SQLPTRepresentation::TimeoutResponse() {
return query.GetInteger(0);
}
-bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
+bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int> *seconds) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
LOG4CXX_INFO(logger_,
@@ -211,7 +209,7 @@ bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
}
std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language) {
+ const std::vector<std::string> &msg_codes, const std::string &language) {
std::vector<UserFriendlyMessage> result;
std::vector<std::string>::const_iterator it = msg_codes.begin();
std::vector<std::string>::const_iterator it_end = msg_codes.end();
@@ -225,7 +223,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg(
EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
LOG4CXX_INFO(logger_, "SQLPTRepresentation::GetUpdateUrls for "
- << service_type);
+ << service_type);
dbms::SQLQuery query(db());
EndpointUrls ret;
if (query.Prepare(sql_pt::kSelectEndpoint)) {
@@ -252,7 +250,7 @@ std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
query.Bind(0, std::string("lock_screen_icon_url"));
query.Bind(1, std::string("default"));
- if(!query.Exec()) {
+ if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
return ret;
}
@@ -267,13 +265,12 @@ std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
return ret;
}
-
-int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
+int SQLPTRepresentation::GetNotificationsNumber(const std::string &priority) {
LOG4CXX_INFO(logger_, "GetNotificationsNumber");
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for priority "
- "notification number.");
+ "notification number.");
return 0;
}
query.Bind(0, priority);
@@ -289,8 +286,8 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
return 0;
}
-bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
- std::string* priority) {
+bool SQLPTRepresentation::GetPriority(const std::string &policy_app_id,
+ std::string *priority) {
LOG4CXX_INFO(logger_, "GetPriority");
if (NULL == priority) {
LOG4CXX_WARN(logger_, "Input priority parameter is null.");
@@ -332,12 +329,12 @@ InitResult SQLPTRepresentation::Init() {
const uint16_t open_attempt_timeout_ms =
profile::Profile::instance()->open_attempt_timeout_ms();
const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000;
- LOG4CXX_DEBUG(logger_, "Open attempt timeout(ms) is: "
- << open_attempt_timeout_ms);
+ LOG4CXX_DEBUG(logger_,
+ "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
for (int i = 0; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
- LOG4CXX_INFO(logger_, "Attempt: " << i+1);
- if (db_->Open()){
+ LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ if (db_->Open()) {
LOG4CXX_INFO(logger_, "Database opened.");
is_opened = true;
break;
@@ -345,9 +342,9 @@ InitResult SQLPTRepresentation::Init() {
}
if (!is_opened) {
LOG4CXX_ERROR(logger_, "Open retry sequence failed. Tried "
- << attempts << " attempts with "
- << open_attempt_timeout_ms
- << " open timeout(ms) for each.");
+ << attempts << " attempts with "
+ << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
return InitResult::FAIL;
}
}
@@ -356,7 +353,7 @@ InitResult SQLPTRepresentation::Init() {
LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
return InitResult::FAIL;
}
-#endif // __QNX__
+#endif // __QNX__
dbms::SQLQuery check_pages(db());
if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) {
LOG4CXX_WARN(logger_, "Incorrect pragma for page counting.");
@@ -372,7 +369,7 @@ InitResult SQLPTRepresentation::Init() {
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
LOG4CXX_INFO(logger_, "Selecting is first run "
- << check_first_run.GetBoolean(0));
+ << check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
dbms::SQLQuery set_not_first_run(db());
set_not_first_run.Exec(sql_pt::kSetNotFirstRun);
@@ -394,15 +391,13 @@ InitResult SQLPTRepresentation::Init() {
}
dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed creating schema of database: " << query.LastError().text());
+ LOG4CXX_ERROR(logger_, "Failed creating schema of database: "
+ << query.LastError().text());
return InitResult::FAIL;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed insert init data to database: " << query.LastError().text());
+ LOG4CXX_ERROR(logger_, "Failed insert init data to database: "
+ << query.LastError().text());
return InitResult::FAIL;
}
return InitResult::SUCCESS;
@@ -413,9 +408,7 @@ bool SQLPTRepresentation::Close() {
return db_->LastError().number() == dbms::OK;
}
-VehicleData SQLPTRepresentation::GetVehicleData() {
- return VehicleData();
-}
+VehicleData SQLPTRepresentation::GetVehicleData() { return VehicleData(); }
bool SQLPTRepresentation::Drop() {
dbms::SQLQuery query(db());
@@ -427,21 +420,18 @@ bool SQLPTRepresentation::Drop() {
return true;
}
-void SQLPTRepresentation::WriteDb() {
- db_->Backup();
-}
+void SQLPTRepresentation::WriteDb() { db_->Backup(); }
bool SQLPTRepresentation::Clear() {
dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteData)) {
LOG4CXX_ERROR(logger_,
- "Failed clearing database: " << query.LastError().text());
+ "Failed clearing database: " << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed insert init data to database: " << query.LastError().text());
+ LOG4CXX_ERROR(logger_, "Failed insert init data to database: "
+ << query.LastError().text());
return false;
}
return true;
@@ -455,15 +445,13 @@ bool SQLPTRepresentation::RefreshDB() {
return false;
}
if (!query.Exec(sql_pt::kCreateSchema)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed creating schema of database: " << query.LastError().text());
+ LOG4CXX_ERROR(logger_, "Failed creating schema of database: "
+ << query.LastError().text());
return false;
}
if (!query.Exec(sql_pt::kInsertInitData)) {
- LOG4CXX_ERROR(
- logger_,
- "Failed insert init data to database: " << query.LastError().text());
+ LOG4CXX_ERROR(logger_, "Failed insert init data to database: "
+ << query.LastError().text());
return false;
}
return true;
@@ -479,20 +467,20 @@ SQLPTRepresentation::GenerateSnapshot() const {
GatherDeviceData(&*table->policy_table.device_data);
GatherFunctionalGroupings(&table->policy_table.functional_groupings);
GatherConsumerFriendlyMessages(
- &*table->policy_table.consumer_friendly_messages);
+ &*table->policy_table.consumer_friendly_messages);
GatherApplicationPoliciesSection(&table->policy_table.app_policies_section);
return table;
}
void SQLPTRepresentation::GatherModuleMeta(
- policy_table::ModuleMeta* meta) const {
+ policy_table::ModuleMeta *meta) const {
LOG4CXX_INFO(logger_, "Gather Module Meta Info");
meta->mark_initialized();
// Section Module Meta is empty for SDL specific
}
void SQLPTRepresentation::GatherModuleConfig(
- policy_table::ModuleConfig* config) const {
+ policy_table::ModuleConfig *config) const {
LOG4CXX_INFO(logger_, "Gather Configuration Info");
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) {
@@ -506,6 +494,7 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_make = query.GetString(5);
*config->vehicle_model = query.GetString(6);
*config->vehicle_year = query.GetString(7);
+ *config->certificate = query.GetString(8);
}
dbms::SQLQuery endpoints(db());
@@ -514,7 +503,7 @@ void SQLPTRepresentation::GatherModuleConfig(
} else {
while (endpoints.Next()) {
config->endpoints[endpoints.GetString(1)][endpoints.GetString(2)]
- .push_back(endpoints.GetString(0));
+ .push_back(endpoints.GetString(0));
}
}
@@ -524,7 +513,7 @@ void SQLPTRepresentation::GatherModuleConfig(
} else {
while (notifications.Next()) {
config->notifications_per_minute_by_priority[notifications.GetString(0)] =
- notifications.GetInteger(1);
+ notifications.GetInteger(1);
}
}
dbms::SQLQuery seconds(db());
@@ -539,7 +528,7 @@ void SQLPTRepresentation::GatherModuleConfig(
}
bool SQLPTRepresentation::GatherUsageAndErrorCounts(
- policy_table::UsageAndErrorCounts* counts) const {
+ policy_table::UsageAndErrorCounts *counts) const {
LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectAppLevels)) {
@@ -553,7 +542,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts(
}
void SQLPTRepresentation::GatherDeviceData(
- policy_table::DeviceData* data) const {
+ policy_table::DeviceData *data) const {
LOG4CXX_INFO(logger_, "Gather device data.");
data->mark_initialized();
@@ -568,7 +557,7 @@ void SQLPTRepresentation::GatherDeviceData(
}
bool SQLPTRepresentation::GatherFunctionalGroupings(
- policy_table::FunctionalGroupings* groups) const {
+ policy_table::FunctionalGroupings *groups) const {
LOG4CXX_INFO(logger_, "Gather Functional Groupings info");
dbms::SQLQuery func_group(db());
if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) {
@@ -611,7 +600,7 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
}
bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
- policy_table::ConsumerFriendlyMessages* messages) const {
+ policy_table::ConsumerFriendlyMessages *messages) const {
LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages");
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) {
@@ -623,7 +612,7 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
}
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
- policy_table::ApplicationPoliciesSection* policies) const {
+ policy_table::ApplicationPoliciesSection *policies) const {
LOG4CXX_INFO(logger_, "Gather applications policies");
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppPolicies)) {
@@ -633,7 +622,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
while (query.Next()) {
rpc::Nullable<policy_table::ApplicationParams> params;
- const std::string& app_id = query.GetString(0);
+ const std::string &app_id = query.GetString(0);
if (IsApplicationRevoked(app_id)) {
params.set_to_null();
(*policies).apps[app_id] = params;
@@ -679,14 +668,15 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
return true;
}
-bool SQLPTRepresentation::Save(const policy_table::Table& table) {
+bool SQLPTRepresentation::Save(const policy_table::Table &table) {
LOG4CXX_AUTO_TRACE(logger_);
db_->BeginTransaction();
if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) {
db_->RollbackTransaction();
return false;
}
- if (!SaveApplicationPoliciesSection(table.policy_table.app_policies_section)) {
+ if (!SaveApplicationPoliciesSection(
+ table.policy_table.app_policies_section)) {
db_->RollbackTransaction();
return false;
}
@@ -695,7 +685,7 @@ bool SQLPTRepresentation::Save(const policy_table::Table& table) {
return false;
}
if (!SaveConsumerFriendlyMessages(
- *table.policy_table.consumer_friendly_messages)) {
+ *table.policy_table.consumer_friendly_messages)) {
db_->RollbackTransaction();
return false;
}
@@ -717,7 +707,7 @@ bool SQLPTRepresentation::Save(const policy_table::Table& table) {
}
bool SQLPTRepresentation::SaveFunctionalGroupings(
- const policy_table::FunctionalGroupings& groups) {
+ const policy_table::FunctionalGroupings &groups) {
dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteRpc)) {
LOG4CXX_WARN(logger_, "Incorrect delete from rpc.");
@@ -748,8 +738,9 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
// to avoid ambiguity.
query.Bind(0, static_cast<int64_t>(id));
query.Bind(1, it->first);
- it->second.user_consent_prompt.is_initialized() ?
- query.Bind(2, *(it->second.user_consent_prompt)) : query.Bind(2);
+ it->second.user_consent_prompt.is_initialized()
+ ? query.Bind(2, *(it->second.user_consent_prompt))
+ : query.Bind(2);
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into functional groups");
@@ -764,20 +755,20 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
}
bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
- const policy_table::Rpc& rpcs) {
+ const policy_table::Rpc &rpcs) {
dbms::SQLQuery query(db());
dbms::SQLQuery query_parameter(db());
- if (!query.Prepare(sql_pt::kInsertRpc)
- || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) {
+ if (!query.Prepare(sql_pt::kInsertRpc) ||
+ !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc");
return false;
}
policy_table::Rpc::const_iterator it;
for (it = rpcs.begin(); it != rpcs.end(); ++it) {
- const policy_table::HmiLevels& hmi_levels = it->second.hmi_levels;
+ const policy_table::HmiLevels &hmi_levels = it->second.hmi_levels;
// TODO(IKozyrenko): Check logic if optional container is missing
- const policy_table::Parameters& parameters = *it->second.parameters;
+ const policy_table::Parameters &parameters = *it->second.parameters;
policy_table::HmiLevels::const_iterator hmi_it;
policy_table::Parameters::const_iterator ps_it;
for (hmi_it = hmi_levels.begin(); hmi_it != hmi_levels.end(); ++hmi_it) {
@@ -785,9 +776,9 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
for (ps_it = parameters.begin(); ps_it != parameters.end(); ++ps_it) {
query_parameter.Bind(0, it->first);
query_parameter.Bind(
- 1, std::string(policy_table::EnumToJsonString(*hmi_it)));
+ 1, std::string(policy_table::EnumToJsonString(*hmi_it)));
query_parameter.Bind(
- 2, std::string(policy_table::EnumToJsonString(*ps_it)));
+ 2, std::string(policy_table::EnumToJsonString(*ps_it)));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
@@ -810,7 +801,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
}
bool SQLPTRepresentation::SaveApplicationPoliciesSection(
- const policy_table::ApplicationPoliciesSection& policies) {
+ const policy_table::ApplicationPoliciesSection &policies) {
dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
@@ -863,20 +854,23 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
}
bool SQLPTRepresentation::SaveSpecificAppPolicy(
- const policy_table::ApplicationPolicies::value_type& app) {
+ const policy_table::ApplicationPolicies::value_type &app) {
dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application (device).");
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert statement into application (device).");
return false;
}
app_query.Bind(0, app.first);
- app_query.Bind(1, std::string(policy_table::EnumToJsonString(app.second.priority)));
+ app_query.Bind(
+ 1, std::string(policy_table::EnumToJsonString(app.second.priority)));
app_query.Bind(2, app.second.is_null());
app_query.Bind(3, *app.second.memory_kb);
app_query.Bind(4, *app.second.heart_beat_timeout_ms);
- app.second.certificate.is_initialized() ?
- app_query.Bind(5, *app.second.certificate) : app_query.Bind(5);
+ app.second.certificate.is_initialized()
+ ? app_query.Bind(5, *app.second.certificate)
+ : app_query.Bind(5);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -911,7 +905,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
}
bool policy::SQLPTRepresentation::SaveDevicePolicy(
- const policy_table::DevicePolicy& device) {
+ const policy_table::DevicePolicy &device) {
dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
@@ -919,7 +913,8 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
}
app_query.Bind(0, kDeviceId);
- app_query.Bind(1, std::string(policy_table::EnumToJsonString(device.priority)));
+ app_query.Bind(1,
+ std::string(policy_table::EnumToJsonString(device.priority)));
app_query.Bind(2, false);
app_query.Bind(3, 0);
app_query.Bind(4, 0);
@@ -938,7 +933,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
}
bool SQLPTRepresentation::SaveAppGroup(
- const std::string& app_id, const policy_table::Strings& app_groups) {
+ const std::string &app_id, const policy_table::Strings &app_groups) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppGroup)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for app group");
@@ -952,9 +947,8 @@ bool SQLPTRepresentation::SaveAppGroup(
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect insert into app group." << query.LastError().text());
+ LOG4CXX_WARN(logger_, "Incorrect insert into app group."
+ << query.LastError().text());
return false;
}
}
@@ -962,8 +956,8 @@ bool SQLPTRepresentation::SaveAppGroup(
return true;
}
-bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
- const policy_table::Strings& nicknames) {
+bool SQLPTRepresentation::SaveNickname(const std::string &app_id,
+ const policy_table::Strings &nicknames) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNickname)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname");
@@ -983,8 +977,8 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
return true;
}
-bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
- const policy_table::AppHMITypes& types) {
+bool SQLPTRepresentation::SaveAppType(const std::string &app_id,
+ const policy_table::AppHMITypes &types) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for app type");
@@ -1005,8 +999,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
}
bool SQLPTRepresentation::SaveRequestType(
- const std::string& app_id,
- const policy_table::RequestTypes& types) {
+ const std::string &app_id, const policy_table::RequestTypes &types) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
@@ -1026,33 +1019,35 @@ bool SQLPTRepresentation::SaveRequestType(
return true;
}
-bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
+bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta &meta) {
// Section Module Meta is empty for SDL specific
return true;
}
bool SQLPTRepresentation::SaveModuleConfig(
- const policy_table::ModuleConfig& config) {
+ const policy_table::ModuleConfig &config) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateModuleConfig)) {
LOG4CXX_WARN(logger_, "Incorrect update statement for module config");
return false;
}
- bool is_preloaded = config.preloaded_pt.is_initialized() &&
- *config.preloaded_pt;
+ bool is_preloaded =
+ config.preloaded_pt.is_initialized() && *config.preloaded_pt;
query.Bind(0, is_preloaded);
query.Bind(1, config.exchange_after_x_ignition_cycles);
query.Bind(2, config.exchange_after_x_kilometers);
query.Bind(3, config.exchange_after_x_days);
query.Bind(4, config.timeout_after_x_seconds);
- config.vehicle_make.is_initialized() ?
- query.Bind(5, *(config.vehicle_make)) : query.Bind(5);
- config.vehicle_model.is_initialized() ?
- query.Bind(6, *(config.vehicle_model)) : query.Bind(6);
- config.vehicle_year.is_initialized() ?
- query.Bind(7, *(config.vehicle_year)) : query.Bind(7);
+ config.vehicle_make.is_initialized() ? query.Bind(5, *(config.vehicle_make))
+ : query.Bind(5);
+ config.vehicle_model.is_initialized() ? query.Bind(6, *(config.vehicle_model))
+ : query.Bind(6);
+ config.vehicle_year.is_initialized() ? query.Bind(7, *(config.vehicle_year))
+ : query.Bind(7);
+ config.certificate.is_initialized() ? query.Bind(8, *(config.certificate))
+ : query.Bind(8);
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
@@ -1064,7 +1059,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
}
if (!SaveNumberOfNotificationsPerMinute(
- config.notifications_per_minute_by_priority)) {
+ config.notifications_per_minute_by_priority)) {
return false;
}
@@ -1076,7 +1071,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
}
bool SQLPTRepresentation::SaveServiceEndpoints(
- const policy_table::ServiceEndpoints& endpoints) {
+ const policy_table::ServiceEndpoints &endpoints) {
dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteEndpoint)) {
LOG4CXX_WARN(logger_, "Incorrect delete from endpoint.");
@@ -1090,10 +1085,10 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
policy_table::ServiceEndpoints::const_iterator it;
for (it = endpoints.begin(); it != endpoints.end(); ++it) {
- const policy_table::URLList& apps = it->second;
+ const policy_table::URLList &apps = it->second;
policy_table::URLList::const_iterator app_it;
for (app_it = apps.begin(); app_it != apps.end(); ++app_it) {
- const policy_table::URL& urls = app_it->second;
+ const policy_table::URL &urls = app_it->second;
policy_table::URL::const_iterator url_it;
for (url_it = urls.begin(); url_it != urls.end(); ++url_it) {
query.Bind(0, it->first);
@@ -1111,7 +1106,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
}
bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
- const policy_table::ConsumerFriendlyMessages& messages) {
+ const policy_table::ConsumerFriendlyMessages &messages) {
LOG4CXX_AUTO_TRACE(logger_);
// According CRS-2419 If there is no “consumer_friendly_messages” key,
@@ -1137,11 +1132,12 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
policy_table::Messages::const_iterator it;
// TODO(IKozyrenko): Check logic if optional container is missing
- for (it = messages.messages->begin(); it != messages.messages->end(); ++it) {
+ for (it = messages.messages->begin(); it != messages.messages->end();
+ ++it) {
if (!SaveMessageType(it->first)) {
return false;
}
- const policy_table::Languages& langs = it->second.languages;
+ const policy_table::Languages &langs = it->second.languages;
policy_table::Languages::const_iterator lang_it;
for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) {
if (!SaveLanguage(lang_it->first)) {
@@ -1159,7 +1155,7 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
return true;
}
-bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
+bool SQLPTRepresentation::SaveMessageType(const std::string &type) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for message type.");
@@ -1175,7 +1171,7 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
return true;
}
-bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
+bool SQLPTRepresentation::SaveLanguage(const std::string &code) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertLanguage)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for language.");
@@ -1192,14 +1188,14 @@ bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
}
bool SQLPTRepresentation::SaveMessageString(
- const std::string& type, const std::string& lang,
- const policy_table::MessageString& strings) {
+ const std::string &type, const std::string &lang,
+ const policy_table::MessageString &strings) {
// Section is empty for SDL specific
return true;
}
bool SQLPTRepresentation::SaveSecondsBetweenRetries(
- const policy_table::SecondsBetweenRetries& seconds) {
+ const policy_table::SecondsBetweenRetries &seconds) {
dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) {
LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
@@ -1224,7 +1220,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
}
bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
- const policy_table::NumberOfNotificationsPerMinute& notifications) {
+ const policy_table::NumberOfNotificationsPerMinute &notifications) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) {
LOG4CXX_WARN(logger_,
@@ -1246,7 +1242,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
}
bool SQLPTRepresentation::SaveDeviceData(
- const policy_table::DeviceData& devices) {
+ const policy_table::DeviceData &devices) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertDeviceData)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
@@ -1266,8 +1262,8 @@ bool SQLPTRepresentation::SaveDeviceData(
}
bool SQLPTRepresentation::SaveUsageAndErrorCounts(
- const policy_table::UsageAndErrorCounts& counts) {
- const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized();
+ const policy_table::UsageAndErrorCounts &counts) {
+ const_cast<policy_table::UsageAndErrorCounts &>(counts).mark_initialized();
dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
@@ -1279,8 +1275,8 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
}
policy_table::AppLevels::const_iterator it;
- const policy_table::AppLevels& app_levels = *counts.app_level;
- const_cast<policy_table::AppLevels&>(*counts.app_level).mark_initialized();
+ const policy_table::AppLevels &app_levels = *counts.app_level;
+ const_cast<policy_table::AppLevels &>(*counts.app_level).mark_initialized();
for (it = app_levels.begin(); it != app_levels.end(); ++it) {
query.Bind(0, it->first);
if (!query.Exec()) {
@@ -1322,8 +1318,8 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) {
if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/
"UPDATE `module_meta` SET `flag_update_required` = ?")) {
LOG4CXX_WARN(logger_,
- "Incorrect update into module meta (update_required): " <<
- strerror(errno));
+ "Incorrect update into module meta (update_required): "
+ << strerror(errno));
return;
}
query.Bind(0, value);
@@ -1332,9 +1328,9 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) {
}
}
-bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
- StringArray* nicknames,
- StringArray* app_types) {
+bool SQLPTRepresentation::GetInitialAppData(const std::string &app_id,
+ StringArray *nicknames,
+ StringArray *app_types) {
LOG4CXX_INFO(logger_, "Getting initial application data.");
dbms::SQLQuery app_names(db());
if (!app_names.Prepare(sql_pt::kSelectNicknames)) {
@@ -1360,13 +1356,13 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
}
bool SQLPTRepresentation::GetFunctionalGroupings(
- policy_table::FunctionalGroupings& groups) {
+ policy_table::FunctionalGroupings &groups) {
LOG4CXX_INFO(logger_, "GetFunctionalGroupings");
return GatherFunctionalGroupings(&groups);
}
bool SQLPTRepresentation::GatherAppType(
- const std::string& app_id, policy_table::AppHMITypes* app_types) const {
+ const std::string &app_id, policy_table::AppHMITypes *app_types) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppTypes)) {
LOG4CXX_WARN(logger_, "Incorrect select from app types");
@@ -1385,8 +1381,8 @@ bool SQLPTRepresentation::GatherAppType(
}
bool SQLPTRepresentation::GatherRequestType(
- const std::string& app_id,
- policy_table::RequestTypes* request_types) const {
+ const std::string &app_id,
+ policy_table::RequestTypes *request_types) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestTypes)) {
LOG4CXX_WARN(logger_, "Incorrect select from request types.");
@@ -1405,7 +1401,7 @@ bool SQLPTRepresentation::GatherRequestType(
}
bool SQLPTRepresentation::GatherNickName(
- const std::string& app_id, policy_table::Strings* nicknames) const {
+ const std::string &app_id, policy_table::Strings *nicknames) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNicknames)) {
LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
@@ -1420,7 +1416,7 @@ bool SQLPTRepresentation::GatherNickName(
}
bool SQLPTRepresentation::GatherAppGroup(
- const std::string& app_id, policy_table::Strings* app_groups) const {
+ const std::string &app_id, policy_table::Strings *app_groups) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppGroups)) {
LOG4CXX_WARN(logger_, "Incorrect select from app groups");
@@ -1434,7 +1430,7 @@ bool SQLPTRepresentation::GatherAppGroup(
return true;
}
-bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
+bool SQLPTRepresentation::SaveApplicationCustomData(const std::string &app_id,
bool is_revoked,
bool is_default,
bool is_predata) {
@@ -1458,7 +1454,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
}
bool SQLPTRepresentation::IsApplicationRevoked(
- const std::string& app_id) const {
+ const std::string &app_id) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) {
@@ -1472,9 +1468,9 @@ bool SQLPTRepresentation::IsApplicationRevoked(
return false;
}
return query.IsNull(0) ? false : query.GetBoolean(0);
- }
+}
bool SQLPTRepresentation::IsApplicationRepresented(
- const std::string& app_id) const {
+ const std::string &app_id) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) {
LOG4CXX_WARN(logger_, "Incorrect select application by id");
@@ -1489,7 +1485,7 @@ bool SQLPTRepresentation::IsApplicationRepresented(
return query.GetInteger(0) != 0;
}
-bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const {
+bool SQLPTRepresentation::IsDefaultPolicy(const std::string &app_id) const {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) {
LOG4CXX_WARN(logger_, "Incorrect select application by id");
@@ -1504,11 +1500,11 @@ bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const {
return query.IsNull(0) ? false : query.GetBoolean(0);
}
-bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const {
+bool SQLPTRepresentation::IsPredataPolicy(const std::string &app_id) const {
return false;
}
-bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
+bool SQLPTRepresentation::SetDefaultPolicy(const std::string &app_id) {
dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
@@ -1534,7 +1530,7 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
return false;
}
-bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
+bool SQLPTRepresentation::SetIsDefault(const std::string &app_id,
bool is_default) const {
LOG4CXX_TRACE(logger_, "Set flag is_default of application");
dbms::SQLQuery query(db());
@@ -1552,9 +1548,9 @@ bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
return true;
}
-dbms::SQLDatabase* SQLPTRepresentation::db() const {
+dbms::SQLDatabase *SQLPTRepresentation::db() const {
#ifdef __QNX__
- dbms::SQLDatabase* db = new dbms::SQLDatabase(kDatabaseName);
+ dbms::SQLDatabase *db = new dbms::SQLDatabase(kDatabaseName);
db->Open();
return db;
#else
@@ -1562,8 +1558,8 @@ dbms::SQLDatabase* SQLPTRepresentation::db() const {
#endif
}
-bool SQLPTRepresentation::CopyApplication(const std::string& source,
- const std::string& destination) {
+bool SQLPTRepresentation::CopyApplication(const std::string &source,
+ const std::string &destination) {
dbms::SQLQuery source_app(db());
if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) {
LOG4CXX_WARN(logger_, "Incorrect select statement from application.");
@@ -1585,10 +1581,8 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(1, source_app.GetBoolean(0));
source_app.IsNull(1) ? query.Bind(2)
: query.Bind(2, source_app.GetBoolean(1));
- source_app.IsNull(2) ? query.Bind(3)
- : query.Bind(3, source_app.GetString(2));
- source_app.IsNull(3) ? query.Bind(4)
- : query.Bind(4, source_app.GetString(3));
+ source_app.IsNull(2) ? query.Bind(3) : query.Bind(3, source_app.GetString(2));
+ source_app.IsNull(3) ? query.Bind(4) : query.Bind(4, source_app.GetString(3));
source_app.IsNull(4) ? query.Bind(5)
: query.Bind(5, source_app.GetBoolean(4));
source_app.IsNull(5) ? query.Bind(6)
@@ -1620,8 +1614,6 @@ void SQLPTRepresentation::SetPreloaded(bool value) {
}
}
-bool SQLPTRepresentation::SetVINValue(const std::string& value) {
- return true;
-}
+bool SQLPTRepresentation::SetVINValue(const std::string &value) { return true; }
-} // namespace policy
+} // namespace policy