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
43typedef uint64_t ir_code;
44
50 ir_code code;
51 struct ir_code_node* next;
52};
53
60struct ir_ncode {
62 char* name;
63
66
68 int length;
69
71 lirc_t* signals;
72
76
80
83
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
145
146
150struct 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;
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;
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;
202 unsigned int min_code_repeat;
203 unsigned int freq;
204 unsigned int duty_cycle;
208 /* serial protocols */
209 unsigned int baud;
210 unsigned int bits_in_byte;
211 unsigned int parity;
212 unsigned int stop_bits;
218 /* end of user editable values */
219
220 ir_code toggle_bit_mask_state;
221 int toggle_mask_state;
222 int repeat_countdown;
225 int reps;
226 struct timeval last_send;
234 lirc_t min_pulse_length, max_pulse_length;
235 lirc_t min_space_length, max_space_length;
238 struct ir_remote* next;
239};
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif
uint64_t ir_code
Denotes an internal coded representation for an IR transmission.
State describing code, pre, post + gap and repeat state.
ir_code code
Code part, matched to code defintion.
int repeat_flag
True if code is a repeated one.
ir_code post
post data, sent after code.
lirc_t min_remaining_gap
Estimated min time of trailing gap.
lirc_t max_remaining_gap
Estimated max time of trailing gap.
ir_code pre
pre data, before code.
An ir_code for entering into (singly) linked lists, i.e.
IR Command, corresponding to one (command defining) line of the configuration file.
struct ir_ncode * next_ncode
Next code in recorded buttons list.
struct ir_code_node * next
Linked list of the subsequent ir_code's, after the first one.
ir_code code
The first code of the command.
struct ir_code_node * transmit_state
(private)
int length
(private)
lirc_t * signals
(private)
struct ir_code_node * current
Should point at the ir_code currently being transmitted, or NULL if none.
char * name
Name of command.
One remote as represented in the configuration file.
const char * driver
Name of driver for LIRCCODE cases.
uint32_t repeat_gap
time between two repeat codes if different from gap
lirc_t stwo
2 (only used for RC-MM)
unsigned int freq
modulation frequency
int suppress_repeat
suppress unwanted repeats
unsigned int aeps
detecting very short pulses is difficult with relative tolerance for some remotes,...
uint32_t gap2
time between signals in usecs
lirc_t min_total_signal_length
how long is the shortest signal including gap
unsigned int stop_bits
mapping: 1->2 1.5->3 2->4
unsigned int bits_in_byte
default: 8
struct ir_ncode dyncodes[2]
helper structs for unknown buttons
lirc_t sfoot
foot
ir_code rc6_mask
RC-6 doubles signal length of some bits.
lirc_t max_remaining_gap
gap range
lirc_t ptrail
trailing pulse
unsigned int duty_cycle
0<duty cycle<=100 default: 50
lirc_t min_gap_length
how long is the shortest gap
ir_code repeat_mask
mask defines which bits are inverted for repeats
lirc_t srepeat
indicate repeating
ir_code pre_data
data which the remote sends before actual keycode
int bits
bits (length of code)
int post_data_bits
length of post_data
ir_code ignore_mask
mask defines which bits can be ignored when matching a code
int release_detected
set by release generator
lirc_t plead
leading pulse
lirc_t sthree
3 (only used for RC-MM)
lirc_t shead
header
struct timeval last_send
time last_code was received or sent
ir_code post_data
data which the remote sends after actual keycode
ir_code toggle_mask
Sharp (?) error detection scheme.
int flags
flags
unsigned int baud
can be overridden by [p|s]zero, [p|s]one
int min_repeat
code is repeated at least x times code sent once -> min_repeat=0
int manual_sort
If set in any remote, disables automatic sorting.
lirc_t post_s
signal between keycode and post_code
lirc_t pre_s
signal between pre_data and keycode
uint32_t gap
time between signals in usecs
int eps
eps (relative tolerance)
char * dyncodes_name
name for unknown buttons
struct ir_ncode * last_code
code received or sent last
struct ir_ncode * toggle_code
toggle code received or sent last
unsigned int min_code_repeat
meaningful only if remote sends a repeat code: in this case this value indicates how often the real c...
const char * name
name of remote control
ir_code toggle_bit_mask
previously only one bit called toggle_bit
unsigned int parity
currently unsupported
int pre_data_bits
length of pre_data
lirc_t max_gap_length
how long is the longest gap
int dyncode
last received code
lirc_t max_total_signal_length
how long is the longest signal including gap
lirc_t min_remaining_gap
remember gap for CONST_LENGTH remotes
int toggle_bit
obsolete