LIRC libraries Linux Infrared Remote Control

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
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(). More...
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(). More...
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(). More...
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(). More...

## Functions
ssize_t | raw_read (void *buffer, size_t size, unsigned int timeout_us)
| Absolute error tolerance (us).
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.
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.
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.
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.

## Macro Definition Documentation

## ◆ BUTTON

#define BUTTON (80 + 1)

Definition at line 57 of file irrecord.h.

## ◆ max

#define max | ( |  | a,
|  |  | b
| ) |  | (a > b ? a : b)

Definition at line 55 of file irrecord.h.

## ◆ MAX_GAP

#define MAX_GAP 100000

Definition at line 73 of file irrecord.h.

## ◆ MAX_SIGNALS

#define MAX_SIGNALS 200

Definition at line 61 of file irrecord.h.

## ◆ min

#define min | ( |  | a,
|  |  | b
| ) |  | (a > b ? b : a)

Definition at line 54 of file irrecord.h.

## ◆ MIN_GAP

#define MIN_GAP 20000

Definition at line 72 of file irrecord.h.

## ◆ RETRIES

#define RETRIES 10

Definition at line 58 of file irrecord.h.

## ◆ SAMPLES

#define SAMPLES 80

Definition at line 75 of file irrecord.h.

## ◆ TH_HEADER

#define TH_HEADER 90

Definition at line 65 of file irrecord.h.

## ◆ TH_IS_BIT

#define TH_IS_BIT 10

Definition at line 69 of file irrecord.h.

## ◆ TH_LEAD

#define TH_LEAD 90

Definition at line 68 of file irrecord.h.

## ◆ TH_RC6_SIGNAL

#define TH_RC6_SIGNAL 550

Definition at line 70 of file irrecord.h.

## ◆ TH_REPEAT

#define TH_REPEAT 90

Definition at line 66 of file irrecord.h.

## ◆ TH_SPACE_ENC

#define TH_SPACE_ENC 80 /* I want less than 20% mismatches */

Definition at line 64 of file irrecord.h.

## ◆ TH_TRAIL

#define TH_TRAIL 90

Definition at line 67 of file irrecord.h.

## Typedef Documentation

## ◆ remote_func

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

Definition at line 85 of file irrecord.h.

## Enumeration Type Documentation

## ◆ analyse_mode

enum analyse_mode

Definition at line 87 of file irrecord.h.

## ◆ button_status

enum button_status

Return from one pass in record_buttons().

Definition at line 124 of file irrecord.h.

## ◆ get_gap_status

enum get_gap_status

Return form one attempt to get gap in get_gap().

Definition at line 104 of file irrecord.h.

## ◆ lengths_status

enum lengths_status

Return from one attempt to determine lengths in get_lengths().

Definition at line 91 of file irrecord.h.

## ◆ toggle_status

enum toggle_status

Return from one attempt in get_toggle_bit_mask().

Definition at line 114 of 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.

## ◆ button_state_init()

void button_state_init | ( | struct button_state * | state,
|  | int | started_as_root
| ) |  |

Initiate a pristine button_state.

Definition at line 219 of file irrecord.c.

## ◆ config_file_finish()

int config_file_finish | ( | struct main_state * | state,
|  | const struct opts * | opts
| ) |  |

Write the final config file.

Definition at line 2119 of file irrecord.c.

## ◆ config_file_setup()

void config_file_setup | ( | struct main_state * | state,
|  | const struct opts * | opts
| ) |  |

Write the provisionary config file.

Definition at line 2102 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 1787 of file irrecord.c.

## ◆ flushhw()

void flushhw | ( | void |  | ) |

Clear the driver input buffers.

Definition at line 139 of file irrecord.c.

## ◆ for_each_remote()

void for_each_remote | ( | struct ir_remote * | remotes,
|  | remote_func | func
| ) |  |

Unconditionally apply func(remote) for all items in remotes list.

Definition at line 491 of file irrecord.c.

## ◆ free_all_lengths()

void free_all_lengths | ( | void |  | ) |

Free heap data allocated by get_lengths().

Definition at line 664 of file irrecord.c.

## ◆ gap_state_init()

void gap_state_init | ( | struct gap_state * | state | ) |

Initiate a pristine gap_state.

Definition at line 189 of file irrecord.c.

## ◆ get_gap_length()

enum get_gap_status get_gap_length | ( | struct gap_state * | state,
|  | struct ir_remote * | remote
| ) |  |

Try to find out gap length, returning gap_status.

Definition at line 1207 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.

## ◆ get_post_data()

void get_post_data | ( | struct ir_remote * | remote | ) |

Test hook: Extract remote->post_data and post_data_bits from bits.

Definition at line 327 of file irrecord.c.

## ◆ get_pre_data()

void get_pre_data | ( | struct ir_remote * | remote | ) |

Test hook: Extract remote->pre_data from remote->bits.

Definition at line 269 of file irrecord.c.

## ◆ get_toggle_bit_mask()

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.

Definition at line 1556 of file irrecord.c.

## ◆ invert_data()

void invert_data | ( | struct ir_remote * | remote | ) |

Test hook: Invert all data items in remote.

Definition at line 424 of file irrecord.c.

## ◆ lengths_state_init()

void lengths_state_init | ( | struct lengths_state * | state | ) |

Initiate a pristine lengths_state.

Definition at line 195 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 1815 of file irrecord.c.

## ◆ record_buttons()

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.

Definition at line 1848 of file irrecord.c.

## ◆ remove_post_data()

void remove_post_data | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->post_data into remote->bits.

Definition at line 403 of file irrecord.c.

## ◆ remove_pre_data()

void remove_pre_data | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->pre_data into remote->bits.

Definition at line 383 of file irrecord.c.

## ◆ remove_trail()

void remove_trail | ( | struct ir_remote * | remote | ) |

Test hook: Move remote->trail into remote->bits.

Definition at line 463 of file irrecord.c.

## ◆ toggle_state_init()

void toggle_state_init | ( | struct toggle_state * | state | ) |

Initiate a pristine toggle_state.

Definition at line 211 of file irrecord.c.

## Variable Documentation

## ◆ aeps

lirc_t aeps
| extern

Error tolerance in per cent.

Definition at line 63 of file irrecord.c.

## ◆ eps

unsigned int eps
| extern

Shared list of remotes.

Definition at line 62 of file irrecord.c.

## ◆ remote

struct ir_remote remote
| extern

Definition at line 61 of file irrecord.c.