2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
19 using System.Threading.Tasks;
21 namespace ElmSharp.Accessible
24 /// Enumeration for the ReadingStatus.
26 /// <since_tizen> preview </since_tizen>
27 [Obsolete("This has been deprecated in API12")]
28 public enum ReadingStatus
49 /// AccessibleUtil provides a method to set the reading information.
51 /// <since_tizen> preview </since_tizen>
52 [Obsolete("This has been deprecated in API12")]
53 public static class AccessibleUtil
56 static void AtspiSignalCallback(IntPtr data, string say_signal)
58 GCHandle gch = GCHandle.FromIntPtr(data);
59 TaskCompletionSource<ReadingStatus> tcs = (TaskCompletionSource<ReadingStatus>)gch.Target;
60 if (say_signal.Equals("ReadingCancelled"))
62 tcs.SetResult(ReadingStatus.Cancelled);
64 else if (say_signal.Equals("ReadingStopped"))
66 tcs.SetResult(ReadingStatus.Stoppped);
68 else if (say_signal.Equals("ReadingSkipped"))
70 tcs.SetResult(ReadingStatus.Skipped);
74 tcs.SetException(new InvalidOperationException("unknown signal : " + say_signal));
81 /// Reads the given text by a screen reader.
83 /// <param name="text">The reading text.</param>
84 /// <param name="discardable">If true, reading can be discarded by subsequent reading requests. If false, reading must be finished before the next reading request can be started.</param>
85 /// <returns>Return a task with the reading status.</returns>
86 /// <since_tizen> preview </since_tizen>
87 [Obsolete("This has been deprecated in API12")]
88 public static Task<ReadingStatus> Say(string text, bool discardable)
90 var tcs = new TaskCompletionSource<ReadingStatus>();
91 GCHandle gch = GCHandle.Alloc(tcs);
92 Interop.Elementary.elm_atspi_bridge_utils_say(text, discardable, AtspiSignalCallback, GCHandle.ToIntPtr(gch));