/***************************************************************************
* CVSID: $Id$
*
* libhal.h : HAL daemon C convenience library headers
*
* Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
* Copyright (C) 2007 Codethink Ltd. Author Rob Taylor <rob.taylor@codethink.co.uk>
*
* Licensed under the Academic Free License version 2.1
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
**************************************************************************/
#ifndef LIBHAL_H
#define LIBHAL_H
#if defined(__cplusplus)
extern "C" {
#if 0
} /* shut up emacs indenting */
#endif
#endif
#if defined(__GNUC__)
#else
#define LIBHAL_DEPRECATED
#endif
do { \
if (dbus_error_is_set(_dbus_error_)) \
} while (0)
/**
* LIBHAL_CHECK_LIBHALCONTEXT:
* @_ctx_: the context
* @_ret_: what to use for return value if context is invalid
*
* Handy macro for checking whether a context is valid.
*/
do { \
"%s %d : LibHalContext *ctx is NULL\n", \
return _ret_; \
} \
} while(0)
/**
* LibHalPropertyType:
*
* Possible types for properties on hal device objects
*/
typedef enum {
/** Used to report error condition */
/** Type for 32-bit signed integer property */
/** Type for 64-bit unsigned integer property */
/** Type for double precision floating point property */
/** Type for boolean property */
/** Type for UTF-8 string property */
/** Type for list of UTF-8 strings property */
/**
* LibHalIntegrateDBusIntoMainLoop:
* @ctx: context for connection to hald
* @dbus_connection: DBus connection to use in ctx
*
* Type for function in application code that integrates a
* DBusConnection object into its own mainloop.
*/
/**
* LibHalDeviceAdded:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
*
* Type for callback when a device is added.
*/
const char *udi);
/**
* LibHalDeviceRemoved:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
*
* Type for callback when a device is removed.
*/
const char *udi);
/**
* LibHalDeviceNewCapability:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
* @capability: capability of the device
*
* Type for callback when a device gains a new capability.
*
*/
const char *udi,
const char *capability);
/**
* LibHalDeviceLostCapability:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
* @capability: capability of the device
*
* Type for callback when a device loses a capability.
*
*/
const char *udi,
const char *capability);
/**
* LibHalDevicePropertyModified:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
* @key: name of the property that has changed
* @is_removed: whether or not property was removed
* @is_added: whether or not property was added
*
* Type for callback when a property of a device changes.
*/
const char *udi,
const char *key,
/**
* LibHalDeviceCondition:
* @ctx: context for connection to hald
* @udi: the Unique Device Id
* @condition_name: name of the condition, e.g. ProcessorOverheating. Consult the HAL spec for details
* @condition_detail: detail of condition
*
* Type for callback when a non-continuous condition occurs on a device.
*/
const char *udi,
const char *condition_name,
const char *condition_detail);
/* Create a new context for a connection with hald */
LibHalContext *libhal_ctx_new (void);
/* Enable or disable caching */
/* Set DBus connection to use to talk to hald. */
/* Get DBus connection to use to talk to hald. */
/* Set user data for the context */
/* Get user data for the context */
/* Set the callback for when a device is added */
/* Set the callback for when a device is removed */
/* Set the callback for when a device gains a new capability */
dbus_bool_t libhal_ctx_set_device_new_capability (LibHalContext *ctx, LibHalDeviceNewCapability callback);
/* Set the callback for when a device loses a capability */
dbus_bool_t libhal_ctx_set_device_lost_capability (LibHalContext *ctx, LibHalDeviceLostCapability callback);
/* Set the callback for when a property is modified on a device */
dbus_bool_t libhal_ctx_set_device_property_modified (LibHalContext *ctx, LibHalDevicePropertyModified callback);
/* Set the callback for when a device emits a condition */
/* Initialize the connection to hald */
/* Shut down a connection to hald */
/* Free a LibHalContext resource */
/* Create an already initialized connection to hald */
/* Get all devices in the Global Device List (GDL). */
/* Determine if a device exists. */
/* Print a device to stdout; useful for debugging. */
/* Determine if a property on a device exists. */
const char *udi,
const char *key,
/* Get the value of a property of type string. */
const char *udi,
const char *key,
/* Get the value of a property of type signed integer. */
const char *udi,
const char *key,
/* Get the value of a property of type unsigned integer. */
const char *udi,
const char *key,
/* Get the value of a property of type double. */
const char *udi,
const char *key,
/* Get the value of a property of type bool. */
const char *udi,
const char *key,
/* Get the value of a property of type string list. */
const char *udi,
const char *key,
/* Set a property of type string. */
const char *udi,
const char *key,
const char *value,
/* Set a property of type signed integer. */
const char *udi,
const char *key,
/* Set a property of type unsigned integer. */
const char *udi,
const char *key,
/* Set a property of type double. */
const char *udi,
const char *key,
double value,
/* Set a property of type bool. */
const char *udi,
const char *key,
/* Append to a property of type strlist. */
const char *udi,
const char *key,
const char *value,
/* Prepend to a property of type strlist. */
const char *udi,
const char *key,
const char *value,
/* Remove a specified string from a property of type strlist. */
const char *udi,
const char *key,
unsigned int idx,
/* Remove a specified string from a property of type strlist. */
const char *udi,
const char *key,
const char *value,
/* Remove a property. */
const char *udi,
const char *key,
/* Query a property type of a device. */
const char *udi,
const char *key,
struct LibHalChangeSet_s;
const char *key,
const char *value);
const char *key,
const char *key,
const char *key,
double value);
const char *key,
const char *key,
const char **value);
struct LibHalProperty_s;
struct LibHalPropertySet_s;
/* Retrieve all the properties on a device. */
const char *udi,
/* Free a property set earlier obtained with libhal_device_get_all_properties(). */
/* Get the number of properties in a property set. */
/* Get type of property. */
/* Get the value of a property of type string. */
/* Get the value of a property of type signed integer. */
/* Get the value of a property of type unsigned integer. */
/* Get the value of a property of type double. */
/* Get the value of a property of type bool. */
/* Get the value of a property of type string list. */
/**
* LibHalPropertySetIterator:
*
* Iterator for inspecting all properties. Do not access any members;
* use the libhal_psi_* family of functions instead.
*/
struct LibHalPropertySetIterator_s {
};
/* Initialize a property set iterator. */
/* Determine whether there are more properties to iterate over */
/* Advance iterator to next property. */
/* Get type of property. */
/* Get the key of a property. */
/* Get the value of a property of type string. */
/* Get the value of a property of type signed integer. */
/* Get the value of a property of type unsigned integer. */
/* Get the value of a property of type double. */
/* Get the value of a property of type bool. */
/* Get the value of a property of type string list. */
/* Get the length of an array of strings */
unsigned int libhal_string_array_length (char **str_array);
/* Frees a NULL-terminated array of strings. If passed NULL, does nothing. */
void libhal_free_string_array (char **str_array);
/* Frees a nul-terminated string */
void libhal_free_string (char *str);
/* Create a new device object which will be hidden from applications
* until the CommitToGdl(), ie. libhal_device_commit_to_gdl(), method is called.
*/
/* When a hidden device has been built using the NewDevice method, ie.
* libhal_new_device(), and the org.freedesktop.Hal.Device interface
* this function will commit it to the global device list.
*/
const char *temp_udi,
const char *udi,
/* This method can be invoked when a device is removed. The HAL daemon
* will shut down the device. Note that the device may still be in the device
* list if the Persistent property is set to true.
*/
const char *udi,
/* Merge properties from one device to another. */
const char *target_udi,
const char *source_udi,
/* Check a set of properties for two devices matches. */
const char *udi1,
const char *udi2,
const char *property_namespace,
/* Find a device in the GDL where a single string property matches a
* given value.
*/
const char *key,
const char *value,
int *num_devices,
/* Assign a capability to a device. */
const char *udi,
const char *capability,
/* Check if a device has a capability. The result is undefined if the
* device doesn't exist.
*/
const char *udi,
const char *capability,
/* Find devices with a given capability. */
const char *capability,
int *num_devices,
/* Watch all devices, ie. the device_property_changed callback is
* invoked when the properties on any device changes.
*/
/* Add a watch on a device, so the device_property_changed callback is
* invoked when the properties on the given device changes.
*/
const char *udi,
/* Remove a watch on a device */
const char *udi,
/* Take an advisory lock on the device. */
const char *udi,
const char *reason_to_lock,
char **reason_why_locked,
/* Release an advisory lock on the device. */
const char *udi,
const char *udi,
const char *udi,
/* Emit a condition from a device (for hald helpers only) */
const char *udi,
const char *condition_name,
const char *condition_details,
/* Claim an interface for a device (for hald helpers only) */
const char *udi,
const char *interface_name,
const char *introspection_xml,
/* hald waits for all addons to call this function before announcing the addon (for hald helpers only) */
#if defined(__cplusplus)
}
#endif
#endif /* LIBHAL_H */