LIRC libraries: /home/mk/tmp/lirc/lib/lirc_client.h (05e7bd8 2016-10-20 17:36:59 +0200) Source File

| LIRC libraries LinuxInfraredRemoteControl

lirc_client.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** lirc_client.h ***********************************************************
3 ****************************************************************************
4 *
5 * Copyright (C) 1998 Trent Piepho <xyzzy@u.washington.edu>
6 * Copyright (C) 1998 Christoph Bartelmus <lirc@bartelmus.de>
7 *
8 */
9
109 #ifndef LIRC_CLIENT_H
110 #define LIRC_CLIENT_H
111
112 #include <errno.h>
113 #include <stdarg.h>
114 #include <stddef.h>
115 #include <stdint.h>
116 #include <stdio.h>
117 #include <stdlib.h>
118 #include <string.h>
119 #include <syslog.h>
120 #include <unistd.h>
121
122 #include "lirc/paths.h"
123 #include "lirc/lirc_config.h"
124 #include "lirc/curl_poll.h"
125
126 #ifdef __cplusplus
127 extern "C" {
128 #endif
129
130
131 #ifndef __u32
132 typedef uint32_t __u32;
133 #endif
134
135 #define LIRC_RET_SUCCESS (0)
136 #define LIRC_RET_ERROR (-1)
137
138 #define LIRC_ALL ((char*)(-1))
139
140
141 enum lirc_flags { none = 0x00,
142 once = 0x01,
143 quit = 0x02,
144 mode = 0x04,
145 ecno = 0x08,
146 startup_mode = 0x10,
147 toggle_reset = 0x20, };
148
149 struct lirc_list {
150 char* string;
151 struct lirc_list* next;
152 };
153
154 struct lirc_code {
155 char* remote;
156 char* button;
157 struct lirc_code* next;
158 };
159
160 struct lirc_config {
161 char* lircrc_class;
162 char* current_mode;
163 struct lirc_config_entry* next;
164 struct lirc_config_entry* first;
165
166 int sockfd;
167 };
168
169 struct lirc_config_entry {
170 char* prog;
171 struct lirc_code* code;
172 unsigned int rep_delay;
173 unsigned int ign_first_events;
174 unsigned int rep;
175 struct lirc_list* config;
176 char* change_mode;
177 unsigned int flags;
178
179 char* mode;
180 struct lirc_list* next_config;
181 struct lirc_code* next_code;
182
183 struct lirc_config_entry* next;
184 };
185
192 typedef struct {
193 char packet[PACKET_SIZE + 1];
194 char buffer[PACKET_SIZE + 1];
195 char reply[PACKET_SIZE + 1];
196 int head;
197 int reply_to_stdout;
198 char* next;
199 } lirc_cmd_ctx;
200
208 int lirc_init(const char* prog, int verbose);
209
214 int lirc_deinit(void);
215
230 int lirc_readconfig(const char* path,
231 struct lirc_config** config,
232 int (check) (char* s));
233
235 void lirc_freeconfig(struct lirc_config* config);
236
238 char* lirc_nextir(void);
239
241 char* lirc_ir2char(struct lirc_config* config, char* code);
242
252 int lirc_nextcode(char** code);
253
265 int lirc_code2char(struct lirc_config* config, char* code, char** string);
266
267
268 /* new interface for client daemon */
281 int lirc_readconfig_only(const char* file,
282 struct lirc_config** config,
283 int (check) (char* s));
284
285 int lirc_code2charprog(struct lirc_config* config,
286 char* code,
287 char** string,
288 char** prog);
289
298 size_t lirc_getsocketname(const char* id, char* buf, size_t size);
299
308 const char* lirc_getmode(struct lirc_config* config);
309
319 const char* lirc_setmode(struct lirc_config* config, const char* mode);
320
321 /* 0.9.2: New interface for sending data. */
322
333 int lirc_command_init(lirc_cmd_ctx* ctx, const char* fmt, ...);
334
335
346 int lirc_command_run(lirc_cmd_ctx* ctx, int fd);
347
354 void lirc_command_reply_to_stdout(lirc_cmd_ctx* ctx);
355
368 int lirc_send_one(int fd, const char* remote, const char* keysym);
369
370
386 int lirc_simulate(int fd,
387 const char* remote,
388 const char* keysym,
389 int scancode,
390 int repeat);
391
392
403 int lirc_get_remote_socket(const char* address, int port, int quiet);
404
405
416 int lirc_get_local_socket(const char* path, int quiet);
417
418
422 #ifdef __cplusplus
423 }
424 #endif
425
426 #endif
lirc_command_reply_to_stdout
void lirc_command_reply_to_stdout(lirc_cmd_ctx *ctx)
Definition: lirc_client.c:122
lirc_config_entry
Definition: lirc_client.h:169
lirc_init
int lirc_init(const char *prog, int verbose)
Definition: lirc_client.c:339
lirc_setmode
const char * lirc_setmode(struct lirc_config *config, const char *mode)
Definition: lirc_client.c:1953
lirc_get_local_socket
int lirc_get_local_socket(const char *path, int quiet)
Definition: lirc_client.c:2042
lirc_command_run
int lirc_command_run(lirc_cmd_ctx *ctx, int fd)
Definition: lirc_client.c:185
lirc_code
Definition: lirc_client.h:154
lirc_config::lircrc_class
char * lircrc_class
Definition: lirc_client.h:161
lirc_getmode
const char * lirc_getmode(struct lirc_config *config)
Definition: lirc_client.c:1932
PACKET_SIZE
#define PACKET_SIZE
Definition: lirc_config.h:98
lirc_simulate
int lirc_simulate(int fd, const char *remote, const char *keysym, int scancode, int repeat)
Definition: lirc_client.c:1996
lirc_getsocketname
size_t lirc_getsocketname(const char *id, char *buf, size_t size)
Definition: lirc_client.c:1923
lirc_command_init
int lirc_command_init(lirc_cmd_ctx *ctx, const char *fmt,...)
Definition: lirc_client.c:105
lirc_cmd_ctx::head
int head
Definition: lirc_client.h:196
lirc_nextcode
int lirc_nextcode(char **code)
Definition: lirc_client.c:1865
lirc_get_remote_socket
int lirc_get_remote_socket(const char *address, int port, int quiet)
Definition: lirc_client.c:2064
lirc_code2char
int lirc_code2char(struct lirc_config *config, char *code, char **string)
Definition: lirc_client.c:1799
lirc_cmd_ctx
Definition: lirc_client.h:192
lirc_readconfig_only
int lirc_readconfig_only(const char *file, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1512
lirc_readconfig
int lirc_readconfig(const char *path, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1433
lirc_cmd_ctx::next
char * next
Definition: lirc_client.h:198
lirc_send_one
int lirc_send_one(int fd, const char *remote, const char *keysym)
Definition: lirc_client.c:1981
lirc_cmd_ctx::reply_to_stdout
int reply_to_stdout
Definition: lirc_client.h:197
lirc_freeconfig
void lirc_freeconfig(struct lirc_config *config)
Definition: lirc_client.c:1520
lirc_config
Definition: lirc_client.h:160
lirc_list
Definition: lirc_client.h:149
lirc_nextir
char * lirc_nextir(void)
Definition: lirc_client.c:1847
lirc_deinit
int lirc_deinit(void)
Definition: lirc_client.c:360
lirc_ir2char
char * lirc_ir2char(struct lirc_config *config, char *code)
Definition: lirc_client.c:1712