DevkitDevice

DevkitDevice — Details about a device

Synopsis


#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);

Object Hierarchy

  GObject
   +----DevkitDevice

Description

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().

Details

DevkitDevice

typedef struct _DevkitDevice DevkitDevice;

The DevkitDevice struct is opaque and should not be accessed directly.


DevkitDeviceClass

typedef struct {
        GObjectClass   parent_class;
} DevkitDeviceClass;

Class structure for DevkitDevice.

GObjectClass parent_class;

Parent class.

DevkitDeviceForeachFunc ()

gboolean            (*DevkitDeviceForeachFunc)          (DevkitDevice *device,
                                                         const gchar *key,
                                                         const gchar *value,
                                                         gpointer user_data);

Callback function used in devkit_device_properties_foreach().

device :

the DevkitDevice for we are iterating over.

key :

property key.

value :

property value.

user_data :

user data.

Returns :

return TRUE to top the iteration.

devkit_device_get_subsystem ()

const gchar *       devkit_device_get_subsystem         (DevkitDevice *device);

Get the OS specific subsystem for device.

device :

a DevkitDevice.

Returns :

the OS-specific subsystem for device.

devkit_device_get_native_path ()

const gchar *       devkit_device_get_native_path       (DevkitDevice *device);

Get the OS specific native path for device.

device :

a DevkitDevice.

Returns :

the OS-specific native path for device.

devkit_device_get_device_file ()

const gchar *       devkit_device_get_device_file       (DevkitDevice *device);

Get the UNIX device file, if any, for device.

device :

a DevkitDevice.

Returns :

the UNIX device file for device or NULL if no UNIX device file exists.

devkit_device_get_device_file_symlinks ()

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.

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.

devkit_device_properties_foreach ()

gboolean            devkit_device_properties_foreach    (DevkitDevice *device,
                                                         DevkitDeviceForeachFunc func,
                                                         gpointer user_data);

Iterates over all properties of device.

device :

a DevkitDevice.

func :

a callback function of type DevkitDeviceForeachFunc

user_data :

data to pass to func

Returns :

TRUE only if func short-circuited the iteration.

devkit_device_has_property ()

gboolean            devkit_device_has_property          (DevkitDevice *device,
                                                         const gchar *key);

Check if a the property with the given key exists.

device :

a DevkitDevice.

key :

name of property.

Returns :

TRUE only if the value for key exist.

devkit_device_get_property ()

const gchar *       devkit_device_get_property          (DevkitDevice *device,
                                                         const gchar *key);

Look up the value for key on device.

device :

a DevkitDevice.

key :

name of property.

Returns :

the value for key or NULL if key doesn't exist on device.

devkit_device_get_property_as_int ()

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.

device :

a DevkitDevice.

key :

name of property.

Returns :

the value for key or G_MAXINT if key doesn't exist or isn't an integer.

devkit_device_get_property_as_uint64 ()

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.

device :

a DevkitDevice.

key :

name of property.

Returns :

the value for key or G_MAXUINT64 if key doesn't exist or isn't a guint64.

devkit_device_get_property_as_boolean ()

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.

device :

a DevkitDevice.

key :

name of property.

Returns :

the value for key or FALSE if key doesn't exist or isn't a gboolean.

devkit_device_dup_property_as_str ()

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.

device :

a DevkitDevice.

key :

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().

devkit_device_dup_property_as_strv ()

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.

device :

a DevkitDevice.

key :

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().