diff options
author | Maksym Ked (GitHub) <41471947+mked-luxoft@users.noreply.github.com> | 2019-08-29 22:28:40 +0300 |
---|---|---|
committer | Jacob Keeler <jacob.keeler@livioradio.com> | 2019-08-29 15:28:40 -0400 |
commit | e90b4aa4729ca9f64e7b6f4aa9fc746c29863f23 (patch) | |
tree | 75d35eac19de42817e387b91250faab94f7e4e70 /src/components/application_manager/include/application_manager | |
parent | 5905717229c512e975ca95715736db795f3105d2 (diff) | |
download | sdl_core-e90b4aa4729ca9f64e7b6f4aa9fc746c29863f23.tar.gz |
Feature/service status update to hmi (#2921)
* Added OnServiceUpdate notification
* Added handling of service status update
- introduced ServiceStatusUpdateHandler and ServiceStatusUpdateHandlerListener interfaces
- added lacking interface functions to corresponding entities
- added notification of listeners
- introduced ServiceStatusUpdateNotificationBuilder
- replaced shared_ptr with unique_ptr
- moved SERVICE_RECEIVED
* Add UT's for service status update to HMI feature
* Added ServiceStatusUpdateDocumentation
* Added sending error on PTU retries exceed allowed count
* Fix OnServiceUpdate for unsecure force protected service
* Updates according to proposal changes
Added new result codes for ServiceStatusUpdateReasonStructure
Diffstat (limited to 'src/components/application_manager/include/application_manager')
6 files changed, 84 insertions, 8 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index a224d51a33..702f7a9a4d 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -58,6 +58,8 @@ #include "application_manager/rpc_service.h" #include "application_manager/state_controller_impl.h" +#include "application_manager/rpc_handler.h" + #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/policies/policy_handler_observer.h" #include "connection_handler/connection_handler.h" @@ -69,6 +71,7 @@ #include "policies/policy_handler.h" #include "protocol_handler/protocol_handler.h" #include "protocol_handler/protocol_observer.h" +#include "protocol_handler/service_status_update_handler_listener.h" #include "interfaces/HMI_API.h" #include "interfaces/HMI_API_schema.h" @@ -132,7 +135,8 @@ typedef std::shared_ptr<timer::Timer> TimerSPtr; class ApplicationManagerImpl : public ApplicationManager, public connection_handler::ConnectionHandlerObserver, - public policy::PolicyHandlerObserver + public policy::PolicyHandlerObserver, + public protocol_handler::ServiceStatusUpdateHandlerListener #ifdef ENABLE_SECURITY , public security_manager::SecurityManagerListener @@ -538,6 +542,50 @@ class ApplicationManagerImpl */ void OnPTUFinished(const bool ptu_result) FINAL; +#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) + /** + * @brief OnCertDecryptFailed is called when certificate decryption fails in + * external flow + * @return since this callback is a part of SecurityManagerListener, bool + * return value is used to indicate whether listener instance can be deleted + * by calling entity. if true - listener can be deleted and removed from + * listeners by SecurityManager, false - listener retains its place within + * SecurityManager. + */ + bool OnCertDecryptFailed() FINAL; + + /** + * @brief OnCertDecryptFinished is called when certificate decryption is + * finished in the external flow + * @param decrypt_result bool value indicating whether decryption was + * successful + */ + void OnCertDecryptFinished(const bool decrypt_result) FINAL; +#endif + + /** + * @brief OnPTUTimeoutExceeded is called on policy table update timed out + */ + void OnPTUTimeoutExceeded() FINAL; + + /** + *@brief ProcessServiceStatusUpdate callback that is invoked in case of + *service status update + *@param connection_key - connection key + *@param service_type enum value containing type of service. + *@param service_event enum value containing event that occured during service + *start. + *@param service_update_reason enum value containing reason why service_event + *occured. + **/ + void ProcessServiceStatusUpdate( + const uint32_t connection_key, + hmi_apis::Common_ServiceType::eType service_type, + hmi_apis::Common_ServiceEvent::eType service_event, + utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType> + service_update_reason) FINAL; + + bool OnPTUFailed() FINAL; /* * @brief Starts audio pass thru thread * @@ -657,7 +705,7 @@ class ApplicationManagerImpl * @brief Notification about handshake failure * @return true on success notification handling or false otherwise */ - bool OnHandshakeFailed() OVERRIDE; + bool OnGetSystemTimeFailed() OVERRIDE; /** * @brief Notification that certificate update is required. diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 8f05b523b3..aff4659323 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -89,10 +89,18 @@ class MessageHelper { static smart_objects::SmartObjectSPtr CreateHMINotification( hmi_apis::FunctionID::eType function_id); + static smart_objects::SmartObjectSPtr CreateOnServiceUpdateNotification( + const hmi_apis::Common_ServiceType::eType type, + const hmi_apis::Common_ServiceEvent::eType event, + const hmi_apis::Common_ServiceStatusUpdateReason::eType reason = + hmi_apis::Common_ServiceStatusUpdateReason::INVALID_ENUM, + const uint32_t app_id = 0); + /** * @brief Creates request for different interfaces(JSON) * @param correlation_id unique ID - * @param params Vector of arguments that we need in GetVehicleData request + * @param params Vector of arguments that we need in GetVehicleData + * request * (e.g. gps, odometer, fuel_level) */ static void CreateGetVehicleDataRequest( diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index dddd1b333d..5ddac88dd9 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -103,8 +103,11 @@ class PolicyHandler : public PolicyHandlerInterface, void OnSnapshotCreated(const BinaryMessage& pt_string, const std::vector<int>& retry_delay_seconds, uint32_t timeout_exchange) OVERRIDE; + + PTURetryHandler& ptu_retry_handler() const OVERRIDE; #else // EXTERNAL_PROPRIETARY_MODE - void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE; + void OnSnapshotCreated(const BinaryMessage& pt_string, + const PTUIterationType iteration_type) OVERRIDE; #endif // EXTERNAL_PROPRIETARY_MODE virtual bool GetPriority(const std::string& policy_app_id, std::string* priority) const OVERRIDE; @@ -176,6 +179,9 @@ class PolicyHandler : public PolicyHandlerInterface, const std::string& policy_app_id, const std::string& hmi_level) OVERRIDE; +#ifndef EXTERNAL_PROPRIETARY_MODE + void OnPTUTimeOut() OVERRIDE; +#endif /** * Gets all allowed module types * @param app_id unique identifier of application @@ -456,9 +462,12 @@ class PolicyHandler : public PolicyHandlerInterface, std::string& cloud_transport_type, std::string& hybrid_app_preference) const OVERRIDE; + void OnAuthTokenUpdated(const std::string& policy_app_id, + const std::string& auth_token) OVERRIDE; + /** - * @brief Callback for when a SetCloudAppProperties message is received from a - * mobile app + * @brief Callback for when a SetCloudAppProperties message is received + * from a mobile app * @param message The SetCloudAppProperties message */ void OnSetCloudAppProperties( @@ -502,11 +511,11 @@ class PolicyHandler : public PolicyHandlerInterface, virtual void OnCertificateUpdated( const std::string& certificate_data) OVERRIDE; + #ifdef EXTERNAL_PROPRIETARY_MODE void OnCertificateDecrypted(bool is_succeeded) OVERRIDE; + void ProcessCertDecryptFailed(); #endif // EXTERNAL_PROPRIETARY_MODE - void OnAuthTokenUpdated(const std::string& policy_app_id, - const std::string& auth_token); virtual bool CanUpdate() OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h index 3c4dce2fbc..fdfed698c4 100644 --- a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h +++ b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h @@ -53,6 +53,8 @@ class PolicyHandlerObserver { virtual void OnPTUFinished(const bool ptu_result) {} + virtual void OnPTUTimeoutExceeded() {} + virtual ~PolicyHandlerObserver() {} }; } // namespace policy 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 1d13417fa1..b3ca00013a 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 @@ -616,6 +616,9 @@ extern const char* policyfile; extern const char* is_active; extern const char* is_deactivated; extern const char* event_name; +extern const char* service_type; +extern const char* service_event; +extern const char* reason; } // namespace hmi_notification diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h index 46aa98e6c1..a8ba796a1b 100644 --- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h +++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h @@ -130,6 +130,12 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler, void ProcessSystemTimeReadyNotification(); /** + * @brief ResetPendingSystemTimeRequests resets waiting for system time + * requests flag + */ + void ResetPendingSystemTimeRequests() OVERRIDE; + + /** * @brief Checks if UTC time is ready to provided by HMI * and can be requested by GetSystemTime request * @return True if HMI is ready to provide UTC time |