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

libhal.h

00001 /***************************************************************************
00002  * CVSID: $Id: libhal.h,v 1.18 2004/09/17 17:05:48 joe 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 #if defined(__cplusplus)
00032 extern "C" {
00033 #endif
00034 
00041 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00042 typedef struct LibHalContext_s LibHalContext;
00043 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00044 
00050 typedef void (*LibHalIntegrateDBusIntoMainLoop) (LibHalContext *ctx,
00051                          DBusConnection *
00052                          dbus_connection);
00053 
00058 typedef void (*LibHalDeviceAdded) (LibHalContext *ctx, const char *udi);
00059 
00064 typedef void (*LibHalDeviceRemoved) (LibHalContext *ctx, const char *udi);
00065 
00071 typedef void (*LibHalNewCapability) (LibHalContext *ctx, 
00072                      const char *udi,
00073                      const char *capability);
00074 
00080 typedef void (*LibHalLostCapability) (LibHalContext *ctx, 
00081                       const char *udi,
00082                       const char *capability);
00083 
00091 typedef void (*LibHalDevicePropertyModified) (LibHalContext *ctx,
00092                           const char *udi,
00093                           const char *key,
00094                           dbus_bool_t is_removed,
00095                           dbus_bool_t is_added);
00096 
00106 typedef void (*LibHalDeviceCondition) (LibHalContext *ctx,
00107                        const char *udi,
00108                        const char *condition_name,
00109                        DBusMessage *message);
00110 
00111 
00117 typedef struct LibHalFunctions_s {
00121     LibHalIntegrateDBusIntoMainLoop main_loop_integration;
00122 
00124     LibHalDeviceAdded device_added;
00125 
00127     LibHalDeviceRemoved device_removed;
00128 
00130     LibHalNewCapability device_new_capability;
00131 
00133     LibHalLostCapability device_lost_capability;
00134 
00136     LibHalDevicePropertyModified device_property_modified;
00137 
00139     LibHalDeviceCondition device_condition;
00140 
00141 } LibHalFunctions;
00142 
00143 
00144 LibHalContext *hal_initialize (const LibHalFunctions * cb_functions,
00145                    dbus_bool_t use_cache);
00146 
00147 int hal_shutdown (LibHalContext *ctx);
00148 
00149 void hal_ctx_set_user_data(LibHalContext *ctx, void *user_data);
00150 
00151 void* hal_ctx_get_user_data(LibHalContext *ctx);
00152 
00153 char **hal_get_all_devices (LibHalContext *ctx, int *num_devices);
00154 dbus_bool_t hal_device_exists (LibHalContext *ctx, const char *udi);
00155 
00156 void hal_device_print (LibHalContext *ctx, const char *udi);
00157 
00158 dbus_bool_t hal_device_property_exists (LibHalContext *ctx, 
00159                     const char *udi,
00160                     const char *key);
00161 
00162 char *hal_device_get_property_string (LibHalContext *ctx, const char *udi,
00163                       const char *key);
00164 
00165 dbus_int32_t hal_device_get_property_int (LibHalContext *ctx, 
00166                       const char *udi,
00167                       const char *key);
00168 
00169 dbus_uint64_t hal_device_get_property_uint64 (LibHalContext *ctx, 
00170                       const char *udi,
00171                       const char *key);
00172 
00173 double hal_device_get_property_double (LibHalContext *ctx, 
00174                        const char *udi,
00175                        const char *key);
00176 
00177 dbus_bool_t hal_device_get_property_bool (LibHalContext *ctx, 
00178                       const char *udi,
00179                       const char *key);
00180 
00181 dbus_bool_t hal_device_set_property_string (LibHalContext *ctx, 
00182                         const char *udi,
00183                         const char *key,
00184                         const char *value);
00185 
00186 dbus_bool_t hal_device_set_property_int (LibHalContext *ctx, 
00187                      const char *udi,
00188                      const char *key,
00189                      dbus_int32_t value);
00190 
00191 dbus_bool_t hal_device_set_property_uint64 (LibHalContext *ctx, 
00192                      const char *udi,
00193                      const char *key,
00194                      dbus_uint64_t value);
00195 
00196 dbus_bool_t hal_device_set_property_double (LibHalContext *ctx, 
00197                         const char *udi,
00198                         const char *key,
00199                         double value);
00200 
00201 dbus_bool_t hal_device_set_property_bool (LibHalContext *ctx, 
00202                       const char *udi,
00203                       const char *key,
00204                       dbus_bool_t value);
00205 
00206 dbus_bool_t hal_device_remove_property (LibHalContext *ctx, 
00207                     const char *udi,
00208                     const char *key);
00209 
00210 int hal_device_get_property_type (LibHalContext *ctx, 
00211                   const char *udi,
00212                   const char *key);
00213 
00214 
00215 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00216 struct LibHalProperty_s;
00217 typedef struct LibHalProperty_s LibHalProperty;
00218 
00219 struct LibHalPropertySet_s;
00220 typedef struct LibHalPropertySet_s LibHalPropertySet;
00221 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00222 
00223 
00224 LibHalPropertySet *hal_device_get_all_properties (LibHalContext *ctx, 
00225                           const char *udi);
00226 
00227 void hal_free_property_set (LibHalPropertySet * set);
00228 
00230 struct LibHalPropertySetIterator_s {
00231     LibHalPropertySet *set;    
00232     unsigned int index;        
00233     LibHalProperty *cur_prop;  
00234     void *reservered0;         
00235     void *reservered1;         
00236 };
00237 
00238 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00239 typedef struct LibHalPropertySetIterator_s LibHalPropertySetIterator;
00240 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00241 
00242 void hal_psi_init (LibHalPropertySetIterator * iter,
00243            LibHalPropertySet * set);
00244 
00245 dbus_bool_t hal_psi_has_more (LibHalPropertySetIterator * iter);
00246 void hal_psi_next (LibHalPropertySetIterator * iter);
00247 
00248 int hal_psi_get_type (LibHalPropertySetIterator * iter);
00249 
00250 char *hal_psi_get_key (LibHalPropertySetIterator * iter);
00251 
00252 char *hal_psi_get_string (LibHalPropertySetIterator * iter);
00253 dbus_int32_t hal_psi_get_int (LibHalPropertySetIterator * iter);
00254 dbus_uint64_t hal_psi_get_uint64 (LibHalPropertySetIterator * iter);
00255 double hal_psi_get_double (LibHalPropertySetIterator * iter);
00256 dbus_bool_t hal_psi_get_bool (LibHalPropertySetIterator * iter);
00257 
00258 void hal_free_string_array (char **str_array);
00259 void hal_free_string (char *str);
00260 
00261 char *hal_agent_new_device (LibHalContext *ctx);
00262 dbus_bool_t hal_agent_commit_to_gdl (LibHalContext *ctx,
00263                      const char *temp_udi,
00264                      const char *udi);
00265 dbus_bool_t hal_agent_remove_device (LibHalContext *ctx, 
00266                      const char *udi);
00267 dbus_bool_t hal_agent_merge_properties (LibHalContext *ctx,
00268                     const char *target_udi,
00269                     const char *source_udi);
00270 
00271 dbus_bool_t hal_agent_device_matches (LibHalContext *ctx,
00272                       const char *udi1,
00273                       const char *udi2,
00274                       const char *property_namespace);
00275 
00276 char **hal_manager_find_device_string_match (LibHalContext *ctx,
00277                          const char *key,
00278                          const char *value,
00279                          int *num_devices);
00280 
00281 
00282 dbus_bool_t hal_device_add_capability (LibHalContext *ctx,
00283                        const char *udi,
00284                        const char *capability);
00285 
00286 dbus_bool_t hal_device_query_capability (LibHalContext *ctx,
00287                      const char *udi,
00288                      const char *capability);
00289 
00290 char **hal_find_device_by_capability (LibHalContext *ctx,
00291                       const char *capability,
00292                       int *num_devices);
00293 
00294 int hal_device_property_watch_all (LibHalContext *ctx);
00295 int hal_device_add_property_watch (LibHalContext *ctx, 
00296                    const char *udi);
00297 int hal_device_remove_property_watch (LibHalContext *ctx, 
00298                       const char *udi);
00299 
00300 dbus_bool_t hal_device_lock (LibHalContext *ctx,
00301                  const char *udi,
00302                  const char *reason_to_lock,
00303                  char **reason_why_locked);
00304 
00305 dbus_bool_t hal_device_unlock (LibHalContext *ctx,
00306                    const char *udi);
00307 
00310 #if defined(__cplusplus)
00311 }
00312 #endif
00313 
00314 #endif /* LIBHAL_H */

Generated on Wed Aug 13 16:57:54 2008 for HAL by  doxygen 1.3.9.1