LIRC libraries
LinuxInfraredRemoteControl
irrecord.h File Reference

Library part of irrecord, functions to identify unknown remotes. More...

#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <syslog.h>
#include <unistd.h>
#include "lirc_private.h"

Go to the source code of this file.

Classes

struct  lengths
 
struct  opts
 Parsed run-time options, reflects long_options and the command line, mostly a const object. More...
 
struct  main_state
 Overall state in main. More...
 
struct  gap_state
 Private state in get_gap_length(). More...
 
struct  lengths_state
 State in get_lengths(), private besides commented. More...
 
struct  toggle_state
 Private state in get_togggle_bit_mask(). More...
 
struct  button_state
 State while recording buttons, privates besides commented. More...
 

Macros

#define min(a, b)   (a > b ? b : a)
 
#define max(a, b)   (a > b ? a : b)
 
#define BUTTON   (80 + 1)
 
#define RETRIES   10
 
#define MAX_SIGNALS   200
 
#define TH_SPACE_ENC   80 /* I want less than 20% mismatches */
 
#define TH_HEADER   90
 
#define TH_REPEAT   90
 
#define TH_TRAIL   90
 
#define TH_LEAD   90
 
#define TH_IS_BIT   10
 
#define TH_RC6_SIGNAL   550
 
#define MIN_GAP   20000
 
#define MAX_GAP   100000
 
#define SAMPLES   80
 

Typedefs

typedef void(* remote_func) (struct ir_remote *remotes)
 

Enumerations

enum  analyse_mode { MODE_GET_GAP, MODE_HAVE_GAP }
 
enum  lengths_status {
  STS_LEN_OK, STS_LEN_FAIL, STS_LEN_RAW_OK, STS_LEN_TIMEOUT,
  STS_LEN_AGAIN, STS_LEN_AGAIN_INFO, STS_LEN_NO_GAP_FOUND, STS_LEN_TOO_LONG
}
 Return from one attempt to determine lengths in get_lengths().
 
enum  get_gap_status {
  STS_GAP_INIT, STS_GAP_TIMEOUT, STS_GAP_FOUND, STS_GAP_GOT_ONE_PRESS,
  STS_GAP_AGAIN
}
 Return form one attempt to get gap in get_gap().
 
enum  toggle_status {
  STS_TGL_TIMEOUT, STS_TGL_GOT_ONE_PRESS, STS_TGL_NOT_FOUND, STS_TGL_FOUND,
  STS_TGL_AGAIN
}
 Return from one attempt in get_toggle_bit_mask().
 
enum  button_status {
  STS_BTN_INIT, STS_BTN_GET_NAME, STS_BTN_INIT_DATA, STS_BTN_GET_RAW_DATA,
  STS_BTN_GET_DATA, STS_BTN_GET_TOGGLE_BITS, STS_BTN_RECORD_DONE, STS_BTN_BUTTON_DONE,
  STS_BTN_BUTTONS_DONE, STS_BTN_ALL_DONE, STS_BTN_SOFT_ERROR, STS_BTN_HARD_ERROR,
  STS_BTN_TIMEOUT
}
 Return from one pass in record_buttons().
 

Functions

ssize_t raw_read (void *buffer, size_t size, unsigned int timeout_us)
 Absolute error tolerance (us). More...
 
void for_each_remote (struct ir_remote *remotes, remote_func func)
 Unconditionally apply func(remote) for all items in remotes list.
 
void btn_state_set_message (struct button_state *state, const char *fmt,...)
 sprintf-style message formatting into state->message. More...
 
void flushhw (void)
 Clear the driver input buffers.
 
void gap_state_init (struct gap_state *state)
 Initiate a pristine gap_state.
 
void lengths_state_init (struct lengths_state *state)
 Initiate a pristine lengths_state.
 
void toggle_state_init (struct toggle_state *state)
 Initiate a pristine toggle_state.
 
void button_state_init (struct button_state *state, int started_as_root)
 Initiate a pristine button_state.
 
enum get_gap_status get_gap_length (struct gap_state *state, struct ir_remote *remote)
 Try to find out gap length, returning gap_status.
 
enum lengths_status get_lengths (struct lengths_state *state, struct ir_remote *remote, int force, int interactive)
 Try to find out pre/post etc. More...
 
void free_all_lengths (void)
 Free heap data allocated by get_lengths().
 
enum toggle_status get_toggle_bit_mask (struct toggle_state *state, struct ir_remote *remote)
 Try to find out toggle_bit_mask, returning toggle_status.
 
int do_analyse (const struct opts *opts, struct main_state *state)
 The –analyse wrapper, returns boolean ok/fail. More...
 
enum button_status record_buttons (struct button_state *btn_state, enum button_status last_status, struct main_state *state, const struct opts *opts)
 Try to record one button, returning button_status.
 
void config_file_setup (struct main_state *state, const struct opts *opts)
 Write the provisionary config file.
 
int config_file_finish (struct main_state *state, const struct opts *opts)
 Write the final config file.
 
void get_pre_data (struct ir_remote *remote)
 Test hook: Extract remote->pre_data from remote->bits.
 
void get_post_data (struct ir_remote *remote)
 Test hook: Extract remote->post_data and post_data_bits from bits.
 
void remove_pre_data (struct ir_remote *remote)
 Test hook: Move remote->pre_data into remote->bits.
 
void remove_post_data (struct ir_remote *remote)
 Test hook: Move remote->post_data into remote->bits.
 
void invert_data (struct ir_remote *remote)
 Test hook: Invert all data items in remote.
 
void remove_trail (struct ir_remote *remote)
 Test hook: Move remote->trail into remote->bits.
 

Variables

struct ir_remote remote
 
unsigned int eps
 Shared list of remotes.
 
lirc_t aeps
 Error tolerance in per cent.
 

Detailed Description

Library part of irrecord, functions to identify unknown remotes.

Definition in file irrecord.h.

Function Documentation

◆ btn_state_set_message()

void btn_state_set_message ( struct button_state state,
const char *  fmt,
  ... 
)

sprintf-style message formatting into state->message.

sprintf-style message formatting into state->message.

Definition at line 97 of file irrecord.c.

◆ do_analyse()

int do_analyse ( const struct opts opts,
struct main_state state 
)

The –analyse wrapper, returns boolean ok/fail.

The –analyse wrapper, returns boolean ok/fail.

Definition at line 1776 of file irrecord.c.

◆ get_lengths()

enum lengths_status get_lengths ( struct lengths_state state,
struct ir_remote remote,
int  force,
int  interactive 
)

Try to find out pre/post etc.

lengths, returning lengths_status.

Definition at line 1387 of file irrecord.c.

◆ raw_read()

ssize_t raw_read ( void *  buffer,
size_t  size,
unsigned int  timeout_us 
)

Absolute error tolerance (us).

Try to read some bytes from the device, no decoding whatsoever.

Definition at line 1804 of file irrecord.c.