clean code and changed version nro.
[irreco.git] / irreco / src / core / irreco_backend_instance.h
blob0f2a76ca49870dcc57ddb0bd1793e008ecb01d6d
1 /*
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.
20 /**
21 * @addtogroup IrrecoBackendInstance
22 * @{
25 /**
26 * @file
27 * Header file of @ref IrrecoBackendInstance.
30 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
31 /* Typedef */
32 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
34 * Make sure that typedefs are available before we include anything elese.
36 * This makes sure that whatever other structures that depend on structures
37 * defined in this file will compile OK recardles of header inclusion order.
39 #ifndef __IRRECO_BACKEND_INSTANCE_H_TYPEDEF__
40 #define __IRRECO_BACKEND_INSTANCE_H_TYPEDEF__
41 typedef struct _IrrecoBackendInstance IrrecoBackendInstance;
42 #endif /* __IRRECO_BACKEND_INSTANCE_H_TYPEDEF__ */
46 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
47 /* Include */
48 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
49 #ifndef __IRRECO_BACKEND_INSTANCE_H__
50 #define __IRRECO_BACKEND_INSTANCE_H__
51 #include "irreco.h"
52 #include "irreco_cmd.h"
53 #include "irreco_backend_lib.h"
54 #include "irreco_backend_device.h"
55 #include <irreco_string_table.h>
56 #include "../api/irreco_backend_api.h"
60 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
61 /* Datatypes */
62 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
63 struct _IrrecoBackendInstance {
64 IrrecoData *irreco_data;
66 GString *name;
67 GString *description;
68 GString *name_and_description;
70 gchar *config;
71 IrrecoBackendLib *lib;
72 gpointer contex;
73 IrrecoStringTable *device_list;
75 /* List of IrrecoCmd objects that depend on this instace. */
76 GPtrArray *irreco_cmd_dependencies;
81 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
82 /* Macro */
83 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
85 #define IRRECO_BACKEND_ENTER(_instance, _function) \
86 IRRECO_OUTPUT(2, ">> ") \
87 irreco_debug_print("Calling \"%s\" inside \"%s\"\n", \
88 _function, _instance->lib->name)
89 #define IRRECO_BACKEND_RETURN(_function) \
90 IRRECO_OUTPUT(2, "<< ") \
91 irreco_debug_print("Returned from \"%s\"\n", _function)
94 * Iterate trough device list of the instance.
96 #define IRRECO_BACKEND_INSTANCE_FOREACH(_instance, _device_var_name) \
97 IRRECO_STRING_TABLE_FOREACH_DATA(_instance->device_list, \
98 IrrecoBackendDevice*, \
99 _device_var_name)
100 #define IRRECO_BACKEND_INSTANCE_FOREACH_END IRRECO_STRING_TABLE_FOREACH_END
104 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
105 /* Prototypes */
106 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
107 IrrecoBackendInstance *
108 irreco_backend_instance_create(IrrecoBackendLib * backend_lib,
109 IrrecoData *irreco_data);
110 void irreco_backend_instance_destroy(IrrecoBackendInstance *self);
111 void irreco_backend_instance_destroy_full(IrrecoBackendInstance *self,
112 gboolean permanently);
113 gboolean irreco_backend_instance_api_edit(IrrecoBackendInstance *self);
114 gboolean irreco_backend_instance_api_export(IrrecoBackendInstance *self);
115 void irreco_backend_instance_add_cmd_dependency(IrrecoBackendInstance *self,
116 IrrecoCmd * command);
117 void irreco_backend_instance_remove_cmd_dependency(IrrecoBackendInstance *self,
118 IrrecoCmd * command);
119 gboolean irreco_backend_instance_check_status(IrrecoBackendInstance *self,
120 IrrecoBackendStatus status);
121 void irreco_backend_instance_set_name(IrrecoBackendInstance *self,
122 gchar * name);
123 void irreco_backend_instance_set_config(IrrecoBackendInstance *self,
124 gchar * config);
125 const gchar *
126 irreco_backend_instance_get_name(IrrecoBackendInstance *self);
127 const gchar *
128 irreco_backend_instance_get_description(IrrecoBackendInstance *self);
129 const gchar *
130 irreco_backend_instance_get_name_and_description(IrrecoBackendInstance *self);
131 gboolean irreco_backend_instance_read_from_conf(IrrecoBackendInstance *self);
132 gboolean irreco_backend_instance_save_to_conf(IrrecoBackendInstance *self);
133 gboolean irreco_backend_instance_send_command(IrrecoBackendInstance *self,
134 const gchar *device_name,
135 const gchar *command_name);
136 void irreco_backend_instance_configure(IrrecoBackendInstance *self,
137 GtkWindow *parent);
138 void irreco_backend_instance_create_device(IrrecoBackendInstance *self,
139 GtkWindow *parent);
140 void irreco_backend_instance_get_devcmd_list(IrrecoBackendInstance *self);
142 gboolean irreco_backend_instance_export_conf(IrrecoBackendInstance *self,
143 const char * device_name,
144 IrrecoBackendFileContainer **file_container);
146 gboolean irreco_backend_instance_import_conf(IrrecoBackendInstance *self,
147 IrrecoBackendFileContainer *file_container);
149 gboolean irreco_backend_instance_check_conf(IrrecoBackendInstance *self,
150 IrrecoBackendFileContainer *file_container);
152 #endif /* __IRRECO_BACKEND_INSTANCE_H__ */
154 /** @} */