summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/hmi
diff options
context:
space:
mode:
authorokozlovlux <okozlov@luxoft.com>2017-02-20 19:16:07 +0200
committerokozlovlux <okozlov@luxoft.com>2017-05-17 19:27:11 +0300
commit6a3c65f64fb7e9e5a770476b3f664d57606af33a (patch)
treebc618e0ff31525d9157b1df098a5149efe557720 /src/components/application_manager/src/commands/hmi
parent8aadc5d6d51b49c381fb89fd4b1fbfebec732cc3 (diff)
downloadsdl_core-6a3c65f64fb7e9e5a770476b3f664d57606af33a.tar.gz
Add functionality for External UCS
- added functionality for External UCS: ON by the User - added UTs for policices External UCS: ON by the User - added perstistence for external user consent status received from system Fix issuies for HTTP and PROPRIETARY mode in mock policy handler - fixed issues in mock policy handler - fix coding style
Diffstat (limited to 'src/components/application_manager/src/commands/hmi')
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
index 2219d508ff..2e408dcae0 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
@@ -40,6 +40,7 @@
#include <string>
#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
+#include "utils/make_shared.h"
namespace {
@@ -75,19 +76,22 @@ struct PermissionsAppender
policy::PermissionConsent& consents_;
};
+#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Converts SmartObject data to customer connectivity status item and
* appends to collection
*/
-struct CCSStatusAppender
+struct ExternalConsentStatusAppender
: std::unary_function<void, const smart_objects::SmartArray::value_type&> {
- CCSStatusAppender(policy::CCSStatus& ccs_status) : ccs_status_(ccs_status) {}
+ ExternalConsentStatusAppender(
+ policy::ExternalConsentStatus& external_consent_status)
+ : external_consent_status_(external_consent_status) {}
void operator()(const smart_objects::SmartArray::value_type& item) const {
using namespace policy;
using namespace hmi_apis;
using namespace application_manager;
- CCSStatusItem status_item(
+ ExternalConsentStatusItem status_item(
static_cast<uint32_t>(item[strings::entity_type].asUInt()),
static_cast<uint32_t>(item[strings::entity_id].asUInt()),
static_cast<Common_EntityStatus::eType>(
@@ -95,13 +99,13 @@ struct CCSStatusAppender
? policy::kStatusOn
: policy::kStatusOff);
- ccs_status_.insert(status_item);
+ external_consent_status_.insert(status_item);
}
private:
- policy::CCSStatus& ccs_status_;
+ policy::ExternalConsentStatus& external_consent_status_;
};
-
+#endif
} // namespace
namespace application_manager {
@@ -122,15 +126,15 @@ void OnAppPermissionConsentNotification::Run() {
policy::PermissionConsent permission_consent;
- PermissionConsent permission_consent;
+ // If user defined group permissions for specific app
+ if (msg_params.keyExists(strings::app_id)) {
+ connection_key = msg_params[strings::app_id].asUInt();
+ }
+
if (msg_params.keyExists(strings::consented_functions)) {
- const SmartArray* user_consents =
+ const smart_objects::SmartArray* user_consent =
msg_params[strings::consented_functions].asArray();
- if (msg_params.keyExists("consentedFunctions")) {
- smart_objects::SmartArray* user_consent =
- msg_params["consentedFunctions"].asArray();
-
smart_objects::SmartArray::const_iterator it = user_consent->begin();
smart_objects::SmartArray::const_iterator it_end = user_consent->end();
for (; it != it_end; ++it) {
@@ -150,17 +154,23 @@ void OnAppPermissionConsentNotification::Run() {
permission_consent.consent_source = msg_params[strings::source].asString();
}
-
- CCSStatus ccs_status;
- if (msg_params.keyExists(strings::ccs_status)) {
- const SmartArray* system_ccs_status =
- msg_params[strings::ccs_status].asArray();
-
- application_manager_.GetPolicyHandler().OnAppPermissionConsent(
- connection_key, permission_consent);
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ policy::ExternalConsentStatus external_consent_status;
+ if (msg_params.keyExists(strings::external_consent_status)) {
+ const utils::SharedPtr<smart_objects::SmartArray>
+ system_external_consent_status =
+ msg_params[strings::external_consent_status].asArray();
+ ExternalConsentStatusAppender status_appender(external_consent_status);
+ std::for_each(system_external_consent_status->begin(),
+ system_external_consent_status->end(),
+ status_appender);
}
+ application_manager_.GetPolicyHandler().OnAppPermissionConsent(
+ connection_key, permission_consent, external_consent_status);
+#else
+ application_manager_.GetPolicyHandler().OnAppPermissionConsent(
+ connection_key, permission_consent);
+#endif
}
-
-} // namespace commands
-
+} // commands
} // namespace application_manager