Skip to content

Commit

Permalink
Remove OnButtonSubscription notification
Browse files Browse the repository at this point in the history
  • Loading branch information
ychernysheva committed Jul 12, 2021
1 parent 06dc978 commit e5dfa88
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 391 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,40 +272,6 @@ class MessageHelper {
static smart_objects::SmartObjectSPtr CreateSetAppIcon(
const std::string& path_to_icon, uint32_t app_id);

/**
* @brief Sends button subscription notification
* @param app_id Application ID
* @param button Enum with button name
* @param is_subscribed true if subscribed, false otherwise
* @param app_mngr reference to application manager
*/
static void SendOnButtonSubscriptionNotification(
const uint32_t app_id,
const hmi_apis::Common_ButtonName::eType button,
const bool is_subscribed,
ApplicationManager& app_mngr);

/**
* @brief Creates button subscription notification
* @param app_id Application ID
* @param button Enum with button name
* @param is_subscribed true if subscribed, false otherwise
* @return notification message in SmartObject format
*/
static smart_objects::SmartObjectSPtr CreateOnButtonSubscriptionNotification(
const uint32_t app_id,
const hmi_apis::Common_ButtonName::eType button,
const bool is_subscribed);

/**
* @brief Sends button subscription notifications for all buttons
* that application is subscribed on
* @param app shared pointer to application instance
* @param app_mngr reference to application manager
*/
static void SendAllOnButtonSubscriptionNotificationsForApp(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);

/**
* @brief Creates button subscription requests for buttons
* that application is subscribed on
Expand Down Expand Up @@ -1010,18 +976,6 @@ class MessageHelper {
static void SendResetPropertiesRequest(ApplicationSharedPtr application,
ApplicationManager& app_mngr);

/**
* @brief SendUnsubscribeButtonNotification sends notification to HMI to
* remove button subscription for application
* @param button Button type
* @param application Application to unsubscribe
* @param app_mngr Application manager
*/
static void SendUnsubscribeButtonNotification(
mobile_apis::ButtonName::eType button,
ApplicationSharedPtr application,
ApplicationManager& app_mngr);

/**
* @brief Sends HMI status notification to mobile
* @param application application with changed HMI status
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
Expand Down Expand Up @@ -779,10 +778,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::Buttons_OnButtonPress: {
return factory.GetCreator<commands::hmi::OnButtonPressNotification>();
}
case hmi_apis::FunctionID::Buttons_OnButtonSubscription: {
return factory
.GetCreator<commands::hmi::OnButtonSubscriptionNotification>();
}
case hmi_apis::FunctionID::Navigation_OnTBTClientState: {
return factory.GetCreator<commands::OnNaviTBTClientStateNotification>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
#include "hmi/on_audio_data_streaming_notification.h"
#include "hmi/on_button_event_notification.h"
#include "hmi/on_button_press_notification.h"
#include "hmi/on_button_subscription_notification.h"
#include "hmi/on_device_chosen_notification.h"
#include "hmi/on_device_state_changed_notification.h"
#include "hmi/on_driver_distraction_notification.h"
Expand Down Expand Up @@ -450,7 +449,6 @@ typedef Types<commands::NaviIsReadyResponse,

typedef Types<commands::hmi::OnButtonEventNotification,
commands::hmi::OnButtonPressNotification,
commands::hmi::OnButtonSubscriptionNotification,
commands::OnNaviTBTClientStateNotification,
commands::hmi::OnUIKeyBoardInputNotification,
commands::hmi::OnUITouchEventNotification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
Expand Down Expand Up @@ -343,7 +342,6 @@ class HMIOnNotificationsEventDispatcher

typedef Types<OnAppPermissionChangedNotification,
OnAudioDataStreamingNotification,
hmi::OnButtonSubscriptionNotification,
OnFileRemovedNotification,
OnPutFileNotification,
OnResumeAudioSourceNotification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,6 @@ class RegisterAppInterfaceRequestTest
hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
_))
.WillByDefault(Return(true));
ON_CALL(
mock_rpc_service_,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
_))
.WillByDefault(Return(true));
}

void SetCommonPreconditionsToCheckWithPolicyData(MockAppPtr mock_app) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,19 @@ void DeleteGlobalProperties(ApplicationSharedPtr app,
void DeleteButtonSubscriptions(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
ButtonSubscriptions buttons = app->SubscribedButtons().GetData();

for (auto button : buttons) {
if (mobile_apis::ButtonName::CUSTOM_BUTTON == button) {
const auto hmi_button =
static_cast<hmi_apis::Common_ButtonName::eType>(button);
if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_button) {
continue;
}
MessageHelper::SendUnsubscribeButtonNotification(button, app, app_manager);
app->UnsubscribeFromButton(button);
smart_objects::SmartObjectSPtr unsubscribe_request =
MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi(
app->app_id(),
hmi_button,
hmi_apis::FunctionID::Buttons_UnsubscribeButton,
app_manager);
app_manager.GetRPCService().ManageHMICommand(unsubscribe_request);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/components/application_manager/src/hmi_interfaces_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ generate_function_to_interface_convert_map() {
convert_map[Buttons_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_OnButtonEvent] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_OnButtonPress] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_OnButtonSubscription] =
HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_SubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[Buttons_UnsubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons;
convert_map[BasicCommunication_OnReady] =
Expand Down
Loading

0 comments on commit e5dfa88

Please sign in to comment.