Skip to content

Commit e90b4aa

Browse files
mked-luxoftjacobkeeler
authored andcommitted
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
1 parent 5905717 commit e90b4aa

File tree

82 files changed

+2230
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2230
-205
lines changed

Doxyfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ EXAMPLE_RECURSIVE = NO
899899
# \image command).
900900

901901
IMAGE_PATH = \
902-
src/components/security_manager/docs/assets
902+
src/components/security_manager/docs/assets \
903+
src/components/protocol_handler/docs/assets
903904

904905
# The INPUT_FILTER tag can be used to specify a program that doxygen should
905906
# invoke to filter for each input file. Doxygen will invoke the filter program

src/appMain/life_cycle_impl.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ bool LifeCycleImpl::StartComponents() {
103103
app_manager_ =
104104
new application_manager::ApplicationManagerImpl(profile_, profile_);
105105

106+
auto service_status_update_handler =
107+
std::unique_ptr<protocol_handler::ServiceStatusUpdateHandler>(
108+
new protocol_handler::ServiceStatusUpdateHandler(app_manager_));
109+
110+
protocol_handler_->set_service_status_update_handler(
111+
std::move(service_status_update_handler));
112+
106113
DCHECK(!hmi_handler_);
107114
hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(profile_);
108115

src/components/application_manager/include/application_manager/application_manager_impl.h

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
#include "application_manager/rpc_service.h"
5959
#include "application_manager/state_controller_impl.h"
6060

61+
#include "application_manager/rpc_handler.h"
62+
6163
#include "application_manager/policies/policy_handler_interface.h"
6264
#include "application_manager/policies/policy_handler_observer.h"
6365
#include "connection_handler/connection_handler.h"
@@ -69,6 +71,7 @@
6971
#include "policies/policy_handler.h"
7072
#include "protocol_handler/protocol_handler.h"
7173
#include "protocol_handler/protocol_observer.h"
74+
#include "protocol_handler/service_status_update_handler_listener.h"
7275

7376
#include "interfaces/HMI_API.h"
7477
#include "interfaces/HMI_API_schema.h"
@@ -132,7 +135,8 @@ typedef std::shared_ptr<timer::Timer> TimerSPtr;
132135
class ApplicationManagerImpl
133136
: public ApplicationManager,
134137
public connection_handler::ConnectionHandlerObserver,
135-
public policy::PolicyHandlerObserver
138+
public policy::PolicyHandlerObserver,
139+
public protocol_handler::ServiceStatusUpdateHandlerListener
136140
#ifdef ENABLE_SECURITY
137141
,
138142
public security_manager::SecurityManagerListener
@@ -538,6 +542,50 @@ class ApplicationManagerImpl
538542
*/
539543
void OnPTUFinished(const bool ptu_result) FINAL;
540544

545+
#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
546+
/**
547+
* @brief OnCertDecryptFailed is called when certificate decryption fails in
548+
* external flow
549+
* @return since this callback is a part of SecurityManagerListener, bool
550+
* return value is used to indicate whether listener instance can be deleted
551+
* by calling entity. if true - listener can be deleted and removed from
552+
* listeners by SecurityManager, false - listener retains its place within
553+
* SecurityManager.
554+
*/
555+
bool OnCertDecryptFailed() FINAL;
556+
557+
/**
558+
* @brief OnCertDecryptFinished is called when certificate decryption is
559+
* finished in the external flow
560+
* @param decrypt_result bool value indicating whether decryption was
561+
* successful
562+
*/
563+
void OnCertDecryptFinished(const bool decrypt_result) FINAL;
564+
#endif
565+
566+
/**
567+
* @brief OnPTUTimeoutExceeded is called on policy table update timed out
568+
*/
569+
void OnPTUTimeoutExceeded() FINAL;
570+
571+
/**
572+
*@brief ProcessServiceStatusUpdate callback that is invoked in case of
573+
*service status update
574+
*@param connection_key - connection key
575+
*@param service_type enum value containing type of service.
576+
*@param service_event enum value containing event that occured during service
577+
*start.
578+
*@param service_update_reason enum value containing reason why service_event
579+
*occured.
580+
**/
581+
void ProcessServiceStatusUpdate(
582+
const uint32_t connection_key,
583+
hmi_apis::Common_ServiceType::eType service_type,
584+
hmi_apis::Common_ServiceEvent::eType service_event,
585+
utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>
586+
service_update_reason) FINAL;
587+
588+
bool OnPTUFailed() FINAL;
541589
/*
542590
* @brief Starts audio pass thru thread
543591
*
@@ -657,7 +705,7 @@ class ApplicationManagerImpl
657705
* @brief Notification about handshake failure
658706
* @return true on success notification handling or false otherwise
659707
*/
660-
bool OnHandshakeFailed() OVERRIDE;
708+
bool OnGetSystemTimeFailed() OVERRIDE;
661709

662710
/**
663711
* @brief Notification that certificate update is required.

src/components/application_manager/include/application_manager/message_helper.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,18 @@ class MessageHelper {
8989
static smart_objects::SmartObjectSPtr CreateHMINotification(
9090
hmi_apis::FunctionID::eType function_id);
9191

92+
static smart_objects::SmartObjectSPtr CreateOnServiceUpdateNotification(
93+
const hmi_apis::Common_ServiceType::eType type,
94+
const hmi_apis::Common_ServiceEvent::eType event,
95+
const hmi_apis::Common_ServiceStatusUpdateReason::eType reason =
96+
hmi_apis::Common_ServiceStatusUpdateReason::INVALID_ENUM,
97+
const uint32_t app_id = 0);
98+
9299
/**
93100
* @brief Creates request for different interfaces(JSON)
94101
* @param correlation_id unique ID
95-
* @param params Vector of arguments that we need in GetVehicleData request
102+
* @param params Vector of arguments that we need in GetVehicleData
103+
* request
96104
* (e.g. gps, odometer, fuel_level)
97105
*/
98106
static void CreateGetVehicleDataRequest(

src/components/application_manager/include/application_manager/policies/policy_handler.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ class PolicyHandler : public PolicyHandlerInterface,
103103
void OnSnapshotCreated(const BinaryMessage& pt_string,
104104
const std::vector<int>& retry_delay_seconds,
105105
uint32_t timeout_exchange) OVERRIDE;
106+
107+
PTURetryHandler& ptu_retry_handler() const OVERRIDE;
106108
#else // EXTERNAL_PROPRIETARY_MODE
107-
void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE;
109+
void OnSnapshotCreated(const BinaryMessage& pt_string,
110+
const PTUIterationType iteration_type) OVERRIDE;
108111
#endif // EXTERNAL_PROPRIETARY_MODE
109112
virtual bool GetPriority(const std::string& policy_app_id,
110113
std::string* priority) const OVERRIDE;
@@ -176,6 +179,9 @@ class PolicyHandler : public PolicyHandlerInterface,
176179
const std::string& policy_app_id,
177180
const std::string& hmi_level) OVERRIDE;
178181

182+
#ifndef EXTERNAL_PROPRIETARY_MODE
183+
void OnPTUTimeOut() OVERRIDE;
184+
#endif
179185
/**
180186
* Gets all allowed module types
181187
* @param app_id unique identifier of application
@@ -456,9 +462,12 @@ class PolicyHandler : public PolicyHandlerInterface,
456462
std::string& cloud_transport_type,
457463
std::string& hybrid_app_preference) const OVERRIDE;
458464

465+
void OnAuthTokenUpdated(const std::string& policy_app_id,
466+
const std::string& auth_token) OVERRIDE;
467+
459468
/**
460-
* @brief Callback for when a SetCloudAppProperties message is received from a
461-
* mobile app
469+
* @brief Callback for when a SetCloudAppProperties message is received
470+
* from a mobile app
462471
* @param message The SetCloudAppProperties message
463472
*/
464473
void OnSetCloudAppProperties(
@@ -502,11 +511,11 @@ class PolicyHandler : public PolicyHandlerInterface,
502511

503512
virtual void OnCertificateUpdated(
504513
const std::string& certificate_data) OVERRIDE;
514+
505515
#ifdef EXTERNAL_PROPRIETARY_MODE
506516
void OnCertificateDecrypted(bool is_succeeded) OVERRIDE;
517+
void ProcessCertDecryptFailed();
507518
#endif // EXTERNAL_PROPRIETARY_MODE
508-
void OnAuthTokenUpdated(const std::string& policy_app_id,
509-
const std::string& auth_token);
510519

511520
virtual bool CanUpdate() OVERRIDE;
512521

src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class PolicyHandlerObserver {
5353

5454
virtual void OnPTUFinished(const bool ptu_result) {}
5555

56+
virtual void OnPTUTimeoutExceeded() {}
57+
5658
virtual ~PolicyHandlerObserver() {}
5759
};
5860
} // namespace policy

src/components/application_manager/include/application_manager/smart_object_keys.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,9 @@ extern const char* policyfile;
616616
extern const char* is_active;
617617
extern const char* is_deactivated;
618618
extern const char* event_name;
619+
extern const char* service_type;
620+
extern const char* service_event;
621+
extern const char* reason;
619622

620623
} // namespace hmi_notification
621624

src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler,
129129
*/
130130
void ProcessSystemTimeReadyNotification();
131131

132+
/**
133+
* @brief ResetPendingSystemTimeRequests resets waiting for system time
134+
* requests flag
135+
*/
136+
void ResetPendingSystemTimeRequests() OVERRIDE;
137+
132138
/**
133139
* @brief Checks if UTC time is ready to provided by HMI
134140
* and can be requested by GetSystemTime request
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (c) 2019, Ford Motor Company
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following
13+
* disclaimer in the documentation and/or other materials provided with the
14+
* distribution.
15+
*
16+
* Neither the name of the Ford Motor Company nor the names of its contributors
17+
* may be used to endorse or promote products derived from this software
18+
* without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
* POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
33+
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
34+
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
35+
36+
#include "application_manager/commands/notification_to_hmi.h"
37+
38+
namespace sdl_rpc_plugin {
39+
namespace app_mngr = application_manager;
40+
41+
namespace commands {
42+
namespace hmi {
43+
44+
/**
45+
* @brief OnServiceUpdateNotification command class
46+
**/
47+
class OnServiceUpdateNotification
48+
: public app_mngr::commands::NotificationToHMI {
49+
public:
50+
/**
51+
* @brief OnServiceUpdateNotification class constructor
52+
* @param application_manager ref to application manager
53+
* @param rpc_service ref to rpc service
54+
* @param hmi_capabilities ref to HMI capabilities
55+
* @param policy_handle ref to policy handler
56+
**/
57+
OnServiceUpdateNotification(
58+
const app_mngr::commands::MessageSharedPtr& message,
59+
app_mngr::ApplicationManager& application_manager,
60+
app_mngr::rpc_service::RPCService& rpc_service,
61+
app_mngr::HMICapabilities& hmi_capabilities,
62+
policy::PolicyHandlerInterface& policy_handler);
63+
64+
/**
65+
* @brief OnServiceUpdateNotification class destructor
66+
**/
67+
virtual ~OnServiceUpdateNotification() OVERRIDE;
68+
69+
/**
70+
* @brief Execute command
71+
**/
72+
void Run() OVERRIDE;
73+
74+
private:
75+
DISALLOW_COPY_AND_ASSIGN(OnServiceUpdateNotification);
76+
};
77+
78+
} // namespace hmi
79+
} // namespace commands
80+
} // namespace sdl_rpc_plugin
81+
82+
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_

src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(
5151

5252
void BasicCommunicationGetSystemTimeRequest::onTimeOut() {
5353
LOG4CXX_AUTO_TRACE(logger_);
54-
application_manager_.protocol_handler().NotifyOnFailedHandshake();
54+
application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed();
5555
}
5656

5757
} // namespace commands

0 commit comments

Comments
 (0)