summaryrefslogtreecommitdiff
path: root/src/components/include
diff options
context:
space:
mode:
authorIra Lytvynenko (GitHub) <ILytvynenko@luxoft.com>2019-08-30 23:09:07 +0300
committerShobhit Adlakha <ShobhitAd@users.noreply.github.com>2019-08-30 16:09:07 -0400
commite7b5c75c704f6cd577f0857e4cbe17cf6ec160fa (patch)
treeb7c7c7703d70076a78b14e7d97668487aa14df49 /src/components/include
parent0186b8c46584aa86e96f0bfa8c38e735c3f0ac0a (diff)
downloadsdl_core-e7b5c75c704f6cd577f0857e4cbe17cf6ec160fa.tar.gz
Feature/Remote Control - Allow Multiple Modules per Module Type (#2984)
* Add new functionality to the interfaces * Add moduleId processing to the resource allocation manager Add GetResources function to helpers to get a list of resources Update unit tests with moduleID param Update command tests after updating the resource allocation manager * Add GetAcquiredModuleTypes and ReleaseModuleType functions for policy checking * Remove redundant SetResourceState call and fix UTs SetResourceState is called in RCCommandRequest::on_event function so it makes no sense to call it again RCCommandRequest::on_event * Add moduleInfo to default capabilities * Add ModuleId method to RCCommandRequest Add ModuleId method to RCCommandRequest for extracting module_id from command message. Update all inherited commands from RCCommandRequest. * Add ReleaseInteriorVehicleDataModule RPC Add ReleaseInteriorVehicleDataModuleRequest. Add ReleaseInteriorVehicleDataModuleResponse. Update ResourceAllocationManager interface: - add method ReleaseResource(); Update ResourceAllocationManagerImpl: - move ReleaseResource() from private section to public for implementing interface; * Add GetInteriorVehicleDataConsentRequest RPC Add GetInteriorVehicleDataConsentRequest without logic. Add GetInteriorVehicleDataConsentResponse. Update RCCommandFactory. * Refactor RC capabilities checking Create RCCapabilities manager, move all functions related to capabilities checking from commands into it. Move auxiliary functions to the rc_helpers. Create mock for RC capabilities manager Update UTs after RC capabilities manager adding * Use range based loop for smart objects with array type * Add ModuleId() function implementation Add const to the ModuleType() function Add function to get the moduleId from hmi capabilities Process missing moduleId param in HMI response In case if HMI doesn't provide the moduleId in response SDL will consider such response as invalid and send generic error response to the mobile Add moduleId to the hmi request * Add moduleId validation by capabilities and button_name for ButtonPress * Add moduleId validation by capabilities for GetIVD and SetIVD Add capabilities check to the rc_command_request * Add const to the capabilities check functions * Add function to get list of all available resources from hmi capabilities * Fix UTs after updating the capabilities check Update unit tests after obtaining available resources from capabilities * Add new HMI RPC SetGlobalProperties and save user_location of application Update SetGlobalPropertiesRequest - update PrepareResponseParameters method according to third new parameter "rc_properties"; * Add new parameter to ini file Add period for module_id consent expiring * Update interior vehicle data caching with moduleId processing Update unit tests that are related to caching with moduleId processing * Add separate file for RCRpcTypes * Add RCConsentManager - add interface RCConsetnManager - add implementation RCConsentManagerImpl - add new rc constants - add mock class for RCConsentManager Remove all consents after RC disabling Add checking ModuleConsent to RCCommandRequest Add logic for GetInteriorVehicleDataConsentRequest from Mobile Save the driver's decision when SDL sends the GIVDConsent request * Define Grid, add functions for getting moduleServiceArea and allowMultipleAccess values Add Seat Location capabilities checking and function for getting driver's location Check if the user location area and the service area has something in common, or the user location is driver, otherwise - reject the module reallocation request Fix UTs after adding the location check * Update SEAT module type processing Add converting id to moduleId: If the vehicle support at least one seat control, seat control capability includes at least two items. 1st for driver’s seat. 2nd for front passenger’s seat * Add SetGlobalProperties Unit tests Add Unit test for PrepareResultCodeForResponse method Add Unit test for PrepareResultForMobileResponse method * Add ReleaseInteriorVehicleDataModuleRequest Unit tests * Set resource to free if SIVD request is invalid * Add Grid Unit tests * Add ResourceAllocationManager Unit tests * Add MockRCHelpers. * Add ResourceAllocationManager Unit tests * Allocate resource after receiving successful response from HMI Send OnRCStatus notification only in case resource allocation state was changed * Rename function to indicate that it returns a list of module types * Rename typedef to indicate that it defines a pair moduleType and capabilitiesStatus * Fix functions descriptions * Rename function to indicate that it returns data related to the module type * Fix CheckIfModuleExistsInCapabilities function name * Update cached consents logic for GIVDC Behavior for cache consents has been updated according to the following comment: 1. If accessMode=AUTO_ALLOW, return true by default 2. If accessMode=AUTO_DENY, check if another app is using the resource a. If the resource is IN_USE, return false b. If the resource is FREE, return true 3. If accessMode=ASK_DRIVER, check if the consent is cached a. If it is cached, return that result b. If it is NOT cached, then prompt the driver for consent * Update logic for allowMultipleAccess=false
Diffstat (limited to 'src/components/include')
-rw-r--r--src/components/include/application_manager/application_manager_settings.h1
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h16
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h1
-rw-r--r--src/components/include/test/application_manager/mock_rpc_plugin.h5
-rw-r--r--src/components/include/utils/date_time.h4
5 files changed, 25 insertions, 2 deletions
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 0f73ea94ed..524feed6e5 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -83,6 +83,7 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& named_audio_pipe_path() const = 0;
virtual const std::string& video_stream_file() const = 0;
virtual const std::string& audio_stream_file() const = 0;
+ virtual uint16_t period_for_consent_expiration() const = 0;
virtual bool use_full_app_id() const = 0;
virtual uint32_t rpc_pass_through_timeout() const = 0;
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index a30625347d..ab8d5ba4e6 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -521,6 +521,22 @@ class HMICapabilities {
virtual const smart_objects::SmartObject* rc_capability() const = 0;
+ /**
+ * @brief Sets available SeatLocation capabilities for further usage by
+ * RC functionality
+ * @param seat_location_capability capabilities to set
+ */
+ virtual void set_seat_location_capability(
+ const smart_objects::SmartObject& seat_location_capability) = 0;
+
+ /**
+ * @brief seat_location_capability Retrieves information regarding the
+ * seat location capability
+ * @return smart object of seat location capability
+ */
+ virtual const smart_objects::SmartObject* seat_location_capability()
+ const = 0;
+
virtual void Init(resumption::LastState* last_state) = 0;
/**
diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h
index 483e78b3f0..998ff252fe 100644
--- a/src/components/include/test/application_manager/mock_application_manager_settings.h
+++ b/src/components/include/test/application_manager/mock_application_manager_settings.h
@@ -89,6 +89,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(named_audio_pipe_path, const std::string&());
MOCK_CONST_METHOD0(video_stream_file, const std::string&());
MOCK_CONST_METHOD0(audio_stream_file, const std::string&());
+ MOCK_CONST_METHOD0(period_for_consent_expiration, uint16_t());
MOCK_CONST_METHOD0(use_full_app_id, bool());
MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t());
MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t());
diff --git a/src/components/include/test/application_manager/mock_rpc_plugin.h b/src/components/include/test/application_manager/mock_rpc_plugin.h
index 94ce8ccbb6..7e4ff11bc7 100644
--- a/src/components/include/test/application_manager/mock_rpc_plugin.h
+++ b/src/components/include/test/application_manager/mock_rpc_plugin.h
@@ -10,11 +10,12 @@ namespace plugin_manager {
class MockRPCPlugin : public RPCPlugin {
public:
- MOCK_METHOD4(Init,
+ MOCK_METHOD5(Init,
bool(ApplicationManager& app_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler));
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state));
MOCK_METHOD2(IsAbleToProcess,
bool(const int32_t function_id,
const commands::Command::CommandSource message_source));
diff --git a/src/components/include/utils/date_time.h b/src/components/include/utils/date_time.h
index 17b4fafe38..747cb0ea69 100644
--- a/src/components/include/utils/date_time.h
+++ b/src/components/include/utils/date_time.h
@@ -53,6 +53,7 @@ const int32_t MILLISECONDS_IN_SECOND = 1000;
const int32_t MICROSECONDS_IN_MILLISECOND = 1000;
const int32_t NANOSECONDS_IN_MICROSECOND = 1000;
const int32_t SECONDS_IN_HOUR = 3600;
+const int32_t SECONDS_IN_DAY = 86400;
const int32_t MICROSECONDS_IN_SECOND =
MILLISECONDS_IN_SECOND * MICROSECONDS_IN_MILLISECOND;
const int32_t NANOSECONDS_IN_MILLISECOND =
@@ -83,6 +84,9 @@ int64_t calculateTimeSpan(const TimeDuration& sinceTime);
// return MILLISECONDS count between time1 and time2
int64_t calculateTimeDiff(const TimeDuration& time1, const TimeDuration& time2);
+// returns difference between specific date and current date
+int64_t calculateAmountDaysFromDate(const std::time_t& start_date);
+
/**
* @brief Adds milliseconds to time struct
* @param time contains time struct