*/
virtual std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const = 0;
+ /**
+ * @copydoc UiObject::next()
+ */
+ virtual std::shared_ptr<AccessibleNode> next() const = 0;
+
+ /**
+ * @copydoc UiObject::prev()
+ */
+ virtual std::shared_ptr<AccessibleNode> prev() const = 0;
+
+ /**
+ * @copydoc UiObject::first()
+ */
+ virtual std::shared_ptr<AccessibleNode> first() const = 0;
+
+ /**
+ * @copydoc UiObject::last()
+ */
+ virtual std::shared_ptr<AccessibleNode> last() const = 0;
+
/**
* @brief Called by @AccessibleWatcher::notifyAll.
* Changes Node property If it's @EventType, @ObjectEventType are matches.
*/
std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const override;
+ /**
+ * @copydoc UiObject::next()
+ */
+ std::shared_ptr<AccessibleNode> next() const override;
+
+ /**
+ * @copydoc UiObject::prev()
+ */
+ std::shared_ptr<AccessibleNode> prev() const override;
+
+ /**
+ * @copydoc UiObject::first()
+ */
+ std::shared_ptr<AccessibleNode> first() const override;
+
+ /**
+ * @copydoc UiObject::last()
+ */
+ std::shared_ptr<AccessibleNode> last() const override;
+
/**
* @copydoc AccessibleNode::isValid()
*/
static GArray *Atspi_collection_get_matches_in_matches(AtspiCollection *obj, AtspiMatchRule *first_rule, AtspiMatchRule *second_rule, AtspiCollectionSortOrder sortby, gint first_count, gint second_count, gboolean traverse, GError **error);
static AtspiAccessibleNodeInfo *Atspi_accessible_get_node_info(AtspiAccessible *obj, GError **error);
static void Atspi_accessible_free_node_info(AtspiAccessibleNodeInfo *node_info);
+ static AtspiAccessible *Atspi_accessible_get_neighbor(AtspiAccessible *root, AtspiAccessible *start, AtspiNeighborSearchDirection direction, GError **error);
private:
static std::recursive_mutex mMutex;
*/
std::vector<std::shared_ptr<AccessibleNode>> getMatchesInMatches(const std::shared_ptr<UiSelector> firstSelector, const std::shared_ptr<UiSelector> secondSelector, const bool ealryReturn) const override;
+ /**
+ * @copydoc UiObject::next()
+ */
+ std::shared_ptr<AccessibleNode> next() const override;
+
+ /**
+ * @copydoc UiObject::prev()
+ */
+ std::shared_ptr<AccessibleNode> prev() const override;
+
+ /**
+ * @copydoc UiObject::first()
+ */
+ std::shared_ptr<AccessibleNode> first() const override;
+
+ /**
+ * @copydoc UiObject::last()
+ */
+ std::shared_ptr<AccessibleNode> last() const override;
+
public:
/**
* @brief TBD
*/
std::shared_ptr<AccessibleNode> getAccessibleNode() const;
+ /**
+ * @brief Gets object's next.
+ *
+ * @return UiObject pointer
+ *
+ * @since_tizen 9.0
+ */
+ std::shared_ptr<UiObject> next() const;
+
+ /**
+ * @brief Gets object's prev.
+ *
+ * @return UiObject pointer
+ *
+ * @since_tizen 9.0
+ */
+ std::shared_ptr<UiObject> prev() const;
+
+ /**
+ * @brief Gets object's first.
+ *
+ * @return UiObject pointer
+ *
+ * @since_tizen 9.0
+ */
+ std::shared_ptr<UiObject> first() const;
+
+ /**
+ * @brief Gets object's last.
+ *
+ * @return UiObject pointer
+ *
+ * @since_tizen 9.0
+ */
+ std::shared_ptr<UiObject> last() const;
+
private:
std::shared_ptr<UiDevice> mDevice;
std::shared_ptr<UiSelector> mSelector;
return ret;
}
+
+std::shared_ptr<AccessibleNode> AtspiAccessibleNode::next() const
+{
+ if (!isValid()) {
+ return nullptr;
+ }
+ AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+ if (app) {
+ AtspiAccessible *next = AtspiWrapper::Atspi_accessible_get_neighbor(app, mNode, ATSPI_NEIGHBOR_SEARCH_FORWARD, NULL);
+ if (!next) {
+ next = AtspiWrapper::Atspi_accessible_get_neighbor(app, NULL, ATSPI_NEIGHBOR_SEARCH_FORWARD, NULL);
+ }
+ g_object_unref(app);
+ if (next) return std::make_shared<AtspiAccessibleNode>(next);
+ }
+
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> AtspiAccessibleNode::prev() const
+{
+ if (!isValid()) {
+ return nullptr;
+ }
+ AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+ if (app) {
+ AtspiAccessible *prev = AtspiWrapper::Atspi_accessible_get_neighbor(app, mNode, ATSPI_NEIGHBOR_SEARCH_BACKWARD, NULL);
+ if (!prev) {
+ prev = AtspiWrapper::Atspi_accessible_get_neighbor(app, NULL, ATSPI_NEIGHBOR_SEARCH_BACKWARD, NULL);
+ }
+ g_object_unref(app);
+ if (prev) return std::make_shared<AtspiAccessibleNode>(prev);
+ }
+
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> AtspiAccessibleNode::first() const
+{
+ if (!isValid()) {
+ return nullptr;
+ }
+ AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+ if (app) {
+ AtspiAccessible *first = AtspiWrapper::Atspi_accessible_get_neighbor(app, NULL, ATSPI_NEIGHBOR_SEARCH_FORWARD, NULL);
+ g_object_unref(app);
+ if (first) return std::make_shared<AtspiAccessibleNode>(first);
+ }
+
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> AtspiAccessibleNode::last() const
+{
+ if (!isValid()) {
+ return nullptr;
+ }
+ AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+ if (app) {
+ AtspiAccessible *last = AtspiWrapper::Atspi_accessible_get_neighbor(app, NULL, ATSPI_NEIGHBOR_SEARCH_BACKWARD, NULL);
+ g_object_unref(app);
+ if (last) return std::make_shared<AtspiAccessibleNode>(last);
+ }
+
+ return nullptr;
+}
\ No newline at end of file
std::unique_lock<std::recursive_mutex> lock(mMutex);
atspi_accessible_free_node_info(node_info);
}
+
+AtspiAccessible *AtspiWrapper::Atspi_accessible_get_neighbor(AtspiAccessible *root, AtspiAccessible *start, AtspiNeighborSearchDirection direction, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_accessible_get_neighbor(root, start, direction, error);
+}
+
{
mActionSet.clear();
}
+
+std::shared_ptr<AccessibleNode> MockAccessibleNode::next() const
+{
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> MockAccessibleNode::prev() const
+{
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> MockAccessibleNode::first() const
+{
+ return nullptr;
+}
+
+std::shared_ptr<AccessibleNode> MockAccessibleNode::last() const
+{
+ return nullptr;
+}
\ No newline at end of file
// mDevice->waitForIdle();
return mNode;
}
+
+std::shared_ptr<UiObject> UiObject::next() const {
+ auto nextNode = mNode->next();
+ if (nextNode) {
+ return std::make_shared<UiObject>(mDevice, mSelector, nextNode);
+ }
+ return nullptr;
+}
+
+std::shared_ptr<UiObject> UiObject::prev() const {
+ auto prevNode = mNode->prev();
+ if (prevNode) {
+ return std::make_shared<UiObject>(mDevice, mSelector, prevNode);
+ }
+ return nullptr;
+}
+
+std::shared_ptr<UiObject> UiObject::first() const {
+ auto firstNode = mNode->first();
+ if (firstNode) {
+ return std::make_shared<UiObject>(mDevice, mSelector, firstNode);
+ }
+ return nullptr;
+}
+
+std::shared_ptr<UiObject> UiObject::last() const {
+ auto lastNode = mNode->last();
+ if (lastNode) {
+ return std::make_shared<UiObject>(mDevice, mSelector, lastNode);
+ }
+ return nullptr;
+}
\ No newline at end of file
::grpc::Status moveTo(::grpc::ServerContext *context,
const ::aurum::ReqMoveTo *request,
::aurum::RspMoveTo *response) override;
+ ::grpc::Status next(::grpc::ServerContext *context,
+ const ::aurum::ReqNext *request,
+ ::aurum::RspNext *response) override;
+ ::grpc::Status prev(::grpc::ServerContext *context,
+ const ::aurum::ReqPrev *request,
+ ::aurum::RspPrev *response) override;
+ ::grpc::Status first(::grpc::ServerContext *context,
+ const ::aurum::ReqFirst *request,
+ ::aurum::RspFirst *response) override;
+ ::grpc::Status last(::grpc::ServerContext *context,
+ const ::aurum::ReqLast *request,
+ ::aurum::RspLast *response) override;
public:
int WAIT_TIMEOUT_MS;
};
#include "Commands/GetTextMinBoundingRectCommand.h"
#include "Commands/SetXMLSyncCommand.h"
#include "Commands/GetAngleCommand.h"
+#include "Commands/NextCommand.h"
+#include "Commands/PrevCommand.h"
+#include "Commands/FirstCommand.h"
+#include "Commands/LastCommand.h"
--- /dev/null
+/*
+ * Copyright (c) 2023 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 FirstCommand : public Command {
+protected:
+ const ::aurum::ReqFirst *mRequest;
+ ::aurum::RspFirst *mResponse;
+
+public:
+ FirstCommand(const ::aurum::ReqFirst *request,
+ ::aurum::RspFirst *response);
+ ::grpc::Status execute() override;
+};
--- /dev/null
+/*
+ * Copyright (c) 2023 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 LastCommand : public Command {
+protected:
+ const ::aurum::ReqLast *mRequest;
+ ::aurum::RspLast *mResponse;
+
+public:
+ LastCommand(const ::aurum::ReqLast *request,
+ ::aurum::RspLast *response);
+ ::grpc::Status execute() override;
+};
--- /dev/null
+/*
+ * Copyright (c) 2023 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 NextCommand : public Command {
+protected:
+ const ::aurum::ReqNext *mRequest;
+ ::aurum::RspNext *mResponse;
+
+public:
+ NextCommand(const ::aurum::ReqNext *request,
+ ::aurum::RspNext *response);
+ ::grpc::Status execute() override;
+};
--- /dev/null
+/*
+ * Copyright (c) 2023 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 PrevCommand : public Command {
+protected:
+ const ::aurum::ReqPrev *mRequest;
+ ::aurum::RspPrev *mResponse;
+
+public:
+ PrevCommand(const ::aurum::ReqPrev *request,
+ ::aurum::RspPrev *response);
+ ::grpc::Status execute() override;
+};
files('src/Commands/GetTextMinBoundingRectCommand.cc'),
files('src/Commands/SetXMLSyncCommand.cc'),
files('src/Commands/GetAngleCommand.cc'),
+ files('src/Commands/NextCommand.cc'),
+ files('src/Commands/PrevCommand.cc'),
+ files('src/Commands/FirstCommand.cc'),
+ files('src/Commands/LastCommand.cc'),
]
bootstrap_svr_dep = [
{
std::unique_ptr<MoveToCommand> cmd = std::make_unique<MoveToCommand>(request, response);
return execute(cmd.get(), true);
+}
+
+::grpc::Status aurumServiceImpl::next(::grpc::ServerContext *context,
+ const ::aurum::ReqNext *request,
+ ::aurum::RspNext *response)
+{
+ std::unique_ptr<NextCommand> cmd = std::make_unique<NextCommand>(request, response);
+ return execute(cmd.get(), true);
+}
+
+::grpc::Status aurumServiceImpl::prev(::grpc::ServerContext *context,
+ const ::aurum::ReqPrev *request,
+ ::aurum::RspPrev *response)
+{
+ std::unique_ptr<PrevCommand> cmd = std::make_unique<PrevCommand>(request, response);
+ return execute(cmd.get(), true);
+}
+
+::grpc::Status aurumServiceImpl::first(::grpc::ServerContext *context,
+ const ::aurum::ReqFirst *request,
+ ::aurum::RspFirst *response)
+{
+ std::unique_ptr<FirstCommand> cmd = std::make_unique<FirstCommand>(request, response);
+ return execute(cmd.get(), true);
+}
+::grpc::Status aurumServiceImpl::last(::grpc::ServerContext *context,
+ const ::aurum::ReqLast *request,
+ ::aurum::RspLast *response)
+{
+ std::unique_ptr<LastCommand> cmd = std::make_unique<LastCommand>(request, response);
+ return execute(cmd.get(), true);
}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2023 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 "FirstCommand.h"
+#include "UiObject.h"
+
+FirstCommand::FirstCommand(const ::aurum::ReqFirst *request,
+ ::aurum::RspFirst *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status FirstCommand::execute()
+{
+ LOGI("First --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> base = mObjMap->getElement(mRequest->elementid());
+
+ if (!base) {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ return grpc::Status::OK;
+ }
+
+ auto found = base->first();
+
+ if (found != nullptr) {
+ UiObject *obj = found.get();
+ obj->refresh();
+ if (mObjMap->getElement(obj->getId()) == nullptr)
+ mObjMap->addElement(std::move(found));
+
+ LOGI("found object : %p elementId:%s", obj, obj->getId().c_str());
+
+ ::aurum::Element *elm = mResponse->mutable_element();
+ elm->set_elementid(obj->getId());
+ elm->set_package(obj->getApplicationPackage());
+
+ ::aurum::Rect *rect = elm->mutable_geometry();
+ const Rect<int> &size = obj->getScreenBoundingBox();
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+
+ ::aurum::Rect *windowRect = elm->mutable_windowrelativegeometry();
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowRelativeSize.mTopLeft.x);
+ windowRect->set_y(windowRelativeSize.mTopLeft.y);
+ windowRect->set_width(windowRelativeSize.width());
+ windowRect->set_height(windowRelativeSize.height());
+
+ elm->set_widgettype(obj->getType());
+ elm->set_widgetstyle(obj->getElementStyle());
+
+ elm->set_text(obj->getText());
+ elm->set_xpath(obj->getXPath());
+ elm->set_ocrtext(obj->getOcrText());
+ elm->set_automationid(obj->getAutomationId());
+ elm->set_package(obj->getApplicationPackage());
+ elm->set_role(obj->getRole());
+
+ elm->set_ischecked(obj->isChecked());
+ elm->set_ischeckable(obj->isCheckable());
+ elm->set_isclickable(obj->isClickable());
+ elm->set_isenabled(obj->isEnabled());
+ elm->set_isfocused(obj->isFocused());
+ elm->set_isfocusable(obj->isFocusable());
+ elm->set_isscrollable(obj->isScrollable());
+ elm->set_isselected(obj->isSelected());
+ elm->set_isshowing(obj->isShowing());
+ elm->set_isactive(obj->isActive());
+ elm->set_isvisible(obj->isVisible());
+ elm->set_isselectable(obj->isSelectable());
+ elm->set_ishighlightable(obj->isHighlightable());
+
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
+
+ elm->set_windowangle(obj->getWindowAngle());
+ elm->set_targetangle(obj->getTargetAngle());
+
+ elm->set_interface(obj->getInterface());
+ elm->set_description(obj->getDescription());
+
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+
+ return grpc::Status::OK;
+}
--- /dev/null
+/*
+ * Copyright (c) 2023 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 "LastCommand.h"
+#include "UiObject.h"
+
+LastCommand::LastCommand(const ::aurum::ReqLast *request,
+ ::aurum::RspLast *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status LastCommand::execute()
+{
+ LOGI("Last --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> base = mObjMap->getElement(mRequest->elementid());
+
+ if (!base) {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ return grpc::Status::OK;
+ }
+
+ auto found = base->last();
+
+ if (found != nullptr) {
+ UiObject *obj = found.get();
+ obj->refresh();
+ if (mObjMap->getElement(obj->getId()) == nullptr)
+ mObjMap->addElement(std::move(found));
+
+ LOGI("found object : %p elementId:%s", obj, obj->getId().c_str());
+
+ ::aurum::Element *elm = mResponse->mutable_element();
+ elm->set_elementid(obj->getId());
+ elm->set_package(obj->getApplicationPackage());
+
+ ::aurum::Rect *rect = elm->mutable_geometry();
+ const Rect<int> &size = obj->getScreenBoundingBox();
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+
+ ::aurum::Rect *windowRect = elm->mutable_windowrelativegeometry();
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowRelativeSize.mTopLeft.x);
+ windowRect->set_y(windowRelativeSize.mTopLeft.y);
+ windowRect->set_width(windowRelativeSize.width());
+ windowRect->set_height(windowRelativeSize.height());
+
+ elm->set_widgettype(obj->getType());
+ elm->set_widgetstyle(obj->getElementStyle());
+
+ elm->set_text(obj->getText());
+ elm->set_xpath(obj->getXPath());
+ elm->set_ocrtext(obj->getOcrText());
+ elm->set_automationid(obj->getAutomationId());
+ elm->set_package(obj->getApplicationPackage());
+ elm->set_role(obj->getRole());
+
+ elm->set_ischecked(obj->isChecked());
+ elm->set_ischeckable(obj->isCheckable());
+ elm->set_isclickable(obj->isClickable());
+ elm->set_isenabled(obj->isEnabled());
+ elm->set_isfocused(obj->isFocused());
+ elm->set_isfocusable(obj->isFocusable());
+ elm->set_isscrollable(obj->isScrollable());
+ elm->set_isselected(obj->isSelected());
+ elm->set_isshowing(obj->isShowing());
+ elm->set_isactive(obj->isActive());
+ elm->set_isvisible(obj->isVisible());
+ elm->set_isselectable(obj->isSelectable());
+ elm->set_ishighlightable(obj->isHighlightable());
+
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
+
+ elm->set_windowangle(obj->getWindowAngle());
+ elm->set_targetangle(obj->getTargetAngle());
+
+ elm->set_interface(obj->getInterface());
+ elm->set_description(obj->getDescription());
+
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+
+ return grpc::Status::OK;
+}
--- /dev/null
+/*
+ * Copyright (c) 2023 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 "NextCommand.h"
+#include "UiObject.h"
+
+NextCommand::NextCommand(const ::aurum::ReqNext *request,
+ ::aurum::RspNext *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status NextCommand::execute()
+{
+ LOGI("Next --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> base = mObjMap->getElement(mRequest->elementid());
+
+ if (!base) {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ return grpc::Status::OK;
+ }
+
+ auto found = base->next();
+
+ if (found != nullptr) {
+ UiObject *obj = found.get();
+ obj->refresh();
+ if (mObjMap->getElement(obj->getId()) == nullptr)
+ mObjMap->addElement(std::move(found));
+
+ LOGI("found object : %p elementId:%s", obj, obj->getId().c_str());
+
+ ::aurum::Element *elm = mResponse->mutable_element();
+ elm->set_elementid(obj->getId());
+ elm->set_package(obj->getApplicationPackage());
+
+ ::aurum::Rect *rect = elm->mutable_geometry();
+ const Rect<int> &size = obj->getScreenBoundingBox();
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+
+ ::aurum::Rect *windowRect = elm->mutable_windowrelativegeometry();
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowRelativeSize.mTopLeft.x);
+ windowRect->set_y(windowRelativeSize.mTopLeft.y);
+ windowRect->set_width(windowRelativeSize.width());
+ windowRect->set_height(windowRelativeSize.height());
+
+ elm->set_widgettype(obj->getType());
+ elm->set_widgetstyle(obj->getElementStyle());
+
+ elm->set_text(obj->getText());
+ elm->set_xpath(obj->getXPath());
+ elm->set_ocrtext(obj->getOcrText());
+ elm->set_automationid(obj->getAutomationId());
+ elm->set_package(obj->getApplicationPackage());
+ elm->set_role(obj->getRole());
+
+ elm->set_ischecked(obj->isChecked());
+ elm->set_ischeckable(obj->isCheckable());
+ elm->set_isclickable(obj->isClickable());
+ elm->set_isenabled(obj->isEnabled());
+ elm->set_isfocused(obj->isFocused());
+ elm->set_isfocusable(obj->isFocusable());
+ elm->set_isscrollable(obj->isScrollable());
+ elm->set_isselected(obj->isSelected());
+ elm->set_isshowing(obj->isShowing());
+ elm->set_isactive(obj->isActive());
+ elm->set_isvisible(obj->isVisible());
+ elm->set_isselectable(obj->isSelectable());
+ elm->set_ishighlightable(obj->isHighlightable());
+
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
+
+ elm->set_windowangle(obj->getWindowAngle());
+ elm->set_targetangle(obj->getTargetAngle());
+
+ elm->set_interface(obj->getInterface());
+ elm->set_description(obj->getDescription());
+
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+
+ return grpc::Status::OK;
+}
--- /dev/null
+/*
+ * Copyright (c) 2023 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 "PrevCommand.h"
+#include "UiObject.h"
+
+PrevCommand::PrevCommand(const ::aurum::ReqPrev *request,
+ ::aurum::RspPrev *response)
+ : mRequest{request}, mResponse{response}
+{
+}
+
+::grpc::Status PrevCommand::execute()
+{
+ LOGI("Prev --------------- ");
+
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> base = mObjMap->getElement(mRequest->elementid());
+
+ if (!base) {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ return grpc::Status::OK;
+ }
+
+ auto found = base->prev();
+
+ if (found != nullptr) {
+ UiObject *obj = found.get();
+ obj->refresh();
+ if (mObjMap->getElement(obj->getId()) == nullptr)
+ mObjMap->addElement(std::move(found));
+
+ LOGI("found object : %p elementId:%s", obj, obj->getId().c_str());
+
+ ::aurum::Element *elm = mResponse->mutable_element();
+ elm->set_elementid(obj->getId());
+ elm->set_package(obj->getApplicationPackage());
+
+ ::aurum::Rect *rect = elm->mutable_geometry();
+ const Rect<int> &size = obj->getScreenBoundingBox();
+ rect->set_x(size.mTopLeft.x);
+ rect->set_y(size.mTopLeft.y);
+ rect->set_width(size.width());
+ rect->set_height(size.height());
+
+ ::aurum::Rect *windowRect = elm->mutable_windowrelativegeometry();
+ const Rect<int> &windowRelativeSize = obj->getWindowBoundingBox();
+ windowRect->set_x(windowRelativeSize.mTopLeft.x);
+ windowRect->set_y(windowRelativeSize.mTopLeft.y);
+ windowRect->set_width(windowRelativeSize.width());
+ windowRect->set_height(windowRelativeSize.height());
+
+ elm->set_widgettype(obj->getType());
+ elm->set_widgetstyle(obj->getElementStyle());
+
+ elm->set_text(obj->getText());
+ elm->set_xpath(obj->getXPath());
+ elm->set_ocrtext(obj->getOcrText());
+ elm->set_automationid(obj->getAutomationId());
+ elm->set_package(obj->getApplicationPackage());
+ elm->set_role(obj->getRole());
+
+ elm->set_ischecked(obj->isChecked());
+ elm->set_ischeckable(obj->isCheckable());
+ elm->set_isclickable(obj->isClickable());
+ elm->set_isenabled(obj->isEnabled());
+ elm->set_isfocused(obj->isFocused());
+ elm->set_isfocusable(obj->isFocusable());
+ elm->set_isscrollable(obj->isScrollable());
+ elm->set_isselected(obj->isSelected());
+ elm->set_isshowing(obj->isShowing());
+ elm->set_isactive(obj->isActive());
+ elm->set_isvisible(obj->isVisible());
+ elm->set_isselectable(obj->isSelectable());
+ elm->set_ishighlightable(obj->isHighlightable());
+
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
+
+ elm->set_windowangle(obj->getWindowAngle());
+ elm->set_targetangle(obj->getTargetAngle());
+
+ elm->set_interface(obj->getInterface());
+ elm->set_description(obj->getDescription());
+
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+
+ return grpc::Status::OK;
+}
rpc setXMLSync(ReqSetXMLSync) returns (RspSetXMLSync) {}
rpc getAngle(ReqGetAngle) returns (RspGetAngle) {}
rpc moveTo(ReqMoveTo) returns (RspMoveTo) {}
+ rpc next(ReqNext) returns (RspNext) {}
+ rpc prev(ReqPrev) returns (RspPrev) {}
+ rpc first(ReqFirst) returns (RspFirst) {}
+ rpc last(ReqLast) returns (RspLast) {}
}
// ------------------------------------ //
int32 windowAngle = 2;
int32 targetAngle = 3;
}
+
+message ReqNext {
+ string elementId = 1;
+}
+
+message RspNext {
+ RspStatus status = 1;
+ Element element = 2;
+}
+
+message ReqPrev {
+ string elementId = 1;
+}
+
+message RspPrev {
+ RspStatus status = 1;
+ Element element = 2;
+}
+
+message ReqFirst {
+ string elementId = 1;
+}
+
+message RspFirst {
+ RspStatus status = 1;
+ Element element = 2;
+}
+
+message ReqLast {
+ string elementId = 1;
+}
+
+message RspLast {
+ RspStatus status = 1;
+ Element element = 2;
+}