diff options
Diffstat (limited to 'src/components/policy/policy_regular/src/policy_manager_impl.cc')
-rw-r--r-- | src/components/policy/policy_regular/src/policy_manager_impl.cc | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index b6101eb960..3a41cfa08b 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -87,8 +87,6 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { update_status_manager_.set_listener(listener); } -#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE - std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); @@ -96,23 +94,8 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( Json::Value value; if (reader.parse(json, &value)) { - return std::make_shared<policy_table::Table>(&value); - } else { - return std::make_shared<policy_table::Table>(); - } -} - -#else - -std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( - const BinaryMessage& pt_content) { - std::string json(pt_content.begin(), pt_content.end()); - utils::JsonReader reader; - Json::Value value; - - if (reader.parse(json, &value)) { // For PT Update received from SDL Server. - if (value["data"].size() != 0) { + if (value.isObject() && value["data"].isArray() && !value["data"].empty()) { Json::Value data = value["data"]; return std::make_shared<policy_table::Table>(&data[0]); } else { @@ -123,8 +106,6 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( } } -#endif - void PolicyManagerImpl::CheckTriggers() { SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); @@ -330,16 +311,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( SDL_LOG_DEBUG( "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); -#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE - // Assuemes Policy Table was parsed, formatted, and/or decrypted by - // the HMI after system request before calling OnReceivedPolicyUpdate - // Parse message into table struct std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); -#else - // Message Received from server unecnrypted with PTU in first element - // of 'data' array. No Parsing was done by HMI. - std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); -#endif if (!pt_update) { SDL_LOG_WARN("Parsed table pointer is NULL."); ; |