LIRC libraries: /tmp/work/src/lirc-0.10.2/lib/ir_remote_types.h Source File

LIRC libraries Linux Infrared Remote Control

Loading...
Searching...
No Matches
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
23extern "C" {
24#endif
25
26#include <stdint.h>
27
28#include <sys/time.h>
29#include <unistd.h>
30#include <string.h>
31#include <math.h>
32#include <stdlib.h>
33#if defined(__linux__)
34#include <linux/types.h>
35#endif
36
37#include "media/lirc.h"
38
43 typedef uint64_t ir_code;
44
49 struct ir_code_node {
50 ir_code code;
51 struct ir_code_node* next;
52};
53
60 struct ir_ncode {
62 char* name;
63
65 ir_code code;
66
68 int length;
69
71 lirc_t* signals;
72
75 struct ir_code_node* next;
76
79 struct ir_code_node* current;
80
82 struct ir_code_node* transmit_state;
83
85 struct ir_ncode* next_ncode;
86};
87
88/*
89 * struct ir_remote
90 * defines the encoding of a remote control
91 */
92
93/* definitions for flags */
94
95#define IR_PROTOCOL_MASK 0x07ff
96
97/* protocols: must not be combined */
98/* Don't forget to take a look at config_file.h when adding new flags */
99
100#define RAW_CODES 0x0001
101#define RC5 0x0002
102#define SHIFT_ENC RC5
103/* Hm, RC6 protocols seem to have changed the biphase semantics so
104 * that lircd will calculate the bit-wise complement of the codes. But
105 * this is only a guess as I did not have a datasheet... */
106
107#define RC6 0x0004
108#define RCMM 0x0008
109#define SPACE_ENC 0x0010
110#define SPACE_FIRST 0x0020
111#define GRUNDIG 0x0080
112#define BO 0x0100
113#define SERIAL 0x0200
114#define XMP 0x0400
116/* additinal flags: can be orred together with protocol flag */
117#define REVERSE 0x0800
118#define NO_HEAD_REP 0x1000
119#define NO_FOOT_REP 0x2000
120#define CONST_LENGTH 0x4000
121#define REPEAT_HEADER 0x8000
123#define COMPAT_REVERSE 0x00010000
128#define REPEAT_MAX_DEFAULT 600
129
130#define DEFAULT_FREQ 38000
131
132#define IR_PARITY_NONE 0
133#define IR_PARITY_EVEN 1
134#define IR_PARITY_ODD 2
135
137 struct decode_ctx_t {
138 ir_code code;
139 ir_code pre;
140 ir_code post;
141 int repeat_flag;
142 lirc_t max_remaining_gap;
143 lirc_t min_remaining_gap;
144};
145
146
150 struct ir_remote {
151 const char* name;
152 const char* driver;
153 struct ir_ncode* codes;
154 int bits;
155 int flags;
156 int eps;
157 unsigned int aeps;
163 char* dyncodes_name;
164 int dyncode;
165 struct ir_ncode dyncodes[2];
167 /* pulse and space lengths of: */
168
169 lirc_t phead, shead;
170 lirc_t pthree, sthree;
171 lirc_t ptwo, stwo;
172 lirc_t pone, sone;
173 lirc_t pzero, szero;
174 lirc_t plead;
175 lirc_t ptrail;
176 lirc_t pfoot, sfoot;
177 lirc_t prepeat, srepeat;
179 int pre_data_bits;
180 ir_code pre_data;
181 int post_data_bits;
182 ir_code post_data;
183 lirc_t pre_p, pre_s;
184 lirc_t post_p, post_s;
186 uint32_t gap;
187 uint32_t gap2;
188 uint32_t repeat_gap;
189 int toggle_bit;
190 ir_code toggle_bit_mask;
191 int suppress_repeat;
194 int min_repeat;
202 unsigned int min_code_repeat;
203 unsigned int freq;
204 unsigned int duty_cycle;
205 ir_code toggle_mask;
206 ir_code rc6_mask;
208 /* serial protocols */
209 unsigned int baud;
210 unsigned int bits_in_byte;
211 unsigned int parity;
212 unsigned int stop_bits;
216 ir_code ignore_mask;
217 ir_code repeat_mask;
218 /* end of user editable values */
219
220 ir_code toggle_bit_mask_state;
221 int toggle_mask_state;
222 int repeat_countdown;
223 struct ir_ncode* last_code;
224 struct ir_ncode* toggle_code;
225 int reps;
226 struct timeval last_send;
227 lirc_t min_remaining_gap;
228 lirc_t max_remaining_gap;
230 lirc_t min_total_signal_length;
231 lirc_t max_total_signal_length;
232 lirc_t min_gap_length;
233 lirc_t max_gap_length;
234 lirc_t min_pulse_length, max_pulse_length;
235 lirc_t min_space_length, max_space_length;
236 int release_detected;
237 int manual_sort;
238 struct ir_remote* next;
239};
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif
ir_code
uint64_t ir_code
Denotes an internal coded representation for an IR transmission.
Definition: ir_remote_types.h:43
decode_ctx_t
State describing code, pre, post + gap and repeat state.
Definition: ir_remote_types.h:137
decode_ctx_t::code
ir_code code
Code part, matched to code defintion.
Definition: ir_remote_types.h:138
decode_ctx_t::repeat_flag
int repeat_flag
True if code is a repeated one.
Definition: ir_remote_types.h:141
decode_ctx_t::post
ir_code post
post data, sent after code.
Definition: ir_remote_types.h:140
decode_ctx_t::min_remaining_gap
lirc_t min_remaining_gap
Estimated min time of trailing gap.
Definition: ir_remote_types.h:143
decode_ctx_t::max_remaining_gap
lirc_t max_remaining_gap
Estimated max time of trailing gap.
Definition: ir_remote_types.h:142
decode_ctx_t::pre
ir_code pre
pre data, before code.
Definition: ir_remote_types.h:139
ir_code_node
An ir_code for entering into (singly) linked lists, i.e.
Definition: ir_remote_types.h:49
ir_ncode
IR Command, corresponding to one (command defining) line of the configuration file.
Definition: ir_remote_types.h:60
ir_ncode::next_ncode
struct ir_ncode * next_ncode
Next code in recorded buttons list.
Definition: ir_remote_types.h:85
ir_ncode::next
struct ir_code_node * next
Linked list of the subsequent ir_code's, after the first one.
Definition: ir_remote_types.h:75
ir_ncode::code
ir_code code
The first code of the command.
Definition: ir_remote_types.h:65
ir_ncode::transmit_state
struct ir_code_node * transmit_state
(private)
Definition: ir_remote_types.h:82
ir_ncode::length
int length
(private)
Definition: ir_remote_types.h:68
ir_ncode::signals
lirc_t * signals
(private)
Definition: ir_remote_types.h:71
ir_ncode::current
struct ir_code_node * current
Should point at the ir_code currently being transmitted, or NULL if none.
Definition: ir_remote_types.h:79
ir_ncode::name
char * name
Name of command.
Definition: ir_remote_types.h:62
ir_remote
One remote as represented in the configuration file.
Definition: ir_remote_types.h:150
ir_remote::driver
const char * driver
Name of driver for LIRCCODE cases.
Definition: ir_remote_types.h:152
ir_remote::repeat_gap
uint32_t repeat_gap
time between two repeat codes if different from gap
Definition: ir_remote_types.h:188
ir_remote::stwo
lirc_t stwo
2 (only used for RC-MM)
Definition: ir_remote_types.h:171
ir_remote::freq
unsigned int freq
modulation frequency
Definition: ir_remote_types.h:203
ir_remote::suppress_repeat
int suppress_repeat
suppress unwanted repeats
Definition: ir_remote_types.h:191
ir_remote::aeps
unsigned int aeps
detecting very short pulses is difficult with relative tolerance for some remotes,...
Definition: ir_remote_types.h:157
ir_remote::gap2
uint32_t gap2
time between signals in usecs
Definition: ir_remote_types.h:187
ir_remote::min_total_signal_length
lirc_t min_total_signal_length
how long is the shortest signal including gap
Definition: ir_remote_types.h:230
ir_remote::stop_bits
unsigned int stop_bits
mapping: 1->2 1.5->3 2->4
Definition: ir_remote_types.h:212
ir_remote::bits_in_byte
unsigned int bits_in_byte
default: 8
Definition: ir_remote_types.h:210
ir_remote::dyncodes
struct ir_ncode dyncodes[2]
helper structs for unknown buttons
Definition: ir_remote_types.h:165
ir_remote::sfoot
lirc_t sfoot
foot
Definition: ir_remote_types.h:176
ir_remote::rc6_mask
ir_code rc6_mask
RC-6 doubles signal length of some bits.
Definition: ir_remote_types.h:206
ir_remote::max_remaining_gap
lirc_t max_remaining_gap
gap range
Definition: ir_remote_types.h:228
ir_remote::ptrail
lirc_t ptrail
trailing pulse
Definition: ir_remote_types.h:175
ir_remote::duty_cycle
unsigned int duty_cycle
0<duty cycle<=100 default: 50
Definition: ir_remote_types.h:204
ir_remote::min_gap_length
lirc_t min_gap_length
how long is the shortest gap
Definition: ir_remote_types.h:232
ir_remote::repeat_mask
ir_code repeat_mask
mask defines which bits are inverted for repeats
Definition: ir_remote_types.h:217
ir_remote::srepeat
lirc_t srepeat
indicate repeating
Definition: ir_remote_types.h:177
ir_remote::pre_data
ir_code pre_data
data which the remote sends before actual keycode
Definition: ir_remote_types.h:180
ir_remote::bits
int bits
bits (length of code)
Definition: ir_remote_types.h:154
ir_remote::post_data_bits
int post_data_bits
length of post_data
Definition: ir_remote_types.h:181
ir_remote::ignore_mask
ir_code ignore_mask
mask defines which bits can be ignored when matching a code
Definition: ir_remote_types.h:216
ir_remote::release_detected
int release_detected
set by release generator
Definition: ir_remote_types.h:236
ir_remote::plead
lirc_t plead
leading pulse
Definition: ir_remote_types.h:174
ir_remote::sthree
lirc_t sthree
3 (only used for RC-MM)
Definition: ir_remote_types.h:170
ir_remote::shead
lirc_t shead
header
Definition: ir_remote_types.h:169
ir_remote::szero
lirc_t szero
0
Definition: ir_remote_types.h:173
ir_remote::last_send
struct timeval last_send
time last_code was received or sent
Definition: ir_remote_types.h:226
ir_remote::post_data
ir_code post_data
data which the remote sends after actual keycode
Definition: ir_remote_types.h:182
ir_remote::toggle_mask
ir_code toggle_mask
Sharp (?) error detection scheme.
Definition: ir_remote_types.h:205
ir_remote::flags
int flags
flags
Definition: ir_remote_types.h:155
ir_remote::baud
unsigned int baud
can be overridden by [p|s]zero, [p|s]one
Definition: ir_remote_types.h:209
ir_remote::min_repeat
int min_repeat
code is repeated at least x times code sent once -> min_repeat=0
Definition: ir_remote_types.h:194
ir_remote::manual_sort
int manual_sort
If set in any remote, disables automatic sorting.
Definition: ir_remote_types.h:237
ir_remote::post_s
lirc_t post_s
signal between keycode and post_code
Definition: ir_remote_types.h:184
ir_remote::pre_s
lirc_t pre_s
signal between pre_data and keycode
Definition: ir_remote_types.h:183
ir_remote::gap
uint32_t gap
time between signals in usecs
Definition: ir_remote_types.h:186
ir_remote::eps
int eps
eps (relative tolerance)
Definition: ir_remote_types.h:156
ir_remote::dyncodes_name
char * dyncodes_name
name for unknown buttons
Definition: ir_remote_types.h:163
ir_remote::last_code
struct ir_ncode * last_code
code received or sent last
Definition: ir_remote_types.h:223
ir_remote::toggle_code
struct ir_ncode * toggle_code
toggle code received or sent last
Definition: ir_remote_types.h:224
ir_remote::min_code_repeat
unsigned int min_code_repeat
meaningful only if remote sends a repeat code: in this case this value indicates how often the real c...
Definition: ir_remote_types.h:202
ir_remote::sone
lirc_t sone
1
Definition: ir_remote_types.h:172
ir_remote::name
const char * name
name of remote control
Definition: ir_remote_types.h:151
ir_remote::toggle_bit_mask
ir_code toggle_bit_mask
previously only one bit called toggle_bit
Definition: ir_remote_types.h:190
ir_remote::parity
unsigned int parity
currently unsupported
Definition: ir_remote_types.h:211
ir_remote::pre_data_bits
int pre_data_bits
length of pre_data
Definition: ir_remote_types.h:179
ir_remote::max_gap_length
lirc_t max_gap_length
how long is the longest gap
Definition: ir_remote_types.h:233
ir_remote::dyncode
int dyncode
last received code
Definition: ir_remote_types.h:164
ir_remote::max_total_signal_length
lirc_t max_total_signal_length
how long is the longest signal including gap
Definition: ir_remote_types.h:231
ir_remote::min_remaining_gap
lirc_t min_remaining_gap
remember gap for CONST_LENGTH remotes
Definition: ir_remote_types.h:227
ir_remote::toggle_bit
int toggle_bit
obsolete
Definition: ir_remote_types.h:189