1 /* $Id: lirc_client.h,v 5.11 2008/05/20 18:54:37 lirc Exp $ */ 2 3 /**************************************************************************** 4 ** lirc_client.h *********************************************************** 5 **************************************************************************** 6 * 7 * lirc_client - common routines for lircd clients 8 * 9 * Copyright (C) 1998 Trent Piepho <xyzzy@u.washington.edu> 10 * Copyright (C) 1998 Christoph Bartelmus <lirc@bartelmus.de> 11 * 12 */ 13 14 #ifndef LIRC_CLIENT_H 15 #define LIRC_CLIENT_H 16 17 #include <stddef.h> 18 #include <stdint.h> 19 20 #ifndef __u32 21 typedef uint32_t __u32; 22 #endif 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 #define LIRC_RET_SUCCESS (0) 29 #define LIRC_RET_ERROR (-1) 30 31 #define LIRC_ALL ((char *) (-1)) 32 33 enum lirc_flags { none = 0x00, 34 once = 0x01, 35 quit = 0x02, 36 mode = 0x04, 37 ecno = 0x08, 38 startup_mode = 0x10, 39 toggle_reset = 0x20, 40 }; 41 42 struct lirc_list { 43 char *string; 44 struct lirc_list *next; 45 }; 46 47 struct lirc_code { 48 char *remote; 49 char *button; 50 struct lirc_code *next; 51 }; 52 53 struct lirc_config { 54 char *current_mode; 55 struct lirc_config_entry *next; 56 struct lirc_config_entry *first; 57 58 int sockfd; 59 }; 60 61 struct lirc_config_entry { 62 char *prog; 63 struct lirc_code *code; 64 unsigned int rep_delay; 65 unsigned int rep; 66 struct lirc_list *config; 67 char *change_mode; 68 unsigned int flags; 69 70 char *mode; 71 struct lirc_list *next_config; 72 struct lirc_code *next_code; 73 74 struct lirc_config_entry *next; 75 }; 76 77 int lirc_init(char *prog, int verbose); 78 int lirc_deinit(void); 79 80 int lirc_readconfig(char *file, struct lirc_config **config, int (check) (char *s)); 81 void lirc_freeconfig(struct lirc_config *config); 82 83 /* obsolete */ 84 char *lirc_nextir(void); 85 /* obsolete */ 86 char *lirc_ir2char(struct lirc_config *config, char *code); 87 88 int lirc_nextcode(char **code); 89 int lirc_code2char(struct lirc_config *config, char *code, char **string); 90 91 /* new interface for client daemon */ 92 int lirc_readconfig_only(char *file, struct lirc_config **config, int (check) (char *s)); 93 int lirc_code2charprog(struct lirc_config *config, char *code, char **string, char **prog); 94 size_t lirc_getsocketname(const char *filename, char *buf, size_t size); 95 const char *lirc_getmode(struct lirc_config *config); 96 const char *lirc_setmode(struct lirc_config *config, const char *mode); 97 98 #ifdef __cplusplus 99 } 100 #endif 101 #endif 102