[ATSPI] Added support for ToolkitName and Version to dali 14/256714/15
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 25 Aug 2021 16:08:01 +0000 (18:08 +0200)
committerLukasz Oleksak <l.oleksak@samsung.com>
Tue, 31 Aug 2021 10:33:23 +0000 (10:33 +0000)
Change-Id: Ibee9189930452c4c04856a8a2c1f0fd4512b1680

dali/devel-api/adaptor-framework/accessibility-impl.h
dali/internal/accessibility/bridge/bridge-application.cpp [new file with mode: 0644]
dali/internal/accessibility/bridge/bridge-application.h [new file with mode: 0644]
dali/internal/accessibility/bridge/bridge-base.h
dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/accessibility/file.list

index 262e555..ff8933a 100644 (file)
@@ -47,6 +47,7 @@ class DALI_ADAPTOR_API Value;
 class DALI_ADAPTOR_API Component;
 class DALI_ADAPTOR_API Collection;
 class DALI_ADAPTOR_API Action;
+class DALI_ADAPTOR_API Application;
 
 /**
  * @brief Base class for different accessibility bridges.
@@ -873,6 +874,31 @@ public:
 };
 
 /**
+ * @brief An interface identifying the root object
+ * associated with a running application.
+ *
+ * @note Provides global properties describing
+ * application's runtime environment.
+ */
+class Application : public virtual Accessible
+{
+public:
+  /**
+   * @brief Gets name of graphic user interface framework used by an application.
+   *
+   * @return String with name
+   */
+  virtual std::string GetToolkitName() = 0;
+
+  /**
+   * @brief Gets version of graphic user interface framework used by an application.
+   *
+   * @return String with version
+   */
+  virtual std::string GetVersion() = 0;
+};
+
+/**
  * @brief Interface enabling advanced quering of accessibility objects.
  *
  * @note since all mathods can be implemented inside bridge,
diff --git a/dali/internal/accessibility/bridge/bridge-application.cpp b/dali/internal/accessibility/bridge/bridge-application.cpp
new file mode 100644 (file)
index 0000000..b892601
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-application.h>
+
+using namespace Dali::Accessibility;
+
+void BridgeApplication::RegisterInterfaces()
+{
+  DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceApplication};
+  AddGetPropertyToInterface(desc, "ToolkitName", &BridgeApplication::GetToolkitName);
+  AddGetPropertyToInterface(desc, "Version", &BridgeApplication::GetVersion);
+  dbusServer.addInterface("/", desc, true);
+}
+
+Application* BridgeApplication::FindSelf() const
+{
+  auto self = BridgeBase::FindSelf();
+  assert(self);
+  auto appInterface = dynamic_cast<Application*>(self);
+  if(!appInterface)
+  {
+    throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Application interface"};
+  }
+  return appInterface;
+}
+
+std::string BridgeApplication::GetToolkitName()
+{
+  return FindSelf()->GetToolkitName();
+}
+
+std::string BridgeApplication::GetVersion()
+{
+  return FindSelf()->GetVersion();
+}
diff --git a/dali/internal/accessibility/bridge/bridge-application.h b/dali/internal/accessibility/bridge/bridge-application.h
new file mode 100644 (file)
index 0000000..21020b3
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_APPLICATION_H
+#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_APPLICATION_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+/*
+ * Implementation of org.a11y.atspi.Application interface
+ */
+
+class BridgeApplication : public virtual BridgeBase
+{
+protected:
+  BridgeApplication() = default;
+
+  void RegisterInterfaces();
+
+  Dali::Accessibility::Application* FindSelf() const;
+
+public:
+  /**
+   * @brief Gets name of graphic user interface framework used by an application.
+   *
+   * @return String with name
+   */
+  std::string GetToolkitName();
+
+  /**
+   * @brief Gets version of graphic user interface framework used by an application.
+   *
+   * @return String with version
+   */
+  std::string GetVersion();
+};
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_APPLICATION_H
index fa46045..0396539 100644 (file)
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-version.h>
 #include <dali/public-api/signals/connection-tracker.h>
 #include <memory>
 
 // INTERNAL INCLUDES
 #include <dali/internal/accessibility/bridge/accessibility-common.h>
 
-class AppAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection
+class AppAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection, public virtual Dali::Accessibility::Application
 {
 public:
   Dali::Accessibility::EmptyAccessibleWithAddress parent;
@@ -99,6 +100,16 @@ public:
   {
     return {"", "root"};
   }
+
+  std::string GetToolkitName() override
+  {
+    return {"dali"};
+  }
+
+  std::string GetVersion() override
+  {
+    return std::to_string(Dali::ADAPTOR_MAJOR_VERSION) + "." + std::to_string(Dali::ADAPTOR_MINOR_VERSION);
+  }
 };
 
 enum class FilteredEvents
index 11c580e..b424b6a 100644 (file)
@@ -36,6 +36,7 @@
 #include <dali/internal/accessibility/bridge/bridge-selection.h>
 #include <dali/internal/accessibility/bridge/bridge-text.h>
 #include <dali/internal/accessibility/bridge/bridge-value.h>
+#include <dali/internal/accessibility/bridge/bridge-application.h>
 #include <dali/internal/accessibility/bridge/dummy-atspi.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/environment-variables.h>
@@ -51,7 +52,8 @@ class BridgeImpl : public virtual BridgeBase,
                    public BridgeValue,
                    public BridgeText,
                    public BridgeEditableText,
-                   public BridgeSelection
+                   public BridgeSelection,
+                   public BridgeApplication
 {
   DBus::DBusClient                                              listenOnAtspiEnabledSignalClient;
   DBus::DBusClient                                              registryClient, directReadingClient;
@@ -245,6 +247,7 @@ public:
     BridgeText::RegisterInterfaces();
     BridgeEditableText::RegisterInterfaces();
     BridgeSelection::RegisterInterfaces();
+    BridgeApplication::RegisterInterfaces();
 
     RegisterOnBridge(&application);
 
index e62ef56..efa4476 100755 (executable)
@@ -51,6 +51,7 @@ SET( adaptor_accessibility_atspi_bridge_src_files
     ${adaptor_accessibility_dir}/bridge/accessible.cpp
     ${adaptor_accessibility_dir}/bridge/bridge-accessible.cpp
     ${adaptor_accessibility_dir}/bridge/bridge-action.cpp
+    ${adaptor_accessibility_dir}/bridge/bridge-application.cpp
     ${adaptor_accessibility_dir}/bridge/bridge-base.cpp
     ${adaptor_accessibility_dir}/bridge/bridge-collection.cpp
     ${adaptor_accessibility_dir}/bridge/bridge-component.cpp