[TCSACR-93] Add USB Host C# API
[platform/core/csapi/tizenfx.git] / src / Tizen.System.Usb / Usb / UsbDeviceStrings.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     /// String information for USB device.
23     /// </summary>
24     public class UsbDeviceStrings
25     {
26         private readonly UsbDevice _device;
27         private string _language;
28
29         internal UsbDeviceStrings(UsbDevice device, string language)
30         {
31             _device = device;
32             _language = language;
33         }
34
35         /// <summary>
36         /// Gets string describing device manufacturer.
37         /// </summary>
38         /// <exception cref="InvalidOperationException">Throws exception if device is disconnected or not opened for operation.</exception>
39         /// <exception cref="UnauthorizedAccessException">Throws exception if user has insufficient permission on device.</exception>
40         public string Manufacturer
41         {
42             get
43             {
44                 _device.ThrowIfDisposed();
45                 return Interop.DescriptorString(_device._handle.GetManufacturerStr, _language);
46             }
47         }
48
49         /// <summary>
50         /// Gets product string of device
51         /// </summary>
52         /// <exception cref="InvalidOperationException">Throws exception if device is not opened for operation.</exception>
53         /// <exception cref="UnauthorizedAccessException">Throws exception if user has insufficient permission on device.</exception>
54         public string Product
55         {
56             get
57             {
58                 _device.ThrowIfDisposed();
59                 return Interop.DescriptorString(_device._handle.GetProductStr, _language);
60             }
61         }
62
63         /// <summary>
64         /// Gets serial number of a device.
65         /// </summary>
66         /// <exception cref="InvalidOperationException">Throws exception if device is not opened for operation.</exception>
67         /// <exception cref="UnauthorizedAccessException">Throws exception if user has insufficient permission on device.</exception>
68         public string Serial
69         {
70             get
71             {
72                 _device.ThrowIfDisposed();
73                 return Interop.DescriptorString(_device._handle.GetSerialNumberStr, _language);
74             }
75         }
76     }
77 }