Add Vconf interop and update turning on/off accessibility 03/290403/1 accepted/tizen/unified/20230325.044640
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 24 Mar 2023 04:29:45 +0000 (13:29 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 24 Mar 2023 04:31:17 +0000 (13:31 +0900)
- Added Vconf Interop to set/get vconf bool
- Updated to turn on/off tts feature

Change-Id: Ie85e66b9c6eb4c787faccd289e9520821b4ff328
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
Settings/SettingAccessibility/Interop/Interop.Vconf.cs [new file with mode: 0755]
Settings/SettingAccessibility/SettingWidgetAccessibility.cs
packaging/org.tizen.cssetting-accessibility-1.0.0.tpk [changed mode: 0644->0755]

diff --git a/Settings/SettingAccessibility/Interop/Interop.Vconf.cs b/Settings/SettingAccessibility/Interop/Interop.Vconf.cs
new file mode 100755 (executable)
index 0000000..fba8225
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright(c) 2023 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.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+internal static partial class Interop
+{
+    internal static partial class Vconf
+    {
+        [global::System.Runtime.InteropServices.DllImport("libvconf.so.0", EntryPoint = "vconf_get_bool")]
+        internal static extern int GetVconfBool(string key, out bool value);
+
+        [global::System.Runtime.InteropServices.DllImport("libvconf.so.0", EntryPoint = "vconf_set_bool")]
+        internal static extern int SetVconfBool(string key, bool value);
+    }
+}
index d439de4b99f70fc818790adce9a7b1f3aba32c43..325c5dd0f537596da0a6c9ba5510cf97c514b880 100755 (executable)
@@ -7,6 +7,7 @@ using Tizen.NUI.Accessibility;
 using Tizen.Applications;\r
 using System.Runtime.InteropServices;\r
 using System.Collections.Generic;\r
+using static Interop.Vconf;\r
 \r
 namespace SettingAccessibility\r
 {\r
@@ -14,6 +15,7 @@ namespace SettingAccessibility
     {\r
         static Navigator navigator;\r
         static ScrollableBase settingScroll;\r
+        private static readonly string VconfkeyAccessibilityTts = "db/setting/accessibility/tts";\r
 \r
         protected override void OnCreate(string contentInfo, Window window)\r
         {\r
@@ -110,14 +112,20 @@ namespace SettingAccessibility
                     if (e.IsSelected)\r
                     {\r
                         Tizen.Log.Debug("NUI", "Switch is selected! Screen Reader turns on. \n");\r
-                        // TODO : Need to add new Enable API\r
-                        //Accessibility.BridgeEnableAutoInit();\r
+                        int ret = SetVconfBool(VconfkeyAccessibilityTts, true);\r
+                        if (ret != 0)\r
+                        {\r
+                            Tizen.Log.Error("NUI", "Setting vconf is failed. error code ["+ret+"] \n");\r
+                        }\r
                     }\r
                     else\r
                     {\r
                         Tizen.Log.Debug("NUI", "Switch is unselected! Screen Reader turns off. \n");\r
-                        // TODO : Need to add new Disable API\r
-                        //Accessibility.BridgeDisableAutoInit();\r
+                        int ret = SetVconfBool(VconfkeyAccessibilityTts, false);\r
+                        if (ret != 0)\r
+                        {\r
+                            Tizen.Log.Error("NUI", "Setting vconf is failed. error code ["+ret+"] \n");\r
+                        }\r
                     }\r
                 };\r
                 // Extra is placed at the end(right end) of the item.\r