diff options
author | Alexander Kutsan (GitHub) <akutsan@luxoft.com> | 2020-02-27 17:36:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 10:36:08 -0500 |
commit | f416c47429dd9a495c15ea6d078ea30ee2971b4a (patch) | |
tree | de72bb92b2c6ce2a89600b26555ea76a7a861052 /src/components/include | |
parent | d5994e8111f2fe46d8735ef2680d4235dada807f (diff) | |
download | sdl_core-f416c47429dd9a495c15ea6d078ea30ee2971b4a.tar.gz |
Feature/Web Engine support (#3221)
* Add ini file parameters for WebEngineSupport
Issue : #3197
* Add Server WebSocket transport
* Policy changes for Web Engine support
Issue : #3197
* Changes in HMI_API for WebEngineSupport
Issue : #3197
* Add application manager implementation for WebEngineSupport
Add appropriate commands
Make changes in application manager
Issue : #3197
* Bug fix : Do not override message params if request setups it
* Update SDD
* fixup! Add application manager implementation for WebEngineSupport
* fixup! Add Server WebSocket transport
* Rename websocket dir to websocket_server
* Rename WebSocketTransport adapter to WebSocketServerTransportAdapter
* fixup! Update SDD
* Fix/update app list after unregistration (#3252)
* fixup! Rename WebSocketTransport adapter to WebSocketServerTransportAdapter
* fixup! Rename websocket dir to websocket_server
* Don't remove enabled WebEngine apps from pending apps
* Rework WebEngine device ID generation
* Fix build after back merge
* Fix get app properties (#3258)
Co-authored-by: Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com>
* Remove unused vin_code variable
Co-authored-by: Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com>
Co-authored-by: Andriy Byzhynar (GitHub) <AByzhynar@luxoft.com>
Co-authored-by: Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com>
Co-authored-by: Andrii Kalinich (GitHub) <AKalinich@luxoft.com>
Diffstat (limited to 'src/components/include')
25 files changed, 309 insertions, 101 deletions
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 057f38f78e..31729aad75 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -165,6 +165,27 @@ class ApplicationManager { virtual DataAccessor<ApplicationSet> applications() const = 0; virtual DataAccessor<AppsWaitRegistrationSet> pending_applications() const = 0; + + /** + * @brief CreatePendingApplication Add applicaiton to pending state + * All info mandatory for application will be fetched from policy database. + * Application will be stored to internal pending applicaitons list. + * UpdateAppList will not be trigerred + * Application will be created if app exists in policy database and + * nicknames are not empty + * @param policy_app_id app id to store + */ + virtual void CreatePendingLocalApplication( + const std::string& policy_app_id) = 0; + + /** + * @brief RemovePendingApplication Remove applicaiton from pending state + * Application will be removed from the internal pending applicaitons list. + * UpdateAppList will not be trigerred + * @param policy_app_id app id to remove + */ + virtual void RemovePendingApplication(const std::string& policy_app_id) = 0; + virtual DataAccessor<ReregisterWaitList> reregister_applications() const = 0; virtual ApplicationSharedPtr application(uint32_t app_id) const = 0; diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h index 3af3b770aa..1e9f4d51b3 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -159,6 +159,13 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { const std::string& policy_app_id) const = 0; /** + * @brief Send OnAppPropertiesChangeNotification to the HMI + * @param policy_app_id policy app id + */ + virtual void SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const = 0; + + /** * @brief CheckSystemAction allows to check whether certain system * action is enabled. * @@ -478,6 +485,13 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { const std::string& policy_app_id) const = 0; /** + * @brief Get a list of policy app ids + * @return apps list filled with the policy app ids of each + * application + */ + virtual std::vector<std::string> GetApplicationPolicyIDs() const = 0; + + /** * @brief Get a list of enabled cloud applications * @param enabled_apps List filled with the policy app id of each enabled * cloud application @@ -495,29 +509,63 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { const std::string& policy_app_id) const = 0; /** - * @brief Get cloud app policy information, all fields that aren't set for a + * @brief Get a list of enabled local applications + * @return enabled_apps List filled with the policy app id of each enabled + * local application + */ + virtual std::vector<std::string> GetEnabledLocalApps() const = 0; + + /** + * @brief Get app policy information, all fields that aren't set for a * given app will be filled with empty strings - * @param policy_app_id Unique application id - * @param enabled Whether or not the app is enabled - * @param endpoint Filled with the endpoint used to connect to the cloud - * application - * @param certificate Filled with the certificate used to for creating a - * secure connection to the cloud application - * @param auth_token Filled with the token used for authentication when - * reconnecting to the cloud app - * @param cloud_transport_type Filled with the transport type used by the - * cloud application (ex. "WSS") - * @param hybrid_app_preference Filled with the hybrid app preference for the - * cloud application set by the user - */ - virtual bool GetCloudAppParameters( - const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference) const = 0; + * @param policy_app_id policy app id + * @param out_app_properties application properties + * @return true if application presents in database, otherwise - false + */ + virtual bool GetAppProperties(const std::string& policy_app_id, + AppProperties& out_app_properties) const = 0; + + /** + * @brief Callback for when a BC.SetAppProperties message is + * received from the HMI + * @param message The BC.SetAppProperties message + */ + virtual void OnSetAppProperties( + const smart_objects::SmartObject& properties) = 0; + + enum class AppPropertiesState { + NO_CHANGES, + ENABLED_FLAG_SWITCH, + AUTH_TOKEN_CHANGED, + TRANSPORT_TYPE_CHANGED, + ENDPOINT_CHANGED, + NICKNAMES_CHANGED, + HYBRYD_APP_PROPERTIES_CHANGED + }; + + /** + * @brief Checks if the application properties were changed. Compares the + * properties received from the HMI with the stored properties in the database + * @param properties new app properties + * @param app_id application id + * @return AppPropertiesState enum value that indicates which property has + * been changed + */ + virtual AppPropertiesState GetAppPropertiesStatus( + const smart_objects::SmartObject& properties, + const std::string& app_id) const = 0; + + /** + * @brief Check if certain application already in policy db. + * @param policy application id. + * @return true if application presents false otherwise. + */ + virtual bool IsNewApplication(const std::string& application_id) const = 0; + + /** + * @brief OnLocalAppAdded triggers PTU + */ + virtual void OnLocalAppAdded() = 0; /** * @brief Callback for when a SetCloudAppProperties message is received from a diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index eb92336b4f..e98a78f377 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -312,6 +312,19 @@ class ConnectionHandler { const transport_manager::ConnectionUID primary_connection_handle, const transport_manager::ConnectionUID secondary_connection_handle) = 0; + /** + * @brief GetWebEngineDeviceInfo + * @return device info for WebEngine device + */ + virtual const transport_manager::DeviceInfo& GetWebEngineDeviceInfo() + const = 0; + + /** + * @brief Called when HMI cooperation is started, + * creates WebSocketDevice for WebEngine + */ + virtual void CreateWebEngineDevice() = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index 48e4263959..7d6664a009 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -172,6 +172,11 @@ class ConnectionHandlerObserver { const transport_manager::ConnectionUID connection_id, const transport_manager::DeviceInfo& device_info) = 0; + /** + *@brief Called when webengine device added + */ + virtual void OnWebEngineDeviceCreated() = 0; + protected: /** * \brief Destructor diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h index 8220d05584..c613fdd091 100644 --- a/src/components/include/policy/policy_external/policy/policy_listener.h +++ b/src/components/include/policy/policy_external/policy/policy_listener.h @@ -110,6 +110,14 @@ class PolicyListener { const std::string& policy_app_id) const = 0; /** + * @brief Send OnAppPropertiesChangeNotification to the HMI + * @param policy_app_id policy app id + */ + + virtual void SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const = 0; + + /** * @brief GetAvailableApps allows to obtain list of registered applications. */ virtual void GetAvailableApps(std::queue<std::string>&) = 0; diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index 22721841aa..935233e92d 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -602,6 +602,13 @@ class PolicyManager : public usage_statistics::StatisticsManager, virtual Json::Value GetPolicyTableData() const = 0; /** + * @brief Get a list of policy app ids + * @return apps list filled with the policy app ids of each + * application + */ + virtual const std::vector<std::string> GetApplicationPolicyIDs() const = 0; + + /** * @brief Get a list of enabled cloud applications * @param enabled_apps List filled with the policy app id of each enabled * cloud application @@ -610,29 +617,21 @@ class PolicyManager : public usage_statistics::StatisticsManager, std::vector<std::string>& enabled_apps) const = 0; /** - * @brief Get cloud app policy information, all fields that aren't set for a + * @brief Get app policy information, all fields that aren't set for a * given app will be filled with empty strings - * @param policy_app_id Unique application id - * @param enabled Whether or not the app is enabled - * @param endpoint Filled with the endpoint used to connect to the cloud - * application - * @param certificate Filled with the certificate used to for creating a - * secure connection to the cloud application - * @param auth_token Filled with the token used for authentication when - * reconnecting to the cloud app - * @param cloud_transport_type Filled with the transport type used by the - * cloud application (ex. "WSS") - * @param hybrid_app_preference Filled with the hybrid app preference for the - * cloud application set by the user - */ - virtual bool GetCloudAppParameters( - const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference) const = 0; + * @param policy_app_id policy app id + * @param out_app_properties application properties + * @return true if application presents in database, otherwise - false + */ + virtual bool GetAppProperties(const std::string& policy_app_id, + AppProperties& out_app_properties) const = 0; + + /** + * @brief Get a list of enabled local applications + * @return enabled_apps List filled with the policy app id of each enabled + * local application + */ + virtual std::vector<std::string> GetEnabledLocalApps() const = 0; /** * @ brief Initialize new cloud app in the policy table @@ -778,6 +777,12 @@ class PolicyManager : public usage_statistics::StatisticsManager, */ virtual void SendAppPermissionsChanged(const std::string& device_id, const std::string& application_id) = 0; + /** + * @brief Send OnAppPropertiesChangeNotification to the HMI + * @param policy_app_id policy app id + */ + virtual void SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const = 0; /** * @brief Gets all allowed module types @@ -831,6 +836,18 @@ class PolicyManager : public usage_statistics::StatisticsManager, virtual ExternalConsentStatus GetExternalConsentStatus() = 0; /** + * @brief OnLocalAppAdded triggers PTU + */ + virtual void OnLocalAppAdded() = 0; + + /** + * @brief Check if certain application already in policy db. + * @param policy application id. + * @return true if application presents false otherwise. + */ + virtual bool IsNewApplication(const std::string& application_id) const = 0; + + /** * @brief Restart PTU timeout if PTU in UPDATING state */ virtual void ResetTimeout() = 0; diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h index bbe220060e..5b8245f6a4 100644 --- a/src/components/include/policy/policy_regular/policy/policy_listener.h +++ b/src/components/include/policy/policy_regular/policy/policy_listener.h @@ -108,6 +108,13 @@ class PolicyListener { const std::string& policy_app_id) const = 0; /** + * @brief Send OnAppPropertiesChangeNotification to the HMI + * @param policy_app_id policy app id + */ + virtual void SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const = 0; + + /** * @brief GetAvailableApps allows to obtain list of registered applications. */ virtual void GetAvailableApps(std::queue<std::string>&) = 0; diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index c9143d6bbb..52923a53e2 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -575,6 +575,14 @@ class PolicyManager : public usage_statistics::StatisticsManager, * @return policy_table as json object */ virtual Json::Value GetPolicyTableData() const = 0; + + /** + * @brief Get a list of policy app ids + * @return apps list filled with the policy app ids of each + * application + */ + virtual const std::vector<std::string> GetApplicationPolicyIDs() const = 0; + /** * @brief Get a list of enabled cloud applications * @param enabled_apps List filled with the policy app id of each enabled @@ -584,29 +592,21 @@ class PolicyManager : public usage_statistics::StatisticsManager, std::vector<std::string>& enabled_apps) const = 0; /** - * @brief Get cloud app policy information, all fields that aren't set for a + * @brief Get a list of enabled local applications + * @return enabled_apps List filled with the policy app id of each enabled + * local application + */ + virtual std::vector<std::string> GetEnabledLocalApps() const = 0; + + /** + * @brief Get app policy information, all fields that aren't set for a * given app will be filled with empty strings - * @param policy_app_id Unique application id - * @param enabled Whether or not the app is enabled - * @param endpoint Filled with the endpoint used to connect to the cloud - * application - * @param certificate Filled with the certificate used to for creating a - * secure connection to the cloud application - * @param auth_token Filled with the token used for authentication when - * reconnecting to the cloud app - * @param cloud_transport_type Filled with the transport type used by the - * cloud application (ex. "WSS") - * @param hybrid_app_preference Filled with the hybrid app preference for the - * cloud application set by the user - */ - virtual bool GetCloudAppParameters( - const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference) const = 0; + * @param policy_app_id policy app id + * @param out_app_properties application properties + * @return true if application presents in database, otherwise - false + */ + virtual bool GetAppProperties(const std::string& policy_app_id, + AppProperties& out_app_properties) const = 0; /** * @ brief Initialize new cloud app in the policy table @@ -758,6 +758,13 @@ class PolicyManager : public usage_statistics::StatisticsManager, const std::string& application_id) = 0; /** + * @brief Send OnAppPropertiesChangeNotification to the HMI + * @param policy_app_id policy app id + */ + virtual void SendOnAppPropertiesChangeNotification( + const std::string& policy_app_id) const = 0; + + /** * @brief Gets all allowed module types * @param policy_app_id unique identifier of application * @param modules list of allowed module types @@ -786,6 +793,18 @@ class PolicyManager : public usage_statistics::StatisticsManager, const EndpointUrls& urls) const = 0; /** + * @brief OnLocalAppAdded triggers PTU + */ + virtual void OnLocalAppAdded() = 0; + + /** + * @brief Check if certain application already in policy db. + * @param policy application id. + * @return true if application presents false otherwise. + */ + virtual bool IsNewApplication(const std::string& application_id) const = 0; + + /** * @brief Restart PTU timeout if PTU in UPDATING state */ virtual void ResetTimeout() = 0; diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index b2de63252e..5e9b65fec5 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -86,6 +86,10 @@ class MockApplicationManager : public application_manager::ApplicationManager { DataAccessor<application_manager::AppsWaitRegistrationSet>()); MOCK_CONST_METHOD0(reregister_applications, DataAccessor<application_manager::ReregisterWaitList>()); + MOCK_METHOD1(CreatePendingLocalApplication, + void(const std::string& policy_app_id)); + MOCK_METHOD1(RemovePendingApplication, + void(const std::string& policy_app_id)); MOCK_CONST_METHOD1( application, application_manager::ApplicationSharedPtr(uint32_t app_id)); MOCK_CONST_METHOD0(active_application, @@ -287,6 +291,8 @@ class MockApplicationManager : public application_manager::ApplicationManager { ApplyFunctorForEachPlugin, void(std::function<void(application_manager::plugin_manager::RPCPlugin&)> functor)); + MOCK_METHOD1(SetVINCode, void(const std::string& vin_code)); + MOCK_CONST_METHOD0(GetVINCode, const std::string()); MOCK_METHOD1( GetDeviceTransportType, hmi_apis::Common_TransportType::eType(const std::string& transport_type)); diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h index f6e0b3cb0f..a9cb70354a 100644 --- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h +++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h @@ -206,6 +206,8 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { void(const policy::AppPermissions& permissions, const std::string& device_id, const std::string& policy_app_id)); + MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification, + void(const std::string& policy_app_id)); MOCK_METHOD0(OnPTExchangeNeeded, void()); MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>& apps)); MOCK_METHOD3( @@ -242,18 +244,24 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { const std::vector<std::string>( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id)); + MOCK_CONST_METHOD0(GetApplicationPolicyIDs, std::vector<std::string>()); MOCK_CONST_METHOD1(GetEnabledCloudApps, void(std::vector<std::string>& enabled_apps)); MOCK_CONST_METHOD1(CheckCloudAppEnabled, const bool(const std::string& policy_app_id)); - MOCK_CONST_METHOD7(GetCloudAppParameters, + MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>()); + MOCK_CONST_METHOD2(GetAppProperties, bool(const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference)); + policy::AppProperties& out_app_properties)); + + MOCK_METHOD1(OnSetAppProperties, + void(const smart_objects::SmartObject& message)); + MOCK_CONST_METHOD2( + GetAppPropertiesStatus, + AppPropertiesState(const smart_objects::SmartObject& properties, + const std::string& app_id)); + MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id)); + MOCK_METHOD0(OnLocalAppAdded, void()); MOCK_METHOD1(OnSetCloudAppProperties, void(const smart_objects::SmartObject& message)); MOCK_CONST_METHOD2( diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h index 41c2f04ebb..6acffea0ed 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler.h +++ b/src/components/include/test/connection_handler/mock_connection_handler.h @@ -133,6 +133,8 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler { OnSecondaryTransportEnded, void(const transport_manager::ConnectionUID primary_connection_handle, const transport_manager::ConnectionUID secondary_connection_handle)); + MOCK_METHOD0(CreateWebEngineDevice, void()); + MOCK_CONST_METHOD0(GetWebEngineDeviceInfo, transport_manager::DeviceInfo&()); }; } // namespace connection_handler_test diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h index 8f7ec90550..61877daa23 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h +++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h @@ -46,6 +46,7 @@ class MockConnectionHandlerObserver MOCK_METHOD1(OnDeviceListUpdated, void(const connection_handler::DeviceMap& device_list)); MOCK_METHOD0(OnFindNewApplicationsRequest, void()); + MOCK_METHOD0(OnWebEngineDeviceCreated, void()); MOCK_METHOD1(RemoveDevice, void(const connection_handler::DeviceHandle& device_handle)); MOCK_METHOD4(OnServiceStartedCallback, diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h index b74ddbd13c..c6eb3416da 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h @@ -61,6 +61,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { MOCK_METHOD0(IsPTPreloaded, bool()); MOCK_METHOD0(IgnitionCyclesBeforeExchange, int()); MOCK_METHOD1(KilometersBeforeExchange, int(int current)); + MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>()); MOCK_CONST_METHOD1(GetPermissionsList, bool(StringArray& perm_list)); MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate, bool(Counters counter, int value)); @@ -83,14 +84,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { std::vector<policy_table::VehicleDataItem>()); MOCK_CONST_METHOD1(GetEnabledCloudApps, void(std::vector<std::string>& enabled_apps)); - MOCK_CONST_METHOD7(GetCloudAppParameters, + MOCK_CONST_METHOD2(GetAppProperties, bool(const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference)); + AppProperties& out_app_properties)); MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id)); MOCK_METHOD2(SetCloudAppEnabled, void(const std::string& policy_app_id, const bool enabled)); diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h index 2eb5b3300b..0060d2299f 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h @@ -94,6 +94,8 @@ class MockPolicyListener : public ::policy::PolicyListener { void(const policy::AppPermissions& permissions, const std::string& device_id, const std::string& policy_app_id)); + MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification, + void(const std::string& policy_app_id)); MOCK_CONST_METHOD1( GetDevicesIds, std::vector<std::string>(const std::string& policy_app_id)); diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h index d2023fd3d4..5adb982410 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h @@ -194,6 +194,8 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD2(SendAppPermissionsChanged, void(const std::string& device_id, const std::string& application_id)); + MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification, + void(const std::string& application_id)); MOCK_CONST_METHOD2(GetModuleTypes, bool(const std::string& policy_app_id, std::vector<std::string>* modules)); @@ -228,14 +230,12 @@ class MockPolicyManager : public PolicyManager { std::vector<policy_table::VehicleDataItem>()); MOCK_CONST_METHOD1(GetEnabledCloudApps, void(std::vector<std::string>& enabled_apps)); - MOCK_CONST_METHOD7(GetCloudAppParameters, + MOCK_CONST_METHOD2(GetAppProperties, bool(const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference)); + AppProperties& out_app_properties)); + MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>()); + MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id)); + MOCK_METHOD0(OnLocalAppAdded, void()); MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id)); MOCK_METHOD2(SetCloudAppEnabled, void(const std::string& policy_app_id, const bool enabled)); diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h index e592caf3bc..7c78eadfc8 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h @@ -55,6 +55,7 @@ class MockCacheManagerInterface : public CacheManagerInterface { MOCK_METHOD0(IsPTPreloaded, bool()); MOCK_METHOD0(IgnitionCyclesBeforeExchange, int()); MOCK_METHOD1(KilometersBeforeExchange, int(int current)); + MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>()); MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate, bool(Counters counter, int value)); MOCK_METHOD1(DaysBeforeExchange, int(int current)); @@ -69,14 +70,9 @@ class MockCacheManagerInterface : public CacheManagerInterface { std::vector<policy_table::VehicleDataItem>()); MOCK_CONST_METHOD1(GetEnabledCloudApps, void(std::vector<std::string>& enabled_apps)); - MOCK_CONST_METHOD7(GetCloudAppParameters, + MOCK_CONST_METHOD2(GetAppProperties, bool(const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference)); + AppProperties& out_app_properties)); MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id)); MOCK_METHOD2(SetCloudAppEnabled, void(const std::string& policy_app_id, const bool enabled)); diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h index 48c549e91b..e5f2321217 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h @@ -89,6 +89,8 @@ class MockPolicyListener : public ::policy::PolicyListener { void(const policy::AppPermissions& permissions, const std::string& device_id, const std::string& policy_app_id)); + MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification, + void(const std::string& policy_app_id)); MOCK_METHOD3(OnUpdateHMILevel, void(const std::string& device_id, const std::string& policy_app_id, diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h index da9edb9fe5..a76d61dfe4 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h @@ -193,6 +193,8 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD2(SendAppPermissionsChanged, void(const std::string& device_id, const std::string& application_id)); + MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification, + void(const std::string& application_id)); MOCK_CONST_METHOD2(GetModuleTypes, bool(const std::string& policy_app_id, std::vector<std::string>* modules)); @@ -223,14 +225,12 @@ class MockPolicyManager : public PolicyManager { std::vector<policy_table::VehicleDataItem>()); MOCK_CONST_METHOD1(GetEnabledCloudApps, void(std::vector<std::string>& enabled_apps)); - MOCK_CONST_METHOD7(GetCloudAppParameters, + MOCK_CONST_METHOD2(GetAppProperties, bool(const std::string& policy_app_id, - bool& enabled, - std::string& endpoint, - std::string& certificate, - std::string& auth_token, - std::string& cloud_transport_type, - std::string& hybrid_app_preference)); + AppProperties& out_app_properties)); + MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>()); + MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id)); + MOCK_METHOD0(OnLocalAppAdded, void()); MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id)); MOCK_METHOD2(SetCloudAppEnabled, void(const std::string& policy_app_id, const bool enabled)); diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h index c853ceb512..1920af18a3 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager.h +++ b/src/components/include/test/transport_manager/mock_transport_manager.h @@ -88,6 +88,8 @@ class MockTransportManager : public ::transport_manager::TransportManager, MOCK_METHOD1(SetTelemetryObserver, void(transport_manager::TMTelemetryObserver* observer)); + MOCK_METHOD0(CreateWebEngineDevice, void()); + MOCK_CONST_METHOD0(GetWebEngineDeviceInfo, transport_manager::DeviceInfo&()); }; } // namespace transport_manager_test diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h index 6ed4ac5d51..10320d51ab 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h @@ -63,6 +63,8 @@ class MockTransportManagerSettings MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t()); MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface, std::string&()); + MOCK_CONST_METHOD0(websocket_server_address, const std::string&()); + MOCK_CONST_METHOD0(websocket_server_port, uint16_t()); MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t()); MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t()); MOCK_CONST_METHOD0(bluetooth_uuid, const uint8_t*()); @@ -72,6 +74,10 @@ class MockTransportManagerSettings MOCK_CONST_METHOD0(aoa_filter_version, const std::string&()); MOCK_CONST_METHOD0(aoa_filter_uri, const std::string&()); MOCK_CONST_METHOD0(aoa_filter_serial_number, const std::string&()); + MOCK_CONST_METHOD0(ws_server_cert_path, const std::string&()); + MOCK_CONST_METHOD0(ws_server_key_path, const std::string&()); + MOCK_CONST_METHOD0(ws_server_ca_cert_path, const std::string&()); + MOCK_CONST_METHOD0(wss_server_supported, const bool()); }; } // namespace transport_manager_test diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h index a07365f8c0..d4ce0a39c8 100644 --- a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h +++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h @@ -108,6 +108,10 @@ class MockTransportAdapter transport_manager::transport_adapter::TransportConfig()); MOCK_METHOD1(CreateDevice, void(const std::string& uid)); + MOCK_METHOD1(AddDevice, + transport_manager::transport_adapter::DeviceSptr( + transport_manager::transport_adapter::DeviceSptr device)); + #ifdef TELEMETRY_MONITOR MOCK_METHOD0(GetTelemetryObserver, ::transport_manager::TMTelemetryObserver*()); diff --git a/src/components/include/transport_manager/common.h b/src/components/include/transport_manager/common.h index 08f52ae1d0..f8b0cabe2e 100644 --- a/src/components/include/transport_manager/common.h +++ b/src/components/include/transport_manager/common.h @@ -69,6 +69,11 @@ enum { enum ConnectionStatus { INVALID = -1, PENDING, RETRY, CONNECTED, CLOSING }; +namespace webengine_constants { +const std::string kWebEngineConnectionType("WEBENGINE_WEBSOCKET"); +const std::string kWebEngineDeviceName("Web Engine"); +} // namespace webengine_constants + /** * @brief Type definition for variable that hold handle of device. */ diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h index 8b46be253b..e9494b4ced 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -68,6 +68,7 @@ enum DeviceType { IOS_USB_HOST_MODE, IOS_USB_DEVICE_MODE, IOS_CARPLAY_WIRELESS, // running on iAP over Carplay wireless transport + WEBENGINE_WEBSOCKET, UNKNOWN }; @@ -225,6 +226,16 @@ class TransportAdapter { const DeviceUID& device_handle) const = 0; /** + * @brief Add device to the container(map), if container doesn't hold it yet. + * in TransportAdapter is used only to add a WebEngine device + * + * @param device Smart pointer to the device. + * + * @return Smart pointer to the device. + */ + virtual DeviceSptr AddDevice(DeviceSptr device) = 0; + + /** * @brief RunAppOnDevice allows to run specific application on the certain *device. * diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index e370e3e4c6..4697bf9982 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -215,6 +215,18 @@ class TransportManager { */ virtual int PerformActionOnClients( const TransportAction required_action) const = 0; + + /** + * @brief Called when websocket server transport adapter is available. + * Creates WebSocketDevice for WebEngine and add it to the device list + */ + virtual void CreateWebEngineDevice() = 0; + + /** + * @brief GetWebEngineDeviceInfo + * @return device info for WebEngine device + */ + virtual const DeviceInfo& GetWebEngineDeviceInfo() const = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_H_ diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h index 83d0b3e833..fee5b031ed 100644 --- a/src/components/include/transport_manager/transport_manager_settings.h +++ b/src/components/include/transport_manager/transport_manager_settings.h @@ -69,7 +69,24 @@ class TransportManagerSettings : public TransportManagerMMESettings { */ virtual const std::string& transport_manager_tcp_adapter_network_interface() const = 0; +#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT + /** + *@brief Returns websocket server address + */ + virtual const std::string& websocket_server_address() const = 0; + + /** + * @brief Returns port for websocket server + */ + virtual uint16_t websocket_server_port() const = 0; +#ifdef ENABLE_SECURITY + virtual const std::string& ws_server_cert_path() const = 0; + virtual const std::string& ws_server_key_path() const = 0; + virtual const std::string& ws_server_ca_cert_path() const = 0; + virtual const bool wss_server_supported() const = 0; +#endif // ENABLE_SECURITY +#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT /** * @brief Returns retry timeout for cloud app connections */ |