[NUI] Add SystemSettings.FontTypeChanged in Text components
[platform/core/csapi/tizenfx.git] / src / Tizen.System / Device / IR.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.Linq;
20
21 namespace Tizen.System
22 {
23     /// <summary>
24     /// The IR API provides the functions to control the IR transmitter.
25     /// The IR API provides the way to get the information if IR is available and then transmit the IR command.
26     /// </summary>
27     /// <privilege>
28     /// http://tizen.org/privilege/use_ir
29     /// </privilege>
30     /// <example>
31     /// <code>
32     ///     Console.WriteLine("IR availability for this device is: {0}", IR.IsAvailable);
33     /// </code>
34     /// </example>
35     /// <since_tizen> 3 </since_tizen>
36     public static class IR
37     {
38         /// <summary>
39         /// Gets the information whether the IR module is available.
40         /// </summary>
41         /// <since_tizen> 3 </since_tizen>
42         public static bool IsAvailable
43         {
44             get
45             {
46                 bool available = false;
47                 DeviceError res = (DeviceError)Interop.Device.DeviceIRIsAvailable(out available);
48                 if (res != DeviceError.None)
49                 {
50                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get ir status.");
51                 }
52                 return available;
53             }
54         }
55
56         /// <summary>
57         /// Transmits the IR command.
58         /// </summary>
59         /// <since_tizen> 3 </since_tizen>
60         /// <param name="carrierFreequency">
61         /// The carrier frequency to transmit the IR command (Hertz).
62         /// </param>
63         /// <param name="pattern">
64         /// The IR command list of type integer.
65         /// </param>
66         /// <exception cref="ArgumentException"> When an invalid parameter value is set.</exception>
67         /// <exception cref="UnauthorizedAccessException">If the privilege is not set.</exception>
68         /// <exception cref="InvalidOperationException">In case of any system error.</exception>
69         /// <exception cref="NotSupportedException">In case the device does not support this behavior.</exception>
70         /// <example>
71         /// <code>
72         ///    try
73         ///    {
74         ///       List&lt;int&gt; pattern = new List&lt;int&gt;();
75         ///       pattern.Add(10);
76         ///       pattern.Add(50);
77         ///       IR.Transmit(60657, pattern);
78         ///    }
79         ///    catch(Exception e)
80         ///    {
81         ///    }
82         /// </code>
83         /// </example>
84         public static void Transmit(int carrierFreequency, IList<int> pattern)
85         {
86             int[] patternArray = pattern.ToArray();
87             DeviceError res = (DeviceError)Interop.Device.DeviceIRTransmit(carrierFreequency, patternArray, pattern.Count());
88             if (res != DeviceError.None)
89             {
90                 throw DeviceExceptionFactory.CreateException(res, "unable to trasmit IR command.");
91             }
92         }
93     }
94 }