diff options
author | Andriy Byzhynar <abyzhynar@luxoft.com> | 2019-07-11 14:44:07 +0300 |
---|---|---|
committer | Andriy Byzhynar (GitHub) <AByzhynar@luxoft.com> | 2019-08-20 21:17:13 +0300 |
commit | 2e33f8ed1f70692c2e7607aafaf074722ec8dfa0 (patch) | |
tree | b0d5d8593cc0c40dcaf72290fdb231ead5c18cd5 /src | |
parent | 721b317ff9859b6a340c2ab7bb43c39ef72311e2 (diff) | |
download | sdl_core-2e33f8ed1f70692c2e7607aafaf074722ec8dfa0.tar.gz |
Add window_id() method to Command class
Diffstat (limited to 'src')
4 files changed, 21 insertions, 0 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index 0693f9868d..0536c7aee1 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -33,6 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_ #include <stdint.h> +#include "application_manager/hmi_state.h" #include "smart_objects/smart_object.h" namespace application_manager { @@ -93,6 +94,11 @@ class Command { virtual int32_t function_id() const = 0; /* + * @brief Retrieves Window ID + */ + virtual WindowID window_id() const = 0; + + /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 4e52ac23ce..a526fede6e 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -118,6 +118,11 @@ class CommandImpl : public Command { int32_t function_id() const OVERRIDE; /* + * @brief Retrieves Window ID + */ + WindowID window_id() const OVERRIDE; + + /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 521a44890f..82f19ed89a 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -96,6 +96,15 @@ int32_t CommandImpl::function_id() const { return (*message_)[strings::params][strings::function_id].asInt(); } +WindowID CommandImpl::window_id() const { + if ((*message_).keyExists(strings::msg_params)) { + if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { + return (*message_)[strings::msg_params][strings::window_id].asUInt(); + } + } + return mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +} + uint32_t CommandImpl::connection_key() const { return (*message_)[strings::params][strings::connection_key].asUInt(); } diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h index dfc6691ef4..77b5bb7c38 100644 --- a/src/components/application_manager/test/include/application_manager/mock_request.h +++ b/src/components/application_manager/test/include/application_manager/mock_request.h @@ -55,6 +55,7 @@ class MockRequest : public application_manager::commands::Command { MOCK_METHOD0(CleanUp, bool()); MOCK_CONST_METHOD0(default_timeout, uint32_t()); MOCK_CONST_METHOD0(function_id, int32_t()); + MOCK_CONST_METHOD0(window_id, application_manager::WindowID()); MOCK_METHOD0(onTimeOut, void()); MOCK_METHOD0(AllowedToTerminate, bool()); MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed)); |