Review Uix.InputMethod/SttEngine/TtsEngine API cs files
[platform/core/csapi/tizenfx.git] / src / Tizen.Uix.InputMethod / Tizen.Uix.InputMethod / InputMethodDeviceInformation.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.Collections.Generic;
19 using System.Text;
20 using static Interop.InputMethod;
21
22 namespace Tizen.Uix.InputMethod
23 {
24     /// <summary>
25     /// Enumeration for the device class.
26     /// </summary>
27     /// <since_tizen> 4 </since_tizen>
28     public enum DeviceClass
29     {
30         /// <summary>
31         /// None.
32         /// </summary>
33         None,
34         /// <summary>
35         /// Seat.
36         /// </summary>
37         Seat,
38         /// <summary>
39         /// Keyboard.
40         /// </summary>
41         Keyboard,
42         /// <summary>
43         /// Mouse.
44         /// </summary>
45         Mouse,
46         /// <summary>
47         /// Touch.
48         /// </summary>
49         Touch,
50         /// <summary>
51         /// Pen.
52         /// </summary>
53         Pen,
54         /// <summary>
55         /// Pointer.
56         /// </summary>
57         Pointer,
58         /// <summary>
59         /// Gamepad.
60         /// </summary>
61         Gamepad,
62         /// <summary>
63         /// Undefined.
64         /// </summary>
65         Undefined
66     };
67
68     /// <summary>
69     /// Enumeration for the device subclass.
70     /// </summary>
71     /// <since_tizen> 4 </since_tizen>
72     public enum DeviceSubclass
73     {
74         /// <summary>
75         /// None.
76         /// </summary>
77         None,
78         /// <summary>
79         /// Finger.
80         /// </summary>
81         Finger,
82         /// <summary>
83         /// FingerNail.
84         /// </summary>
85         FingerNail,
86         /// <summary>
87         /// Knuckle.
88         /// </summary>
89         Knuckle,
90         /// <summary>
91         /// Palm.
92         /// </summary>
93         Palm,
94         /// <summary>
95         /// HandSize.
96         /// </summary>
97         HandSize,
98         /// <summary>
99         /// HandFlat.
100         /// </summary>
101         HandFlat,
102         /// <summary>
103         /// PenTip.
104         /// </summary>
105         PenTip,
106         /// <summary>
107         /// Trackpad.
108         /// </summary>
109         Trackpad,
110         /// <summary>
111         /// Trackpoint.
112         /// </summary>
113         Trackpoint,
114         /// <summary>
115         /// Trackball.
116         /// </summary>
117         Trackball,
118         /// <summary>
119         /// Undefined.
120         /// </summary>
121         Undefined
122     };
123
124     /// <summary>
125     /// This class gives the device information, like the name, class, and subclass.
126     /// </summary>
127     /// <since_tizen> 4 </since_tizen>
128     public class InputMethodDeviceInformation
129     {
130         private IntPtr _handle;
131         internal InputMethodDeviceInformation(IntPtr handle)
132         {
133             _handle = handle;
134         }
135
136         /// <summary>
137         /// Gets the device name of the key event.
138         /// </summary>
139         /// <since_tizen> 4 </since_tizen>
140         public string Name
141         {
142             get
143             {
144                 string name;
145                 ErrorCode error = ImeDeviceInfoGetName(_handle, out name);
146                 if (error != ErrorCode.None)
147                 {
148                     Log.Error(LogTag, "GetName Failed with error " + error);
149                     return "";
150                 }
151                 return name;
152             }
153         }
154
155         /// <summary>
156         /// Gets the device class of the key event.
157         /// </summary>
158         /// <since_tizen> 4 </since_tizen>
159         public DeviceClass DeviceClass
160         {
161             get
162             {
163                 DeviceClass devClass;
164                 ErrorCode error = ImeDeviceInfoGetClass(_handle, out devClass);
165                 if (error != ErrorCode.None)
166                 {
167                     Log.Error(LogTag, "GetClass Failed with error " + error);
168                     return DeviceClass.Undefined;
169                 }
170                 return devClass;
171             }
172         }
173
174         /// <summary>
175         /// Gets the device subclass of the key event.
176         /// </summary>
177         /// <since_tizen> 4 </since_tizen>
178         public DeviceSubclass DeviceSubclass
179         {
180             get
181             {
182                 DeviceSubclass subclass;
183                 ErrorCode error = ImeDeviceInfoGetSubclass(_handle, out subclass);
184                 if (error != ErrorCode.None)
185                 {
186                     Log.Error(LogTag, "GetSubclass Failed with error " + error);
187                     return DeviceSubclass.Undefined;
188                 }
189                 return subclass;
190             }
191         }
192     }
193 }