00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef LIRC_CLIENT_H
00015 #define LIRC_CLIENT_H
00016
00017 #include <stddef.h>
00018
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022
00023 #define LIRC_RET_SUCCESS (0)
00024 #define LIRC_RET_ERROR (-1)
00025
00026 #define LIRC_ALL ((char *) (-1))
00027
00028 enum lirc_flags {none=0x00,
00029 once=0x01,
00030 quit=0x02,
00031 mode=0x04,
00032 ecno=0x08,
00033 startup_mode=0x10,
00034 toggle_reset=0x20,
00035 };
00036
00037 struct lirc_state
00038 {
00039 int lirc_lircd;
00040 int lirc_verbose;
00041 char *lirc_prog;
00042 char *lirc_buffer;
00043 char *lircrc_root_file;
00044 char *lircrc_user_file;
00045 };
00046
00047 struct lirc_list
00048 {
00049 char *string;
00050 struct lirc_list *next;
00051 };
00052
00053 struct lirc_code
00054 {
00055 char *remote;
00056 char *button;
00057 struct lirc_code *next;
00058 };
00059
00060 struct lirc_config
00061 {
00062 char *current_mode;
00063 struct lirc_config_entry *next;
00064 struct lirc_config_entry *first;
00065
00066 int sockfd;
00067 };
00068
00069 struct lirc_config_entry
00070 {
00071 char *prog;
00072 struct lirc_code *code;
00073 unsigned int rep_delay;
00074 unsigned int rep;
00075 struct lirc_list *config;
00076 char *change_mode;
00077 unsigned int flags;
00078
00079 char *mode;
00080 struct lirc_list *next_config;
00081 struct lirc_code *next_code;
00082
00083 struct lirc_config_entry *next;
00084 };
00085
00086 struct lirc_state *lirc_init(const char *lircrc_root_file,
00087 const char *lircrc_user_file,
00088 const char *prog, const char *lircd, int verbose);
00089 int lirc_deinit(struct lirc_state*);
00090
00091 int lirc_readconfig(const struct lirc_state *state,
00092 const char *file,struct lirc_config **config,
00093 int (check)(char *s));
00094 void lirc_freeconfig(struct lirc_config *config);
00095
00096 #if 0
00097
00098 char *lirc_nextir(struct lirc_state *state);
00099
00100 char *lirc_ir2char(const struct lirc_state *state, struct lirc_config *config,char *code);
00101 #endif
00102
00103 int lirc_nextcode(struct lirc_state *state, char **code);
00104 int lirc_code2char(const struct lirc_state *state, struct lirc_config *config,char *code,char **string);
00105
00106
00107 int lirc_readconfig_only(const struct lirc_state *state,
00108 const char *file, struct lirc_config **config,
00109 int (check)(char *s));
00110 int lirc_code2charprog(struct lirc_state *state,
00111 struct lirc_config *config,char *code,char **string,
00112 char **prog);
00113 size_t lirc_getsocketname(const char *filename, char *buf, size_t size);
00114 const char *lirc_getmode(const struct lirc_state *state, struct lirc_config *config);
00115 const char *lirc_setmode(const struct lirc_state *state, struct lirc_config *config, const char *mode);
00116
00117 #ifdef __cplusplus
00118 }
00119 #endif
00120
00121 #endif