[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / AccessibleUtil.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19 using System.Threading.Tasks;
20
21 namespace ElmSharp.Accessible
22 {
23     /// <summary>
24     /// Enumeration for the ReadingStatus.
25     /// </summary>
26     /// <since_tizen> preview </since_tizen>
27     [Obsolete("This has been deprecated in API12")]
28     public enum ReadingStatus
29     {
30         /// <summary>
31         /// Unknown status.
32         /// </summary>
33         Unknown,
34         /// <summary>
35         /// Cancelled status.
36         /// </summary>
37         Cancelled,
38         /// <summary>
39         /// Stopped status.
40         /// </summary>
41         Stoppped,
42         /// <summary>
43         /// Skipped status.
44         /// </summary>
45         Skipped
46     }
47
48     /// <summary>
49     /// AccessibleUtil provides a method to set the reading information.
50     /// </summary>
51     /// <since_tizen> preview </since_tizen>
52     [Obsolete("This has been deprecated in API12")]
53     public static class AccessibleUtil
54     {
55
56         static void AtspiSignalCallback(IntPtr data, string say_signal)
57         {
58             GCHandle gch = GCHandle.FromIntPtr(data);
59             TaskCompletionSource<ReadingStatus> tcs = (TaskCompletionSource<ReadingStatus>)gch.Target;
60             if (say_signal.Equals("ReadingCancelled"))
61             {
62                 tcs.SetResult(ReadingStatus.Cancelled);
63             }
64             else if (say_signal.Equals("ReadingStopped"))
65             {
66                 tcs.SetResult(ReadingStatus.Stoppped);
67             }
68             else if (say_signal.Equals("ReadingSkipped"))
69             {
70                 tcs.SetResult(ReadingStatus.Skipped);
71             }
72             else
73             {
74                 tcs.SetException(new InvalidOperationException("unknown signal : " + say_signal));
75             }
76
77             gch.Free();
78         }
79
80         /// <summary>
81         /// Reads the given text by a screen reader.
82         /// </summary>
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)
89         {
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));
93             return tcs.Task;
94         }
95     }
96 }