Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/sdl_0285_c…
Browse files Browse the repository at this point in the history
…onstantTBT_update
  • Loading branch information
LitvinenkoIra committed Jan 15, 2021
2 parents 37f4fb7 + 44e7e5d commit b4b474c
Show file tree
Hide file tree
Showing 45 changed files with 608 additions and 205 deletions.
3 changes: 1 addition & 2 deletions src/appMain/sdl_preloaded_pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,7 @@
"hmi_levels": [
"FULL",
"LIMITED",
"BACKGROUND",
"NONE"
"BACKGROUND"
]
},
"UnpublishAppService": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ class AppServiceManager {
virtual bool UpdateNavigationCapabilities(
smart_objects::SmartObject& out_params);

/**
* @brief Retrieve the active service for handling waypoints if available
* @return The active NAVIGATION service if it handles waypoints, nullptr
* otherwise
*/
virtual AppService* FindWayPointsHandler();

/**
* @brief Get the RPCPassingHandler tied to this object
* @return The RPCPassingHandler tied to this object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,32 +286,22 @@ class ApplicationManagerImpl
*/
bool IsAppSubscribedForWayPoints(Application& app) const OVERRIDE;

void SaveWayPointsMessage(
smart_objects::SmartObjectSPtr way_points_message) OVERRIDE;
void SaveWayPointsMessage(smart_objects::SmartObjectSPtr way_points_message,
uint32_t app_id = 0) OVERRIDE;

/**
* @brief Subscribe Application for way points
* @param Application id
*/
void SubscribeAppForWayPoints(uint32_t app_id) OVERRIDE;
void SubscribeAppForWayPoints(uint32_t app_id,
bool response_from_hmi = true) OVERRIDE;

/**
* @brief Subscribe Application for way points
* @param Application pointer
*/
void SubscribeAppForWayPoints(ApplicationSharedPtr app) OVERRIDE;
void SubscribeAppForWayPoints(ApplicationSharedPtr app,
bool response_from_hmi = true) OVERRIDE;

/**
* @brief Unsubscribe Application for way points
* @param Application id
*/
void UnsubscribeAppFromWayPoints(uint32_t app_id) OVERRIDE;
void UnsubscribeAppFromWayPoints(uint32_t app_id,
bool response_from_hmi = true) OVERRIDE;

/**
* @brief Unsubscribe Application for way points
* @param Application pointer
*/
void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) OVERRIDE;
void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app,
bool response_from_hmi = true) OVERRIDE;

bool IsSubscribedToHMIWayPoints() const OVERRIDE;

/**
* @brief Is Any Application is subscribed for way points
Expand Down Expand Up @@ -1562,7 +1552,11 @@ class ApplicationManagerImpl
*/
std::set<uint32_t> subscribed_way_points_apps_list_;

smart_objects::SmartObjectSPtr way_points_data_;
bool subscribed_to_hmi_way_points_;

smart_objects::SmartObjectSPtr hmi_way_points_data_;

std::map<uint32_t, smart_objects::SmartObject> mobile_way_points_data_;

/**
* @brief Map contains applications which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,9 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void LinkAppsToDevice();

void SetHeartBeatTimeout(const std::string& policy_app_id,
const uint32_t app_id);

typedef std::vector<application_manager::ApplicationSharedPtr> Applications;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,13 @@ void RCAppExtension::RevertResumption(
const auto module_subscriptions =
ConvertSmartObjectToModuleCollection(resumption_data);

for (auto& module : module_subscriptions) {
SDL_LOG_TRACE("Requested to unsubscribe module_type "
<< module.first << "module_id: " << module.second);
}
std::set<rc_rpc_plugin::ModuleUid> to_be_unsubscribed;

const auto app_id = application_.app_id();
auto no_apps_subscribed = [app_id,
this](const rc_rpc_plugin::ModuleUid& module) {
SDL_LOG_TRACE("Requested to unsubscribe module_type "
<< module.first << "module_id: " << module.second);
if (plugin_.IsOtherAppsSubscribed(module, app_id)) {
SDL_LOG_DEBUG("Some other app except " << app_id
<< " is already subscribed to "
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2018, 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_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_

#include "application_manager/commands/command_notification_from_mobile_impl.h"
#include "utils/macro.h"

namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;

namespace commands {

class OnWayPointChangeNotificationFromMobile
: public app_mngr::commands::CommandNotificationFromMobileImpl {
public:
/**
* @brief OnWayPointChangeNotificationFromMobile class constructor
*
* @param message Incoming SmartObject message
**/
OnWayPointChangeNotificationFromMobile(
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 OnWayPointChangeNotificationFromMobile class destructor
**/
virtual ~OnWayPointChangeNotificationFromMobile();

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

private:
DISALLOW_COPY_AND_ASSIGN(OnWayPointChangeNotificationFromMobile);
};

} // namespace commands
} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_FROM_MOBILE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ class PerformInteractionRequest
* @return true if send response to mobile application otherwise
* return false.
*/
bool ProcessVRResponse(const smart_objects::SmartObject& message,
smart_objects::SmartObject& msg_params);
bool ProcessVRResponse(const smart_objects::SmartObject& message);

/**
* @brief Sends PerformInteraction response to mobile side
* @param message which should send to mobile side
*/
void ProcessUIResponse(const smart_objects::SmartObject& message,
smart_objects::SmartObject& msg_params);
void ProcessUIResponse(const smart_objects::SmartObject& message);

/*
* @brief Sends UI PerformInteraction request to HMI
Expand Down Expand Up @@ -279,6 +277,7 @@ class PerformInteractionRequest
mobile_apis::InteractionMode::eType interaction_mode_;
std::int32_t ui_choice_id_received_;
std::int32_t vr_choice_id_received_;
std::string ui_text_entry_received_;

bool ui_response_received_;
bool vr_response_received_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class SubscribeWayPointsRequest
*/
bool Init() FINAL;

void onTimeOut() FINAL;

private:
DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class UnsubscribeWayPointsRequest
*/
bool Init() FINAL;

void onTimeOut() FINAL;

private:
DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

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

#include "application_manager/app_service_manager.h"

namespace sdl_rpc_plugin {
using namespace application_manager;

Expand All @@ -56,8 +58,12 @@ void OnNaviWayPointChangeNotification::Run() {
// prepare SmartObject for mobile factory
(*message_)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnWayPointChangeID);
application_manager_.SaveWayPointsMessage(message_, 0);

SendNotificationToMobile(message_);
if (application_manager_.GetAppServiceManager().FindWayPointsHandler() ==
nullptr) {
SendNotificationToMobile(message_);
}
}

} // namespace commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ bool AlertManeuverRequest::PrepareResponseParameters(
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_TTS)))) {
result_code = mobile_apis::Result::WARNINGS;
return_info = std::string("Unsupported phoneme type sent in a prompt");
return_info = app_mngr::commands::MergeInfos(
navigation_alert_info, info_navi_, tts_alert_info, info_tts_);
return result;
}
result_code =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,10 @@ bool AlertRequest::PrepareResponseParameters(

bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info);

/* result=false if UI interface is ok and TTS interface = UNSUPPORTED_RESOURCE
* and sdl receive TTS.IsReady=true or SDL doesn't receive responce for
* TTS.IsReady.
*/
if (result && ui_alert_info.is_ok && tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_NOT_AVAILABLE != tts_alert_info.interface_state) {
result = false;
}
result_code = mobile_apis::Result::WARNINGS;
if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) &&
tts_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) {
tts_response_info_ = "Unsupported phoneme type sent in a prompt";
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
return result;
Expand All @@ -234,7 +225,10 @@ bool AlertRequest::PrepareResponseParameters(
info = app_mngr::commands::MergeInfos(
ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_);
// Mobile Alert request is successful when UI_Alert is successful
if (is_ui_alert_sent_ && !ui_alert_info.is_ok) {
bool has_unsupported_data =
ui_alert_info.is_unsupported_resource &&
HmiInterfaces::STATE_NOT_AVAILABLE != ui_alert_info.interface_state;
if (is_ui_alert_sent_ && !ui_alert_info.is_ok && !has_unsupported_data) {
return false;
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ void OnWayPointChangeNotification::Run() {
(*message_)[strings::params][strings::connection_key] = *app_id;
SendNotification();
}
application_manager_.SaveWayPointsMessage(message_);
}
} // namespace commands
} // namespace sdl_rpc_plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
Copyright (c) 2020, 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/mobile/on_way_point_change_notification_from_mobile.h"

#include "application_manager/app_service_manager.h"
#include "application_manager/message.h"
#include "application_manager/message_helper.h"

namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {

SDL_CREATE_LOG_VARIABLE("Commands")

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

OnWayPointChangeNotificationFromMobile::
~OnWayPointChangeNotificationFromMobile() {}

void OnWayPointChangeNotificationFromMobile::Run() {
SDL_LOG_AUTO_TRACE();

(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
ApplicationSharedPtr app = application_manager_.application(connection_key());

if (app.use_count() == 0) {
SDL_LOG_ERROR(
"OnWayPointChangeNotificationFromMobile application doesn't exist");
return;
}

auto service =
application_manager_.GetAppServiceManager().FindWayPointsHandler();
if (!service || !service->mobile_service ||
service->connection_key != connection_key()) {
SDL_LOG_ERROR("Application is not active NAVIGATION ASP");
return;
}

application_manager_.SaveWayPointsMessage(message_, connection_key());

(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
}

} // namespace commands

} // namespace sdl_rpc_plugin
Loading

0 comments on commit b4b474c

Please sign in to comment.