summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-07-22 09:56:55 -0400
committerGitHub <noreply@github.com>2019-07-22 09:56:55 -0400
commita6d1390dab380805ef475552b63a95843ed97133 (patch)
tree0b389772ba2a59159d25c9ab3930220cc8fdf850
parent5e6ea2c18e35b56a3109a0a5c1bb962b9445a094 (diff)
parent73d5a9350d1efba63aed502c54608d581c891d7d (diff)
downloadsdl_core-a6d1390dab380805ef475552b63a95843ed97133.tar.gz
Merge pull request #2947 from smartdevicelink/feature/nav_subscription_buttons
Add Nav Subscription Buttons
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc64
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc40
-rw-r--r--src/components/interfaces/HMI_API.xml21
-rw-r--r--src/components/interfaces/MOBILE_API.xml20
5 files changed, 165 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 0d3158d841..1acb2a7438 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -126,6 +126,26 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
+
+ if (!app->is_navi() &&
+ ((mobile_apis::ButtonName::NAV_CENTER_LOCATION == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_IN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_OUT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_TILT_TOGGLE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_CLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_COUNTERCLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_HEADING_TOGGLE == btn_id))) {
+ return false;
+ }
+
return true;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index 01f8f313b6..786f2b6bd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -106,6 +106,23 @@ TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NavSubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::REJECTED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
@@ -203,6 +220,53 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
const mobile_apis::ButtonName::eType kButtonName =
mobile_apis::ButtonName::OK;
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 0f5bc80d56..7f4b14835f 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -135,6 +135,46 @@ void InitCapabilities() {
hmi_apis::Common_ButtonName::CUSTOM_BUTTON));
button_enum_name.insert(std::make_pair(std::string("SEARCH"),
hmi_apis::Common_ButtonName::SEARCH));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_CENTER_LOCATION"),
+ hmi_apis::Common_ButtonName::NAV_CENTER_LOCATION));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_IN"), hmi_apis::Common_ButtonName::NAV_ZOOM_IN));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_OUT"), hmi_apis::Common_ButtonName::NAV_ZOOM_OUT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_UP"), hmi_apis::Common_ButtonName::NAV_PAN_UP));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_RIGHT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_DOWN"), hmi_apis::Common_ButtonName::NAV_PAN_DOWN));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_LEFT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_LEFT"), hmi_apis::Common_ButtonName::NAV_PAN_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_TILT_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_TILT_TOGGLE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_CLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_CLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_COUNTERCLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_COUNTERCLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_HEADING_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_HEADING_TOGGLE));
text_fields_enum_name.insert(std::make_pair(
std::string("mainField1"), hmi_apis::Common_TextFieldName::mainField1));
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 3725529c46..32ca710c6d 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -116,6 +116,27 @@
<element name="SOURCE" />
<element name="SHUFFLE" />
<element name="REPEAT" />
+
+ <!-- Navigation Subscription Buttons -->
+ <element name="NAV_CENTER_LOCATION" />
+ <element name="NAV_ZOOM_IN" />
+ <element name="NAV_ZOOM_OUT" />
+ <element name="NAV_PAN_UP" />
+ <element name="NAV_PAN_UP_RIGHT" />
+ <element name="NAV_PAN_RIGHT" />
+ <element name="NAV_PAN_DOWN_RIGHT" />
+ <element name="NAV_PAN_DOWN" />
+ <element name="NAV_PAN_DOWN_LEFT" />
+ <element name="NAV_PAN_LEFT" />
+ <element name="NAV_PAN_UP_LEFT" />
+ <element name="NAV_TILT_TOGGLE">
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" />
+ <element name="NAV_HEADING_TOGGLE">
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="ButtonEventMode">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 4122ae0631..fb6e9dc95e 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -623,6 +623,26 @@
<element name="SOURCE" since="4.5" />
<element name="SHUFFLE" since="4.5" />
<element name="REPEAT" since="4.5" />
+ <!-- Navigation Buttons -->
+ <element name="NAV_CENTER_LOCATION" since="6.0" />
+ <element name="NAV_ZOOM_IN" since="6.0" />
+ <element name="NAV_ZOOM_OUT" since="6.0" />
+ <element name="NAV_PAN_UP" since="6.0" />
+ <element name="NAV_PAN_UP_RIGHT" since="6.0" />
+ <element name="NAV_PAN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN" since="6.0" />
+ <element name="NAV_PAN_DOWN_LEFT" since="6.0" />
+ <element name="NAV_PAN_LEFT" since="6.0" />
+ <element name="NAV_PAN_UP_LEFT" since="6.0" />
+ <element name="NAV_TILT_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" since="6.0" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" since="6.0" />
+ <element name="NAV_HEADING_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="MediaClockFormat" since="1.0">