LIRC libraries
LinuxInfraredRemoteControl
ir_remote_types.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** ir_remote_types.h *******************************************************
3 ****************************************************************************
4 *
5 * ir_remote_types.h - describes and decodes the signals from IR remotes
6 *
7 * Copyright (C) 1996,97 Ralph Metzler <rjkm@thp.uni-koeln.de>
8 * Copyright (C) 1998 Christoph Bartelmus <lirc@bartelmus.de>
9 *
10 */
11 
19 #ifndef IR_REMOTE_TYPES_H
20 #define IR_REMOTE_TYPES_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #if defined(__linux__)
27 #include <sys/types.h>
28 #else
29 #include <stdint.h>
30 typedef int8_t __s8;
31 typedef uint8_t __u8;
32 typedef int16_t __s16;
33 typedef uint16_t __u16;
34 typedef int32_t __s32;
35 typedef uint32_t __u32;
36 typedef int64_t __s64;
37 typedef uint64_t __u64;
38 #endif
39 
40 #include <sys/time.h>
41 #include <unistd.h>
42 #include <string.h>
43 #include <math.h>
44 #include <stdlib.h>
45 #if defined(__linux__)
46 #include <linux/types.h>
47 #endif
48 
49 #ifdef HAVE_KERNEL_LIRC_H
50 #include <linux/lirc.h>
51 #else
52 #include "include/media/lirc.h"
53 #endif
54 
59 typedef __u64 ir_code;
60 
65 struct ir_code_node {
66  ir_code code;
67  struct ir_code_node* next;
68 };
69 
76 struct ir_ncode {
78  char* name;
79 
81  ir_code code;
82 
84  int length;
85 
87  lirc_t* signals;
88 
91  struct ir_code_node* next;
92 
96 
99 
102 };
103 
104 /*
105  * struct ir_remote
106  * defines the encoding of a remote control
107  */
108 
109 /* definitions for flags */
110 
111 #define IR_PROTOCOL_MASK 0x07ff
112 
113 /* protocols: must not be combined */
114 /* Don't forget to take a look at config_file.h when adding new flags */
115 
116 #define RAW_CODES 0x0001
117 #define RC5 0x0002
118 #define SHIFT_ENC RC5
119 /* Hm, RC6 protocols seem to have changed the biphase semantics so
120  * that lircd will calculate the bit-wise complement of the codes. But
121  * this is only a guess as I did not have a datasheet... */
122 
123 #define RC6 0x0004
124 #define RCMM 0x0008
125 #define SPACE_ENC 0x0010
126 #define SPACE_FIRST 0x0020
127 #define GOLDSTAR 0x0040
128 #define GRUNDIG 0x0080
129 #define BO 0x0100
130 #define SERIAL 0x0200
131 #define XMP 0x0400
133 /* additinal flags: can be orred together with protocol flag */
134 #define REVERSE 0x0800
135 #define NO_HEAD_REP 0x1000
136 #define NO_FOOT_REP 0x2000
137 #define CONST_LENGTH 0x4000
138 #define REPEAT_HEADER 0x8000
140 #define COMPAT_REVERSE 0x00010000
145 #define REPEAT_MAX_DEFAULT 600
146 
147 #define DEFAULT_FREQ 38000
148 
149 #define IR_PARITY_NONE 0
150 #define IR_PARITY_EVEN 1
151 #define IR_PARITY_ODD 2
152 
154 struct decode_ctx_t {
155  ir_code code;
156  ir_code pre;
157  ir_code post;
161 };
162 
163 
167 struct ir_remote {
168  const char* name;
169  const char* driver;
170  struct ir_ncode* codes;
171  int bits;
172  int flags;
173  int eps;
174  unsigned int aeps;
181  int dyncode;
182  struct ir_ncode dyncodes[2];
184  /* pulse and space lengths of: */
185 
186  lirc_t phead, shead;
187  lirc_t pthree, sthree;
188  lirc_t ptwo, stwo;
189  lirc_t pone, sone;
190  lirc_t pzero, szero;
191  lirc_t plead;
192  lirc_t ptrail;
193  lirc_t pfoot, sfoot;
194  lirc_t prepeat, srepeat;
197  ir_code pre_data;
199  ir_code post_data;
200  lirc_t pre_p, pre_s;
201  lirc_t post_p, post_s;
203  __u32 gap;
204  __u32 gap2;
205  __u32 repeat_gap;
207  ir_code toggle_bit_mask;
219  unsigned int min_code_repeat;
220  unsigned int freq;
221  unsigned int duty_cycle;
222  ir_code toggle_mask;
223  ir_code rc6_mask;
225  /* serial protocols */
226  unsigned int baud;
227  unsigned int bits_in_byte;
228  unsigned int parity;
229  unsigned int stop_bits;
233  ir_code ignore_mask;
234  ir_code repeat_mask;
235  /* end of user editable values */
236 
237  ir_code toggle_bit_mask_state;
238  int toggle_mask_state;
239  int repeat_countdown;
240  struct ir_ncode* last_code;
242  int reps;
243  struct timeval last_send;
249  lirc_t min_gap_length;
250  lirc_t max_gap_length;
251  lirc_t min_pulse_length, max_pulse_length;
252  lirc_t min_space_length, max_space_length;
255  struct ir_remote* next;
256 };
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif
lirc_t min_remaining_gap
lirc_t min_total_signal_length
unsigned int freq
lirc_t max_gap_length
lirc_t max_total_signal_length
ir_code post_data
ir_code repeat_mask
struct ir_ncode * toggle_code
struct ir_code_node * next
unsigned int baud
const char * name
lirc_t * signals
struct ir_ncode * last_code
unsigned int parity
__u64 ir_code
lirc_t min_gap_length
char * name
struct ir_code_node * current
unsigned int duty_cycle
ir_code toggle_mask
ir_code pre_data
char * dyncodes_name
lirc_t max_remaining_gap
__u32 repeat_gap
unsigned int stop_bits
unsigned int aeps
lirc_t srepeat
int release_detected
lirc_t min_remaining_gap
struct ir_code_node * transmit_state
lirc_t max_remaining_gap
ir_code code
const char * driver
struct ir_ncode * next_ncode
unsigned int min_code_repeat
ir_code rc6_mask
ir_code toggle_bit_mask
ir_code ignore_mask
unsigned int bits_in_byte