devicelist.h

Go to the documentation of this file.
00001 #ifndef __DEVICELIST_H__
00002 #define __DEVICELIST_H__
00003 
00004 /**
00005  * File Name  : devicelist.h
00006  *
00007  * Description: Functions to maintain a list of available HAL devices
00008  */
00009 
00010 /*
00011  * This file is part of sysd.
00012  *
00013  * sysd is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * sysd is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2008 iRex Technologies B.V.
00029  * All rights reserved.
00030  *
00031  * Parts used from halevt, Copyright (C) 2007  Patrice Dumas <pertusus at free dot fr>
00032  */
00033 
00034 
00035 //----------------------------------------------------------------------------
00036 // Include Files
00037 //----------------------------------------------------------------------------
00038 
00039 #include <hal/libhal.h>
00040 
00041 G_BEGIN_DECLS
00042 
00043 
00044 //----------------------------------------------------------------------------
00045 // Definitions
00046 //---------------------------------------------------------------------------- 
00047 
00048 
00049 //----------------------------------------------------------------------------
00050 // Type Declarations
00051 //----------------------------------------------------------------------------
00052 
00053 typedef struct hal_device_property
00054 {
00055   char *key;
00056   char **values;
00057   struct hal_device_property *next;
00058 } hal_device_property;
00059 
00060 typedef struct hal_device
00061 {
00062    char *udi;
00063    struct hal_device_property *properties;
00064    struct hal_device *next;
00065 } hal_device;
00066 
00067 
00068 //----------------------------------------------------------------------------
00069 // Global Constants
00070 //----------------------------------------------------------------------------
00071 
00072 
00073 //============================================================================
00074 // Public Functions
00075 //============================================================================
00076 
00077 /**---------------------------------------------------------------------------
00078  *
00079  * Name :  hal_device_list_add_device
00080  *
00081  * @brief  Add udi to device list
00082  *
00083  * @param  ctx HAL context
00084  * @param  udi Unique Device Id
00085  *
00086  * @return 
00087  *
00088  *--------------------------------------------------------------------------*/
00089 hal_device *hal_device_list_add_device(LibHalContext *ctx, const char *udi);
00090 
00091 /**---------------------------------------------------------------------------
00092  *
00093  * Name :  hal_device_list_get_property
00094  *
00095  * @brief  Return the property of the given device
00096  *
00097  * @param  property 
00098  * @param  device
00099  *
00100  * @return 
00101  *
00102  *--------------------------------------------------------------------------*/
00103 hal_device_property *hal_device_list_get_property(const char *property, const hal_device *device);
00104 
00105 /**---------------------------------------------------------------------------
00106  *
00107  * Name :  hal_device_list_find_device
00108  *
00109  * @brief  Return the device pointed to by udi
00110  *
00111  * @param  udi Unique Device Id
00112  *
00113  * @return 
00114  *
00115  *--------------------------------------------------------------------------*/
00116 hal_device *hal_device_list_find_device(const char *udi);
00117 
00118 /**---------------------------------------------------------------------------
00119  *
00120  * Name :  hal_device_list_get_root
00121  *
00122  * @brief  Get device llst root 
00123  *
00124  * @param  --
00125  *
00126  * @return Returns root of device list
00127  *
00128  *--------------------------------------------------------------------------*/
00129 hal_device *hal_device_list_get_root();
00130 
00131 /**---------------------------------------------------------------------------
00132  *
00133  * Name :  hal_device_list_remove_device
00134  *
00135  * @brief  Remove udi from device list
00136  *
00137  * @param  udi Unique Device Id
00138  *
00139  * @return Returns TRUE on success, FALSE on failure
00140  *
00141  *--------------------------------------------------------------------------*/
00142 gboolean hal_device_list_remove_device(const char *udi);
00143 
00144 /**---------------------------------------------------------------------------
00145  *
00146  * Name :  hal_device_list_remove_property
00147  *
00148  * @brief  Remove property of udi from device list
00149  *
00150  * @param  udi Unique Device Id
00151  * @param  key
00152  *
00153  * @return Returns TRUE on success, FALSE on failure
00154  *
00155  *--------------------------------------------------------------------------*/
00156 gboolean hal_device_list_remove_property(const char *udi, const char *key);
00157 
00158 /**---------------------------------------------------------------------------
00159  *
00160  * Name :  hal_device_list_set_property
00161  *
00162  * @brief  Set property of udi from device list
00163  *
00164  * @param  udi Unique Device Id
00165  * @param  key
00166  *
00167  * @return Returns TRUE on success, FALSE on failure
00168  *
00169  *--------------------------------------------------------------------------*/
00170 gboolean hal_device_list_set_property(const char *udi, const char *key);
00171 
00172 /**---------------------------------------------------------------------------
00173  *
00174  * Name :  hal_print_all_devices
00175  *
00176  * @brief  Print all available devices (for debugging)
00177  *
00178  * @return --
00179  *
00180  *--------------------------------------------------------------------------*/
00181 void hal_print_all_devices();
00182 
00183 /**---------------------------------------------------------------------------
00184  *
00185  * Name :  hal_count_devices
00186  *
00187  * @brief  Return the number of devices available
00188  *
00189  * @return Number of devices
00190  *
00191  *--------------------------------------------------------------------------*/
00192 int hal_count_devices();
00193 
00194 G_END_DECLS
00195 
00196 #endif /* __DEVICELIST_H__ */
Generated by  doxygen 1.6.2-20100208