Tizen Native API
9.0
|
The IR API provides functions to control a IR transmitter.
Required Header
#include <device/ir.h>
Overview
The IR API provides the way to get the information whether IR is available and transmit IR command.
Related Features
This API is related with the following feature:
- http://tizen.org/feature/consumer_ir
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from feature element description.
Functions | |
int | device_ir_is_available (bool *available) |
Gets the information the IR module is available on the device. | |
int | device_ir_transmit (int carrier_frequency, int *pattern, int size) |
Transmits IR command with the specified carrier frequency and pattern. |
Function Documentation
int device_ir_is_available | ( | bool * | available | ) |
Gets the information the IR module is available on the device.
Gets the boolean value whether the IR module is available on the device.
If the IR module is available, the function returns true
in the available parameter.
Otherwise, it returns false
.
- Since :
- 3.0
- Remarks:
- Ensure that the provided available pointer is valid and has enough memory allocated.
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/use_ir
- Parameters:
-
[out] available The information whether IR is available
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not supported device #include <stdio.h> #include <device/ir.h> ... bool ir_available; int ret = device_ir_is_available(&ir_available); if (ret != DEVICE_ERROR_NONE) { return -1; } ... if (ir_available) { printf("IR module is available.\n"); } else { printf("IR module is not available.\n"); } ...
int device_ir_transmit | ( | int | carrier_frequency, |
int * | pattern, | ||
int | size | ||
) |
Transmits IR command with the specified carrier frequency and pattern.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/use_ir
- Parameters:
-
[in] carrier_frequency Carrier frequency to transmit IR command (Hertz) [in] pattern Integer array of IR command [in] size Size of IR command pattern
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed DEVICE_ERROR_NOT_SUPPORTED Not supported device #include <stdio.h> #include <device/ir.h> ... int carrier_frequency = 38000; // Carrier frequency in Hertz int pattern[] = {900, 450, 450, 450, 450, 450, 450, 450, 450, 450}; // Example IR command pattern int size = sizeof(pattern) / sizeof(pattern[0]); // Size of the IR command pattern int ret = device_ir_transmit(carrier_frequency, pattern, size); if (ret != DEVICE_ERROR_NONE) { return -1; } printf("IR command transmitted successfully.\n"); ...
- See also:
- device_ir_is_available()