Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

libhal.h

00001 /***************************************************************************
00002  * CVSID: $Id: libhal.h,v 1.12 2004/04/10 16:51:56 david Exp $
00003  *
00004  * libhal.h : HAL daemon C convenience library headers
00005  *
00006  * Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
00007  *
00008  * Licensed under the Academic Free License version 2.0
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  **************************************************************************/
00025 
00026 #ifndef LIBHAL_H
00027 #define LIBHAL_H
00028 
00029 #include <dbus/dbus.h>
00030 
00031 /*
00032 #if defined(__cplusplus)
00033 extern "C" {
00034 #endif
00035 */
00036 
00043 typedef struct LibHalContext_s
00044 LibHalContext;
00045 
00051 typedef void (*LibHalIntegrateDBusIntoMainLoop) (LibHalContext *ctx,
00052                          DBusConnection *
00053                          dbus_connection);
00054 
00059 typedef void (*LibHalDeviceAdded) (LibHalContext *ctx, const char *udi);
00060 
00065 typedef void (*LibHalDeviceRemoved) (LibHalContext *ctx, const char *udi);
00066 
00072 typedef void (*LibHalNewCapability) (LibHalContext *ctx, 
00073                      const char *udi,
00074                      const char *capability);
00075 
00081 typedef void (*LibHalLostCapability) (LibHalContext *ctx, 
00082                       const char *udi,
00083                       const char *capability);
00084 
00092 typedef void (*LibHalDevicePropertyModified) (LibHalContext *ctx,
00093                           const char *udi,
00094                           const char *key,
00095                           dbus_bool_t is_removed,
00096                           dbus_bool_t is_added);
00097 
00107 typedef void (*LibHalDeviceCondition) (LibHalContext *ctx,
00108                        const char *udi,
00109                        const char *condition_name,
00110                        DBusMessage *message);
00111 
00112 
00118 typedef struct LibHalFunctions_s {
00122     LibHalIntegrateDBusIntoMainLoop main_loop_integration;
00123 
00125     LibHalDeviceAdded device_added;
00126 
00128     LibHalDeviceRemoved device_removed;
00129 
00131     LibHalNewCapability device_new_capability;
00132 
00134     LibHalLostCapability device_lost_capability;
00135 
00137     LibHalDevicePropertyModified device_property_modified;
00138 
00140     LibHalDeviceCondition device_condition;
00141 
00142 } LibHalFunctions;
00143 
00144 
00145 LibHalContext *hal_initialize (const LibHalFunctions * functions,
00146                    dbus_bool_t use_cache);
00147 
00148 int hal_shutdown (LibHalContext *ctx);
00149 
00150 char **hal_get_all_devices (LibHalContext *ctx, int *num_devices);
00151 dbus_bool_t hal_device_exists (LibHalContext *ctx, const char *udi);
00152 
00153 void hal_device_print (LibHalContext *ctx, const char *udi);
00154 
00155 dbus_bool_t hal_device_property_exists (LibHalContext *ctx, 
00156                     const char *udi,
00157                     const char *key);
00158 
00159 char *hal_device_get_property_string (LibHalContext *ctx, const char *udi,
00160                       const char *key);
00161 
00162 dbus_int32_t hal_device_get_property_int (LibHalContext *ctx, 
00163                       const char *udi,
00164                       const char *key);
00165 
00166 double hal_device_get_property_double (LibHalContext *ctx, 
00167                        const char *udi,
00168                        const char *key);
00169 
00170 dbus_bool_t hal_device_get_property_bool (LibHalContext *ctx, 
00171                       const char *udi,
00172                       const char *key);
00173 
00174 dbus_bool_t hal_device_set_property_string (LibHalContext *ctx, 
00175                         const char *udi,
00176                         const char *key,
00177                         const char *value);
00178 
00179 dbus_bool_t hal_device_set_property_int (LibHalContext *ctx, 
00180                      const char *udi,
00181                      const char *key,
00182                      dbus_int32_t value);
00183 
00184 dbus_bool_t hal_device_set_property_double (LibHalContext *ctx, 
00185                         const char *udi,
00186                         const char *key,
00187                         double value);
00188 
00189 dbus_bool_t hal_device_set_property_bool (LibHalContext *ctx, 
00190                       const char *udi,
00191                       const char *key,
00192                       dbus_bool_t value);
00193 
00194 dbus_bool_t hal_device_remove_property (LibHalContext *ctx, 
00195                     const char *udi,
00196                     const char *key);
00197 
00198 int hal_device_get_property_type (LibHalContext *ctx, 
00199                   const char *udi,
00200                   const char *key);
00201 
00202 
00203 struct LibHalProperty_s;
00204 typedef struct LibHalProperty_s LibHalProperty;
00205 
00206 struct LibHalPropertySet_s;
00207 typedef struct LibHalPropertySet_s LibHalPropertySet;
00208 
00209 LibHalPropertySet *hal_device_get_all_properties (LibHalContext *ctx, 
00210                           const char *udi);
00211 
00212 void hal_free_property_set (LibHalPropertySet * set);
00213 
00215 struct LibHalPropertySetIterator_s {
00216     LibHalPropertySet *set;
00217     unsigned int index;
00218     LibHalProperty *cur_prop;
00219     void *reservered0;
00220     void *reservered1;
00221 };
00222 
00223 typedef struct LibHalPropertySetIterator_s
00224 LibHalPropertySetIterator;
00225 
00226 void hal_psi_init (LibHalPropertySetIterator * iter,
00227            LibHalPropertySet * set);
00228 
00229 dbus_bool_t hal_psi_has_more (LibHalPropertySetIterator * iter);
00230 void hal_psi_next (LibHalPropertySetIterator * iter);
00231 
00232 int hal_psi_get_type (LibHalPropertySetIterator * iter);
00233 
00234 char *hal_psi_get_key (LibHalPropertySetIterator * iter);
00235 
00236 char *hal_psi_get_string (LibHalPropertySetIterator * iter);
00237 dbus_int32_t hal_psi_get_int (LibHalPropertySetIterator * iter);
00238 double hal_psi_get_double (LibHalPropertySetIterator * iter);
00239 dbus_bool_t hal_psi_get_bool (LibHalPropertySetIterator * iter);
00240 
00241 void hal_free_string_array (char **str_array);
00242 void hal_free_string (char *str);
00243 
00244 char *hal_agent_new_device (LibHalContext *ctx);
00245 dbus_bool_t hal_agent_commit_to_gdl (LibHalContext *ctx,
00246                      const char *temp_udi,
00247                      const char *udi);
00248 dbus_bool_t hal_agent_remove_device (LibHalContext *ctx, 
00249                      const char *udi);
00250 dbus_bool_t hal_agent_merge_properties (LibHalContext *ctx,
00251                     const char *udi,
00252                     const char *from_udi);
00253 
00254 dbus_bool_t hal_agent_device_matches (LibHalContext *ctx,
00255                       const char *udi1,
00256                       const char *udi2,
00257                       const char *namespace);
00258 
00259 char **hal_manager_find_device_string_match (LibHalContext *ctx,
00260                          const char *key,
00261                          const char *value,
00262                          int *num_devices);
00263 
00264 
00265 dbus_bool_t hal_device_add_capability (LibHalContext *ctx,
00266                        const char *device,
00267                        const char *capability);
00268 
00269 dbus_bool_t hal_device_query_capability (LibHalContext *ctx,
00270                      const char *udi,
00271                      const char *capability);
00272 
00273 char **hal_find_device_by_capability (LibHalContext *ctx,
00274                       const char *capability,
00275                       int *num_devices);
00276 
00277 int hal_device_property_watch_all (LibHalContext *ctx);
00278 int hal_device_add_property_watch (LibHalContext *ctx, 
00279                    const char *udi);
00280 int hal_device_remove_property_watch (LibHalContext *ctx, 
00281                       const char *udi);
00282 
00285 #if defined(__cplusplus)
00286 }
00287 #endif
00288 #endif              /* LIBHAL_H */

Generated on Sat Apr 24 19:57:45 2004 for HAL by doxygen 1.3.6-20040222