Aurum: add generating mouse device event. 22/319722/3
authorHosang Kim <hosang12.kim@samsung.com>
Thu, 31 Oct 2024 01:21:58 +0000 (10:21 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Thu, 31 Oct 2024 01:30:45 +0000 (10:30 +0900)
Change-Id: I1adb196493e03523e72ffc3c5586f7558d5a83ad

18 files changed:
libaurum/inc/Impl/MockDeviceImpl.h
libaurum/inc/Impl/TizenDeviceImpl.h
libaurum/inc/Interface/IDevice.h
libaurum/inc/UiDevice.h
libaurum/src/Impl/MockDeviceImpl.cc
libaurum/src/Impl/TizenDeviceImpl.cc
libaurum/src/UiDevice.cc
org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h
org.tizen.aurum-bootstrap/inc/Commands/Commands.h
org.tizen.aurum-bootstrap/inc/Commands/MouseDownCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/inc/Commands/MouseMoveCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/inc/Commands/MouseUpCommand.h [new file with mode: 0644]
org.tizen.aurum-bootstrap/meson.build
org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc
org.tizen.aurum-bootstrap/src/Commands/MouseDownCommand.cc [new file with mode: 0644]
org.tizen.aurum-bootstrap/src/Commands/MouseMoveCommand.cc [new file with mode: 0644]
org.tizen.aurum-bootstrap/src/Commands/MouseUpCommand.cc [new file with mode: 0644]
protocol/aurum.proto

index 6aa62be9a1105f67a15a4e05d7b67a1d8f8eb28a..2047754c1f4a5193358753d95b3d02b0d71c190f 100644 (file)
@@ -98,6 +98,20 @@ public:
      */
     bool wheelDown(int amount, const int durationMs) override;
 
+    /**
+     * @copydoc IDevice::mouseDown()
+     */
+    bool mouseDown(const int x, const int y, const int button) override;
+
+    /**
+     * @copydoc IDevice::mouseMove()
+     */
+    bool mouseMove(const int x, const int y, const int button) override;
+
+    /**
+     * @copydoc IDevice::mouseUp()
+     */
+    bool mouseUp(const int x, const int y, const int button) override;
     /**
      * @brief TBD
      * @since_tizen 6.5
index aefc5041c5b74e36f5a97f0d45164140c0c7bc77..5f5f43b26e77efd9c6bf2e33a3fcc0d0e5ea9da6 100644 (file)
@@ -78,6 +78,21 @@ public:
      */
     bool wheelDown(int amount, const int durationMs) override;
 
+    /**
+     * @copydoc IDevice::mouseDown()
+     */
+    bool mouseDown(const int x, const int y, const int button) override;
+
+    /**
+     * @copydoc IDevice::mouseMove()
+     */
+    bool mouseMove(const int x, const int y, const int button) override;
+
+    /**
+     * @copydoc IDevice::mouseUp()
+     */
+    bool mouseUp(const int x, const int y, const int button) override;
+
     /**
      * @copydoc IDevice::pressKeyCode()
      */
@@ -175,7 +190,7 @@ private:
 private:
     efl_util_inputgen_h mFakeTouchHandle;
     efl_util_inputgen_h mFakeKeyboardHandle;
-    efl_util_inputgen_h mFakeWheelHandle;
+    efl_util_inputgen_h mFakePointerHandle;
     static const int INTV_CLICK = 5;
     static const int INTV_SHORTSTROKE = 10;
     static const int INTV_LONGSTROKE = 2000;
index ccb4ddbbe9e54821cdcb6f4c34e48c2015a6492f..f53ee54fb67e0ee759fc3d428d2376b82e9e79bd 100644 (file)
@@ -184,6 +184,45 @@ public:
      */
     virtual bool wheelDown(int amount, const int durationMs) = 0;
 
+    /**
+     * @brief Performs a mouse down at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse down succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    virtual bool mouseDown(const int x, const int y, const int button) = 0;
+
+    /**
+     * @brief Performs a mouse move at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse move succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    virtual bool mouseMove(const int x, const int y, const int button) = 0;
+
+    /**
+     * @brief Performs a mouse up at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse up succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    virtual bool mouseUp(const int x, const int y, const int button) = 0;
+
     /**
      * @brief Simulates a press on the given keycode key.
      *
index d2e6ae5d02ca87314ee4ffa1b7d2d54c2326b486..86103723fc083c45d2f90a070fc86a3989dc9c17 100644 (file)
@@ -152,6 +152,45 @@ public:
      */
     bool wheelDown(int amount, const int durationMs) override;
 
+    /**
+     * @brief Performs a mouse down at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse down succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    bool mouseDown(const int x, const int y, const int button) override;
+
+    /**
+     * @brief Performs a mouse move at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse move succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    bool mouseMove(const int x, const int y, const int button) override;
+
+    /**
+     * @brief Performs a mouse up at arbitrary coordinates specified by the user.
+     *
+     * @param[in] x x coordinate
+     * @param[in] y y coordinate
+     * @param[in] button mouse button number
+     *
+     * @return true if the mouse up succeeded else false
+     *
+     * @since_tizen 10.0
+     */
+    bool mouseUp(const int x, const int y, const int button) override;
+
     /**
      * @brief Simulates a press on the given keycode key.
      *
index 5df8d619962879140edc6513a1191927a2119726..03611afcd7a2201a28be0a59d0866bf22f8beb9d 100644 (file)
@@ -146,6 +146,21 @@ bool MockDeviceImpl::wheelDown(int amount, const int durationMs)
 
 }
 
+bool MockDeviceImpl::mouseDown(const int x, const int y, const int button)
+{
+    return false;
+}
+
+bool MockDeviceImpl::mouseMove(const int x, const int y, const int button)
+{
+    return false;
+}
+
+bool MockDeviceImpl::mouseUp(const int x, const int y, const int button)
+{
+    return false;
+}
+
 bool MockDeviceImpl::pressKeyCode(std::string keycode, KeyRequestType type)
 {
     mKeyDevice.push_back(std::tuple<KeyType, KeyRequestType, std::string>(KeyType::KEY, type, keycode));
index a9243ba54ecebaaf52e7de543e136b42666cf5b9..05f8702d78e3577f99e6ffec00da28f918f6e335 100644 (file)
@@ -50,7 +50,7 @@ static GDBusConnection *system_conn;
 std::vector<std::shared_ptr<AccessibleNode>> TizenDeviceImpl::mCachedNode;
 
 TizenDeviceImpl::TizenDeviceImpl()
-: mFakeTouchHandle{0}, mFakeKeyboardHandle{0}, mFakeWheelHandle{0}, tStart{}, isTimerStarted{false}, mTouchSeq{}
+: mFakeTouchHandle{0}, mFakeKeyboardHandle{0}, mFakePointerHandle{0}, tStart{}, isTimerStarted{false}, mTouchSeq{}
 {
     LOGI("device implementation init");
     ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
@@ -58,7 +58,7 @@ TizenDeviceImpl::TizenDeviceImpl()
         obj->mFakeTouchHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN, "SMSRC Fake Input");
         obj->mFakeKeyboardHandle =
         efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, "SMSRC Fake Input");
-        obj->mFakeWheelHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_POINTER, "SMSRC Fake Input");
+        obj->mFakePointerHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_POINTER, "SMSRC Fake Input");
 
         return NULL;
     }, this);
@@ -77,7 +77,7 @@ TizenDeviceImpl::~TizenDeviceImpl()
         TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(data);
         efl_util_input_deinitialize_generator(obj->mFakeTouchHandle);
         efl_util_input_deinitialize_generator(obj->mFakeKeyboardHandle);
-        efl_util_input_deinitialize_generator(obj->mFakeWheelHandle);
+        efl_util_input_deinitialize_generator(obj->mFakePointerHandle);
 
         return NULL;
     }, this);
@@ -100,7 +100,6 @@ bool TizenDeviceImpl::click(const int x, const int y, const unsigned int duratio
     return true;
 }
 
-
 int TizenDeviceImpl::touchDown(const int x, const int y)
 {
     int seq = grabTouchSeqNumber();
@@ -146,10 +145,9 @@ bool TizenDeviceImpl::wheelUp(int amount, const int durationMs)
 {
     LOGI("wheel up %d for %d", amount, durationMs);
     long result = -1;
-    TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
     for (int i = 0; i < amount; i++){
          TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
-         result = (long)efl_util_input_generate_wheel(obj->mFakeWheelHandle, EFL_UTIL_INPUT_POINTER_WHEEL_HORZ, 1);
+         result = (long)efl_util_input_generate_wheel(obj->mFakePointerHandle, EFL_UTIL_INPUT_POINTER_WHEEL_HORZ, 1);
          usleep(durationMs * MSEC_PER_SEC/amount);
     }
 
@@ -160,15 +158,54 @@ bool TizenDeviceImpl::wheelDown(int amount, const int durationMs)
 {
     LOGI("wheel down %d for %d", amount, durationMs);
     long result = -1;
-    TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
     for (int i = 0; i < amount; i++){
         TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
-        result = (long)efl_util_input_generate_wheel(obj->mFakeWheelHandle, EFL_UTIL_INPUT_POINTER_WHEEL_HORZ, -1);
+        result = (long)efl_util_input_generate_wheel(obj->mFakePointerHandle, EFL_UTIL_INPUT_POINTER_WHEEL_HORZ, -1);
         usleep(durationMs * MSEC_PER_SEC/amount);
     }
 
     return result == EFL_UTIL_ERROR_NONE;
 }
+
+bool TizenDeviceImpl::mouseDown(const int x, const int y, const int button)
+{
+    LOGI("mouse down %d %d, button:%d", x, y, button);
+    long result = -1;
+    if (button > 0) {
+         TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
+         result = (long)efl_util_input_generate_pointer(obj->mFakePointerHandle, button, EFL_UTIL_INPUT_POINTER_BUTTON_DOWN,
+                                                        x, y);
+    }
+
+    return result == EFL_UTIL_ERROR_NONE;
+}
+
+bool TizenDeviceImpl::mouseMove(const int x, const int y, const int button)
+{
+    LOGI("mouse move %d %d, button:%d", x, y, button);
+    long result = -1;
+    if (button > 0) {
+         TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
+         result = (long)efl_util_input_generate_pointer(obj->mFakePointerHandle, button, EFL_UTIL_INPUT_POINTER_MOVE,
+                                                        x, y);
+    }
+
+    return result == EFL_UTIL_ERROR_NONE;
+}
+
+bool TizenDeviceImpl::mouseUp(const int x, const int y, const int button)
+{
+   LOGI("mouse up %d %d, button:%d", x, y, button);
+   long result = -1;
+   if (button > 0) {
+        TizenDeviceImpl *obj = static_cast<TizenDeviceImpl *>(this);
+        result = (long)efl_util_input_generate_pointer(obj->mFakePointerHandle, button, EFL_UTIL_INPUT_POINTER_BUTTON_UP,
+                                                       x, y);
+    }
+
+    return result == EFL_UTIL_ERROR_NONE;
+}
+
 void TizenDeviceImpl::startTimer(void)
 {
     isTimerStarted = true;
index 98d98bc8c9aa9af8c6bf24d88396f53abc4e6a43..ff3f57cc1befe538df42e00702bd0c911a74c92b 100644 (file)
@@ -327,6 +327,27 @@ bool UiDevice::wheelDown(int amount, const int durationMs)
     return result;
 }
 
+bool UiDevice::mouseDown(const int x, const int y, const int button)
+{
+    bool result =  mDeviceImpl->mouseDown(x, y, button);
+    waitForIdle();
+    return result;
+}
+
+bool UiDevice::mouseMove(const int x, const int y, const int button)
+{
+    bool result =  mDeviceImpl->mouseMove(x, y, button);
+    waitForIdle();
+    return result;
+}
+
+bool UiDevice::mouseUp(const int x, const int y, const int button)
+{
+    bool result =  mDeviceImpl->mouseUp(x, y, button);
+    waitForIdle();
+    return result;
+}
+
 bool UiDevice::generateKey(KeyType keyType, KeyRequestType keyReqestType)
 {
     std::unique_ptr<KeyAction> keyAction;
index e99d9665b20ad7bcfb254131eac5ce7b656b5b76..b46f12c56d3aac964f458ae81eb9b15f8c081e99 100644 (file)
@@ -150,6 +150,15 @@ public:
     ::grpc::Status getParent(::grpc::ServerContext *context,
                             const ::aurum::ReqGetParent *request,
                             ::aurum::RspGetParent *response) override;
+    ::grpc::Status mouseDown(::grpc::ServerContext *context,
+                             const ::aurum::ReqMouseDown *request,
+                             ::aurum::RspMouseDown *response) override;
+    ::grpc::Status mouseUp(::grpc::ServerContext *context,
+                           const ::aurum::ReqMouseUp *request,
+                           ::aurum::RspMouseUp *response) override;
+    ::grpc::Status mouseMove(::grpc::ServerContext *context,
+                             const ::aurum::ReqMouseMove *request,
+                             ::aurum::RspMouseMove *response) override;
 public:
     int WAIT_TIMEOUT_MS;
 };
index 5add72fa6e1067ecbac4e2a5bb58b49204a07077..9d41566fb610d41976c8ef2201271d80028952c7 100644 (file)
@@ -52,3 +52,6 @@
 #include "Commands/FirstCommand.h"
 #include "Commands/LastCommand.h"
 #include "Commands/GetParentCommand.h"
+#include "Commands/MouseDownCommand.h"
+#include "Commands/MouseMoveCommand.h"
+#include "Commands/MouseUpCommand.h"
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/MouseDownCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/MouseDownCommand.h
new file mode 100644 (file)
index 0000000..22debed
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class MouseDownCommand : public Command {
+private:
+    const ::aurum::ReqMouseDown *mRequest;
+    ::aurum::RspMouseDown *mResponse;
+
+public:
+    MouseDownCommand(const ::aurum::ReqMouseDown *request,
+                     ::aurum::RspMouseDown *response);
+    ::grpc::Status execute() override;
+};
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/MouseMoveCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/MouseMoveCommand.h
new file mode 100644 (file)
index 0000000..8675510
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class MouseMoveCommand : public Command {
+private:
+    const ::aurum::ReqMouseMove *mRequest;
+    ::aurum::RspMouseMove *mResponse;
+
+public:
+    MouseMoveCommand(const ::aurum::ReqMouseMove *request,
+                     ::aurum::RspMouseMove *response);
+    ::grpc::Status execute() override;
+};
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/inc/Commands/MouseUpCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/MouseUpCommand.h
new file mode 100644 (file)
index 0000000..6caacc8
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "bootstrap.h"
+
+class MouseUpCommand : public Command {
+private:
+    const ::aurum::ReqMouseUp *mRequest;
+    ::aurum::RspMouseUp *mResponse;
+
+public:
+    MouseUpCommand(const ::aurum::ReqMouseUp *request,
+                   ::aurum::RspMouseUp *response);
+    ::grpc::Status execute() override;
+};
\ No newline at end of file
index 62ae5fcbd43c98250593da2effe8ae5daaf62ed1..315b844c7d2c8a90d5152161bfcd7b27a17532f5 100644 (file)
@@ -55,6 +55,9 @@ bootstrap_svr_src += [
    files('src/Commands/FirstCommand.cc'),
    files('src/Commands/LastCommand.cc'),
    files('src/Commands/GetParentCommand.cc'),
+   files('src/Commands/MouseDownCommand.cc'),
+   files('src/Commands/MouseMoveCommand.cc'),
+   files('src/Commands/MouseUpCommand.cc'),
 ]
 
 bootstrap_svr_dep = [
index 80b09926ba711c95d01becaecc8224a14afd98bf..a8642cc0262b49b31329caf934ea26f8ec81fdf3 100644 (file)
@@ -350,4 +350,28 @@ aurumServiceImpl::~aurumServiceImpl()
 {
     std::unique_ptr<GetParentCommand> cmd = std::make_unique<GetParentCommand>(request, response);
     return execute(cmd.get(), true);
+}
+
+::grpc::Status aurumServiceImpl::mouseDown(::grpc::ServerContext *context,
+                                           const ::aurum::ReqMouseDown *request,
+                                           ::aurum::RspMouseDown *response)
+{
+    std::unique_ptr<MouseDownCommand> cmd = std::make_unique<MouseDownCommand>(request, response);
+    return execute(cmd.get(), false);
+}
+
+::grpc::Status aurumServiceImpl::mouseUp(::grpc::ServerContext *context,
+                                         const ::aurum::ReqMouseUp *request,
+                                         ::aurum::RspMouseUp *response)
+{
+    std::unique_ptr<MouseUpCommand> cmd = std::make_unique<MouseUpCommand>(request, response);
+    return execute(cmd.get(), false);
+}
+
+::grpc::Status aurumServiceImpl::mouseMove(::grpc::ServerContext *context,
+                                           const ::aurum::ReqMouseMove *request,
+                                           ::aurum::RspMouseMove *response)
+{
+    std::unique_ptr<MouseMoveCommand> cmd = std::make_unique<MouseMoveCommand>(request, response);
+    return execute(cmd.get(), false);
 }
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/src/Commands/MouseDownCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/MouseDownCommand.cc
new file mode 100644 (file)
index 0000000..723a69f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "MouseDownCommand.h"
+#include "UiDevice.h"
+
+MouseDownCommand::MouseDownCommand(const ::aurum::ReqMouseDown *request,
+                                   ::aurum::RspMouseDown *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status MouseDownCommand::execute()
+{
+    LOGI("MouseDown --------------- ");
+
+    const aurum::Point& point_ = mRequest->coordination();
+    const int button = mRequest->button();
+    bool result = UiDevice::getInstance()
+        ->mouseDown(point_.x(), point_.y(), button);
+
+    if (result) mResponse->set_status(::aurum::RspStatus::OK);
+    else mResponse->set_status(::aurum::RspStatus::ERROR);
+
+    return grpc::Status::OK;
+}
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/src/Commands/MouseMoveCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/MouseMoveCommand.cc
new file mode 100644 (file)
index 0000000..90447cd
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "MouseMoveCommand.h"
+#include "UiDevice.h"
+
+MouseMoveCommand::MouseMoveCommand(const ::aurum::ReqMouseMove *request,
+                                   ::aurum::RspMouseMove *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status MouseMoveCommand::execute()
+{
+    LOGI("MouseMove --------------- ");
+
+    const aurum::Point& point = mRequest->coordination();
+    const int button = mRequest->button();
+    bool result = UiDevice::getInstance()
+        ->mouseMove(point.x(), point.y(), button);
+
+    if (result) mResponse->set_status(::aurum::RspStatus::OK);
+    else mResponse->set_status(::aurum::RspStatus::ERROR);
+
+    return grpc::Status::OK;
+}
\ No newline at end of file
diff --git a/org.tizen.aurum-bootstrap/src/Commands/MouseUpCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/MouseUpCommand.cc
new file mode 100644 (file)
index 0000000..050039e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#include "MouseUpCommand.h"
+#include "UiDevice.h"
+
+MouseUpCommand::MouseUpCommand(const ::aurum::ReqMouseUp *request,
+                               ::aurum::RspMouseUp *response)
+    : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status MouseUpCommand::execute()
+{
+    LOGI("MouseUp --------------- ");
+
+    const aurum::Point& point = mRequest->coordination();
+    const int button = mRequest->button();
+    bool result = UiDevice::getInstance()
+        ->mouseUp(point.x(), point.y(), button);
+
+    if (result) mResponse->set_status(::aurum::RspStatus::OK);
+    else mResponse->set_status(::aurum::RspStatus::ERROR);
+
+    return grpc::Status::OK;
+}
\ No newline at end of file
index 33bf56dd7b83913670c52573c2fe9d5bf9be3bf2..ee93d0a0c51b5baa10de09c555fd746d78f16beb 100644 (file)
@@ -44,6 +44,9 @@ service Bootstrap {
    rpc first(ReqFirst) returns (RspFirst) {}
    rpc last(ReqLast) returns (RspLast) {}
    rpc getParent(ReqGetParent) returns (RspGetParent) {}
+   rpc mouseDown(ReqMouseDown) returns (RspMouseDown) {}
+   rpc mouseMove(ReqMouseMove) returns (RspMouseMove) {}
+   rpc mouseUp(ReqMouseUp) returns (RspMouseUp) {}
 }
 
 // ------------------------------------ //
@@ -476,6 +479,31 @@ message RspTouchUp{
    RspStatus status = 1;
 }
 
+
+message ReqMouseDown{
+   int32 button = 1; // 1: left button, 2: right button, 3: middle button
+   Point coordination = 2;
+}
+message RspMouseDown{
+   RspStatus status = 1;
+}
+
+message ReqMouseMove{
+   int32 button = 1; // 1: left button, 2: right button, 3: middle button
+   Point coordination = 2;
+}
+message RspMouseMove{
+   RspStatus status = 1;
+}
+
+message ReqMouseUp{
+   int32 button = 1; // 1: left button, 2: right button, 3: middle button
+   Point coordination = 2;
+}
+message RspMouseUp{
+   RspStatus status = 1;
+}
+
 // ------------------------------------ //
 
 message ReqInstallApp{