Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@ EXAMPLE_RECURSIVE = NO
# \image command).

IMAGE_PATH = \
src/components/security_manager/docs/assets
src/components/security_manager/docs/assets \
src/components/protocol_handler/docs/assets

# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
Expand Down
7 changes: 7 additions & 0 deletions src/appMain/life_cycle_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ bool LifeCycleImpl::StartComponents() {
app_manager_ =
new application_manager::ApplicationManagerImpl(profile_, profile_);

auto service_status_update_handler =
std::unique_ptr<protocol_handler::ServiceStatusUpdateHandler>(
new protocol_handler::ServiceStatusUpdateHandler(app_manager_));

protocol_handler_->set_service_status_update_handler(
std::move(service_status_update_handler));

DCHECK(!hmi_handler_);
hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(profile_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class PolicyHandlerObserver {

virtual void OnPTUFinished(const bool ptu_result) {}

virtual void OnPTUTimeoutExceeded() {}

virtual ~PolicyHandlerObserver() {}
};
} // namespace policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* Neither the name of the Ford Motor Company nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_

#include "application_manager/commands/notification_to_hmi.h"

namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;

namespace commands {
namespace hmi {

/**
* @brief OnServiceUpdateNotification command class
**/
class OnServiceUpdateNotification
: public app_mngr::commands::NotificationToHMI {
public:
/**
* @brief OnServiceUpdateNotification class constructor
* @param application_manager ref to application manager
* @param rpc_service ref to rpc service
* @param hmi_capabilities ref to HMI capabilities
* @param policy_handle ref to policy handler
**/
OnServiceUpdateNotification(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler);

/**
* @brief OnServiceUpdateNotification class destructor
**/
virtual ~OnServiceUpdateNotification() OVERRIDE;

/**
* @brief Execute command
**/
void Run() OVERRIDE;

private:
DISALLOW_COPY_AND_ASSIGN(OnServiceUpdateNotification);
};

} // namespace hmi
} // namespace commands
} // namespace sdl_rpc_plugin

#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(

void BasicCommunicationGetSystemTimeRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
application_manager_.protocol_handler().NotifyOnFailedHandshake();
application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed();
}

} // namespace commands
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* Neither the name of the Ford Motor Company nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "sdl_rpc_plugin/commands/hmi/on_service_update_notification.h"

namespace sdl_rpc_plugin {
using namespace application_manager;

namespace commands {

namespace hmi {

OnServiceUpdateNotification::OnServiceUpdateNotification(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
: NotificationToHMI(message,
application_manager,
rpc_service,
hmi_capabilities,
policy_handler) {}

OnServiceUpdateNotification::~OnServiceUpdateNotification() {}

void OnServiceUpdateNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}

} // namespace hmi
} // namespace commands
} // namespace sdl_rpc_plugin
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
#include "utils/macro.h"

#ifdef EXTERNAL_PROPRIETARY_MODE
#include "policy/ptu_retry_handler.h"
#endif // EXTERNAL_PROPRIETARY_MODE

using policy::PolicyHandlerInterface;

namespace sdl_rpc_plugin {
Expand Down Expand Up @@ -116,6 +120,17 @@ void OnSystemRequestNotification::Run() {
"Sending request with application id " << app->policy_app_id());

params[strings::connection_key] = app->app_id();

#ifdef EXTERNAL_PROPRIETARY_MODE
using namespace rpc::policy_table_interface_base;
const auto request_type =
static_cast<rpc::policy_table_interface_base::RequestType>(
(*message_)[strings::msg_params][strings::request_type].asUInt());

if (RequestType::RT_PROPRIETARY == request_type) {
policy_handler_.ptu_retry_handler().OnSystemRequestReceived();
}
#endif
SendNotificationToMobile(message_);
}

Expand Down
Loading