Merge "[Inputmethod] Remove Option window apis"
[platform/core/csapi/tizenfx.git] / src / Tizen.System.Usb / Usb / UsbDeviceInformation.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
19 namespace Tizen.System.Usb
20 {
21     /// <summary>
22     /// Device information for USB device.
23     /// </summary>
24     public class UsbDeviceInformation
25     {
26         private readonly UsbDevice _device;
27
28         internal UsbDeviceInformation(UsbDevice device)
29         {
30             _device = device;
31         }
32
33         /// <summary>
34         /// USB specification release number as binary-coded decimal.
35         /// </summary>
36         /// <exception cref="UnauthorizedAccessException">Throws exception if user has insufficient permission on device.</exception>
37         public int UsbVersion
38         {
39             get
40             {
41                 _device.ThrowIfDisposed();
42                 return Interop.NativeGet<int>(_device._handle.GetBcdUsb);
43             }
44         }
45
46         /// <summary>
47         /// Gets device class.
48         /// </summary>
49         public int Class
50         {
51             get
52             {
53                 _device.ThrowIfDisposed();
54                 return Interop.NativeGet<int>(_device._handle.GetClass);
55             }
56         }
57
58         /// <summary>
59         /// Gets device sub class.
60         /// </summary>
61         public int Subclass
62         {
63             get
64             {
65                 _device.ThrowIfDisposed();
66                 return Interop.NativeGet<int>(_device._handle.GetSubClass);
67             }
68         }
69
70         /// <summary>
71         /// Gets device protocol.
72         /// </summary>
73         public int Protocol
74         {
75             get
76             {
77                 _device.ThrowIfDisposed();
78                 return Interop.NativeGet<int>(_device._handle.GetProtocol);
79             }
80         }
81
82         /// <summary>
83         /// Gets vendor id.
84         /// </summary>
85         public int VendorId
86         {
87             get
88             {
89                 _device.ThrowIfDisposed();
90                 return Interop.NativeGet<int>(_device._handle.GetIdVendor);
91             }
92         }
93
94         /// <summary>
95         /// Gets product id.
96         /// </summary>
97         public int ProductId
98         {
99             get
100             {
101                 _device.ThrowIfDisposed();
102                 return Interop.NativeGet<int>(_device._handle.GetIdProduct);
103             }
104         }
105
106         /// <summary>
107         /// Gets device release number in binary-coded decimal.
108         /// </summary>
109         public int DeviceVersion
110         {
111             get
112             {
113                 _device.ThrowIfDisposed();
114                 return Interop.NativeGet<int>(_device._handle.GetBcdDevice);
115             }
116         }
117     }
118 }