LIRC libraries: /home/mk/tmp/lirc/lib/ir_remote_types.h (085323c 2016-01-06 15:32:54 +0100) Source File

| 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
95 struct ir_code_node* current;
96
98 struct ir_code_node* transmit_state;
99
101 struct ir_ncode* next_ncode;
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;
158 int repeat_flag;
159 lirc_t max_remaining_gap;
160 lirc_t min_remaining_gap;
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;
180 char* dyncodes_name;
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;
196 int pre_data_bits;
197 ir_code pre_data;
198 int post_data_bits;
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;
206 int toggle_bit;
207 ir_code toggle_bit_mask;
208 int suppress_repeat;
211 int min_repeat;
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;
241 struct ir_ncode* toggle_code;
242 int reps;
243 struct timeval last_send;
244 lirc_t min_remaining_gap;
245 lirc_t max_remaining_gap;
247 lirc_t min_total_signal_length;
248 lirc_t max_total_signal_length;
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;
253 int release_detected;
254 int manual_sort;
255 struct ir_remote* next;
256 };
257
258 #ifdef __cplusplus
259 }
260 #endif
261
262 #endif
ir_remote::min_remaining_gap
lirc_t min_remaining_gap
Definition: ir_remote_types.h:244
ir_remote
Definition: ir_remote_types.h:167
ir_remote::bits
int bits
Definition: ir_remote_types.h:171
ir_remote::min_total_signal_length
lirc_t min_total_signal_length
Definition: ir_remote_types.h:247
ir_code_node
Definition: ir_remote_types.h:65
ir_remote::freq
unsigned int freq
Definition: ir_remote_types.h:220
ir_remote::max_gap_length
lirc_t max_gap_length
Definition: ir_remote_types.h:250
ir_remote::max_total_signal_length
lirc_t max_total_signal_length
Definition: ir_remote_types.h:248
ir_remote::post_data
ir_code post_data
Definition: ir_remote_types.h:199
ir_remote::post_s
lirc_t post_s
Definition: ir_remote_types.h:201
ir_remote::plead
lirc_t plead
Definition: ir_remote_types.h:191
ir_remote::repeat_mask
ir_code repeat_mask
Definition: ir_remote_types.h:234
ir_remote::toggle_code
struct ir_ncode * toggle_code
Definition: ir_remote_types.h:241
ir_ncode::next
struct ir_code_node * next
Definition: ir_remote_types.h:91
ir_remote::baud
unsigned int baud
Definition: ir_remote_types.h:226
ir_remote::name
const char * name
Definition: ir_remote_types.h:168
ir_ncode::signals
lirc_t * signals
Definition: ir_remote_types.h:87
ir_remote::eps
int eps
Definition: ir_remote_types.h:173
ir_remote::last_code
struct ir_ncode * last_code
Definition: ir_remote_types.h:240
ir_remote::parity
unsigned int parity
Definition: ir_remote_types.h:228
decode_ctx_t::pre
ir_code pre
Definition: ir_remote_types.h:156
ir_code
__u64 ir_code
Definition: ir_remote_types.h:59
ir_remote::sfoot
lirc_t sfoot
Definition: ir_remote_types.h:193
ir_remote::ptrail
lirc_t ptrail
Definition: ir_remote_types.h:192
ir_remote::pre_data_bits
int pre_data_bits
Definition: ir_remote_types.h:196
ir_remote::min_gap_length
lirc_t min_gap_length
Definition: ir_remote_types.h:249
ir_remote::manual_sort
int manual_sort
Definition: ir_remote_types.h:254
ir_ncode::name
char * name
Definition: ir_remote_types.h:78
ir_ncode::current
struct ir_code_node * current
Definition: ir_remote_types.h:95
ir_remote::duty_cycle
unsigned int duty_cycle
Definition: ir_remote_types.h:221
ir_remote::post_data_bits
int post_data_bits
Definition: ir_remote_types.h:198
ir_remote::sthree
lirc_t sthree
Definition: ir_remote_types.h:187
ir_remote::toggle_mask
ir_code toggle_mask
Definition: ir_remote_types.h:222
ir_remote::pre_data
ir_code pre_data
Definition: ir_remote_types.h:197
decode_ctx_t::post
ir_code post
Definition: ir_remote_types.h:157
ir_remote::sone
lirc_t sone
Definition: ir_remote_types.h:189
ir_remote::dyncodes_name
char * dyncodes_name
Definition: ir_remote_types.h:180
ir_remote::shead
lirc_t shead
Definition: ir_remote_types.h:186
decode_ctx_t::max_remaining_gap
lirc_t max_remaining_gap
Definition: ir_remote_types.h:159
decode_ctx_t::code
ir_code code
Definition: ir_remote_types.h:155
ir_remote::repeat_gap
__u32 repeat_gap
Definition: ir_remote_types.h:205
ir_remote::gap
__u32 gap
Definition: ir_remote_types.h:203
ir_remote::stop_bits
unsigned int stop_bits
Definition: ir_remote_types.h:229
ir_remote::pre_s
lirc_t pre_s
Definition: ir_remote_types.h:200
ir_remote::szero
lirc_t szero
Definition: ir_remote_types.h:190
ir_remote::dyncode
int dyncode
Definition: ir_remote_types.h:181
ir_ncode
Definition: ir_remote_types.h:76
ir_remote::stwo
lirc_t stwo
Definition: ir_remote_types.h:188
ir_remote::flags
int flags
Definition: ir_remote_types.h:172
ir_remote::aeps
unsigned int aeps
Definition: ir_remote_types.h:174
ir_remote::srepeat
lirc_t srepeat
Definition: ir_remote_types.h:194
decode_ctx_t
Definition: ir_remote_types.h:154
ir_remote::release_detected
int release_detected
Definition: ir_remote_types.h:253
decode_ctx_t::min_remaining_gap
lirc_t min_remaining_gap
Definition: ir_remote_types.h:160
ir_ncode::transmit_state
struct ir_code_node * transmit_state
Definition: ir_remote_types.h:98
ir_remote::max_remaining_gap
lirc_t max_remaining_gap
Definition: ir_remote_types.h:245
ir_remote::suppress_repeat
int suppress_repeat
Definition: ir_remote_types.h:208
ir_ncode::code
ir_code code
Definition: ir_remote_types.h:81
ir_remote::toggle_bit
int toggle_bit
Definition: ir_remote_types.h:206
ir_remote::driver
const char * driver
Definition: ir_remote_types.h:169
ir_ncode::next_ncode
struct ir_ncode * next_ncode
Definition: ir_remote_types.h:101
ir_remote::min_code_repeat
unsigned int min_code_repeat
Definition: ir_remote_types.h:219
ir_remote::rc6_mask
ir_code rc6_mask
Definition: ir_remote_types.h:223
decode_ctx_t::repeat_flag
int repeat_flag
Definition: ir_remote_types.h:158
ir_remote::toggle_bit_mask
ir_code toggle_bit_mask
Definition: ir_remote_types.h:207
ir_remote::gap2
__u32 gap2
Definition: ir_remote_types.h:204
ir_remote::min_repeat
int min_repeat
Definition: ir_remote_types.h:211
ir_remote::ignore_mask
ir_code ignore_mask
Definition: ir_remote_types.h:233
ir_remote::bits_in_byte
unsigned int bits_in_byte
Definition: ir_remote_types.h:227
ir_ncode::length
int length
Definition: ir_remote_types.h:84