diff options
author | Andrii Kalinich (GitHub) <AKalinich@luxoft.com> | 2017-09-05 18:19:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 18:19:00 +0300 |
commit | 1ab51618c49e7bd2c0c45c952edb16f8fe8d5b2f (patch) | |
tree | 47ed0a8a9fd7acb28d38d72e42588f0a5f63c4a4 | |
parent | d96b7c509b74da521b99c1f4cdbb0d54f198395e (diff) | |
parent | d33bfa260cd13494b9f6f1b4993e936e60ef2f27 (diff) | |
download | sdl_core-1ab51618c49e7bd2c0c45c952edb16f8fe8d5b2f.tar.gz |
Merge branch 'develop' into feature/sdl_remote_control_baseline
25 files changed, 920 insertions, 27 deletions
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json index 94d96d6d18..bef4d1e896 100755 --- a/src/appMain/hmi_capabilities.json +++ b/src/appMain/hmi_capabilities.json @@ -310,7 +310,8 @@ "supportedFormats": [{ "protocol": "RAW", "codec": "H264" - }] + }], + "hapticSpatialDataSupported": false }, "remoteControlCapability": { "buttonCapabilities": [ diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 78064a40c0..68c2de0b6b 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -1003,6 +1003,16 @@ "hmi_levels": ["BACKGROUND"]
}
}
+ },
+ "HapticGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": ["FULL"]
+ },
+ "SendHapticData": {
+ "hmi_levels": ["FULL"]
+ }
+ }
}
},
"consumer_friendly_messages": {
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 9a50ca549e..7a49ce6b81 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -1,6 +1,9 @@ # Copyright (c) 2016, Ford Motor Company # All rights reserved. # +# Copyright (c) 2017 Xevo Inc. +# All rights reserved. +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # @@ -12,7 +15,7 @@ # disclaimer in the documentation and/or other materials provided with the # distribution. # -# Neither the name of the Ford Motor Company nor the names of its contributors +# Neither the name of the copyright holders nor the names of their contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # @@ -339,6 +342,8 @@ set (HMI_COMMANDS_SOURCES ${COMMANDS_SOURCE_DIR}/hmi/rc_is_ready_response.cc ${COMMANDS_SOURCE_DIR}/hmi/rc_get_capabilities_request.cc ${COMMANDS_SOURCE_DIR}/hmi/rc_get_capabilities_response.cc + ${COMMANDS_SOURCE_DIR}/hmi/ui_send_haptic_data_request.cc + ${COMMANDS_SOURCE_DIR}/hmi/ui_send_haptic_data_response.cc ) set (HMI_COMMANDS_SOURCES_JSON diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h new file mode 100644 index 0000000000..a7c491f6bd --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_request.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ + +#include "application_manager/commands/hmi/request_to_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief UISendHapticDataRequest command class + **/ +class UISendHapticDataRequest : public RequestToHMI { + public: + /** + * @brief UISendHapticDataRequest class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + UISendHapticDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief UISendHapticDataRequest class destructor + **/ + ~UISendHapticDataRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UISendHapticDataRequest); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h new file mode 100644 index 0000000000..3c5714ef89 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/ui_send_haptic_data_response.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ + +#include "application_manager/commands/hmi/response_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief UISendHapticDataResponse command class + **/ +class UISendHapticDataResponse : public ResponseFromHMI { + public: + /** + * @brief UISendHapticDataResponse class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + UISendHapticDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief UISendHapticDataResponse class destructor + **/ + ~UISendHapticDataResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UISendHapticDataResponse); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h new file mode 100644 index 0000000000..18703e84c7 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_request.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ + + +#include <string> +#include "application_manager/commands/command_request_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event.h" +#include "smart_objects/smart_object.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SendHapticDataRequest command class + **/ +class SendHapticDataRequest : public CommandRequestImpl { + public: + /** + * @brief SendHapticDataRequest class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + SendHapticDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief SendHapticDataRequest class destructor + **/ + ~SendHapticDataRequest() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + /** + * @brief Interface method that is called whenever new event received + * + * @param event The received event + */ + void on_event(const event_engine::Event& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SendHapticDataRequest); +}; + +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ diff --git a/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h new file mode 100644 index 0000000000..d7bb76f669 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/mobile/send_haptic_data_response.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ + + +#include "application_manager/commands/command_response_impl.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief SendHapticDataResponse command class + **/ +class SendHapticDataResponse : public CommandResponseImpl { + public: + /** + * @brief SendHapticDataResponse class constructor + * + * @param message Incoming SmartObject message + * @param application_manager Reference of application manager + **/ + SendHapticDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief SendHapticDataResponse class destructor + **/ + ~SendHapticDataResponse() OVERRIDE; + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SendHapticDataResponse); +}; + +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_ diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 6fbb477507..ccac1ec67b 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -351,6 +354,11 @@ extern const char* const resolution_width; extern const char* const resolution_height; extern const char* const max_bitrate; extern const char* const supported_formats; +extern const char* const haptic_spatial_data_supported; +extern const char* const haptic_rect_data; +extern const char* const rect; +extern const char* const x; +extern const char* const y; } // namespace strings namespace json { diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc new file mode 100644 index 0000000000..9484906a17 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_request.cc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" + +namespace application_manager { + +namespace commands { + +UISendHapticDataRequest::UISendHapticDataRequest( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : RequestToHMI(message, application_manager) {} + +UISendHapticDataRequest::~UISendHapticDataRequest() {} + +void UISendHapticDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + SendRequest(); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc new file mode 100644 index 0000000000..03a2ce69e2 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/ui_send_haptic_data_response.cc @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" +#include "application_manager/event_engine/event.h" + +#include "interfaces/HMI_API.h" + +namespace application_manager { + +namespace commands { + +UISendHapticDataResponse::UISendHapticDataResponse( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : ResponseFromHMI(message, application_manager) {} + +UISendHapticDataResponse::~UISendHapticDataResponse() {} + +void UISendHapticDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + event_engine::Event event( + hmi_apis::FunctionID::UI_SendHapticData); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc new file mode 100644 index 0000000000..4f50ff20b0 --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/send_haptic_data_request.cc @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/send_haptic_data_request.h" +#include "interfaces/MOBILE_API.h" + +namespace application_manager { + +namespace commands { + +namespace custom_str = utils::custom_string; + +SendHapticDataRequest::SendHapticDataRequest(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandRequestImpl(message, application_manager) {} + +SendHapticDataRequest::~SendHapticDataRequest() {} + +void SendHapticDataRequest::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; + SendHMIRequest(hmi_apis::FunctionID::UI_SendHapticData, + &msg_params, + true); +} + +void SendHapticDataRequest::on_event(const event_engine::Event& event) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace helpers; + + const smart_objects::SmartObject& message = event.smart_object(); + + switch (event.id()) { + case hmi_apis::FunctionID::UI_SendHapticData: { + mobile_apis::Result::eType result_code = + GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( + message[strings::params][hmi_response::code].asUInt())); + + const bool result = Compare<mobile_api::Result::eType, EQ, ONE>( + result_code, + mobile_api::Result::SUCCESS, + mobile_api::Result::WARNINGS); + + SendResponse(result, result_code, NULL, &(message[strings::msg_params])); + break; + } + default: { + LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + return; + } + } +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc new file mode 100644 index 0000000000..cb7cd9f3ec --- /dev/null +++ b/src/components/application_manager/src/commands/mobile/send_haptic_data_response.cc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/mobile/send_haptic_data_response.h" + +namespace application_manager { + +namespace commands { + +SendHapticDataResponse::SendHapticDataResponse(const MessageSharedPtr& message, + ApplicationManager& application_manager) + : CommandResponseImpl(message, application_manager) {} + +SendHapticDataResponse::~SendHapticDataResponse() {} + +void SendHapticDataResponse::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + application_manager_.SendMessageToMobile(message_); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc index f8b8bc791d..d0bc0c41ef 100644 --- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc +++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc @@ -63,9 +63,10 @@ void EventDispatcherImpl::raise_event(const Event& event) { // Call observers EventObserver* temp; while (!observers_.empty()) { - AutoLock auto_lock(observer_lock_); + observer_lock_.Acquire(); temp = *observers_.begin(); observers_.erase(observers_.begin()); + observer_lock_.Release(); temp->on_event(event); } } diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index 6fffd050b8..ffaa8d9b5f 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -278,6 +281,8 @@ #include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h" #include "application_manager/commands/hmi/dial_number_request.h" #include "application_manager/commands/hmi/dial_number_response.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_response.h" #include "application_manager/commands/hmi/rc_is_ready_request.h" #include "application_manager/commands/hmi/rc_is_ready_response.h" @@ -2289,6 +2294,16 @@ CommandSharedPtr HMICommandFactory::CreateCommand( } break; } + case hmi_apis::FunctionID::UI_SendHapticData: { + if (is_response) { + command.reset(new commands::UISendHapticDataResponse( + message, application_manager)); + } else { + command.reset(new commands::UISendHapticDataRequest( + message, application_manager)); + } + break; + } } return command; } diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index e961c4e4d0..4479665f64 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -155,6 +158,7 @@ generate_function_to_interface_convert_map() { convert_map[UI_IsReady] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_ClosePopUp] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_UI; + convert_map[UI_SendHapticData] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[Navigation_IsReady] = HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_SendLocation] = HmiInterfaces::HMI_INTERFACE_Navigation; diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc index d5db849d96..f6f9cab7f5 100644 --- a/src/components/application_manager/src/mobile_command_factory.cc +++ b/src/components/application_manager/src/mobile_command_factory.cc @@ -2,6 +2,9 @@ Copyright (c) 2013, Ford Motor Company All rights reserved. + Copyright (c) 2017 Xevo Inc. + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -13,7 +16,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Ford Motor Company nor the names of its contributors + Neither the name of the copyright holders nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -135,6 +138,8 @@ #include "application_manager/commands/mobile/send_location_response.h" #include "application_manager/commands/mobile/dial_number_request.h" #include "application_manager/commands/mobile/dial_number_response.h" +#include "application_manager/commands/mobile/send_haptic_data_request.h" +#include "application_manager/commands/mobile/send_haptic_data_response.h" #include "interfaces/MOBILE_API.h" #include "utils/make_shared.h" @@ -617,6 +622,17 @@ CommandSharedPtr MobileCommandFactory::CreateCommand( } break; } + case mobile_apis::FunctionID::SendHapticDataID: { + if ((*message)[strings::params][strings::message_type] == + static_cast<int>(application_manager::MessageType::kResponse)) { + command.reset( + new commands::SendHapticDataResponse(message, application_manager)); + } else { + command.reset( + new commands::SendHapticDataRequest(message, application_manager)); + } + break; + } case mobile_apis::FunctionID::OnButtonEventID: { command.reset(new commands::mobile::OnButtonEventNotification( message, application_manager)); diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index f2e7e6522b..d5041ef836 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -312,6 +312,11 @@ const char* const resolution_width = "resolutionWidth"; const char* const resolution_height = "resolutionHeight"; const char* const max_bitrate = "maxBitrate"; const char* const supported_formats = "supportedFormats"; +const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported"; +const char* const haptic_rect_data = "hapticRectData"; +const char* const rect = "rect"; +const char* const x = "x"; +const char* const y = "y"; } // namespace strings namespace json { diff --git a/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc index f444e45a6c..3fa3aaef3a 100644 --- a/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc +++ b/src/components/application_manager/test/commands/hmi/simple_requests_to_hmi_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -114,6 +117,7 @@ #include "application_manager/commands/hmi/sdl_policy_update.h" #include "application_manager/commands/hmi/ui_set_icon_request.h" #include "application_manager/commands/hmi/dial_number_request.h" +#include "application_manager/commands/hmi/ui_send_haptic_data_request.h" #include "application_manager/test/include/application_manager/mock_event_dispatcher.h" @@ -217,7 +221,8 @@ typedef Types<am_commands::VIGetVehicleTypeRequest, am_commands::NaviAlertManeuverRequest, am_commands::AudioStopStreamRequest, am_commands::NaviGetWayPointsRequest, - am_commands::UISetGlobalPropertiesRequest> RequestCommandsList; + am_commands::UISetGlobalPropertiesRequest, + am_commands::UISendHapticDataRequest> RequestCommandsList; typedef Types<am_commands::UIScrollableMessageRequest, am_commands::VRGetCapabilitiesRequest, diff --git a/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc index 7e55b8b834..f257a41624 100644 --- a/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc +++ b/src/components/application_manager/test/commands/hmi/simple_response_from_hmi_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -102,6 +105,7 @@ #include "hmi/update_app_list_response.h" #include "hmi/update_device_list_response.h" #include "hmi/notification_from_hmi.h" +#include "hmi/ui_send_haptic_data_response.h" namespace test { namespace components { @@ -232,7 +236,9 @@ typedef Types< CommandData<commands::VRPerformInteractionResponse, hmi_apis::FunctionID::VR_PerformInteraction>, CommandData<commands::UIScrollableMessageResponse, - hmi_apis::FunctionID::UI_ScrollableMessage> > + hmi_apis::FunctionID::UI_ScrollableMessage>, + CommandData<commands::UISendHapticDataResponse, + hmi_apis::FunctionID::UI_SendHapticData> > ResponseCommandsList; typedef Types<commands::AudioStopStreamResponse, diff --git a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc index 57cafd75e2..b02c9851ee 100644 --- a/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc +++ b/src/components/application_manager/test/commands/hmi/ui_get_capabilities_response_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2016, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -322,6 +325,8 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { video_streaming_capability[strings::supported_formats][0][strings::codec] = hmi_apis::Common_VideoStreamingCodec::H264; + video_streaming_capability[strings::haptic_spatial_data_supported] = true; + ResponseFromHMIPtr command( CreateCommand<UIGetCapabilitiesResponse>(command_msg)); diff --git a/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc new file mode 100644 index 0000000000..1e14f46555 --- /dev/null +++ b/src/components/application_manager/test/commands/mobile/send_haptic_data_test.cc @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Xevo Inc. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gtest/gtest.h" + +#include "commands/commands_test.h" +#include "commands/command_request_test.h" + +#include "mobile/send_haptic_data_request.h" +#include "mobile/send_haptic_data_response.h" + +#include "interfaces/MOBILE_API.h" +#include "application_manager/application.h" +#include "application_manager/mock_application.h" + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace send_haptic_data { + +using ::testing::_; +using ::testing::Return; + +namespace am = ::application_manager; + +using am::commands::SendHapticDataRequest; +using am::commands::SendHapticDataResponse; +using am::commands::MessageSharedPtr; + +typedef SharedPtr<SendHapticDataRequest> SendHapticDataRequestPtr; +typedef SharedPtr<SendHapticDataResponse> SendHapticDataResponsePtr; + +namespace { +const uint32_t kConnectionKey = 1u; +} + +class SendHapticDataRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + SendHapticDataRequestTest() + : msg_(CreateMessage(::smart_objects::SmartType_Map)) + , mock_app_(CreateMockApp()) {} + + void SetUp() OVERRIDE { + (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; + ON_CALL(app_mngr_, application(kConnectionKey)) + .WillByDefault(Return(mock_app_)); + } + + MessageSharedPtr msg_; + MockAppPtr mock_app_; +}; + +class SendHapticDataResponseTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + public: + SendHapticDataResponseTest() : message_(CreateMessage()) {} + + void SetUp() OVERRIDE { + command_sptr_ = CreateCommand<SendHapticDataResponse>(message_); + } + + MessageSharedPtr message_; + SharedPtr<SendHapticDataResponse> command_sptr_; +}; + +TEST_F(SendHapticDataRequestTest, Run_SUCCESS) { + EXPECT_CALL( + app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::UI_SendHapticData))) + .WillOnce(Return(true)); + + SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_)); + + command->Init(); + command->Run(); +} + +TEST_F(SendHapticDataRequestTest, OnEvent_SUCCESS) { + EXPECT_CALL(app_mngr_, + ManageMobileCommand( + MobileResultCodeIs(mobile_apis::Result::SUCCESS), + am::commands::Command::ORIGIN_SDL)); + + (*msg_)[am::strings::msg_params] = 0; + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::SUCCESS; + Event event(hmi_apis::FunctionID::UI_SendHapticData); + event.set_smart_object(*msg_); + SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_)); + + command->Init(); + command->on_event(event); +} + +TEST_F(SendHapticDataResponseTest, Run_Success) { + ::smart_objects::SmartObject& message_ref = *message_; + message_ref[am::strings::msg_params][am::strings::result_code] = + mobile_apis::Result::SUCCESS; + + EXPECT_CALL( + app_mngr_, + SendMessageToMobile( + MobileResultCodeIs(mobile_apis::Result::SUCCESS), + _)); + command_sptr_->Init(); + command_sptr_->Run(); +} + +} // namespace send_haptic_data +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json index 15640b2f31..9db6ee78ae 100644 --- a/src/components/application_manager/test/hmi_capabilities.json +++ b/src/components/application_manager/test/hmi_capabilities.json @@ -525,9 +525,10 @@ "protocol": "RTP", "codec": "Theora" } - ] - } + ], + "hapticSpatialDataSupported": true } + } }, "VR": { "capabilities": [ diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc index 3fd9e730d8..43b757c909 100644 --- a/src/components/application_manager/test/hmi_capabilities_test.cc +++ b/src/components/application_manager/test/hmi_capabilities_test.cc @@ -2,6 +2,9 @@ * Copyright (c) 2017, Ford Motor Company * All rights reserved. * + * Copyright (c) 2017 Xevo Inc. + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -13,7 +16,7 @@ * disclaimer in the documentation and/or other materials provided with the * distribution. * - * Neither the name of the Ford Motor Company nor the names of its contributors + * Neither the name of the copyright holders nor the names of their contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -419,6 +422,9 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) { EXPECT_EQ( 2, vs_capability_so[strings::supported_formats][1][strings::codec].asInt()); + + EXPECT_TRUE(vs_capability_so.keyExists(strings::haptic_spatial_data_supported)); + EXPECT_TRUE(vs_capability_so[strings::haptic_spatial_data_supported].asBool()); // Check remote control capabilites const smart_objects::SmartObject rc_capability_so = diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 23c896ec46..ceb67244f4 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1,7 +1,10 @@ <?xml version="1.0" standalone="yes"?> <!-- -* Copyright (c) 2016, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Copyright (c) 2017 Xevo Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2561,6 +2564,9 @@ Each object will contain a VideoStreamingFormat that describes what can be expected. </description> </param> + <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false"> + <description>True if the system can utilize the haptic spatial data from the source being streamed. </description> + </param> </struct> <struct name="SystemCapabilities"> @@ -2572,18 +2578,42 @@ </param> </struct> + <struct name="RemoteControlCapabilities"> + <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> + <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > + </param> + <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> + <description>If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > + </param> + <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" > + <description>If included, the platform supports RC button controls with the included button names.</description > + </param> + </struct> -<struct name="RemoteControlCapabilities"> - <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> - <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > - </param> - <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true"> - <description>If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description > - </param> - <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" > - <description>If included, the platform supports RC button controls with the included button names.</description > - </param> -</struct> + <struct name="Rectangle"> + <param name="x" type="Float" mandatory="true"> + <description>The X-coordinate of the user control</description> + </param> + <param name="y" type="Float" mandatory="true"> + <description>The Y-coordinate of the user control</description> + </param> + <param name="width" type="Float" mandatory="true"> + <description>The width of the user control's bounding rectangle</description> + </param> + <param name="height" type="Float" mandatory="true"> + <description>The height of the user control's bounding rectangle</description> + </param> + </struct> + + <struct name="HapticRect"> + <description>Defines haptic rectangle data for each user control object for video streaming application</description> + <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true"> + <description>A user control spatial identifier</description> + </param> + <param name="rect" type="Common.Rectangle" mandatory="true"> + <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description> + </param> + </struct> </interface> @@ -3771,6 +3801,22 @@ <description>ID of application related to this RPC.</description> </param> </function> + <function name="SendHapticData" messagetype="request"> + <description>Send the UI spatial data from MOBILE. This data will be utilized by the HMI to determine how and when haptic events should occur</description> + <param name="appID" type="Integer" mandatory="true"> + <description>Internal ID of the application that requested this RPC.</description> + </param> + <param name="hapticRectData" type="Common.HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true"> + <description> + Array of rectangle data structures that represent the locations of all user controls present on the HMI. + This data should be updated if/when the application presents a new screen. + When a request is sent, if successful, it will replace all rectangle data previously sent through RPC. + Avoidance of doubt, when an empty hapticRectData, it will be clear all rectangle data previously sent through RPC. + </description> + </param> + </function> + <function name="SendHapticData" messagetype="response"> + </function> </interface> <interface name="Navigation" version="1.4.0" date="2017-04-27"> diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index e8ecf996e5..a30f8f9170 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -2683,6 +2683,7 @@ <element name="SubscribeWayPointsID" value="46" hexvalue="2E"/>
<element name="UnsubscribeWayPointsID" value="47" hexvalue="2F"/>
<element name="GetSystemCapabilityID" value="48" hexvalue="30"/>
+ <element name="SendHapticDataID" value="49" hexvalue="31" />
<!--
Base Notifications
@@ -2873,6 +2874,9 @@ Each object will contain a VideoStreamingFormat that describes what can be expected.
</description>
</param>
+ <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
+ <description>True if the system can utilize the haptic spatial data from the source being streamed.</description>
+ </param>
</struct>
<struct name="SystemCapability">
@@ -2889,6 +2893,31 @@ </param>
</struct>
+ <struct name="Rectangle">
+ <param name="x" type="Float" mandatory="true">
+ <description>The upper left X-coordinate of the rectangle</description>
+ </param>
+ <param name="y" type="Float" mandatory="true">
+ <description>The upper left Y-coordinate of the rectangle</description>
+ </param>
+ <param name="width" type="Float" mandatory="true">
+ <description>The width of the rectangle</description>
+ </param>
+ <param name="height" type="Float" mandatory="true">
+ <description>The height of the rectangle</description>
+ </param>
+ </struct>
+
+ <struct name="HapticRect">
+ <description>Defines haptic data for each user control object for video streaming application</description>
+ <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>A user control spatial identifier</description>
+ </param>
+ <param name="rect" type="Rectangle" mandatory="true">
+ <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
+ </param>
+ </struct>
+
<!-- Requests/Responses -->
<function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request">
@@ -5331,6 +5360,36 @@ </param>
</function>
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="request" >
+ <description>
+ Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI.
+ This data will be utilized by the HMI to determine how and when haptic events should occur
+ </description>
+ <param name="hapticRectData" type="HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true">
+ <description>
+ Array of rectangle data structures that represent the locations of all user controls present on the HMI.
+ This data should be updated if/when the application presents a new screen.
+ When a request is sent, if successful, it will replace all rectangle data previously sent through RPC.
+ If an empty array is sent, the existing rectangle data will be cleared
+ </description>
+ </param>
+ </function>
+
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ </param>
+ </function>
+
<function name="SendLocation" functionID="SendLocationID" messagetype="request">
<param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
</param>
|