LIRC libraries
LinuxInfraredRemoteControl
 All Classes Files Functions Variables Typedefs Enumerations Macros Modules Pages
irrecord.c File Reference

(91aee28 2017-02-12 11:12:58 +0100)

Implements irrecord.h. More...

#include <stdint.h>
#include <unistd.h>
#include <poll.h>
#include "lirc_private.h"
#include "irrecord.h"

Go to the source code of this file.

Functions

void btn_state_set_message (struct button_state *state, const char *fmt,...)
 snprintf-style message formatting into state->message. More...
 
int availabledata (void)
 Return 1 if there is available after running poll(2), else 0. More...
 
void flushhw (void)
 Clear the driver input buffers. More...
 
int resethw (int started_as_root)
 Reset the hardware. More...
 
void gap_state_init (struct gap_state *state)
 Initiate a pristine gap_state. More...
 
void lengths_state_init (struct lengths_state *state)
 Initiate a pristine lengths_state. More...
 
void toggle_state_init (struct toggle_state *state)
 Initiate a pristine toggle_state. More...
 
void button_state_init (struct button_state *state, int started_as_root)
 Initiate a pristine button_state. More...
 
void get_pre_data (struct ir_remote *remote)
 Test hook: Extract remote->pre_data from remote->bits. More...
 
void get_post_data (struct ir_remote *remote)
 Test hook: Extract remote->post_data and post_data_bits from bits. More...
 
void remove_pre_data (struct ir_remote *remote)
 Test hook: Move remote->pre_data into remote->bits. More...
 
void remove_post_data (struct ir_remote *remote)
 Test hook: Move remote->post_data into remote->bits. More...
 
void invert_data (struct ir_remote *remote)
 Test hook: Invert all data items in remote. More...
 
void remove_trail (struct ir_remote *remote)
 Test hook: Move remote->trail into remote->bits. More...
 
void for_each_remote (struct ir_remote *remotes, remote_func func)
 Unconditionally apply func(remote) for all items in remotes list. More...
 
void unlink_length (struct lengths **first, struct lengths *remove)
 
int add_length (struct lengths **first, lirc_t length)
 
void free_lengths (struct lengths **firstp)
 
void free_all_lengths (void)
 Free heap data allocated by get_lengths(). More...
 
int get_trail_length (struct ir_remote *remote, int interactive)
 
int get_lead_length (struct ir_remote *remote, int interactive)
 
int get_header_length (struct ir_remote *remote, int interactive)
 
int get_repeat_length (struct ir_remote *remote, int interactive)
 
void get_scheme (struct ir_remote *remote, int interactive)
 
int get_data_length (struct ir_remote *remote, int interactive)
 
enum get_gap_status get_gap_length (struct gap_state *state, struct ir_remote *remote)
 Try to find out gap length, returning gap_status. More...
 
int needs_toggle_mask (struct ir_remote *remote)
 Return true if a given remote needs to compute toggle_mask. More...
 
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...
 
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. More...
 
int analyse_get_lengths (struct lengths_state *lengths_state)
 analyse non-interactive get_lengths, returns boolean ok/fail. More...
 
int analyse_remote (struct ir_remote *raw_data, const struct opts *opts)
 Implement the analyse task, return 1 for ok, 0 for errors. More...
 
int do_analyse (const struct opts *opts, struct main_state *state)
 The –analyse wrapper. More...
 
ssize_t raw_read (void *buffer, size_t size, unsigned int timeout_us)
 Absolute error tolerance (us). 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. More...
 
void config_file_setup (struct main_state *state, const struct opts *opts)
 Write the provisionary config file. More...
 
int config_file_finish (struct main_state *state, const struct opts *opts)
 Write the final config file. More...
 

Variables

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

Detailed Description

Implements irrecord.h.

Definition in file irrecord.c.

Function Documentation

int analyse_get_lengths ( struct lengths_state lengths_state)

analyse non-interactive get_lengths, returns boolean ok/fail.

Definition at line 1627 of file irrecord.c.

int analyse_remote ( struct ir_remote raw_data,
const struct opts opts 
)

Implement the analyse task, return 1 for ok, 0 for errors.

Definition at line 1667 of file irrecord.c.

int availabledata ( void  )

Return 1 if there is available after running poll(2), else 0.

Definition at line 118 of file irrecord.c.

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

snprintf-style message formatting into state->message.

sprintf-style message formatting into state->message.

Definition at line 97 of file irrecord.c.

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.

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

Write the final config file.

Definition at line 2106 of file irrecord.c.

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

Write the provisionary config file.

Definition at line 2089 of file irrecord.c.

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

The –analyse wrapper.

The –analyse wrapper, returns boolean ok/fail.

Definition at line 1776 of file irrecord.c.

void flushhw ( void  )

Clear the driver input buffers.

Definition at line 139 of file irrecord.c.

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.

void free_all_lengths ( void  )

Free heap data allocated by get_lengths().

Definition at line 664 of file irrecord.c.

void gap_state_init ( struct gap_state state)

Initiate a pristine gap_state.

Definition at line 189 of file irrecord.c.

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.

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.

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.

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.

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 1545 of file irrecord.c.

void invert_data ( struct ir_remote remote)

Test hook: Invert all data items in remote.

Definition at line 424 of file irrecord.c.

void lengths_state_init ( struct lengths_state state)

Initiate a pristine lengths_state.

Definition at line 195 of file irrecord.c.

int needs_toggle_mask ( struct ir_remote remote)

Return true if a given remote needs to compute toggle_mask.

Definition at line 1249 of file irrecord.c.

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.

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 1835 of file irrecord.c.

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.

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.

void remove_trail ( struct ir_remote remote)

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

Definition at line 463 of file irrecord.c.

int resethw ( int  started_as_root)

Reset the hardware.

Return 1 on OK, else 0 and possibly closes driver.

Definition at line 161 of file irrecord.c.

void toggle_state_init ( struct toggle_state state)

Initiate a pristine toggle_state.

Definition at line 211 of file irrecord.c.

Variable Documentation

lirc_t aeps = 100

Error tolerance in per cent.

Definition at line 63 of file irrecord.c.

unsigned int eps = 30

Shared list of remotes.

Definition at line 62 of file irrecord.c.