2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
24 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
26 #ifndef __BACKEND_INTERNAL_LIRC_H__
27 #define __BACKEND_INTERNAL_LIRC_H__
29 #define IRRECO_DEBUG_PREFIX "INTERNAL_LIRC"
30 #include "irreco_util.h"
33 #include <glib/gprintf.h>
34 #include <glib/gstdio.h>
37 #include "irreco_backend_api.h"
41 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
43 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
45 INTERNAL_LIRC_BACKEND_ERR_CANT_OPEN_SOCKET
= 1,
46 INTERNAL_LIRC_BACKEND_ERR_CANT_CONNECT
,
47 INTERNAL_LIRC_BACKEND_ERR_CANT_RESOLVE_HOST
,
48 INTERNAL_LIRC_BACKEND_ERR_CONFIG_WRITE_FAILED
,
49 INTERNAL_LIRC_BACKEND_ERR_CONFIG_READ_FAILED
,
50 INTERNAL_LIRC_BACKEND_ERR_BAD_PACKET
,
51 INTERNAL_LIRC_BACKEND_ERR_COULD_NOT_SEND_PACKET
,
52 INTERNAL_LIRC_BACKEND_ERR_COMMAND_FAILED
,
53 INTERNAL_LIRC_BACKEND_ERR_TIMEOUT
,
54 INTERNAL_LIRC_BACKEND_ERR_FILE_OPEN_FAILED
,
55 INTERNAL_LIRC_BACKEND_ERR_COULD_NOT_CREATE_DEVICE_DIR
,
56 INTERNAL_LIRC_BACKEND_ERR_COULD_NOT_CREATE_BASE_DIR
,
57 INTERNAL_LIRC_BACKEND_ERR_COULD_NOT_DELETE_DEVICE
58 } IrrecoInternalLircBackendError
;
60 typedef struct _IrrecoInternalLircBackend IrrecoInternalLircBackend
;
61 struct _IrrecoInternalLircBackend
{
67 IrrecoGetDeviceCallback dev_callback
;
68 IrrecoGetCommandCallback cmd_callback
;
71 typedef void (*InternalLircBackendResponseHandler
) (IrrecoInternalLircBackend
72 * internal_lirc_backend
, const char * response
);
76 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
78 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
79 #define _(String) (String)
81 #define INTERNAL_LIRC_BASE_DIR "/home/user/MyDocs/irreco"
82 #define INTERNAL_LIRC_REMOTES_DIR "/home/user/MyDocs/irreco/InternalLircDevices"
83 #define INTERNAL_LIRC_LIRCD_CONF_PATH "/etc/lircd.conf"
84 /* For sbox testing only */
85 /* #define INTERNAL_LIRC_LIRCD_CONF_PATH "/home/user/.irreco/lircd.conf" */
87 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
89 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
90 void* internal_lirc_backend_create();
91 void internal_lirc_backend_destroy(void * instance_context
, gboolean permanently
);
92 IrrecoBackendStatus
internal_lirc_backend_read_from_conf(void * instance_context
,
93 const char * config_file
);
95 IrrecoBackendStatus
internal_lirc_backend_save_to_conf(void * instance_context
,
96 const char * config_file
);
97 const char *internal_lirc_backend_get_error_msg(void * instance_context
,
98 IrrecoBackendStatus code
);
99 int internal_lirc_backend_error(IrrecoInternalLircBackend
* internal_lirc_backend
,
100 IrrecoInternalLircBackendError code
, ...);
101 int internal_lirc_backend_connect(IrrecoInternalLircBackend
* internal_lirc_backend
);
102 void internal_lirc_backend_disconnect(IrrecoInternalLircBackend
* internal_lirc_backend
);
103 IrrecoBackendStatus
internal_lirc_backend_get_devices(void * instance_context
,
104 IrrecoGetDeviceCallback callback
);
105 void internal_lirc_backend_get_device_responce(IrrecoInternalLircBackend
* internal_lirc_backend
,
106 const char * response
);
107 IrrecoBackendStatus
internal_lirc_backend_get_commands(void * instance_context
,
108 const char *device_name
,
110 IrrecoGetCommandCallback callback
);
111 void internal_lirc_backend_get_command_responce(IrrecoInternalLircBackend
* internal_lirc_backend
,
112 const char * response
);
113 gchar
*internal_lirc_backend_get_description(gpointer instance_context
);
114 IrrecoBackendStatus
internal_lirc_backend_send_command(void *instance_context
,
115 const char *device_name
,
117 const char *command_name
,
118 void *command_contex
);
119 IrrecoBackendStatus
internal_lirc_backend_configure(void * instance_context
,
124 #endif /* __BACKEND_INTERNAL_LIRC_H__ */