libaurum: add updateInterface and getInterface API
authorHosang Kim <hosang12.kim@samsung.com>
Thu, 14 Dec 2023 06:47:21 +0000 (15:47 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Fri, 26 Jan 2024 06:42:36 +0000 (15:42 +0900)
Atspi interface is a set of pointers to all interfaces supported by an AtspiAccessible.
We able to check possible feature with interface information. e.g. EditableText, Value and so on.

Change-Id: I6122e135035b15950c1a55f40b47cfb785675eda

12 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/inc/UiObject.h
libaurum/src/Accessibility/AccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc
libaurum/src/UiObject.cc
org.tizen.aurum-bootstrap/src/Commands/DumpObjectTreeCommand.cc
org.tizen.aurum-bootstrap/src/Commands/FindElementCommand.cc
org.tizen.aurum-bootstrap/src/Commands/FindElementsCommand.cc
protocol/aurum.proto

index b65f31673685085706832ee0cb6a661260a4f9c2..bcdc1fce00bcca4f089efc5f564bfe3ecb59715b 100644 (file)
@@ -317,6 +317,11 @@ public:
      */
     Rect<int> getTextMinBoundingRect() const;
 
+    /**
+     * @copydoc UiObject::getInterface()
+     */
+    std::string getInterface() const;
+
     /**
      * @copydoc UiObject::isCheckable()
      */
@@ -456,6 +461,11 @@ public:
      */
     virtual void updateTextMinBoundingRect() = 0;
 
+    /**
+     * @copydoc UiObject::updateInterface()
+     */
+    virtual void updateInterface() = 0;
+
     /**
      * @brief Updates Node information from atspi server.
      *
@@ -565,6 +575,7 @@ protected:
     std::string mStyle;
     std::string mXPath;
     std::string mToolkitName;
+    std::string mInterface;
     Rect<int> mScreenBoundingBox;
     Rect<int> mWindowBoundingBox;
     Rect<int> mTextMinBoundingRect;
index 54d091aa82f03a11716b8a085697b27c80037a89..29c0aeb93df9809a405a88ff3ab3676cb42d9db7 100644 (file)
@@ -146,6 +146,11 @@ public:
      */
     void updateTextMinBoundingRect() override;
 
+    /**
+     * @copydoc UiObject::updateInterface()
+     */
+    void updateInterface() override;
+
     /**
      * @copydoc UiObject::setFocus()
      */
index 77f9ce3a30d8c139e9c6dba81d48fd027889b72a..c2df6a7c31cb32aa1f8bbc6b18bfd6c270ed8593 100644 (file)
@@ -147,6 +147,11 @@ public:
      */
     void updatePid() override;
 
+    /**
+     * @copydoc UiObject::updateInterface()
+     */
+    void updateInterface() override;
+
     /**
      * @brief TBD
      * @since_tizen 7.0
index 3f7911bb737cf279ef9bf0edfe816630adcb514d..6689962500edbb74bd2c9dccf08cefc6cf6aee9c 100644 (file)
@@ -463,6 +463,15 @@ public:
      */
     const Rect<int> getTextMinBoundingRect() const;
 
+    /**
+     * @brief Gets object's interface information.
+     *
+     * @return string
+     *
+     * @since_tizen 8.0
+     */
+    std::string getInterface() const;
+
     /**
      * @brief Sets object's value.
      *
@@ -661,6 +670,13 @@ public:
      */
     void updateTextMinBoundingRect() const;
 
+    /*
+     * @brief Updates object's interface information from atspi server.
+     *
+     * @since_tizen 8.0
+     */
+    void updateInterface() const;
+
     /**
      * @brief Sets focus to object.
      *
index 8f6212bf6e9d4292a36b0e601224aade58f61369..abfed4ad033f53f4798795b8b237d94bd820d777 100644 (file)
@@ -201,6 +201,11 @@ const Rect<int> AccessibleNode::getWindowBoundingBox() const
     return mWindowBoundingBox;
 }
 
+std::string AccessibleNode::getInterface() const
+{
+    return mInterface;
+}
+
 bool AccessibleNode::isCheckable() const
 {
     return hasFeatureProperty(NodeFeatureProperties::CHECKABLE);
index e4572d42413fa7be0d78e88ee851d7325b7a8ec0..a3a1dd6138d84fd4bb48201ff36398c156d671b2 100644 (file)
@@ -308,6 +308,23 @@ void AtspiAccessibleNode::updateTextMinBoundingRect()
     }
 }
 
+void AtspiAccessibleNode::updateInterface()
+{
+    GArray *interfaces = AtspiWrapper::Atspi_accessible_get_interfaces(mNode);
+    if (interfaces)
+    {
+        for (unsigned int i = 0; i < interfaces->len; i++)
+        {
+            gchar *interface = g_array_index(interfaces, gchar *, i);
+            if (g_strcmp0(interface, "EditableText") == 0 || g_strcmp0(interface, "Value") == 0)
+            {
+                mInterface = interface;
+            }
+        }
+        g_array_free(interfaces, true);
+    }
+}
+
 bool AtspiAccessibleNode::setFocus()
 {
     AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
@@ -431,6 +448,20 @@ void AtspiAccessibleNode::refresh(bool updateAll)
             g_object_unref(value);
         }
 
+        GArray *interfaces = AtspiWrapper::Atspi_accessible_get_interfaces(mNode);
+        if (interfaces)
+        {
+            for (unsigned int i = 0; i < interfaces->len; i++)
+            {
+                gchar *interface = g_array_index(interfaces, gchar *, i);
+                if (g_strcmp0(interface, "EditableText") == 0 || g_strcmp0(interface, "Value") == 0)
+                {
+                    mInterface = interface;
+                }
+            }
+            g_array_free(interfaces, true);
+        }
+
         if (updateAll) updateXPath();
 
     } else {
index 860a0892f756a20f6c52136fafc2942be292970d..8a51e90cb6624842a02d86a8fde584f115abb18b 100644 (file)
@@ -132,6 +132,10 @@ void MockAccessibleNode::updateToolkitName()
 {
 }
 
+void MockAccessibleNode::updateInterface()
+{
+}
+
 bool MockAccessibleNode::setFocus()
 {
     return false;
index ca0946bcb56afdc433c28fa5e7814a169ff53beb..82d956392a4408886ce5c3571ec0de0ced54a4d6 100644 (file)
@@ -244,6 +244,11 @@ const Rect<int> UiObject::getTextMinBoundingRect() const
     return getAccessibleNode()->getTextMinBoundingRect();
 }
 
+std::string UiObject::getInterface() const
+{
+    return getAccessibleNode()->getInterface();
+}
+
 bool UiObject::setValue(double value)
 {
     return getAccessibleNode()->setValue(value);
index 6d9b4abb0239e4dc64d219ee08f6b4fbb522d98b..0f00f0f6dd6342414c4696a7797575e594be7cd5 100644 (file)
@@ -86,6 +86,8 @@ void DumpObjectTreeCommand::traverse(::aurum::Element *root, std::shared_ptr<Nod
     root->set_windowangle(obj->getWindowAngle());
     root->set_targetangle(obj->getTargetAngle());
 
+    root->set_interface(obj->getInterface());
+
     for( auto && childNode : node->mChildren) {
         ::aurum::Element *child = root->add_child();
         traverse(child, childNode, depth+1);
index d1470969b791734343c4c22d7e8ffbeb62595531..02b6c8648f870ce589cd476f31c6b8d32a5973bd 100644 (file)
@@ -147,6 +147,8 @@ std::shared_ptr<UiSelector> FindElementCommand::getSelector(void)
         elm->set_windowangle(obj->getWindowAngle());
         elm->set_targetangle(obj->getTargetAngle());
 
+        elm->set_interface(obj->getInterface());
+
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
         mResponse->set_status(::aurum::RspStatus::ERROR);
index cd113f1d84e5310a8325b1b8e523d6d1e11a7733..97c5029150912b79e41495b3a96557695052a008 100644 (file)
@@ -153,6 +153,8 @@ std::vector<std::shared_ptr<UiSelector>> FindElementsCommand::getSelectors(void)
 
             elm->set_windowangle(obj->getWindowAngle());
             elm->set_targetangle(obj->getTargetAngle());
+
+            elm->set_interface(obj->getInterface());
         }
         mResponse->set_status(::aurum::RspStatus::OK);
     } else {
index b83bea55cccb97afaa5271d034371c11d2af2285..dd534a106a54785c091b3163680cfadf899c0ae1 100644 (file)
@@ -94,6 +94,8 @@ message Element {
 
    int32 windowAngle = 31;
    int32 targetAngle = 32;
+
+   string interface = 33;
 }
 
 message Point {