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

libhal.h

00001 /***************************************************************************
00002  * CVSID: $Id: libhal.h,v 1.10 2004/01/17 01:59:51 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* dbus_connection);
00047 
00052 typedef void (*LibHalDeviceAdded)(const char* udi);
00053 
00058 typedef void (*LibHalDeviceRemoved)(const char* udi);
00059 
00065 typedef void (*LibHalNewCapability)(const char* udi, const char* capability);
00066 
00074 typedef void (*LibHalDevicePropertyModified)(const char* udi, 
00075                                              const char* key,
00076                                              dbus_bool_t is_removed,
00077                                              dbus_bool_t is_added);
00078 
00088 typedef void (*LibHalDeviceCondition)(const char* udi, 
00089                                       const char* condition_name,
00090                                       DBusMessage* message);
00091 
00092 
00098 typedef struct LibHalFunctions_s
00099 {
00103     LibHalIntegrateDBusIntoMainLoop    main_loop_integration;
00104 
00106     LibHalDeviceAdded                  device_added;
00107 
00109     LibHalDeviceRemoved                device_removed;
00110 
00112     LibHalNewCapability                device_new_capability;
00113 
00115     LibHalDevicePropertyModified       device_property_modified;
00116 
00118     LibHalDeviceCondition              device_condition;
00119 
00120 } LibHalFunctions;
00121 
00122 int hal_initialize(const LibHalFunctions* functions, dbus_bool_t use_cache);
00123 
00124 int hal_shutdown(void);
00125 
00126 char** hal_get_all_devices(int* num_devices);
00127 dbus_bool_t hal_device_exists(const char* udi);
00128 
00129 void hal_device_print(const char* udi);
00130 
00131 dbus_bool_t hal_device_property_exists(const char* udi, const char* key);
00132 
00133 char* hal_device_get_property_string(const char* udi, const char* key);
00134 dbus_int32_t hal_device_get_property_int(const char* udi,const char* key);
00135 double hal_device_get_property_double(const char* udi, const char* key);
00136 dbus_bool_t hal_device_get_property_bool(const char* udi, const char* key);
00137 
00138 dbus_bool_t hal_device_set_property_string(const char* udi, 
00139                                            const char* key, 
00140                                            const char* value);
00141 dbus_bool_t hal_device_set_property_int(const char* udi, 
00142                                         const char* key, 
00143                                         dbus_int32_t value);
00144 dbus_bool_t hal_device_set_property_double(const char* udi, 
00145                                            const char* key, 
00146                                            double value);
00147 dbus_bool_t hal_device_set_property_bool(const char* udi, 
00148                                          const char* key, 
00149                                          dbus_bool_t value);
00150 dbus_bool_t hal_device_remove_property(const char* udi, const char* key);
00151 
00152 int hal_device_get_property_type(const char* udi, const char* key);
00153 
00154 
00155 struct LibHalProperty_s;
00156 typedef struct LibHalProperty_s LibHalProperty;
00157 
00158 struct LibHalPropertySet_s;
00159 typedef struct LibHalPropertySet_s LibHalPropertySet;
00160 
00161 LibHalPropertySet* hal_device_get_all_properties(const char* udi);
00162 
00163 void hal_free_property_set(LibHalPropertySet* set);
00164 
00166 struct LibHalPropertySetIterator_s
00167 {
00168     LibHalPropertySet* set;
00169     unsigned int index;
00170     LibHalProperty* cur_prop;
00171     void* reservered0;
00172     void* reservered1;
00173 };
00174 
00175 typedef struct LibHalPropertySetIterator_s LibHalPropertySetIterator;
00176 
00177 void hal_psi_init(LibHalPropertySetIterator* iter, LibHalPropertySet* set);
00178 
00179 dbus_bool_t hal_psi_has_more(LibHalPropertySetIterator* iter);
00180 void hal_psi_next(LibHalPropertySetIterator* iter);
00181 
00182 int hal_psi_get_type(LibHalPropertySetIterator* iter);
00183 
00184 char* hal_psi_get_key(LibHalPropertySetIterator* iter);
00185 
00186 char* hal_psi_get_string(LibHalPropertySetIterator* iter);
00187 dbus_int32_t hal_psi_get_int(LibHalPropertySetIterator* iter);
00188 double hal_psi_get_double(LibHalPropertySetIterator* iter);
00189 dbus_bool_t hal_psi_get_bool(LibHalPropertySetIterator* iter);
00190 
00191 void hal_free_string_array(char** str_array);
00192 void hal_free_string(char* str);
00193 
00194 char* hal_agent_new_device(void);
00195 dbus_bool_t hal_agent_commit_to_gdl(const char* temp_udi, const char* udi);
00196 dbus_bool_t hal_agent_remove_device(const char* udi);
00197 dbus_bool_t hal_agent_merge_properties(const char* udi, const char* from_udi);
00198 
00199 dbus_bool_t hal_agent_device_matches(const char* udi1, const char* udi2, 
00200                                      const char* namespace);
00201 
00202 char** hal_manager_find_device_string_match(const char* key,
00203                                             const char* value,
00204                                             int* num_devices);
00205 
00206 
00207 dbus_bool_t hal_device_add_capability(const char* device, 
00208                                       const char* capability);
00209 
00210 dbus_bool_t hal_device_query_capability(const char* udi, 
00211                                         const char* capability);
00212 
00213 char** hal_find_device_by_capability(const char* capability, int* num_devices);
00214 
00215 int hal_device_property_watch_all(void);
00216 int hal_device_add_property_watch(const char* udi);
00217 int hal_device_remove_property_watch(const char* udi);
00218 
00221 #if defined(__cplusplus)
00222 }
00223 #endif
00224 
00225 #endif /* LIBHAL_H */

Generated on Sat Feb 7 22:11:46 2004 for HAL by doxygen 1.3.5