[Tizen][ATSPI] Introduce GetNodeInfo interface 55/305655/1
authorWoochan Lee <wc0917.lee@samsung.com>
Fri, 10 Nov 2023 07:12:43 +0000 (16:12 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Tue, 6 Feb 2024 04:42:21 +0000 (13:42 +0900)
A new interface for delivering entire information with on dbus method call.

Change-Id: Ic0f7189565375ffa53e1061e584215266ac12eef

dali/internal/accessibility/bridge/bridge-accessible.cpp
dali/internal/accessibility/bridge/bridge-accessible.h

index 8fa36d2..c57a887 100644 (file)
@@ -394,6 +394,7 @@ void BridgeAccessible::RegisterInterfaces()
   AddFunctionToInterface(desc, "GetReadingMaterial", &BridgeAccessible::GetReadingMaterial);
   AddFunctionToInterface(desc, "GetRelationSet", &BridgeAccessible::GetRelationSet);
   AddFunctionToInterface(desc, "SetListenPostRender", &BridgeAccessible::SetListenPostRender);
+  AddFunctionToInterface(desc, "GetNodeInfo", &BridgeAccessible::GetNodeInfo);
   mDbusServer.addInterface("/", desc, true);
 }
 
@@ -599,6 +600,51 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     describedByObject};
 }
 
+BridgeAccessible::NodeInfoType BridgeAccessible::GetNodeInfo()
+{
+  auto self         = FindSelf();
+  auto roleName     = self->GetRoleName();
+  auto name         = self->GetName();
+  auto toolkitName  = "dali";
+  auto attributes   = self->GetAttributes();
+  auto states       = self->GetStates();
+
+  auto* component   = Component::DownCast(self);
+  Dali::Rect<> screenExtents = {0, 0, 0, 0};
+  Dali::Rect<> windowExtents = {0, 0, 0, 0};
+  if (component)
+  {
+    screenExtents = component->GetExtents(CoordinateType::SCREEN);
+    windowExtents = component->GetExtents(CoordinateType::WINDOW);
+  }
+
+  auto* valueInterface    = Value::DownCast(self);
+  double currentValue     = 0.0;
+  double minimumIncrement = 0.0;
+  double maximumValue     = 0.0;
+  double minimumValue     = 0.0;
+  if(valueInterface)
+  {
+    currentValue     = valueInterface->GetCurrent();
+    minimumIncrement = valueInterface->GetMinimumIncrement();
+    maximumValue     = valueInterface->GetMaximum();
+    minimumValue     = valueInterface->GetMinimum();
+  }
+
+  return {
+    roleName,
+    name,
+    toolkitName,
+    attributes,
+    states,
+    {screenExtents.x, screenExtents.y, screenExtents.width, screenExtents.height},
+    {windowExtents.x, windowExtents.y, windowExtents.width, windowExtents.height},
+    currentValue,
+    minimumIncrement,
+    maximumValue,
+    minimumValue};
+}
+
 DBus::ValueOrError<bool> BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime)
 {
   // Please be aware of sending GestureInfo point in the different order with parameters
index 329fc43..0f8533d 100644 (file)
@@ -92,6 +92,20 @@ public:
     Dali::Accessibility::Accessible*  // describedByObject
     >;
 
+  using NodeInfoType = DBus::ValueOrError<
+    std::string,                                    // role name
+    std::string,                                    // name
+    std::string,                                    // toolkit name
+    std::unordered_map<std::string, std::string>,   // attributes
+    Dali::Accessibility::States,                    // states
+    std::tuple<int32_t, int32_t, int32_t, int32_t>, // screen extents
+    std::tuple<int32_t, int32_t, int32_t, int32_t>, // window extents
+    double,                                         // current value
+    double,                                         // minimum increment
+    double,                                         // maximum value
+    double                                          // minimum value
+    >;
+
   using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Accessible*>>;
 
   /**
@@ -213,6 +227,12 @@ public:
    */
   DBus::ValueOrError<void> SetListenPostRender(bool enabled);
 
+  /**
+   * @brief Gets Node information of the self object.
+   * @return Node information
+   */
+  NodeInfoType GetNodeInfo();
+
 private:
   /**
    * @brief Calculates Neighbor candidate object in root node.