From c94f518319762e4d95d2a02866f3103f8c66ef62 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Fri, 1 Apr 2022 20:24:16 +0900 Subject: [PATCH] aurum: add focus type for ActionAndWaitEvent Change-Id: Ifccab29c1a47fa3843b1231604b4dd492e7c83c2 --- .../src/Commands/ActionAndWaitEventCommand.cc | 5 ++++- .../Runnable/ActionAndWaitEventRunnable.cc | 21 ++++++++++++++++++- protocol/aurum.proto | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc index b05a05c..76d5e4b 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc @@ -44,7 +44,10 @@ A11yEvent convertEventType(const ::aurum::ReqActionAndWaitEvent_EventType type) std::unique_ptr cmd = std::make_unique( mRequest->type(), mRequest->elementid(), mRequest->xf86keycode()); std::shared_ptr obj = UiDevice::getInstance(); - obj->executeAndWaitForEvents(cmd.get(), convertEventType(mRequest->eventtype()), mRequest->timeoutms()); + bool ret = obj->executeAndWaitForEvents(cmd.get(), convertEventType(mRequest->eventtype()), mRequest->timeoutms()); + + if (ret) mResponse->set_status(::aurum::RspStatus::OK); + else mResponse->set_status(::aurum::RspStatus::ERROR); return grpc::Status::OK; } diff --git a/org.tizen.aurum-bootstrap/src/Runnable/ActionAndWaitEventRunnable.cc b/org.tizen.aurum-bootstrap/src/Runnable/ActionAndWaitEventRunnable.cc index a481271..75c4637 100644 --- a/org.tizen.aurum-bootstrap/src/Runnable/ActionAndWaitEventRunnable.cc +++ b/org.tizen.aurum-bootstrap/src/Runnable/ActionAndWaitEventRunnable.cc @@ -28,6 +28,15 @@ ActionAndWaitEventRunnable::ActionAndWaitEventRunnable(int type, std::string ele void ActionAndWaitEventRunnable::run() const { +/** + * + * enum ActionType{ + * CLICK = 0; + * KEY = 1; + * FOCUS = 2; + * } + * + **/ if (mType == 0) { ObjectMapper *mObjMap = ObjectMapper::getInstance(); std::shared_ptr obj = mObjMap->getElement(mElementId); @@ -39,9 +48,19 @@ void ActionAndWaitEventRunnable::run() const else LOGE("Object Id(%s) is invalid or not exist on view", mElementId.c_str()); } - else { + else if (mType == 1) { LOGD("Send KeyEvent(%s)", mKeyCode.c_str()); std::shared_ptr mDevice = UiDevice::getInstance(); mDevice->pressKeyCode(mKeyCode, KeyRequestType::STROKE); } + else if (mType == 2) { + ObjectMapper *mObjMap = ObjectMapper::getInstance(); + std::shared_ptr obj = mObjMap->getElement(mElementId); + if (obj) { + LOGD("SetFocus Object Id(%s)", mElementId.c_str()); + obj->setFocus(); + } + else + LOGE("Object Id(%s) is invalid or not exist on view", mElementId.c_str()); + } } diff --git a/protocol/aurum.proto b/protocol/aurum.proto index bca9eb4..252a819 100644 --- a/protocol/aurum.proto +++ b/protocol/aurum.proto @@ -441,6 +441,7 @@ message ReqActionAndWaitEvent { enum ActionType{ CLICK = 0; KEY = 1; + FOCUS = 2; } enum EventType { EVENT_WINDOW_ACTIVATE = 0; -- 2.34.1