-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: branch_4.2.1
Are you sure you want to change the base?
Fix does not send UnsubscribeVehicleData request to HMI after last unregister app. #2
Conversation
last unregister app.
HMICommandFactory::CreateCommand(message_to_hmi, *this); | ||
if (!command) { | ||
LOG4CXX_WARN(logger_, "Failed to create command from smart object"); | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Fix in 36b0ead.
@@ -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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Fix in 36b0ead.
@@ -259,6 +259,23 @@ class MessageHelper { | |||
static smart_objects::SmartObjectList CreateAddCommandRequestToHMI( | |||
ApplicationConstSharedPtr app, ApplicationManager& app_mngr); | |||
|
|||
static smart_objects::SmartObjectSPtr CreateMessageForHMI( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Added in 36b0ead.
static smart_objects::SmartObjectSPtr | ||
CreateUnsubscribeVehicleDataMessageForHMI( | ||
const VehicleInfoSubscriptions& vehicle_data, | ||
const application_manager::ApplicationSharedPtr& app); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Fix in 36b0ead.
@@ -2624,7 +2624,51 @@ void ApplicationManagerImpl::UnregisterApplication( | |||
} else { | |||
resume_controller().RemoveApplicationFromSaved(app_to_remove); | |||
} | |||
|
|||
application_manager::VehicleInfoSubscriptions vehicle_data_for_unsubscribe = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IGapchuk could be const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Fix in 36b0ead.
MessageHelper::PrintSmartObject(*message_to_hmi); | ||
#endif | ||
|
||
CommandSharedPtr command = |
There was a problem hiding this comment.
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_); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IGapchuk not related changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Revert in 36b0ead.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AKalinich-Luxoft Renamed in 36b0ead.
@@ -143,7 +143,6 @@ CommandSharedPtr MobileCommandFactory::CreateCommand( | |||
commands::Command::CommandOrigin origin, | |||
ApplicationManager& application_manager) { | |||
CommandSharedPtr command; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IGapchuk unrelated changes
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IGapchuk unrelated changes
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
11b0429
to
5e67cdc
Compare
@IGapchuk Check destination branch and repo |
@IGapchuk Your branches names are invalid |
@IGapchuk Update PR description with detailed info where is the problem and why do you think your fix solves it. |
@IGapchuk Any updates? |
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