summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHerasym Oleh <oolleehh@gmail.com>2016-03-29 17:12:38 +0300
committerHerasym Oleh <oolleehh@gmail.com>2016-04-13 11:32:17 +0300
commitd1d66f08db71b05316747c46bd334998a03f2d8c (patch)
tree391494220e53807f7bf12bfea79192e300d95ca6 /src
parent29c964ac33c41ff315639a1a194d45bf3626b3f7 (diff)
downloadsdl_core-d1d66f08db71b05316747c46bd334998a03f2d8c.tar.gz
Add GetWayPoints implementation command
Add mobile request GetWayPoints Add mobile response GetWayPoints Add HMI request GetWayPoints Add HMI response GetWayPoints Related: APPLINK-21612
Diffstat (limited to 'src')
-rw-r--r--src/components/application_manager/CMakeLists.txt2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h39
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h40
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h43
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h38
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc53
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc58
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_request.cc56
-rw-r--r--src/components/application_manager/src/commands/mobile/get_way_points_response.cc24
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc10
-rw-r--r--src/components/application_manager/src/mobile_command_factory.cc11
11 files changed, 374 insertions, 0 deletions
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index db8d2d3c79..3f0d8eb8b8 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -279,6 +279,8 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_start_stream_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_request.cc
${AM_SOURCE_DIR}/src/commands/hmi/navi_audio_stop_stream_response.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_request.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/navi_get_way_points_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_system_request_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_put_file_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_resume_audio_source_notification.cc
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h
new file mode 100644
index 0000000000..16746c6b6d
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_request.h
@@ -0,0 +1,39 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/hmi/request_to_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviGetWayPointsRequest command class
+ **/
+class NaviGetWayPointsRequest
+ : public RequestToHMI {
+public:
+ /**
+ * @brief NaviGetWayPointsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ explicit NaviGetWayPointsRequest(const MessageSharedPtr& message);
+ /**
+ * @brief NaviGetWayPointsRequest class destructor
+ **/
+ virtual ~NaviGetWayPointsRequest();
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(NaviGetWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h
new file mode 100644
index 0000000000..5b411c73be
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/hmi/navi_get_way_points_response.h
@@ -0,0 +1,40 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/hmi/response_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief NaviGetWaypoints command class
+ **/
+class NaviGetWaypointsResponse
+ : public ResponseFromHMI {
+ public:
+ /**
+ * @brief NaviGetWaypoints class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ explicit NaviGetWaypointsResponse(const MessageSharedPtr& message);
+
+ /**
+ * @brief NaviGetWaypoints class destructor
+ **/
+ virtual ~NaviGetWaypointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NaviGetWaypointsResponse);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h
new file mode 100644
index 0000000000..6d01c98d34
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_request.h
@@ -0,0 +1,43 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief GetWayPointsRequest command class
+ **/
+class GetWayPointsRequest : public CommandRequestImpl {
+public:
+ /**
+ * \brief GetWayPointsRequest class constructor
+ **/
+ explicit GetWayPointsRequest(const MessageSharedPtr& message);
+
+ /**
+ * \brief GetWayPointsRequest class destructor
+ **/
+ virtual ~GetWayPointsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const event_engine::Event& event);
+private:
+ DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h
new file mode 100644
index 0000000000..6378a3eeaf
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/get_way_points_response.h
@@ -0,0 +1,38 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief GetWayPointsResponse command class
+ **/
+class GetWayPointsResponse : public CommandResponseImpl {
+public:
+ /**
+ * \brief GetWayPointsResponse class constructor
+ **/
+ explicit GetWayPointsResponse(const MessageSharedPtr& message);
+
+ /**
+ * \brief GetWayPointsResponse class destructor
+ **/
+ virtual ~GetWayPointsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run() OVERRIDE;
+private:
+ DISALLOW_COPY_AND_ASSIGN(GetWayPointsResponse);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc
new file mode 100644
index 0000000000..2776b120e0
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_request.cc
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, 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/navi_get_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+NaviGetWayPointsRequest::NaviGetWayPointsRequest(
+ const MessageSharedPtr& message)
+ : RequestToHMI(message) {}
+
+NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {}
+
+void NaviGetWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc
new file mode 100644
index 0000000000..062a7be4ee
--- /dev/null
+++ b/src/components/application_manager/src/commands/hmi/navi_get_way_points_response.cc
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, 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/navi_get_way_points_response.h"
+#include "application_manager/event_engine/event.h"
+#include "interfaces/HMI_API.h"
+
+namespace application_manager {
+
+namespace commands {
+
+NaviGetWaypointsResponse::NaviGetWaypointsResponse(
+ const MessageSharedPtr &message)
+ : ResponseFromHMI(message) {}
+
+NaviGetWaypointsResponse::~NaviGetWaypointsResponse() {}
+
+void NaviGetWaypointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::Navigation_GetWayPoints);
+ event.set_smart_object(*message_);
+ event.raise();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
new file mode 100644
index 0000000000..3c927959ca
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc
@@ -0,0 +1,56 @@
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/commands/mobile/get_way_points_request.h"
+
+namespace application_manager {
+
+namespace commands {
+
+GetWayPointsRequest::GetWayPointsRequest(const MessageSharedPtr& message)
+ :CommandRequestImpl(message){
+}
+
+GetWayPointsRequest::~GetWayPointsRequest() {}
+
+void GetWayPointsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "An application with connection key "
+ << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints, NULL, true);
+}
+
+void GetWayPointsRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
+ const smart_objects::SmartObject &message = event.smart_object();
+ switch(event.id()) {
+ case hmi_apis::FunctionID::Navigation_GetWayPoints: {
+ LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event");
+ mobile_apis::Result::eType result_code =
+ GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asUInt()));
+ bool result = mobile_apis::Result::SUCCESS == result_code;
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ break;
+ }
+ }
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc
new file mode 100644
index 0000000000..a8cc574ca1
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/get_way_points_response.cc
@@ -0,0 +1,24 @@
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/commands/mobile/get_way_points_response.h"
+
+namespace application_manager {
+
+namespace commands {
+
+GetWayPointsResponse::GetWayPointsResponse(
+ const MessageSharedPtr &message)
+ : CommandResponseImpl(message) {
+}
+
+GetWayPointsResponse::~GetWayPointsResponse() {
+}
+
+void GetWayPointsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+}
+
+} // 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 7fe5fb607c..8a20c1e1e0 100644
--- a/src/components/application_manager/src/hmi_command_factory.cc
+++ b/src/components/application_manager/src/hmi_command_factory.cc
@@ -213,6 +213,8 @@
#include "application_manager/commands/hmi/navi_subscribe_way_points_response.h"
#include "application_manager/commands/hmi/navi_unsubscribe_way_points_request.h"
#include "application_manager/commands/hmi/navi_unsubscribe_way_points_response.h"
+#include "application_manager/commands/hmi/navi_get_way_points_request.h"
+#include "application_manager/commands/hmi/navi_get_way_points_response.h"
#include "application_manager/commands/hmi/on_ready_notification.h"
#include "application_manager/commands/hmi/on_device_chosen_notification.h"
#include "application_manager/commands/hmi/on_file_removed_notification.h"
@@ -1045,6 +1047,14 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
}
break;
}
+ case hmi_apis::FunctionID::Navigation_GetWayPoints: {
+ if (is_response) {
+ command.reset(new commands::NaviGetWaypointsResponse(message));
+ } else {
+ command.reset(new commands::NaviGetWayPointsRequest(message));
+ }
+ break;
+ }
case hmi_apis::FunctionID::Navigation_UpdateTurnList: {
if (is_response) {
command.reset(new commands::NaviUpdateTurnListResponse(message));
diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc
index 842f01faf8..33e15375e2 100644
--- a/src/components/application_manager/src/mobile_command_factory.cc
+++ b/src/components/application_manager/src/mobile_command_factory.cc
@@ -58,6 +58,8 @@
#include "application_manager/commands/mobile/get_dtcs_response.h"
#include "application_manager/commands/mobile/get_vehicle_data_request.h"
#include "application_manager/commands/mobile/get_vehicle_data_response.h"
+#include "application_manager/commands/mobile/get_way_points_request.h"
+#include "application_manager/commands/mobile/get_way_points_response.h"
#include "application_manager/commands/mobile/list_files_request.h"
#include "application_manager/commands/mobile/list_files_response.h"
#include "application_manager/commands/mobile/on_app_interface_unregistered_notification.h"
@@ -349,6 +351,15 @@ CommandSharedPtr MobileCommandFactory::CreateCommand(
}
break;
}
+ case mobile_apis::FunctionID::GetWayPointsID: {
+ if ((*message)[strings::params][strings::message_type]
+ == static_cast<int>(application_manager::MessageType::kResponse)) {
+ command = utils::MakeShared<commands::GetWayPointsResponse>(message);
+ } else {
+ command = utils::MakeShared<commands::GetWayPointsRequest>(message);
+ }
+ break;
+ }
case mobile_apis::FunctionID::SubscribeVehicleDataID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {