LIRC libraries LinuxInfraredRemoteControl

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

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
125 #ifdef __cplusplus
126 extern "C" {
127 #endif
128
129
130 #ifndef __u32
131 typedef uint32_t __u32;
132 #endif
133
134 #define LIRC_RET_SUCCESS (0)
135 #define LIRC_RET_ERROR (-1)
136
137 #define LIRC_ALL ((char*)(-1))
138
139
140 enum lirc_flags { none = 0x00,
141 once = 0x01,
142 quit = 0x02,
143 mode = 0x04,
144 ecno = 0x08,
145 startup_mode = 0x10,
146 toggle_reset = 0x20, };
147
148 struct lirc_list {
149 char* string;
150 struct lirc_list* next;
151 };
152
153 struct lirc_code {
154 char* remote;
155 char* button;
156 struct lirc_code* next;
157 };
158
159 struct lirc_config {
160 char* lircrc_class;
161 char* current_mode;
162 struct lirc_config_entry* next;
163 struct lirc_config_entry* first;
164
165 int sockfd;
166 };
167
168 struct lirc_config_entry {
169 char* prog;
170 struct lirc_code* code;
171 unsigned int rep_delay;
172 unsigned int ign_first_events;
173 unsigned int rep;
174 struct lirc_list* config;
175 char* change_mode;
176 unsigned int flags;
177
178 char* mode;
179 struct lirc_list* next_config;
180 struct lirc_code* next_code;
181
182 struct lirc_config_entry* next;
183 };
184
191 typedef struct {
192 char packet[PACKET_SIZE + 1];
193 char buffer[PACKET_SIZE + 1];
194 char reply[PACKET_SIZE + 1];
195 int head;
196 int reply_to_stdout;
197 char* next;
198 } lirc_cmd_ctx;
199
207 int lirc_init(const char* prog, int verbose);
208
213 int lirc_deinit(void);
214
229 int lirc_readconfig(const char* path,
230 struct lirc_config** config,
231 int (check) (char* s));
232
234 void lirc_freeconfig(struct lirc_config* config);
235
237 char* lirc_nextir(void);
238
240 char* lirc_ir2char(struct lirc_config* config, char* code);
241
251 int lirc_nextcode(char** code);
252
264 int lirc_code2char(struct lirc_config* config, char* code, char** string);
265
266
267 /* new interface for client daemon */
280 int lirc_readconfig_only(const char* file,
281 struct lirc_config** config,
282 int (check) (char* s));
283
284 int lirc_code2charprog(struct lirc_config* config,
285 char* code,
286 char** string,
287 char** prog);
288
297 size_t lirc_getsocketname(const char* id, char* buf, size_t size);
298
307 const char* lirc_getmode(struct lirc_config* config);
308
318 const char* lirc_setmode(struct lirc_config* config, const char* mode);
319
320 /* 0.9.2: New interface for sending data. */
321
332 int lirc_command_init(lirc_cmd_ctx* ctx, const char* fmt, ...);
333
334
345 int lirc_command_run(lirc_cmd_ctx* ctx, int fd);
346
353 void lirc_command_reply_to_stdout(lirc_cmd_ctx* ctx);
354
367 int lirc_send_one(int fd, const char* remote, const char* keysym);
368
369
385 int lirc_simulate(int fd,
386 const char* remote,
387 const char* keysym,
388 int scancode,
389 int repeat);
390
391
402 int lirc_get_remote_socket(const char* address, int port, int quiet);
403
404
415 int lirc_get_local_socket(const char* path, int quiet);
416
417
421 #ifdef __cplusplus
422 }
423 #endif
424
425 #endif
lirc_command_reply_to_stdout
void lirc_command_reply_to_stdout(lirc_cmd_ctx *ctx)
Definition: lirc_client.c:121
lirc_config_entry
Definition: lirc_client.h:168
lirc_init
int lirc_init(const char *prog, int verbose)
Definition: lirc_client.c:332
lirc_setmode
const char * lirc_setmode(struct lirc_config *config, const char *mode)
Definition: lirc_client.c:1939
lirc_get_local_socket
int lirc_get_local_socket(const char *path, int quiet)
Definition: lirc_client.c:2028
lirc_command_run
int lirc_command_run(lirc_cmd_ctx *ctx, int fd)
Definition: lirc_client.c:179
lirc_code
Definition: lirc_client.h:153
lirc_config::lircrc_class
char * lircrc_class
Definition: lirc_client.h:160
lirc_getmode
const char * lirc_getmode(struct lirc_config *config)
Definition: lirc_client.c:1918
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:1982
lirc_getsocketname
size_t lirc_getsocketname(const char *id, char *buf, size_t size)
Definition: lirc_client.c:1909
lirc_command_init
int lirc_command_init(lirc_cmd_ctx *ctx, const char *fmt,...)
Definition: lirc_client.c:104
lirc_cmd_ctx::head
int head
Definition: lirc_client.h:195
lirc_nextcode
int lirc_nextcode(char **code)
Definition: lirc_client.c:1851
lirc_get_remote_socket
int lirc_get_remote_socket(const char *address, int port, int quiet)
Definition: lirc_client.c:2050
lirc_code2char
int lirc_code2char(struct lirc_config *config, char *code, char **string)
Definition: lirc_client.c:1792
lirc_cmd_ctx
Definition: lirc_client.h:191
lirc_readconfig_only
int lirc_readconfig_only(const char *file, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1505
lirc_readconfig
int lirc_readconfig(const char *path, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1426
lirc_cmd_ctx::next
char * next
Definition: lirc_client.h:197
lirc_send_one
int lirc_send_one(int fd, const char *remote, const char *keysym)
Definition: lirc_client.c:1967
lirc_cmd_ctx::reply_to_stdout
int reply_to_stdout
Definition: lirc_client.h:196
lirc_freeconfig
void lirc_freeconfig(struct lirc_config *config)
Definition: lirc_client.c:1513
lirc_config
Definition: lirc_client.h:159
lirc_list
Definition: lirc_client.h:148
lirc_nextir
char * lirc_nextir(void)
Definition: lirc_client.c:1833
lirc_deinit
int lirc_deinit(void)
Definition: lirc_client.c:353
lirc_ir2char
char * lirc_ir2char(struct lirc_config *config, char *code)
Definition: lirc_client.c:1705