From 763bb21a03beac4f5a1d906746509a10141aed89 Mon Sep 17 00:00:00 2001 From: Andrey Oleynik Date: Fri, 23 Jan 2015 15:12:25 +0200 Subject: APPLINK-8555. HMI_API extended with new notification for safety mode. --- src/components/application_manager/CMakeLists.txt | 1 + .../commands/hmi/on_emergency_event_notification.h | 72 ++++++++++++++++++++++ .../hmi/on_emergency_event_notification.cc | 56 +++++++++++++++++ .../application_manager/src/hmi_command_factory.cc | 5 ++ .../commands/hmi/on_emergency_event_notification.h | 1 + src/components/interfaces/HMI_API.xml | 13 ++++ 6 files changed, 148 insertions(+) create mode 100644 src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h create mode 100644 src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc create mode 120000 src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h (limited to 'src') diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 3f05c039f9..a08bd6fdfe 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -120,6 +120,7 @@ file (GLOB MOBILE_COMMANDS_SOURCES ${AM_SOURCE_DIR}/src/commands/hmi/on_exit_all_applications_notification.cc ${AM_SOURCE_DIR}/src/commands/hmi/on_exit_application_notification.cc ${AM_SOURCE_DIR}/src/commands/hmi/on_start_device_discovery.cc + ${AM_SOURCE_DIR}/src/commands/hmi/on_emergency_event_notification.cc ${AM_SOURCE_DIR}/src/commands/hmi/close_popup_request.cc ${AM_SOURCE_DIR}/src/commands/hmi/close_popup_response.cc ${AM_SOURCE_DIR}/src/commands/hmi/on_app_activated_notification.cc diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h new file mode 100644 index 0000000000..aa82de4d89 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * 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 Ford Motor Company 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_ON_EMERGENCY_EVENT_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_ + +#include "application_manager/commands/hmi/notification_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief OnEmergencyEventNotification command class + **/ +class OnEmergencyEventNotification : public NotificationFromHMI { + public: + /** + * @brief OnEmergencyEventNotification class constructor + * + * @param message Incoming SmartObject message + **/ + explicit OnEmergencyEventNotification(const MessageSharedPtr& message); + + /** + * @brief OnEmergencyEventNotification class destructor + **/ + virtual ~OnEmergencyEventNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnEmergencyEventNotification); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_ diff --git a/src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc new file mode 100644 index 0000000000..9b68157edf --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2015, Ford Motor Company + * 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 Ford Motor Company 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/on_emergency_event_notification.h" +#include "application_manager/application_manager_impl.h" + +namespace application_manager { + +namespace commands { + +OnEmergencyEventNotification::OnEmergencyEventNotification( + const MessageSharedPtr& message) + : NotificationFromHMI(message) { +} + +OnEmergencyEventNotification::~OnEmergencyEventNotification() { +} + +void OnEmergencyEventNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); +} + +} // namespace commands + +} // namespace application_manager + + diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index 53c82315fc..861fa86e08 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -70,6 +70,7 @@ #include "application_manager/commands/hmi/on_resume_audio_source_notification.h" #include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h" #include "application_manager/commands/hmi/on_system_info_changed_notification.h" +#include "application_manager/commands/hmi/on_emergency_event_notification.h" #include "application_manager/commands/hmi/get_system_info_request.h" #include "application_manager/commands/hmi/get_system_info_response.h" #include "application_manager/commands/hmi/close_popup_request.h" @@ -1085,6 +1086,10 @@ CommandSharedPtr HMICommandFactory::CreateCommand( command.reset(new commands::OnSystemInfoChangedNotification(message)); break; } + case hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent: { + command.reset(new commands::OnEmergencyEventNotification(message)); + break; + } case hmi_apis::FunctionID::BasicCommunication_PlayTone: { command.reset(new commands::OnPlayToneNotification(message)); break; diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h new file mode 120000 index 0000000000..4458ec5028 --- /dev/null +++ b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h @@ -0,0 +1 @@ +../../../../../../include/application_manager/commands/hmi/on_emergency_event_notification.h \ No newline at end of file diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index bb9d2f4e31..c1c7bd8620 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -527,6 +527,12 @@ + + Enumeration that describes possible states of emergency event. + + + + @@ -2234,6 +2240,13 @@ + + Notification must be sent from HMI to SDL e.g. in case rear camera is active. + + See EmergencyState. + + + Request from SDL to HMI to obtain information about head unit system. -- cgit v1.2.1