Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix does not send UnsubscribeVehicleData request to HMI after last unregister app. #2

Open
wants to merge 3 commits into
base: branch_4.2.1
Choose a base branch
from

Conversation

IGapchuk
Copy link
Owner

@IGapchuk IGapchuk commented Sep 1, 2018

Fixes 2282

This PR is ready for review.

Risk

This PR makes no API changes.

Summary

When last application unregistered, SDL was not sending to HMI UnsubscribeVehicleData request.

This PR provides fix for that defect: when application unregister , SDL checks for exists other registered applications. If they exist, SDL compares their subscriptions for VehicleDataInfo with subscription of unregister application.
If unregister application only itself subscribe to some VehicleDataInfo, that VehicleDataInfo type will be added for unsubscribing.
If unregister application subscribed for some VehicleDataInfo and some register application subscribed for same VehicleDataInfo, that VehicleDataInfo will not added to unsubscribe.
When checking will be finished and all VehicleDataInfo for unregistering have collected, SDL sends to HMI UnsubscribeVehicleData request.

CLA

@IGapchuk IGapchuk changed the base branch from master to branch_4.2.1 September 1, 2018 11:27
HMICommandFactory::CreateCommand(message_to_hmi, *this);
if (!command) {
LOG4CXX_WARN(logger_, "Failed to create command from smart object");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk i think there should be a return statement here, otherwise command->Init() or command->Run() below may result in a crash

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mked-luxoft That changes was revert.

#include <map>
#include <memory>
#include <utility>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk is memory header needed here?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mked-luxoft Fixed in 36b0ead.

* to unsubscribe.
*/
application_manager::VehicleInfoSubscriptions SelectVehicleDataForUnsubscribe(
const app_mngr::ApplicationSharedPtr& application);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk any reasons to pass shared pointer by reference? Also please take a look at typedef ApplicationConstSharedPtr

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -259,6 +259,23 @@ class MessageHelper {
static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);

static smart_objects::SmartObjectSPtr CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk first param also could be const

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -259,6 +259,23 @@ class MessageHelper {
static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);

static smart_objects::SmartObjectSPtr CreateMessageForHMI(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk please provide description for this function

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static smart_objects::SmartObjectSPtr
CreateUnsubscribeVehicleDataMessageForHMI(
const VehicleInfoSubscriptions& vehicle_data,
const application_manager::ApplicationSharedPtr& app);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk any reasons to pass shared pointer by reference?

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2624,7 +2624,51 @@ void ApplicationManagerImpl::UnregisterApplication(
} else {
resume_controller().RemoveApplicationFromSaved(app_to_remove);
}

application_manager::VehicleInfoSubscriptions vehicle_data_for_unsubscribe =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk could be const

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MessageHelper::PrintSmartObject(*message_to_hmi);
#endif

CommandSharedPtr command =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk why just don't use ManageHMICommand(message_to_hmi) call?

@@ -44,7 +44,6 @@ VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {}

void VIUnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk not related changes

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id) {
auto message = new smart_objects::SmartObject(smart_objects::SmartType_Map);
auto& ref = *message;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk suggest to use more descriptive names like message_so and message_ref

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -143,7 +143,6 @@ CommandSharedPtr MobileCommandFactory::CreateCommand(
commands::Command::CommandOrigin origin,
ApplicationManager& application_manager) {
CommandSharedPtr command;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk unrelated changes

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft Reverted in 36b0ead.

@@ -1328,9 +1371,11 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered;

message[strings::params][strings::message_type] = MessageType::kNotification;
// we put hmi_app_id because applicaton list does not contain application on
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk unrelated changes

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AKalinich-Luxoft Reverted in 36b0ead.

@@ -259,6 +259,23 @@ class MessageHelper {
static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);

static smart_objects::SmartObjectSPtr CreateMessageForHMI(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk i think some sort of a short description is lacking here

Copy link
Owner Author

@IGapchuk IGapchuk Sep 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mked-luxoft Added in 36b0ead.

LOG4CXX_WARN(logger_, "Failed to create command from smart object");
}

int32_t message_type =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IGapchuk minor thing, but i suppose it's better to make this variable const, since we do not modify it anywhere below

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mked-luxoft That changes was revert.

@IGapchuk IGapchuk force-pushed the 4.2.1.fix/sdl_not_send_UnsubscribeVehicleData branch 2 times, most recently from 11b0429 to 5e67cdc Compare September 3, 2018 12:21
@AByzhynar
Copy link
Collaborator

@IGapchuk Check destination branch and repo

@AByzhynar
Copy link
Collaborator

@IGapchuk Your branches names are invalid

@AByzhynar
Copy link
Collaborator

@IGapchuk Update PR description with detailed info where is the problem and why do you think your fix solves it.

@AByzhynar
Copy link
Collaborator

@IGapchuk Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants