• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit InputKit
19 */
20
21/**
22 * The infraredEmitter module generates IR signals of the specified frequency and size, and queries the frequency range supported by the device.
23 *
24 * @namespace infraredEmitter
25 * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
26 * @since 12
27 */
28declare namespace infraredEmitter {
29  /**
30   * Defines the frequency range of IR signals.
31   *
32   * @interface InfraredFrequency
33   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
34   * @systemapi hide for inner use
35   * @since 12
36   */
37  /**
38   * Defines the frequency range of IR signals.
39   *
40   * @interface InfraredFrequency
41   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
42   * @since 15
43   */
44  interface InfraredFrequency {
45    /**
46     * Maximum frequency, in Hz.
47     *
48     * @type { number }
49     * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
50     * @systemapi hide for inner use
51     * @since 12
52     */
53    /**
54     * Maximum frequency, in Hz.
55     *
56     * @type { number }
57     * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
58     * @since 15
59     */
60    max: number;
61
62    /**
63     * Minimum frequency, in Hz.
64     *
65     * @type { number }
66     * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
67     * @systemapi hide for inner use
68     * @since 12
69     */
70    /**
71     * Minimum frequency, in Hz.
72     *
73     * @type { number }
74     * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
75     * @since 15
76     */
77    min: number;
78  }
79
80  /**
81   * Generates IR signals at the specified frequency and level.
82   *
83   * @permission ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
84   * @param { number} infraredFrequency - IR infrared frequency, in Hz.
85   * @param { Array<number>} pattern - IR level signal, in μs. The value must be an even number within the value range of [0,1024].
86   * For example, in the IR level signal array [100,200,300,400], 100 μs is a high-level signal,
87   * 200 μs is a low-level signal, 300 μs is a high-level signal, and 400 μs is a low-level signal.
88   * @throws { BusinessError } 201 - Permission denied.
89   * @throws { BusinessError } 202 - Not system application.
90   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
91   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
92   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
93   * @systemapi hide for inner use
94   * @since 12
95   */
96  /**
97   * Generates IR signals at the specified frequency and level.
98   *
99   * @permission ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
100   * @param { number} infraredFrequency - IR infrared frequency, in Hz.
101   * @param { Array<number>} pattern - IR level signal, in μs. The value must be an even number within the value range of [0,1024].
102   * For example, in the IR level signal array [100,200,300,400], 100 μs is a high-level signal,
103   * 200 μs is a low-level signal, 300 μs is a high-level signal, and 400 μs is a low-level signal.
104   * @throws { BusinessError } 201 - Permission denied.
105   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
106   * <br>2. Incorrect parameter types; 3. Parameter verification failed.
107   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
108   * @since 15
109   */
110  function transmitInfrared(infraredFrequency: number, pattern: Array<number>): void;
111
112  /**
113   * Queries the frequency range of IR signals supported by the mobile phone.
114   *
115   * @permission ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
116   * @returns { Array<InfraredFrequency> } Frequency range, including multiple groups of maximum and minimum frequencies.
117   * @throws { BusinessError } 201 - Permission denied.
118   * @throws { BusinessError } 202 - Not system application.
119   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
120   * @systemapi hide for inner use
121   * @since 12
122   */
123  /**
124   * Queries the frequency range of IR signals supported by the mobile phone.
125   *
126   * @permission ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
127   * @returns { Array<InfraredFrequency> } Frequency range, including multiple groups of maximum and minimum frequencies.
128   * @throws { BusinessError } 201 - Permission denied.
129   * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter
130   * @since 15
131   */
132  function getInfraredFrequencies(): Array<InfraredFrequency>;
133}
134
135export default infraredEmitter;
136