summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorMykola Korniichuk <mkorniichuk@luxoft.com>2018-10-18 15:35:47 +0300
committerMykola Korniichuk (GitHub) <mkorniichuk@luxoft.com>2019-06-11 18:46:00 +0300
commit0f08ba72cbe9061b52950123c5610ed342628537 (patch)
treed27ab03da53e16a5dac717f93f3316c396381f40 /src/components
parent7a7c31b1ac64d6acd1796f5024472905b32ecf73 (diff)
downloadsdl_core-0f08ba72cbe9061b52950123c5610ed342628537.tar.gz
GPS shift support implementation
Diffstat (limited to 'src/components')
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc98
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc8
-rw-r--r--src/components/interfaces/HMI_API.xml7
-rw-r--r--src/components/interfaces/MOBILE_API.xml7
8 files changed, 174 insertions, 39 deletions
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 fc124f7558..86697add18 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
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -344,6 +344,14 @@ extern const char* activate;
extern const char* set_as_default;
extern const char* origin_app;
+// gps data
+extern const char* shifted;
+extern const char* altitude;
+
+// sis data
+extern const char* station_short_name;
+extern const char* station_location;
+
// resuming
extern const char* application_commands;
extern const char* application_submenus;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
index 92ff7e5f01..19b1bf88f8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
index 9549830cec..53e321ef41 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -244,7 +244,19 @@ TEST_F(
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kModuleType] = module_type;
smart_objects::SmartObject radio_data;
+ smart_objects::SmartObject sis_data;
+ smart_objects::SmartObject gps_data;
+
+ gps_data[application_manager::strings::longitude_degrees] = 1.0;
+ gps_data[application_manager::strings::latitude_degrees] = 1.0;
+
+ sis_data[application_manager::strings::station_short_name] =
+ "dummy_short_name";
+ sis_data[application_manager::strings::station_location] = gps_data;
+
radio_data[message_params::kBand] = enums_value::kAM;
+ radio_data[message_params::kSisData] = sis_data;
+
std::shared_ptr<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>
command = CreateRCCommand<
rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
new file mode 100644
index 0000000000..fb14373bcf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, 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 "gtest/gtest.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "mobile/get_vehicle_data_response.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_vehicle_data_response {
+
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::GetVehicleDataResponse;
+
+typedef std::shared_ptr<GetVehicleDataResponse> GetVehicleDataResponsePtr;
+
+class GetVehicleDataResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(GetVehicleDataResponseTest, GetVehicleDataResponse_SUCCESS) {
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ GetVehicleDataResponsePtr command(
+ CreateCommand<GetVehicleDataResponse>(message));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+ command->Run();
+}
+
+} // namespace get_vehicle_data_response
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
index 7081746f28..8df00521de 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,9 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
-#include <map>
-#include <vector>
+#include <strings.h>
#include "gtest/gtest.h"
#include "mobile/on_vehicle_data_notification.h"
@@ -45,6 +43,8 @@
#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
#include "utils/helpers.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
namespace test {
namespace components {
@@ -62,49 +62,75 @@ using am::commands::MessageSharedPtr;
using vehicle_info_plugin::commands::OnVehicleDataNotification;
typedef std::shared_ptr<OnVehicleDataNotification> NotificationPtr;
+typedef std::shared_ptr<vehicle_info_plugin::VehicleInfoAppExtension>
+ VehicleInfoAppExtensionPtr;
+typedef DataAccessor<application_manager::ApplicationSet> ApplicationSetDA;
namespace {
const uint32_t kAppId = 1u;
+const utils::custom_string::CustomString kAppName("test_app");
} // namespace
class OnVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnVehicleDataNotificationTest()
- : command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
+ OnVehicleDataNotificationTest() : mock_app_(CreateMockApp()) {}
- MessageSharedPtr command_msg_;
- NotificationPtr command_;
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ ON_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillByDefault(Return(false));
+ }
+ MockAppPtr mock_app_;
};
-MATCHER_P2(CheckMessageData, key, value, "") {
- const bool kIsMobileProtocolTypeCorrect =
- (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
- am::commands::CommandImpl::mobile_protocol_type_;
-
- const bool kIsProtocolVersionCorrect =
- (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
- am::commands::CommandImpl::protocol_version_;
-
- const bool kIsNotificationCorrect =
- (*arg)[am::strings::params][am::strings::message_type].asInt() ==
- am::MessageType::kNotification;
-
- const bool kIsConnectionKeyCorrect =
- (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
- kAppId;
-
- const bool kAreMsgParamsCorrect =
- (*arg)[am::strings::msg_params][key].asInt() == value;
-
- using namespace helpers;
- return Compare<bool, EQ, ALL>(true,
- kIsMobileProtocolTypeCorrect,
- kIsProtocolVersionCorrect,
- kIsNotificationCorrect,
- kIsConnectionKeyCorrect,
- kAreMsgParamsCorrect);
+TEST_F(OnVehicleDataNotificationTest, OnVehicleDataNotification_SUCCESS) {
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ smart_objects::SmartObject gps_data;
+ gps_data[am::strings::longitude_degrees] = 1.0;
+ gps_data[am::strings::latitude_degrees] = 1.0;
+ gps_data[am::strings::shifted] = true;
+
+ (*message)[am::strings::msg_params][am::strings::gps] = gps_data;
+ (*message)[am::strings::msg_params][am::strings::speed] = 0;
+
+ NotificationPtr command(CreateCommand<OnVehicleDataNotification>(message));
+
+ vehicle_info_plugin::VehicleInfoPlugin vi_plugin;
+ VehicleInfoAppExtensionPtr vi_app_extention_ptr =
+ std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
+ vi_plugin, *mock_app_);
+ vi_app_extention_ptr->subscribeToVehicleInfo(
+ mobile_apis::VehicleDataType::VEHICLEDATA_GPS);
+ vi_app_extention_ptr->subscribeToVehicleInfo(
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED);
+
+ EXPECT_CALL(*mock_app_,
+ QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension::
+ VehicleInfoAppExtensionUID))
+ .WillOnce(Return(vi_app_extention_ptr));
+
+ application_manager::ApplicationSet apps;
+ apps.insert(mock_app_);
+ std::shared_ptr<sync_primitives::Lock> apps_lock =
+ std::make_shared<sync_primitives::Lock>();
+ ApplicationSetDA apps_da(apps, apps_lock);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(apps_da));
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS));
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+
+ command->Run();
}
} // namespace on_vehicle_data_notification
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 872103929f..590519381c 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -311,6 +311,14 @@ const char* activate = "activate";
const char* set_as_default = "setAsDefault";
const char* origin_app = "originApp";
+// gps data
+const char* shifted = "shifted";
+const char* altitude = "altitude";
+
+// sis data
+const char* station_short_name = "stationShortName";
+const char* station_location = "stationLocation";
+
// resuming
const char* application_commands = "applicationCommands";
const char* application_submenus = "applicationSubMenus";
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index a69d2f05c8..e74ae6d359 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -1845,6 +1845,13 @@
<param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="false">
<description>The speed in KPH</description>
</param>
+ <param name="shifted" type="Boolean" mandatory="false">
+ <description>
+ True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ False, if the GPS data is raw and un-shifted.
+ If not provided, then value is assumed False.
+ </description>
+ </param>
</struct>
<struct name="SisData">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index a2cdb88b4d..4ced608f5e 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -2014,6 +2014,13 @@
<param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true" since="2.0" until="5.0"/>
</history>
</param>
+ <param name="shifted" type="Boolean" mandatory="false" since="5.0">
+ <description>
+ True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ False, if the GPS data is raw and un-shifted.
+ If not provided, then value is assumed False.
+ </description>
+ </param>
</struct>
<struct name="VehicleDataResult" since="2.0">