Trunk cleanup: irtrans
[irreco.git] / backend / irtrans / src / irtrans_wrap.h
blob6662753e2d66c866e1b0bd56b93ae9099c79d96d
1 /*
2 * irreco - Ir Remote Control
3 * Copyright (C) 2007 Arto Karppinen (arto.karppinen@iki.fi)
4 *
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.
9 *
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.
21 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
22 /* Typedef */
23 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
25 * Make sure that typedefs are available before we include anything elese.
27 * This makes sure that whatever other structures that depend on structures
28 * defined in this file will compile OK recardles of header inclusion order.
30 #ifndef __HEADER_NAME_H_TYPEDEF__
31 #define __HEADER_NAME_H_TYPEDEF__
32 typedef struct _IRTransWrap IRTransWrap;
33 #endif /* __HEADER_NAME_H_TYPEDEF__ */
37 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
38 /* Include */
39 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
40 #ifndef __HEADER_NAME_H__
41 #define __HEADER_NAME_H__
42 #include "irtrans_plugin.h"
43 #include <irreco_retry_loop.h>
47 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
48 /* Datatypes */
49 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
50 struct _IRTransWrap {
51 SOCKET server_socket;
52 gboolean remote_server;
53 GString *hostname;
55 /* Because IRTrans does not return the result of queries in any
56 kind of format GLib / Gtk can use directly, we create our own list
57 and copy the data there. */
58 GStringChunk *list_chunk;
59 GPtrArray *list_array;
60 gint list_get_pos;
62 IrrecoRetryLoop *loop;
67 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
68 /* Macro */
69 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
70 #define IRTRANS_HOME_DIR "/home/user/.irserver"
71 #define IRTRANS_REMOTES_DIR "/home/user/MyDocs/IRTrans Devices"
72 #define IRTRANS_OLD_REMOTES_DIR "/home/user/MyDocs/remotes"
73 #define IRTRANS_REMOTES_SYMLINK IRTRANS_HOME_DIR "/remotes"
74 #define IRTRANS_PIDFILE IRTRANS_HOME_DIR "/pid"
75 #define IRTRANS_WAIT_MAX IRRECO_SECONDS_TO_USEC(3)
76 #define IRTRANS_WAIT_SLEEP IRRECO_SECONDS_TO_USEC(0.1)
80 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
81 /* Prototypes */
82 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
83 IRTransWrap *irtrans_wrap_new();
84 void irtrans_wrap_delete(IRTransWrap *self);
85 IrrecoBackendStatus irtrans_wrap_connect(IRTransWrap *self);
86 IrrecoBackendStatus irtrans_wrap_connect_to_local(IRTransWrap *self);
87 IrrecoBackendStatus irtrans_wrap_connect_to_remote(IRTransWrap *self);
88 void irtrans_wrap_disconnect(IRTransWrap *self);
89 void irtrans_wrap_set_remote_server(IRTransWrap *self, gboolean remote_server);
90 gboolean irtrans_wrap_get_remote_server(IRTransWrap *self);
91 void irtrans_wrap_set_hostname(IRTransWrap *self, const gchar *string);
92 const gchar *irtrans_wrap_get_hostname(IRTransWrap *self);
93 IrrecoBackendStatus irtrans_wrap_get_autodetect_list(IRTransWrap *self, gint *count);
94 void irtrans_wrap_clear_list(IRTransWrap *self);
95 gboolean irtrans_wrap_get_from_list(IRTransWrap *self, const gchar **string);
96 IrrecoBackendStatus irtrans_wrap_get_remote_list(IRTransWrap *self,
97 gint *count);
98 IrrecoBackendStatus irtrans_wrap_get_command_list(IRTransWrap *self,
99 const gchar *device,
100 gint *count);
101 IrrecoBackendStatus irtrans_wrap_send_command(IRTransWrap *self,
102 const gchar *device,
103 const gchar *command);
104 IrrecoBackendStatus irtrans_wrap_learn_command(IRTransWrap *self,
105 const gchar *device,
106 const gchar *command,
107 gushort timeout);
109 #endif /* __HEADER_NAME_H__ */