24 #include <sys/types.h>
68 if (ncode->
next && node != NULL)
74 get_next_ir_code_node(
const struct ir_ncode* ncode,
82 static inline int bit_count(
const struct ir_remote* remote)
87 static inline int bits_set(
ir_code data)
105 for (i = 0; i < bits; i++)
111 static inline int is_pulse(lirc_t data)
113 return data & PULSE_BIT ? 1 : 0;
116 static inline int is_space(lirc_t data)
118 return !is_pulse(data);
121 static inline int has_repeat(
const struct ir_remote* remote)
123 if (remote->prepeat > 0 && remote->
srepeat > 0)
129 static inline void set_protocol(
struct ir_remote* remote,
int protocol)
131 remote->
flags &= ~(IR_PROTOCOL_MASK);
132 remote->
flags |= protocol;
135 static inline int is_raw(
const struct ir_remote* remote)
143 static inline int is_space_enc(
const struct ir_remote* remote)
151 static inline int is_space_first(
const struct ir_remote* remote)
159 static inline int is_rc5(
const struct ir_remote* remote)
161 if ((remote->
flags & IR_PROTOCOL_MASK) ==
RC5)
167 static inline int is_rc6(
const struct ir_remote* remote)
175 static inline int is_biphase(
const struct ir_remote* remote)
177 if (is_rc5(remote) || is_rc6(remote))
183 static inline int is_rcmm(
const struct ir_remote* remote)
185 if ((remote->
flags & IR_PROTOCOL_MASK) ==
RCMM)
191 static inline int is_goldstar(
const struct ir_remote* remote)
199 static inline int is_grundig(
const struct ir_remote* remote)
207 static inline int is_bo(
const struct ir_remote* remote)
209 if ((remote->
flags & IR_PROTOCOL_MASK) ==
BO)
215 static inline int is_serial(
const struct ir_remote* remote)
223 static inline int is_xmp(
const struct ir_remote* remote)
225 if ((remote->
flags & IR_PROTOCOL_MASK) ==
XMP)
231 static inline int is_const(
const struct ir_remote* remote)
239 static inline int has_repeat_gap(
const struct ir_remote* remote)
247 static inline int has_pre(
const struct ir_remote* remote)
255 static inline int has_post(
const struct ir_remote* remote)
263 static inline int has_header(
const struct ir_remote* remote)
265 if (remote->phead > 0 && remote->
shead > 0)
271 static inline int has_foot(
const struct ir_remote* remote)
273 if (remote->pfoot > 0 && remote->
sfoot > 0)
279 static inline int has_toggle_bit_mask(
const struct ir_remote* remote)
287 static inline int has_ignore_mask(
const struct ir_remote* remote)
295 static inline int has_repeat_mask(
struct ir_remote* remote)
303 static inline int has_toggle_mask(
const struct ir_remote* remote)
311 static inline lirc_t min_gap(
const struct ir_remote* remote)
313 if (remote->
gap2 != 0 && remote->
gap2 < remote->
gap)
319 static inline lirc_t max_gap(
const struct ir_remote* remote)
321 if (remote->
gap2 > remote->
gap)
329 static inline int expect(
const struct ir_remote* remote,
336 if (abs(exdelta - delta) <= exdelta * remote->
eps / 100
337 || abs(exdelta - delta) <= aeps)
342 static inline int expect_at_least(
const struct ir_remote* remote,
349 if (delta + exdelta * remote->
eps / 100 >= exdelta
350 || delta + aeps >= exdelta)
355 static inline int expect_at_most(
const struct ir_remote* remote,
362 if (delta <= exdelta + exdelta * remote->eps / 100
363 || delta <= exdelta + aeps)
368 static inline lirc_t upper_limit(
const struct ir_remote* remote, lirc_t val)
372 lirc_t eps_val = val * (100 + remote->
eps) / 100;
373 lirc_t aeps_val = val + aeps;
375 return eps_val > aeps_val ? eps_val : aeps_val;
378 static inline lirc_t lower_limit(
const struct ir_remote* remote, lirc_t val)
382 lirc_t eps_val = val * (100 - remote->
eps) / 100;
383 lirc_t aeps_val = val - aeps;
390 return eps_val < aeps_val ? eps_val : aeps_val;
394 static inline unsigned long time_elapsed(
const struct timeval* last,
395 const struct timeval* current)
397 unsigned long secs, diff;
399 secs = current->tv_sec - last->tv_sec;
401 diff = 1000000 * secs + current->tv_usec - last->tv_usec;
406 static inline ir_code gen_mask(
int bits)
412 for (i = 0; i < bits; i++) {
427 all <<= remote->
bits;
428 all |= is_raw(remote) ? code : (code & gen_mask(remote->
bits));
450 unsigned int* min_freq,
451 unsigned int* max_freq);
454 lirc_t* max_gap_lengthp,
455 lirc_t* min_pulse_lengthp,
456 lirc_t* min_space_lengthp,
457 lirc_t* max_pulse_lengthp,
458 lirc_t* max_space_lengthp);
471 const struct timeval* start,
472 const struct timeval* last,
473 lirc_t signal_length);
481 const char* remote_name,
482 const char* button_name,
483 const char* button_suffix,
struct ir_remote * last_remote
struct ir_ncode * repeat_code
void ir_remote_init(int use_dyncodes)
void get_filter_parameters(const struct ir_remote *remotes, lirc_t *max_gap_lengthp, lirc_t *min_pulse_lengthp, lirc_t *min_space_lengthp, lirc_t *max_pulse_lengthp, lirc_t *max_space_lengthp)
struct ir_code_node * next
struct ir_ncode * get_code_by_name(const struct ir_remote *remote, const char *name)
Interface to the userspace drivers.
struct ir_remote * get_ir_remote(const struct ir_remote *remotes, const char *name)
int map_code(const struct ir_remote *remote, struct decode_ctx_t *ctx, int pre_bits, ir_code pre, int bits, ir_code code, int post_bits, ir_code post)
char * decode_all(struct ir_remote *remotes)
Describes and decodes the signals from IR remotes.
int write_message(char *buffer, size_t size, const char *remote_name, const char *button_name, const char *button_suffix, ir_code code, int reps)
const struct ir_remote * is_in_remotes(const struct ir_remote *remotes, const struct ir_remote *remote)
const struct ir_remote * get_decoding(void)
void ncode_free(struct ir_ncode *ncode)
void map_gap(const struct ir_remote *remote, struct decode_ctx_t *ctx, const struct timeval *start, const struct timeval *last, lirc_t signal_length)
struct ir_ncode * ncode_dup(struct ir_ncode *ncode)
void get_frequency_range(const struct ir_remote *remotes, unsigned int *min_freq, unsigned int *max_freq)
const struct driver const * curr_driver
struct ir_remote * repeat_remote
int send_ir_ncode(struct ir_remote *remote, struct ir_ncode *code, int delay)