/**
* @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateRoleName() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateUniqueId() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateName() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateApplication() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateAttributes() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateStates() = 0;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ virtual void updateExtents() = 0;
+
+ /**
+ * @brief TBD
* @since_tizen 5.5
*/
virtual void refresh() = 0;
* @brief TBD
*/
mutable std::mutex mLock;
-};
\ No newline at end of file
+};
/**
* @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateRoleName() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateUniqueId() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateName() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateApplication() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateAttributes() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateStates() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateExtents() override;
+
+ /**
+ * @brief TBD
* @since_tizen 5.5
*/
void refresh() override;
* @since_tizen 5.5
*/
AtspiAccessible *mNode;
-};
\ No newline at end of file
+};
/**
* @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateRoleName() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateUniqueId() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateName() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateApplication() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateAttributes() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateStates() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateExtents() override;
+
+ /**
+ * @brief TBD
* @since_tizen 5.5
*/
void refresh() override;
* @brief TBD
*/
std::mutex mLock;
-};
\ No newline at end of file
+};
/**
* @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateRoleName() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateUniqueId() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateName() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateApplication() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateAttributes() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateStates() const;
+
+ /**
+ * @brief TBD
+ * @since_tizen 6.5
+ */
+ void updateExtents() const;
+
+ /**
+ * @brief TBD
* @since_tizen 5.5
*/
void refresh() const;
watcher->attach(shared_from_this());
if (mNode) {
- this->refresh();
+ this->updateApplication();
+ this->updateUniqueId();
+ this->updateStates();
} else {
LOGI("AtspiAccessibleNode Ctor : mNode is null");
}
return static_cast<void *>(mNode);
}
+void AtspiAccessibleNode::updateRoleName()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ gchar *rolename = AtspiWrapper::Atspi_accessible_get_role_name(mNode, NULL);
+ if (rolename) {
+ mRole = rolename;
+ g_free(rolename);
+ }
+}
+
+void AtspiAccessibleNode::updateUniqueId()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ #ifdef TIZEN
+ gchar *uID = AtspiWrapper::Atspi_accessible_get_unique_id(mNode, NULL);
+ if (uID) {
+ mId = uID;
+ g_free(uID);
+ }
+ #else
+ mId = std::string{"N/A"};
+ #endif
+}
+
+void AtspiAccessibleNode::updateName()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ gchar *name = AtspiWrapper::Atspi_accessible_get_name(mNode, NULL);
+ if (name) {
+ mText = name;
+ g_free(name);
+ }
+}
+
+void AtspiAccessibleNode::updateApplication()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(mNode, NULL);
+ if (app) {
+ gchar *pkg = AtspiWrapper::Atspi_accessible_get_name(app, NULL);
+ if (pkg) {
+ mPkg = pkg;
+ g_free(pkg);
+ }
+ g_object_unref(app);
+ }
+}
+
+void AtspiAccessibleNode::updateAttributes()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ GHashTable *attributes = AtspiWrapper::Atspi_accessible_get_attributes(mNode, NULL);
+ if (attributes) {
+ char *t = (char*)g_hash_table_lookup(attributes, "type");
+ if (!t) t = (char*)g_hash_table_lookup(attributes, "t");
+ if (!t) t = (char*)g_hash_table_lookup(attributes, "class");
+ char *s = (char*)g_hash_table_lookup(attributes, "style");
+ char *a = (char*)g_hash_table_lookup(attributes, "automationId");
+
+ if (t) mType = std::string(t);
+ if (s) mStyle = std::string(s);
+ if (a) mAutomationId = std::string(a);
+
+ g_hash_table_unref(attributes);
+ }
+}
+
+void AtspiAccessibleNode::updateStates()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ AtspiStateSet *st = AtspiWrapper::Atspi_accessible_get_state_set(mNode);
+ if (st) {
+ GArray *states = AtspiWrapper::Atspi_state_set_get_states(st);
+ if (states) {
+ AtspiStateType stat;
+ for (unsigned int i = 0; states && (i < states->len); ++i) {
+ stat = g_array_index(states, AtspiStateType, i);
+ setFeatureProperty(stat);
+ }
+ g_array_free(states, 1);
+ }
+ g_object_unref(st);
+ }
+}
+
+void AtspiAccessibleNode::updateExtents()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
+ if (component) {
+ AtspiRect *screenExtent = AtspiWrapper::Atspi_component_get_extents(
+ component, ATSPI_COORD_TYPE_SCREEN, NULL);
+ if (screenExtent) {
+ mScreenBoundingBox =
+ Rect<int>{screenExtent->x, screenExtent->y, screenExtent->x + screenExtent->width,
+ screenExtent->y + screenExtent->height};\
+ g_free(screenExtent);
+ }
+
+ AtspiRect *windowExtent = AtspiWrapper::Atspi_component_get_extents(
+ component, ATSPI_COORD_TYPE_WINDOW, NULL);
+ if (windowExtent) {
+ mWindowBoundingBox =
+ Rect<int>{windowExtent->x, windowExtent->y, windowExtent->x + windowExtent->width,
+ windowExtent->y + windowExtent->height};\
+ g_free(windowExtent);
+ }
+ g_object_unref(component);
+ }
+}
+
void AtspiAccessibleNode::refresh()
{
AtspiWrapper::Atspi_accessible_clear_cache(mNode);
mFeatureProperty = featureProperty;
}
+void MockAccessibleNode::updateRoleName()
+{
+}
+
+void MockAccessibleNode::updateUniqueId()
+{
+}
+
+void MockAccessibleNode::updateName()
+{
+}
+
+void MockAccessibleNode::updateApplication()
+{
+}
+
+void MockAccessibleNode::updateAttributes()
+{
+}
+
+void MockAccessibleNode::updateStates()
+{
+}
+
+void MockAccessibleNode::updateExtents()
+{
+}
+
void MockAccessibleNode::refresh()
{
}
#include <regex>
#include <sstream>
-bool PartialMatch::checkCriteria(const std::string *textA, const std::string textB, const bool *match)
+bool PartialMatch::checkCriteria(const std::string *textA, const std::string textB)
{
- if (!textA || !match) return false;
+ if (!textA) return false;
std::regex re(*textA);
- bool rst = !(!!std::regex_match(textB, re) == (*match));
+ bool rst = !(!!std::regex_match(textB, re) == true);
return rst;
}
-bool PartialMatch::checkCriteria(const std::string *textA, const std::string textB)
-{
- bool match = true;
- return checkCriteria(textA, textB, &match);
-}
-
bool PartialMatch::checkCriteria(const bool *boolA, const bool boolB)
{
if (!boolA) return false;
bool PartialMatch::checkCriteria(const std::shared_ptr<UiSelector> selector,
const std::shared_ptr<AccessibleNode> node)
{
- if(checkCriteria(selector->mText.get(), node->getText(), selector->mMatchText.get())) return false;
- if(checkCriteria(selector->mId.get(), node->getId(), selector->mMatchId.get())) return false;
- if(checkCriteria(selector->mAutomationId.get(), node->getAutomationId(), selector->mMatchAutomationId.get())) return false;
- if(checkCriteria(selector->mType.get(), node->getType(), selector->mMatchType.get())) return false;
- if(checkCriteria(selector->mStyle.get(), node->getStyle(), selector->mMatchStyle.get())) return false;
- if(checkCriteria(selector->mPkg.get(), node->getPkg(), selector->mMatchPkg.get())) return false;
- if(checkCriteria(selector->mRole.get(), node->getRole(), selector->mMatchRole.get())) return false;
- if(checkCriteria(selector->mIschecked.get(), node->isChecked())) return false;
- if(checkCriteria(selector->mIscheckable.get(), node->isCheckable())) return false;
- if(checkCriteria(selector->mIsclickable.get(), node->isClickable())) return false;
- if(checkCriteria(selector->mIsenabled.get(), node->isEnabled())) return false;
- if(checkCriteria(selector->mIsfocused.get(), node->isFocused())) return false;
- if(checkCriteria(selector->mIsfocusable.get(), node->isFocusable())) return false;
- if(checkCriteria(selector->mIsscrollable.get(), node->isScrollable())) return false;
- if(checkCriteria(selector->mIsselected.get(), node->isSelected())) return false;
- if(checkCriteria(selector->mIsshowing.get(), node->isShowing())) return false;
- if(checkCriteria(selector->mIsactive.get(), node->isActive())) return false;
- if(checkCriteria(selector->mIsvisible.get(), node->isVisible())) return false;
- if(checkCriteria(selector->mIsselectable.get(), node->isSelectable())) return false;
+ if (selector->mMatchText.get()) {
+ node->updateName();
+ if (checkCriteria(selector->mText.get(), node->getText())) return false;
+ }
+ if (selector->mMatchId.get()) {
+ node->updateUniqueId();
+ if (checkCriteria(selector->mId.get(), node->getId())) return false;
+ }
+ if (selector->mMatchType.get() || selector->mMatchAutomationId.get() || selector->mMatchStyle.get()) {
+ node->updateAttributes();
+ if (checkCriteria(selector->mAutomationId.get(), node->getAutomationId())) return false;
+ if (checkCriteria(selector->mType.get(), node->getType())) return false;
+ if (checkCriteria(selector->mStyle.get(), node->getStyle())) return false;
+ }
+ if (selector->mMatchPkg.get()) {
+ node->updateApplication();
+ if (checkCriteria(selector->mPkg.get(), node->getPkg())) return false;
+ }
+ if (selector->mMatchRole.get()) {
+ node->updateRoleName();
+ if (checkCriteria(selector->mRole.get(), node->getRole())) return false;
+ }
+ if (checkCriteria(selector->mIschecked.get(), node->isChecked())) return false;
+ if (checkCriteria(selector->mIscheckable.get(), node->isCheckable())) return false;
+ if (checkCriteria(selector->mIsclickable.get(), node->isClickable())) return false;
+ if (checkCriteria(selector->mIsenabled.get(), node->isEnabled())) return false;
+ if (checkCriteria(selector->mIsfocused.get(), node->isFocused())) return false;
+ if (checkCriteria(selector->mIsfocusable.get(), node->isFocusable())) return false;
+ if (checkCriteria(selector->mIsscrollable.get(), node->isScrollable())) return false;
+ if (checkCriteria(selector->mIsselected.get(), node->isSelected())) return false;
+ if (checkCriteria(selector->mIsshowing.get(), node->isShowing())) return false;
+ if (checkCriteria(selector->mIsactive.get(), node->isActive())) return false;
+ if (checkCriteria(selector->mIsvisible.get(), node->isVisible())) return false;
+ if (checkCriteria(selector->mIsselectable.get(), node->isSelectable())) return false;
return true;
}
mNode->refresh();
}
+void UiObject::updateRoleName() const
+{
+ mNode->updateRoleName();
+}
+
+void UiObject::updateUniqueId() const
+{
+ mNode->updateUniqueId();
+}
+
+void UiObject::updateName() const
+{
+ mNode->updateName();
+}
+
+void UiObject::updateApplication() const
+{
+ mNode->updateApplication();
+}
+
+void UiObject::updateAttributes() const
+{
+ mNode->updateAttributes();
+}
+
+void UiObject::updateStates() const
+{
+ mNode->updateStates();
+}
+
+void UiObject::updateExtents() const
+{
+ mNode->updateExtents();
+}
+
bool UiObject::isValid() const
{
return mNode->isValid();
const Rect<int> UiObject::getScreenBoundingBox() const
{
- mNode->refresh();
return mNode->getScreenBoundingBox();
}
const Rect<int> UiObject::getWindowBoundingBox() const
{
- mNode->refresh();
return mNode->getWindowBoundingBox();
}
void UiObject::click() const
{
- mNode->refresh();
+ mNode->updateExtents();
const Rect<int> rect = mNode->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
mDevice->click(midPoint.x, midPoint.y);
void UiObject::longClick(const unsigned int intv) const
{
- mNode->refresh();
+ mNode->updateExtents();
const Rect<int> rect = mNode->getScreenBoundingBox();
const Point2D<int> midPoint = rect.midPoint();
mDevice->click(midPoint.x, midPoint.y, intv);
if (mNode == nullptr) throw;
// TODO : wait for animation and refresh current node
// mDevice->waitForIdle();
- mNode->refresh();
return mNode;
}
if (obj) {
obj->setText("");
- obj->refresh();
+ obj->updateName();
auto text = obj->getText();
if (text.length() != 0) {
if (hasHintText(obj)) {
if (!node->mNode) return;
std::shared_ptr<UiObject> obj = node->mNode;
+ obj->refresh();
if (mObjMap->getElement(obj->getId()) == nullptr)
mObjMap->addElement(std::move(obj));
if (founds.size() > 0) {
for (auto& found : founds) {
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());
+
+ LOGI("found object : %p elementId:%s", obj, obj->getId().c_str());
::aurum::Element *elm = mResponse->add_elements();
elm->set_elementid(obj->getId());
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isVisible());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isFocused());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isFocusable());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isCheckable());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isChecked());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isEnabled());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isClickable());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isScrollable());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isSelectable());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isSelected());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isShowing());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
mResponse->set_status(aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
+ obj->updateStates();
mResponse->set_boolvalue(obj->isActive());
mResponse->set_status(aurum::RspStatus::OK);
return grpc::Status::OK;
ObjectMapper *mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
if (obj) {
+ obj->updateExtents();
::aurum::Rect *rect = mResponse->mutable_size();
if (type == ::aurum::ReqGetSize_CoordType::ReqGetSize_CoordType_SCREEN) {
const Rect<int> &size = obj->getScreenBoundingBox();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
if (obj) {
+ obj->updateName();
std::string text = obj->getText();
mResponse->set_stringvalue(text.c_str());
mResponse->set_status(::aurum::RspStatus::OK);
LOGI("getElement for elementId(%s)", elementId.c_str());
if (mObjectMap.count(elementId)) {
std::shared_ptr<UiObject> obj = mObjectMap[elementId];
- obj->refresh();
- LOGI("succeeded");
+ LOGI("Object find succeeded");
return obj;
}
LOGI("Id(%s) is not exist in mObjectMap", elementId.c_str());