diff options
Diffstat (limited to 'src/components/application_manager/src/message_helper/message_helper.cc')
-rw-r--r-- | src/components/application_manager/src/message_helper/message_helper.cc | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 48cf1460f9..4a64fdb128 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1817,8 +1817,10 @@ bool MessageHelper::CreateHMIApplicationStruct( &secondary_device_info); } - message[strings::is_cloud_application] = app->is_cloud_app(); - if (app->is_cloud_app()) { + const bool is_cloud_app = app->is_cloud_app(); + message[strings::is_cloud_application] = is_cloud_app; + + if (is_cloud_app) { message[strings::cloud_connection_status] = app_mngr.GetCloudAppConnectionStatus(app); } @@ -1903,6 +1905,57 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( app_mngr.GetRPCService().ManageHMICommand(notification); } +smart_objects::SmartObjectSPtr +MessageHelper::CreateOnAppPropertiesChangeNotification( + const std::string& policy_app_id, ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); + smart_objects::SmartObjectSPtr notification = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Map); + + smart_objects::SmartObject& message = *notification; + message[strings::params][strings::function_id] = + hmi_apis::FunctionID::BasicCommunication_OnAppPropertiesChange; + message[strings::params][strings::message_type] = MessageType::kNotification; + + policy::AppProperties app_properties; + app_mngr.GetPolicyHandler().GetAppProperties(policy_app_id, app_properties); + + policy::StringArray nicknames; + policy::StringArray app_hmi_types; + + app_mngr.GetPolicyHandler().GetInitialAppData( + policy_app_id, &nicknames, &app_hmi_types); + + smart_objects::SmartObject properties(smart_objects::SmartType_Map); + properties[strings::policy_app_id] = policy_app_id; + properties[strings::enabled] = app_properties.enabled; + + smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array); + size_t i = 0; + for (const auto& nickname : nicknames) { + nicknames_array[i++] = nickname; + } + properties[strings::nicknames] = nicknames_array; + + if (!app_properties.auth_token.empty()) { + properties[strings::auth_token] = app_properties.auth_token; + } + if (!app_properties.transport_type.empty()) { + properties[strings::transport_type] = app_properties.transport_type; + } + if (!app_properties.hybrid_app_preference.empty()) { + properties[strings::hybrid_app_preference] = + app_properties.hybrid_app_preference; + } + if (!app_properties.endpoint.empty()) { + properties[strings::endpoint] = app_properties.endpoint; + } + + message[strings::msg_params][strings::properties] = properties; + return notification; +} + smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( ApplicationConstSharedPtr app, const policy::PolicyHandlerInterface& policy_handler, |