LIRC libraries
LinuxInfraredRemoteControl
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
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 
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;
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 
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
void lirc_command_reply_to_stdout(lirc_cmd_ctx *ctx)
Definition: lirc_client.c:121
Definition: lirc_client.h:168
int lirc_init(const char *prog, int verbose)
Definition: lirc_client.c:332
const char * lirc_setmode(struct lirc_config *config, const char *mode)
Definition: lirc_client.c:1939
int lirc_get_local_socket(const char *path, int quiet)
Definition: lirc_client.c:2028
int lirc_command_run(lirc_cmd_ctx *ctx, int fd)
Definition: lirc_client.c:179
char * lircrc_class
Definition: lirc_client.h:160
const char * lirc_getmode(struct lirc_config *config)
Definition: lirc_client.c:1918
#define PACKET_SIZE
Definition: lirc_config.h:98
int lirc_simulate(int fd, const char *remote, const char *keysym, int scancode, int repeat)
Definition: lirc_client.c:1982
size_t lirc_getsocketname(const char *id, char *buf, size_t size)
Definition: lirc_client.c:1909
int lirc_command_init(lirc_cmd_ctx *ctx, const char *fmt,...)
Definition: lirc_client.c:104
int lirc_nextcode(char **code)
Definition: lirc_client.c:1851
int lirc_get_remote_socket(const char *address, int port, int quiet)
Definition: lirc_client.c:2050
int lirc_code2char(struct lirc_config *config, char *code, char **string)
Definition: lirc_client.c:1792
int lirc_readconfig_only(const char *file, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1505
int lirc_readconfig(const char *path, struct lirc_config **config, int(check)(char *s))
Definition: lirc_client.c:1426
int lirc_send_one(int fd, const char *remote, const char *keysym)
Definition: lirc_client.c:1967
int reply_to_stdout
Definition: lirc_client.h:196
void lirc_freeconfig(struct lirc_config *config)
Definition: lirc_client.c:1513
char * lirc_nextir(void)
Definition: lirc_client.c:1833
int lirc_deinit(void)
Definition: lirc_client.c:353
char * lirc_ir2char(struct lirc_config *config, char *code)
Definition: lirc_client.c:1705