From: Hosang Kim Date: Thu, 31 Oct 2024 01:21:58 +0000 (+0900) Subject: Aurum: add generating mouse device event. X-Git-Tag: accepted/tizen/unified/20241127.050323~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ccd9868f564b853f98604d25c03957fd41302b5;p=platform%2Fcore%2Fuifw%2Faurum.git Aurum: add generating mouse device event. Change-Id: I1adb196493e03523e72ffc3c5586f7558d5a83ad --- diff --git a/libaurum/inc/Impl/MockDeviceImpl.h b/libaurum/inc/Impl/MockDeviceImpl.h index 6aa62be..2047754 100644 --- a/libaurum/inc/Impl/MockDeviceImpl.h +++ b/libaurum/inc/Impl/MockDeviceImpl.h @@ -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 diff --git a/libaurum/inc/Impl/TizenDeviceImpl.h b/libaurum/inc/Impl/TizenDeviceImpl.h index aefc504..5f5f43b 100644 --- a/libaurum/inc/Impl/TizenDeviceImpl.h +++ b/libaurum/inc/Impl/TizenDeviceImpl.h @@ -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; diff --git a/libaurum/inc/Interface/IDevice.h b/libaurum/inc/Interface/IDevice.h index ccb4ddb..f53ee54 100644 --- a/libaurum/inc/Interface/IDevice.h +++ b/libaurum/inc/Interface/IDevice.h @@ -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. * diff --git a/libaurum/inc/UiDevice.h b/libaurum/inc/UiDevice.h index d2e6ae5..8610372 100644 --- a/libaurum/inc/UiDevice.h +++ b/libaurum/inc/UiDevice.h @@ -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. * diff --git a/libaurum/src/Impl/MockDeviceImpl.cc b/libaurum/src/Impl/MockDeviceImpl.cc index 5df8d61..03611af 100644 --- a/libaurum/src/Impl/MockDeviceImpl.cc +++ b/libaurum/src/Impl/MockDeviceImpl.cc @@ -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::KEY, type, keycode)); diff --git a/libaurum/src/Impl/TizenDeviceImpl.cc b/libaurum/src/Impl/TizenDeviceImpl.cc index a9243ba..05f8702 100644 --- a/libaurum/src/Impl/TizenDeviceImpl.cc +++ b/libaurum/src/Impl/TizenDeviceImpl.cc @@ -50,7 +50,7 @@ static GDBusConnection *system_conn; std::vector> 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(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(this); for (int i = 0; i < amount; i++){ TizenDeviceImpl *obj = static_cast(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(this); for (int i = 0; i < amount; i++){ TizenDeviceImpl *obj = static_cast(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(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(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(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; diff --git a/libaurum/src/UiDevice.cc b/libaurum/src/UiDevice.cc index 98d98bc..ff3f57c 100644 --- a/libaurum/src/UiDevice.cc +++ b/libaurum/src/UiDevice.cc @@ -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; diff --git a/org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h b/org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h index e99d966..b46f12c 100644 --- a/org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h +++ b/org.tizen.aurum-bootstrap/inc/AurumServiceImpl.h @@ -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; }; diff --git a/org.tizen.aurum-bootstrap/inc/Commands/Commands.h b/org.tizen.aurum-bootstrap/inc/Commands/Commands.h index 5add72f..9d41566 100644 --- a/org.tizen.aurum-bootstrap/inc/Commands/Commands.h +++ b/org.tizen.aurum-bootstrap/inc/Commands/Commands.h @@ -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 index 0000000..22debed --- /dev/null +++ b/org.tizen.aurum-bootstrap/inc/Commands/MouseDownCommand.h @@ -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 index 0000000..8675510 --- /dev/null +++ b/org.tizen.aurum-bootstrap/inc/Commands/MouseMoveCommand.h @@ -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 index 0000000..6caacc8 --- /dev/null +++ b/org.tizen.aurum-bootstrap/inc/Commands/MouseUpCommand.h @@ -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 diff --git a/org.tizen.aurum-bootstrap/meson.build b/org.tizen.aurum-bootstrap/meson.build index 62ae5fc..315b844 100644 --- a/org.tizen.aurum-bootstrap/meson.build +++ b/org.tizen.aurum-bootstrap/meson.build @@ -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 = [ diff --git a/org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc b/org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc index 80b0992..a8642cc 100644 --- a/org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc +++ b/org.tizen.aurum-bootstrap/src/AurumServiceImpl.cc @@ -350,4 +350,28 @@ aurumServiceImpl::~aurumServiceImpl() { std::unique_ptr cmd = std::make_unique(request, response); return execute(cmd.get(), true); +} + +::grpc::Status aurumServiceImpl::mouseDown(::grpc::ServerContext *context, + const ::aurum::ReqMouseDown *request, + ::aurum::RspMouseDown *response) +{ + std::unique_ptr cmd = std::make_unique(request, response); + return execute(cmd.get(), false); +} + +::grpc::Status aurumServiceImpl::mouseUp(::grpc::ServerContext *context, + const ::aurum::ReqMouseUp *request, + ::aurum::RspMouseUp *response) +{ + std::unique_ptr cmd = std::make_unique(request, response); + return execute(cmd.get(), false); +} + +::grpc::Status aurumServiceImpl::mouseMove(::grpc::ServerContext *context, + const ::aurum::ReqMouseMove *request, + ::aurum::RspMouseMove *response) +{ + std::unique_ptr cmd = std::make_unique(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 index 0000000..723a69f --- /dev/null +++ b/org.tizen.aurum-bootstrap/src/Commands/MouseDownCommand.cc @@ -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 index 0000000..90447cd --- /dev/null +++ b/org.tizen.aurum-bootstrap/src/Commands/MouseMoveCommand.cc @@ -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 index 0000000..050039e --- /dev/null +++ b/org.tizen.aurum-bootstrap/src/Commands/MouseUpCommand.cc @@ -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 diff --git a/protocol/aurum.proto b/protocol/aurum.proto index 33bf56d..ee93d0a 100644 --- a/protocol/aurum.proto +++ b/protocol/aurum.proto @@ -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{