summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2020-02-04 10:21:44 -0500
committerJackLivio <jack@livio.io>2020-02-04 10:21:44 -0500
commit86a1be7a53dddff1e5187e23eedc156332096f86 (patch)
tree3e92507bc24fce1edd092b372ea1b9a54cd532b6
parent77cbc96b8ccf794d968eb062b4f1504b6d01b40e (diff)
downloadsdl_core-86a1be7a53dddff1e5187e23eedc156332096f86.tar.gz
Add missing rpc run and on_event logic
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_join_network_request_from_hmi.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_request_from_hmi.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_response_to_hmi.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_request_to_mobile.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response_from_mobile.cc3
-rw-r--r--src/components/interfaces/HMI_API.xml1
7 files changed, 43 insertions, 0 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_join_network_request_from_hmi.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_join_network_request_from_hmi.h
index a74a1d6e0d..ebf913a5ef 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_join_network_request_from_hmi.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_join_network_request_from_hmi.h
@@ -67,6 +67,8 @@ class BCJoinNetworkRequestFromHMI : public app_mngr::commands::RequestFromHMI {
**/
virtual void Run();
+ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(BCJoinNetworkRequestFromHMI);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_request_from_hmi.cc
index 5bd03bfc6e..28bf4a0b55 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_request_from_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_request_from_hmi.cc
@@ -35,6 +35,8 @@
#include "application_manager/rpc_service.h"
#include "interfaces/MOBILE_API.h"
+#include "application_manager/message_helper.h"
+
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
@@ -55,6 +57,38 @@ BCJoinNetworkRequestFromHMI::~BCJoinNetworkRequestFromHMI() {}
void BCJoinNetworkRequestFromHMI::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ std::string policy_app_id = (*message_)[strings::msg_params][strings::policy_app_id].asString();
+ ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id);
+ smart_objects::SmartObject mobile_msg_params(smart_objects::SmartType_Map);
+ mobile_msg_params[strings::wifi_state] = (*message_)[strings::msg_params][strings::wifi_state];
+ mobile_msg_params[strings::ssid] = (*message_)[strings::msg_params][strings::ssid];
+ mobile_msg_params[strings::password] = (*message_)[strings::msg_params][strings::password];
+ mobile_msg_params[strings::security_type] = (*message_)[strings::msg_params][strings::security_type];
+ SendMobileRequest(mobile_apis::FunctionID::JoinNetworkID, app, &mobile_msg_params, true);
+
+}
+
+void BCJoinNetworkRequestFromHMI::on_event(
+ const event_engine::MobileEvent& event) {
+ smart_objects::SmartObject event_message(event.smart_object());
+
+ auto& msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType mobile_result =
+ static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ hmi_apis::Common_Result::eType result =
+ MessageHelper::MobileToHMIResult(mobile_result);
+ bool success = IsMobileResultSuccess(mobile_result);
+
+
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::BasicCommunication_JoinNetwork,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_response_to_hmi.cc
index 4edefa1c56..1449e71bae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_response_to_hmi.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_join_network_response_to_hmi.cc
@@ -55,6 +55,7 @@ BCJoinNetworkResponseToHMI::~BCJoinNetworkResponseToHMI() {}
void BCJoinNetworkResponseToHMI::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_request_to_mobile.cc
index 96ee243c0b..82c7165c1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_request_to_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_request_to_mobile.cc
@@ -55,6 +55,7 @@ JoinNetworkRequestToMobile::~JoinNetworkRequestToMobile() {}
void JoinNetworkRequestToMobile::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response.cc
index b5408a7c0a..829b52b3d0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response.cc
@@ -55,6 +55,7 @@ JoinNetworkResponse::~JoinNetworkResponse() {}
void JoinNetworkResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response_from_mobile.cc
index a3b493f2dc..32eb68aaa9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/join_network_response_from_mobile.cc
@@ -55,6 +55,9 @@ JoinNetworkResponseFromMobile::~JoinNetworkResponseFromMobile() {}
void JoinNetworkResponseFromMobile::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::MobileEvent event(mobile_apis::FunctionID::JoinNetworkID);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 741d8bf578..a8c0a0b195 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -4277,6 +4277,7 @@
<interface name="BasicCommunication" version="2.1.0" date="2019-03-18">
<function name="JoinNetwork" messagetype="request" >
<description>A request for the receiver to join the specified network.</description>
+ <param name="policyAppID" type="String" mandatory="false"/>
<param name="wifiState" type="Common.WiFiStateInfo" mandatory="false">
<description>wifi state info</description>
</param>