• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
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 #ifndef ANDROID_INCLUDE_HARDWARE_CONSUMERIR_H
18 #define ANDROID_INCLUDE_HARDWARE_CONSUMERIR_H
19 
20 #include <stdint.h>
21 #include <sys/cdefs.h>
22 #include <hardware/hardware.h>
23 #include <hardware/hwcomposer_defs.h>
24 
25 #define CONSUMERIR_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
26 #define CONSUMERIR_HARDWARE_MODULE_ID "consumerir"
27 #define CONSUMERIR_TRANSMITTER "transmitter"
28 
29 typedef struct consumerir_freq_range {
30     int min;
31     int max;
32 } consumerir_freq_range_t;
33 
34 typedef struct consumerir_module {
35     struct hw_module_t common;
36 } consumerir_module_t;
37 
38 typedef struct consumerir_device {
39     struct hw_device_t common;
40 
41     /*
42      * (*transmit)() is called to by the ConsumerIrService to send an IR pattern
43      * at a given carrier_freq.
44      *
45      * The pattern is alternating series of carrier on and off periods measured in
46      * microseconds.  The carrier should be turned off at the end of a transmit
47      * even if there are and odd number of entries in the pattern array.
48      *
49      * This call should return when the transmit is complete or encounters an error.
50      *
51      * returns: 0 on success. A negative error code on error.
52      */
53     int (*transmit)(struct consumerir_device *dev, int carrier_freq,
54             const int pattern[], int pattern_len);
55 
56     /*
57      * (*get_num_carrier_freqs)() is called by the ConsumerIrService to get the
58      * number of carrier freqs to allocate space for, which is then filled by
59      * a subsequent call to (*get_carrier_freqs)().
60      *
61      * returns: the number of ranges on success. A negative error code on error.
62      */
63     int (*get_num_carrier_freqs)(struct consumerir_device *dev);
64 
65     /*
66      * (*get_carrier_freqs)() is called by the ConsumerIrService to enumerate
67      * which frequencies the IR transmitter supports.  The HAL implementation
68      * should fill an array of consumerir_freq_range structs with the
69      * appropriate values for the transmitter, up to len elements.
70      *
71      * returns: the number of ranges on success. A negative error code on error.
72      */
73     int (*get_carrier_freqs)(struct consumerir_device *dev,
74             size_t len, consumerir_freq_range_t *ranges);
75 
76     /* Reserved for future use. Must be NULL. */
77     void* reserved[8 - 3];
78 } consumerir_device_t;
79 
80 #endif /* ANDROID_INCLUDE_HARDWARE_CONSUMERIR_H */
81