1# @ohos.multimodalInput.infraredEmitter (IR Management) (System API)
2
3The **infraredEmitter** module generates IR signals of the specified frequency and size, and queries the frequency range supported by the device.
4
5> **NOTE**
6>
7> - The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9> - The APIs provided by this module are system APIs.
10
11## Modules to Import
12
13```js
14import { infraredEmitter } from '@kit.InputKit';
15```
16
17## infraredEmitter.transmitInfrared
18
19transmitInfrared(infraredFrequency: number, pattern: Array<number>): void
20
21Generates IR signals at the specified frequency and level.
22
23**Required permissions**: ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
24
25**System capability**: SystemCapability.MultimodalInput.Input.InfraredEmitter
26
27**Parameters**
28
29| Name      | Type                       | Mandatory  | Description                                      |
30| -------- | ------------------------- | ---- | ---------------------------------------- |
31| infraredFrequency | number             | Yes   | IR frequency, in Hz.|
32| pattern | Array<number> | Yes   | IR level signal, in μs. The number of arrays must be an even number. For example, in [100, 200, 300, 400], 100 μs is a high level signal, 200 μs is a low level signal, 300 μs is a high level signal, and 400 μs is a low level signal. The number of arrays must be in the range of [0, 500).|
33
34**Error codes**
35
36For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
37
38| ID| Error Message         |
39| -------- | ----------------- |
40| 201 | Permission denied. |
41| 202 | Not system application. |
42| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. |
43
44**Example**
45
46```js
47try {
48  infraredEmitter.transmitInfrared(38000, [100, 200, 300, 400]);
49} catch (error) {
50  console.log(`transmitInfrared failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
51}
52```
53
54## infraredEmitter.getInfraredFrequencies
55
56getInfraredFrequencies(): Array<InfraredFrequency>
57
58Queries the frequency range of IR signals supported by the mobile phone.
59
60**Required permissions**: ohos.permission.MANAGE_INPUT_INFRARED_EMITTER
61
62**System capability**: SystemCapability.MultimodalInput.Input.InfraredEmitter
63
64**Return value**
65
66| Parameter                 | Description                 |
67| ------------------- | ------------------- |
68| Array<[InfraredFrequency](#infraredfrequency)> | Frequency range, including multiple groups of maximum and minimum frequencies.|
69
70**Error codes**
71
72For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
73
74| ID| Error Message         |
75| -------- | ----------------- |
76| 201 | Permission denied. |
77| 202 | Not system application. |
78
79**Example**
80
81```js
82try {
83  let frequencies = infraredEmitter.getInfraredFrequencies();
84  console.log(`frequencies: ${JSON.stringify(frequencies)}`);
85} catch (error) {
86  console.log(`Get infrared frequencies failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
87}
88```
89
90##  InfraredFrequency
91
92Defines the frequency range of IR signals.
93
94**System capability**: SystemCapability.MultimodalInput.Input.InfraredEmitter
95
96| Name                              | Type| Mandatory  | Description |
97| -------------------------------- | ---- | ------ | ------ |
98| max                       | number | Yes| Maximum frequency, in Hz.|
99| min                          | number | Yes | Minimum frequency, in Hz.|
100