25 #include "include/media/lirc.h"
26 #include "lirc/release.h"
27 #include "lirc/receive.h"
28 #include "lirc/lirc_log.h"
30 static struct timeval release_time;
32 static struct ir_ncode* release_ncode;
34 static int release_reps;
35 static lirc_t release_gap;
38 static struct ir_ncode* release_ncode2;
43 void register_input(
void)
47 if (release_remote == NULL)
51 gap.tv_usec = release_gap;
53 gettimeofday(&release_time, NULL);
54 timeradd(&release_time, &gap, &release_time);
59 if (reps == 0 && release_remote != NULL) {
60 release_remote2 = release_remote;
61 release_ncode2 = release_ncode;
62 release_code2 = release_code;
65 release_remote = remote;
66 release_ncode = ncode;
70 release_gap = upper_limit(remote,
72 + receive_timeout(upper_limit(remote, remote->
min_gap_length)) + 10000;
74 LOGPRINTF(1,
"release_gap: %lu", release_gap);
79 void get_release_data(
const char** remote_name,
const char** button_name,
int* reps)
81 if (release_remote != NULL) {
82 *remote_name = release_remote->
name;
83 *button_name = release_ncode->
name;
86 *remote_name = *button_name =
"(NULL)";
91 void set_release_suffix(
const char* s)
96 void get_release_time(
struct timeval* tv)
101 const char* check_release_event(
const char** remote_name,
const char** button_name)
105 if (release_remote2 != NULL) {
106 *remote_name = release_remote2->
name;
107 *button_name = release_ncode2->
name;
110 release_remote2->
name,
111 release_ncode2->
name,
115 release_remote2 = NULL;
116 release_ncode2 = NULL;
120 logprintf(LIRC_ERROR,
"message buffer overflow");
130 const char* trigger_release_event(
const char** remote_name,
const char** button_name)
134 if (release_remote != NULL) {
136 *remote_name = release_remote->
name;
137 *button_name = release_ncode->
name;
140 release_remote->
name,
145 timerclear(&release_time);
146 release_remote = NULL;
147 release_ncode = NULL;
151 logprintf(LIRC_ERROR,
"message buffer overflow");
160 const char* release_map_remotes(
struct ir_remote* old,
struct ir_remote*
new,
const char** remote_name,
161 const char** button_name)
166 if (release_remote2 != NULL) {
168 logprintf(LIRC_ERROR,
"release_remote2 still in use");
169 release_remote2 = NULL;
175 if (remote && ncode) {
176 release_remote = remote;
177 release_ncode = ncode;
179 return trigger_release_event(remote_name, button_name);
lirc_t max_total_signal_length
struct ir_ncode * get_code_by_name(const struct ir_remote *remote, const char *name)
struct ir_remote * get_ir_remote(const struct ir_remote *remotes, const char *name)
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)
#define LIRC_RELEASE_SUFFIX
#define LOGPRINTF(level, fmt, args...)