summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Oleynik <aoleynik@luxoft.com>2016-04-07 10:32:33 +0300
committerAndrey Oleynik <aoleynik@luxoft.com>2016-04-11 10:36:31 +0300
commitd71ac02fbcff2b1f4f19b09b4496d0794ff70845 (patch)
tree0d62aa62bc117f181d7e8e91b801a7b49f806c36
parent220535a04280dd5c112a3913db84a295e5705204 (diff)
downloadsdl_core-d71ac02fbcff2b1f4f19b09b4496d0794ff70845.tar.gz
Wrapped extended policy logic with ifdef, code beautified.
Implements: APPLINK-22313 Conflicts: src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h36
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h31
-rw-r--r--src/components/application_manager/src/commands/hmi/on_received_policy_update.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_policy_update.cc16
4 files changed, 54 insertions, 40 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
index 0eeb28218f..4b61deef4f 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_received_policy_update.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,26 +40,26 @@ namespace application_manager {
namespace commands {
class OnReceivedPolicyUpdate : public NotificationFromHMI {
- public:
- /**
- * @brief OnReceivedPolicyUpdate class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit OnReceivedPolicyUpdate(const MessageSharedPtr& message);
-
- /**
- * @brief OnReceivedPolicyUpdate class destructor
+ public:
+ /**
+ * @brief OnReceivedPolicyUpdate class constructor
+ *
+ * @param message Incoming SmartObject message
**/
- virtual ~OnReceivedPolicyUpdate();
+ explicit OnReceivedPolicyUpdate(const MessageSharedPtr& message);
- /**
- * @brief Execute command
- **/
- virtual void Run();
+ /**
+ * @brief OnReceivedPolicyUpdate class destructor
+ **/
+ ~OnReceivedPolicyUpdate() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
- private:
- DISALLOW_COPY_AND_ASSIGN(OnReceivedPolicyUpdate);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnReceivedPolicyUpdate);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
index 481f37a257..9cffc8644d 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/sdl_policy_update.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,20 +40,23 @@ namespace application_manager {
namespace commands {
class SDLPolicyUpdate : public RequestToHMI {
- public:
- /**
- * @brief SDLPolicyUpdate class constructor
- *
- * @param message Incoming SmartObject message
- **/
- explicit SDLPolicyUpdate(const MessageSharedPtr& message);
- virtual ~SDLPolicyUpdate();
- /**
- * @brief Execute command
+ public:
+ /**
+ * @brief SDLPolicyUpdate class constructor
+ *
+ * @param message Incoming SmartObject message
**/
- virtual void Run();
- private:
- DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdate);
+ explicit SDLPolicyUpdate(const MessageSharedPtr& message);
+
+ ~SDLPolicyUpdate() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLPolicyUpdate);
};
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
index a5ea29c6d2..f739c762c7 100644
--- a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
+++ b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@ OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {
void OnReceivedPolicyUpdate::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+#ifdef EXTENDED_POLICY
const std::string& file_path =
(*message_)[strings::msg_params][hmi_notification::policyfile].asString();
policy::BinaryMessage file_content;
@@ -55,7 +56,13 @@ void OnReceivedPolicyUpdate::Run() {
LOG4CXX_ERROR(logger_, "Failed to read Update file.");
return;
}
- policy::PolicyHandler::instance()->ReceiveMessageFromSDK(file_path, file_content);
+ policy::PolicyHandler::instance()->ReceiveMessageFromSDK(file_path,
+ file_content);
+#else
+ LOG4CXX_WARN(logger_,
+ "This RPC is part of extended policy flow."
+ "Please re-build with extended policy mode enabled.");
+#endif
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
index b9c5aaa086..e1fe835224 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_policy_update.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,16 +36,20 @@ namespace application_manager {
namespace commands {
-SDLPolicyUpdate::SDLPolicyUpdate(
- const MessageSharedPtr& message): RequestToHMI(message) {
-}
+SDLPolicyUpdate::SDLPolicyUpdate(const MessageSharedPtr& message)
+ : RequestToHMI(message) {}
-SDLPolicyUpdate::~SDLPolicyUpdate() {
-}
+SDLPolicyUpdate::~SDLPolicyUpdate() {}
void SDLPolicyUpdate::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+#ifdef EXTENDED_POLICY
SendRequest();
+#else
+ LOG4CXX_WARN(logger_,
+ "This RPC is part of extended policy flow."
+ "Please re-build with extended policy mode enabled.");
+#endif
}
} // namespace commands