![]() |
![]() |
![]() |
DeviceKit Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <devkit-gobject/devkit-gobject.h> DevkitDevice; DevkitDeviceClass; gboolean (*DevkitDeviceForeachFunc) (DevkitDevice *device, const gchar *key, const gchar *value, gpointer user_data); const gchar * devkit_device_get_subsystem (DevkitDevice *device); const gchar * devkit_device_get_native_path (DevkitDevice *device); const gchar * devkit_device_get_device_file (DevkitDevice *device); const gchar ** devkit_device_get_device_file_symlinks (DevkitDevice *device); gboolean devkit_device_properties_foreach (DevkitDevice *device, DevkitDeviceForeachFunc func, gpointer user_data); gboolean devkit_device_has_property (DevkitDevice *device, const gchar *key); const gchar * devkit_device_get_property (DevkitDevice *device, const gchar *key); gint devkit_device_get_property_as_int (DevkitDevice *device, const gchar *key); guint64 devkit_device_get_property_as_uint64 (DevkitDevice *device, const gchar *key); gboolean devkit_device_get_property_as_boolean (DevkitDevice *device, const gchar *key); gchar * devkit_device_dup_property_as_str (DevkitDevice *device, const gchar *key); gchar ** devkit_device_dup_property_as_strv (DevkitDevice *device, const gchar *key);
This class wraps details about a device. Instances of this class are returned
to signals handlers for the "device-event" signal and in the result
for enumeration functions such as devkit_client_enumerate_by_subsystem()
.
typedef struct _DevkitDevice DevkitDevice;
The DevkitDevice struct is opaque and should not be accessed directly.
typedef struct { GObjectClass parent_class; } DevkitDeviceClass;
Class structure for DevkitDevice.
GObjectClass |
Parent class. |
gboolean (*DevkitDeviceForeachFunc) (DevkitDevice *device, const gchar *key, const gchar *value, gpointer user_data);
Callback function used in devkit_device_properties_foreach()
.
|
the DevkitDevice for we are iterating over. |
|
property key. |
|
property value. |
|
user data. |
Returns : |
return TRUE to top the iteration.
|
const gchar * devkit_device_get_subsystem (DevkitDevice *device);
Get the OS specific subsystem for device
.
|
a DevkitDevice. |
Returns : |
the OS-specific subsystem for device .
|
const gchar * devkit_device_get_native_path (DevkitDevice *device);
Get the OS specific native path for device
.
|
a DevkitDevice. |
Returns : |
the OS-specific native path for device .
|
const gchar * devkit_device_get_device_file (DevkitDevice *device);
Get the UNIX device file, if any, for device
.
|
a DevkitDevice. |
Returns : |
the UNIX device file for device or NULL if no UNIX device file exists.
|
const gchar ** devkit_device_get_device_file_symlinks (DevkitDevice *device);
Get a list of symlinks (in /dev
) that points to the UNIX device for device
.
|
a DevkitDevice. |
Returns : |
a NULL terminated string array of symlinks. This array is
owned by device and should not be freed by the caller.
|
gboolean devkit_device_properties_foreach (DevkitDevice *device, DevkitDeviceForeachFunc func, gpointer user_data);
Iterates over all properties of device
.
|
a DevkitDevice. |
|
a callback function of type DevkitDeviceForeachFunc |
|
data to pass to func
|
Returns : |
TRUE only if func short-circuited the iteration.
|
gboolean devkit_device_has_property (DevkitDevice *device, const gchar *key);
Check if a the property with the given key exists.
|
a DevkitDevice. |
|
name of property. |
Returns : |
TRUE only if the value for key exist.
|
const gchar * devkit_device_get_property (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value for key or NULL if key doesn't exist on device .
|
gint devkit_device_get_property_as_int (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
and convert it to an integer.
If key
doesn't exist a warning will be printed on stderr.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value for key or G_MAXINT if key doesn't exist or isn't an integer.
|
guint64 devkit_device_get_property_as_uint64 (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
and convert it to an unsigned 64-bit integer.
If key
doesn't exist a warning will be printed on stderr.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value for key or G_MAXUINT64 if key doesn't exist or isn't a guint64.
|
gboolean devkit_device_get_property_as_boolean (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
and convert it to an boolean.
If key
doesn't exist a warning will be printed on stderr.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value for key or FALSE if key doesn't exist or isn't a gboolean.
|
gchar * devkit_device_dup_property_as_str (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
and return a duplicate string.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value of key on device or NULL if key doesn't exist. Caller must free this string with g_free() .
|
gchar ** devkit_device_dup_property_as_strv (DevkitDevice *device, const gchar *key);
Look up the value for key
on device
and return the result of
splitting it into tokens split at white space points.
|
a DevkitDevice. |
|
name of property. |
Returns : |
the value of key on device split into tokens or NULL if key doesn't exist. Caller must free this string array with g_strfreev() .
|