aurum: add focus type for ActionAndWaitEvent 67/273267/2
authorHosang Kim <hosang12.kim@samsung.com>
Fri, 1 Apr 2022 11:24:16 +0000 (20:24 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Mon, 4 Apr 2022 07:58:33 +0000 (16:58 +0900)
Change-Id: Ifccab29c1a47fa3843b1231604b4dd492e7c83c2

org.tizen.aurum-bootstrap/src/Commands/ActionAndWaitEventCommand.cc
org.tizen.aurum-bootstrap/src/Runnable/ActionAndWaitEventRunnable.cc
protocol/aurum.proto

index b05a05c..76d5e4b 100644 (file)
@@ -44,7 +44,10 @@ A11yEvent convertEventType(const ::aurum::ReqActionAndWaitEvent_EventType type)
     std::unique_ptr<ActionAndWaitEventRunnable> cmd = std::make_unique<ActionAndWaitEventRunnable>(
                                                       mRequest->type(), mRequest->elementid(), mRequest->xf86keycode());
     std::shared_ptr<UiDevice> 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;
 }
index a481271..75c4637 100644 (file)
@@ -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<UiObject> 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<UiDevice> mDevice = UiDevice::getInstance();
         mDevice->pressKeyCode(mKeyCode, KeyRequestType::STROKE);
     }
+    else if (mType == 2) {
+        ObjectMapper *mObjMap = ObjectMapper::getInstance();
+        std::shared_ptr<UiObject> 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());
+    }
 }
index bca9eb4..252a819 100644 (file)
@@ -441,6 +441,7 @@ message ReqActionAndWaitEvent {
    enum ActionType{
       CLICK = 0;
       KEY = 1;
+      FOCUS = 2;
    }
    enum EventType {
       EVENT_WINDOW_ACTIVATE = 0;