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