Skip to content

Commit

Permalink
Feature/Remote Control - Allow Multiple Modules per Module Type (#2984)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Ira Lytvynenko (GitHub) authored and ShobhitAd committed Aug 30, 2019
1 parent 0186b8c commit e7b5c75
Show file tree
Hide file tree
Showing 111 changed files with 7,946 additions and 1,246 deletions.
111 changes: 111 additions & 0 deletions src/appMain/hmi_capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,119 +325,210 @@
"pixelPerInch": 117,
"scale": 1
},
"seatLocationCapability": {
"rows": 2,
"columns": 3,
"levels": 1,
"seats": [
{
"row": 0,
"col": 0,
"level": 0,
"rowspan": 1,
"levelspan": 1,
"colspan": 1
}
]
},
"remoteControlCapability": {
"buttonCapabilities": [
{
"longPressAvailable": true,
"name": "AC_MAX",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "AC",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "RECIRCULATE",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_UP",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_DOWN",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_UP",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_DOWN",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST_MAX",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST_REAR",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "UPPER_VENT",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "LOWER_VENT",
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "VOLUME_UP",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "VOLUME_DOWN",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "EJECT",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "SOURCE",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "SHUFFLE",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "REPEAT",
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": false
},
"shortPressAvailable": true,
"upDownAvailable": false
}
],
"climateControlCapabilities": [
{
"moduleInfo": {
"moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
"allowMultipleAccess": false
},
"acEnableAvailable": true,
"acMaxEnableAvailable": true,
"autoModeEnableAvailable": true,
Expand Down Expand Up @@ -470,6 +561,10 @@
],
"radioControlCapabilities": [
{
"moduleInfo": {
"moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
"allowMultipleAccess": true
},
"availableHdChannelsAvailable": true,
"hdChannelAvailable": true,
"moduleName": "radio",
Expand All @@ -488,6 +583,10 @@
"audioControlCapabilities": [
{
"moduleName": "audio",
"moduleInfo": {
"moduleId": "a279fe12-4587-4d12-8514-50f4ea9e9537",
"allowMultipleAccess": true
},
"sourceAvailable": true,
"volumeAvailable": true,
"equalizerAvailable": true,
Expand All @@ -498,6 +597,10 @@
"seatControlCapabilities": [
{
"moduleName": "driver_seat",
"moduleInfo": {
"moduleId": "06cdec22-920e-4865-bf2e-9518463edc68",
"allowMultipleAccess": false
},
"heatingEnabledAvailable" : true,
"coolingEnabledAvailable": true,
"heatingLevelAvailable": true,
Expand All @@ -517,6 +620,10 @@
],
"lightControlCapabilities": {
"moduleName": "light",
"moduleInfo": {
"moduleId": "8d73e369-6a1f-4459-ab5a-6e432631881d",
"allowMultipleAccess": false
},
"supportedLights":[
{
"statusAvailable":true,
Expand Down Expand Up @@ -810,6 +917,10 @@
},
"hmiSettingsControlCapabilities": {
"moduleName": "hmiSettings",
"moduleInfo": {
"moduleId": "c8cace3c-d482-4be1-8862-624a21e34563",
"allowMultipleAccess": true
},
"distanceUnitAvailable": true,
"temperatureUnitAvailable": true,
"displayModeUnitAvailable": true
Expand Down
16 changes: 16 additions & 0 deletions src/appMain/sdl_preloaded_pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,22 @@
"LIMITED",
"NONE"
]
},
"ReleaseInteriorVehicleDataModule": {
"hmi_levels": [
"BACKGROUND",
"FULL",
"LIMITED",
"NONE"
]
},
"GetInteriorVehicleDataConsent": {
"hmi_levels": [
"BACKGROUND",
"FULL",
"LIMITED",
"NONE"
]
}
}
},
Expand Down
6 changes: 5 additions & 1 deletion src/appMain/smartDeviceLink.ini
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,8 @@ HMIOriginID = "HMI_ID"
EmbeddedServices = MEDIA, WEATHER, NAVIGATION

; Additional time added to RPC timeout when passing through to App service
RpcPassThroughTimeout = 10000
RpcPassThroughTimeout = 10000

[RCModuleConsent]
; The period (in days) after which consent for module_id should be removed.
PeriodForConsentExpiration = 30
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,19 @@ class Application : public virtual InitialApplicationData,
*/
virtual void set_cloud_app_certificate(const std::string& certificate) = 0;

/**
* @brief Set user location
* @param smart object of user location
*/
virtual void set_user_location(
const smart_objects::SmartObject& user_location) = 0;

/**
* @brief Get user location
* @return smart object of user location
*/
virtual const smart_objects::SmartObject& get_user_location() const = 0;

protected:
mutable sync_primitives::Lock hmi_states_lock_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ class ApplicationImpl : public virtual Application,
*/
void set_cloud_app_certificate(const std::string& certificate) OVERRIDE;

void set_user_location(
const smart_objects::SmartObject& user_location) OVERRIDE;

const smart_objects::SmartObject& get_user_location() const OVERRIDE;

protected:
/**
* @brief Clean up application folder. Persistent files will stay
Expand Down Expand Up @@ -611,6 +616,7 @@ class ApplicationImpl : public virtual Application,
std::string cloud_transport_type_;
mobile_apis::HybridAppPreference::eType hybrid_app_preference_;
std::string certificate_;
smart_objects::SmartObject user_location_;

/**
* @brief Defines number per time in seconds limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ class CommandRequestImpl : public CommandImpl,
bool IsResultCodeUnsupported(const ResponseInfo& first,
const ResponseInfo& second) const;

/**
* @brief CheckResult checks whether the overall result
* of the responses is successful
* @param first response
* @param second response
* @return true if the overall result is successful
* otherwise - false
*/
bool CheckResult(const ResponseInfo& first, const ResponseInfo& second) const;

protected:
/**
* @brief Returns policy parameters permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ class HMICapabilitiesImpl : public HMICapabilities {

const smart_objects::SmartObject* rc_capability() const OVERRIDE;

void set_seat_location_capability(
const smart_objects::SmartObject& seat_location_capability) OVERRIDE;

const smart_objects::SmartObject* seat_location_capability() const OVERRIDE;

void Init(resumption::LastState* last_state) OVERRIDE;

/*
Expand Down Expand Up @@ -617,6 +622,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
smart_objects::SmartObject* phone_capability_;
smart_objects::SmartObject* video_streaming_capability_;
smart_objects::SmartObject* rc_capability_;
smart_objects::SmartObject* seat_location_capability_;

ApplicationManager& app_mngr_;
HMILanguageHandler hmi_language_handler_;
Expand Down
Loading

0 comments on commit e7b5c75

Please sign in to comment.