*/
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
*/
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()
*/
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;
*/
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.
*
*/
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.
*
}
+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));
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*{
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);
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);
return true;
}
-
int TizenDeviceImpl::touchDown(const int x, const int y)
{
int seq = grabTouchSeqNumber();
{
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);
}
{
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;
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;
::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;
};
#include "Commands/FirstCommand.h"
#include "Commands/LastCommand.h"
#include "Commands/GetParentCommand.h"
+#include "Commands/MouseDownCommand.h"
+#include "Commands/MouseMoveCommand.h"
+#include "Commands/MouseUpCommand.h"
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
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 = [
{
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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
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) {}
}
// ------------------------------------ //
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{