/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * 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; using static Interop.InputMethod; namespace Tizen.Uix.InputMethod { /// /// Enumeration for the device class. /// /// 4 public enum DeviceClass { /// /// None. /// None, /// /// Seat. /// Seat, /// /// Keyboard. /// Keyboard, /// /// Mouse. /// Mouse, /// /// Touch. /// Touch, /// /// Pen. /// Pen, /// /// Pointer. /// Pointer, /// /// Gamepad. /// Gamepad, /// /// Undefined. /// Undefined }; /// /// Enumeration for the device subclass. /// /// 4 public enum DeviceSubclass { /// /// None. /// None, /// /// Finger. /// Finger, /// /// FingerNail. /// FingerNail, /// /// Knuckle. /// Knuckle, /// /// Palm. /// Palm, /// /// HandSize. /// HandSize, /// /// HandFlat. /// HandFlat, /// /// PenTip. /// PenTip, /// /// Trackpad. /// Trackpad, /// /// Trackpoint. /// Trackpoint, /// /// Trackball. /// Trackball, /// /// Undefined. /// Undefined }; /// /// This class gives the device information, like the name, class, and subclass. /// /// 4 public class InputMethodDeviceInformation { private IntPtr _handle; internal InputMethodDeviceInformation(IntPtr handle) { _handle = handle; } /// /// Gets the device name of the key event. /// /// 4 public string Name { get { string name; ErrorCode error = ImeDeviceInfoGetName(_handle, out name); if (error != ErrorCode.None) { Log.Error(LogTag, "GetName Failed with error " + error); return ""; } return name; } } /// /// Gets the device class of the key event. /// /// 4 public DeviceClass DeviceClass { get { DeviceClass devClass; ErrorCode error = ImeDeviceInfoGetClass(_handle, out devClass); if (error != ErrorCode.None) { Log.Error(LogTag, "GetClass Failed with error " + error); return DeviceClass.Undefined; } return devClass; } } /// /// Gets the device subclass of the key event. /// /// 4 public DeviceSubclass DeviceSubclass { get { DeviceSubclass subclass; ErrorCode error = ImeDeviceInfoGetSubclass(_handle, out subclass); if (error != ErrorCode.None) { Log.Error(LogTag, "GetSubclass Failed with error " + error); return DeviceSubclass.Undefined; } return subclass; } } } }