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

libhal.h

00001 /***************************************************************************
00002  * CVSID: $Id: libhal.h,v 1.11 2004/03/03 17:56: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 #if defined(__cplusplus)
00032 extern "C" {
00033 #endif
00034 
00046 typedef void (*LibHalIntegrateDBusIntoMainLoop) (DBusConnection *
00047                          dbus_connection);
00048 
00053 typedef void (*LibHalDeviceAdded) (const char *udi);
00054 
00059 typedef void (*LibHalDeviceRemoved) (const char *udi);
00060 
00066 typedef void (*LibHalNewCapability) (const char *udi,
00067                      const char *capability);
00068 
00076 typedef void (*LibHalDevicePropertyModified) (const char *udi,
00077                           const char *key,
00078                           dbus_bool_t is_removed,
00079                           dbus_bool_t is_added);
00080 
00090 typedef void (*LibHalDeviceCondition) (const char *udi,
00091                        const char *condition_name,
00092                        DBusMessage *message);
00093 
00094 
00100 typedef struct LibHalFunctions_s {
00104     LibHalIntegrateDBusIntoMainLoop main_loop_integration;
00105 
00107     LibHalDeviceAdded device_added;
00108 
00110     LibHalDeviceRemoved device_removed;
00111 
00113     LibHalNewCapability device_new_capability;
00114 
00116     LibHalDevicePropertyModified device_property_modified;
00117 
00119     LibHalDeviceCondition device_condition;
00120 
00121 } LibHalFunctions;
00122 
00123 int hal_initialize (const LibHalFunctions * functions,
00124             dbus_bool_t use_cache);
00125 
00126 int hal_shutdown (void);
00127 
00128 char **hal_get_all_devices (int *num_devices);
00129 dbus_bool_t hal_device_exists (const char *udi);
00130 
00131 void hal_device_print (const char *udi);
00132 
00133 dbus_bool_t hal_device_property_exists (const char *udi,
00134                     const char *key);
00135 
00136 char *hal_device_get_property_string (const char *udi,
00137                       const char *key);
00138 
00139 dbus_int32_t hal_device_get_property_int (const char *udi,
00140                       const char *key);
00141 
00142 double hal_device_get_property_double (const char *udi,
00143                        const char *key);
00144 
00145 dbus_bool_t hal_device_get_property_bool (const char *udi,
00146                       const char *key);
00147 
00148 dbus_bool_t hal_device_set_property_string (const char *udi,
00149                         const char *key,
00150                         const char *value);
00151 
00152 dbus_bool_t hal_device_set_property_int (const char *udi,
00153                      const char *key,
00154                      dbus_int32_t value);
00155 
00156 dbus_bool_t hal_device_set_property_double (const char *udi,
00157                         const char *key,
00158                         double value);
00159 
00160 dbus_bool_t hal_device_set_property_bool (const char *udi,
00161                       const char *key,
00162                       dbus_bool_t value);
00163 
00164 dbus_bool_t hal_device_remove_property (const char *udi,
00165                     const char *key);
00166 
00167 int hal_device_get_property_type (const char *udi,
00168                   const char *key);
00169 
00170 
00171 struct LibHalProperty_s;
00172 typedef struct LibHalProperty_s LibHalProperty;
00173 
00174 struct LibHalPropertySet_s;
00175 typedef struct LibHalPropertySet_s LibHalPropertySet;
00176 
00177 LibHalPropertySet *hal_device_get_all_properties (const char *udi);
00178 
00179 void hal_free_property_set (LibHalPropertySet * set);
00180 
00182 struct LibHalPropertySetIterator_s {
00183     LibHalPropertySet *set;
00184     unsigned int index;
00185     LibHalProperty *cur_prop;
00186     void *reservered0;
00187     void *reservered1;
00188 };
00189 
00190 typedef struct LibHalPropertySetIterator_s
00191 LibHalPropertySetIterator;
00192 
00193 void hal_psi_init (LibHalPropertySetIterator * iter,
00194            LibHalPropertySet * set);
00195 
00196 dbus_bool_t hal_psi_has_more (LibHalPropertySetIterator * iter);
00197 void hal_psi_next (LibHalPropertySetIterator * iter);
00198 
00199 int hal_psi_get_type (LibHalPropertySetIterator * iter);
00200 
00201 char *hal_psi_get_key (LibHalPropertySetIterator * iter);
00202 
00203 char *hal_psi_get_string (LibHalPropertySetIterator * iter);
00204 dbus_int32_t hal_psi_get_int (LibHalPropertySetIterator * iter);
00205 double hal_psi_get_double (LibHalPropertySetIterator * iter);
00206 dbus_bool_t hal_psi_get_bool (LibHalPropertySetIterator * iter);
00207 
00208 void hal_free_string_array (char **str_array);
00209 void hal_free_string (char *str);
00210 
00211 char *hal_agent_new_device (void);
00212 dbus_bool_t hal_agent_commit_to_gdl (const char *temp_udi,
00213                      const char *udi);
00214 dbus_bool_t hal_agent_remove_device (const char *udi);
00215 dbus_bool_t hal_agent_merge_properties (const char *udi,
00216                     const char *from_udi);
00217 
00218 dbus_bool_t hal_agent_device_matches (const char *udi1,
00219                       const char *udi2,
00220                       const char *namespace);
00221 
00222 char **hal_manager_find_device_string_match (const char *key,
00223                          const char *value,
00224                          int *num_devices);
00225 
00226 
00227 dbus_bool_t hal_device_add_capability (const char *device,
00228                        const char *capability);
00229 
00230 dbus_bool_t hal_device_query_capability (const char *udi,
00231                      const char *capability);
00232 
00233 char **hal_find_device_by_capability (const char *capability,
00234                       int *num_devices);
00235 
00236 int hal_device_property_watch_all (void);
00237 int hal_device_add_property_watch (const char *udi);
00238 int hal_device_remove_property_watch (const char *udi);
00239 
00242 #if defined(__cplusplus)
00243 }
00244 #endif
00245 #endif              /* LIBHAL_H */

Generated on Thu Mar 11 21:32:22 2004 for HAL by doxygen 1.3.6-20040222