summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2019-09-23 15:18:16 -0400
committerGitHub <noreply@github.com>2019-09-23 15:18:16 -0400
commita2484ebd100ba1e3021193755bccf5c2d9afb02a (patch)
tree549c84a3c0723ef7fd73359a1ac9fb46a80d8769
parent40d1eb07e8e89f5626a69c2722253c6bf7cb2055 (diff)
parent649dfcc7eff429f290c14f3264447a0fe8f77a6e (diff)
downloadsdl_core-a2484ebd100ba1e3021193755bccf5c2d9afb02a.tar.gz
Merge pull request #3025 from smartdevicelink/fix/gather_consumer_messages
Fix reading of Consumer Friendly Messages in PROPRIETARY mode
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc18
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc27
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc27
3 files changed, 58 insertions, 14 deletions
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index 30eb7b4f38..c8a1b5d7ea 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -563,25 +563,23 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
msg.message_code = query.GetString(7);
std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
if (!msg.tts.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].tts =
- msg.tts;
+ *(specific_message).tts = msg.tts;
}
if (!msg.label.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].label =
- msg.label;
+ *(specific_message).label = msg.label;
}
if (!msg.line1.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].line1 =
- msg.line1;
+ *(specific_message).line1 = msg.line1;
}
if (!msg.line2.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].line2 =
- msg.line2;
+ *(specific_message).line2 = msg.line2;
}
if (!msg.text_body.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].textBody =
- msg.text_body;
+ *(specific_message).textBody = msg.text_body;
}
}
} else {
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index d8f137a52c..5af4cc5440 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -725,10 +725,33 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
if (query.Prepare(sql_pt::kCollectFriendlyMsg)) {
while (query.Next()) {
UserFriendlyMessage msg;
+
+ msg.tts = query.GetString(1);
+ msg.label = query.GetString(2);
+ msg.line1 = query.GetString(3);
+ msg.line2 = query.GetString(4);
+ msg.text_body = query.GetString(5);
msg.message_code = query.GetString(7);
- std::string language = query.GetString(6);
- (*messages->messages)[msg.message_code].languages[language];
+ std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
+ if (!msg.tts.empty()) {
+ *(specific_message).tts = msg.tts;
+ }
+ if (!msg.label.empty()) {
+ *(specific_message).label = msg.label;
+ }
+ if (!msg.line1.empty()) {
+ *(specific_message).line1 = msg.line1;
+ }
+ if (!msg.line2.empty()) {
+ *(specific_message).line2 = msg.line2;
+ }
+ if (!msg.text_body.empty()) {
+ *(specific_message).textBody = msg.text_body;
+ }
}
} else {
LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 60a4ef6021..7b2d01ef53 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -680,10 +680,33 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
if (query.Prepare(sql_pt::kCollectFriendlyMsg)) {
while (query.Next()) {
UserFriendlyMessage msg;
+
+ msg.tts = query.GetString(1);
+ msg.label = query.GetString(2);
+ msg.line1 = query.GetString(3);
+ msg.line2 = query.GetString(4);
+ msg.text_body = query.GetString(5);
msg.message_code = query.GetString(7);
- std::string language = query.GetString(6);
- (*messages->messages)[msg.message_code].languages[language];
+ std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
+ if (!msg.tts.empty()) {
+ *(specific_message).tts = msg.tts;
+ }
+ if (!msg.label.empty()) {
+ *(specific_message).label = msg.label;
+ }
+ if (!msg.line1.empty()) {
+ *(specific_message).line1 = msg.line1;
+ }
+ if (!msg.line2.empty()) {
+ *(specific_message).line2 = msg.line2;
+ }
+ if (!msg.text_body.empty()) {
+ *(specific_message).textBody = msg.text_body;
+ }
}
} else {
LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");