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