![]() |
![]() |
![]() |
DeviceKit Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <devkit-gobject/devkit-gobject.h> DevkitClient; DevkitClientClass; DevkitClient * devkit_client_new (const gchar **subsystems); gboolean devkit_client_connect (DevkitClient *client, GError **error); GList * devkit_client_enumerate_by_subsystem (DevkitClient *client, const gchar **subsystems, GError **error); GList * devkit_client_enumerate_by_native_path (DevkitClient *client, const gchar **native_paths, GError **error); const gchar * devkit_client_get_daemon_version (DevkitClient *client);
This class provides an interface to the DeviceKit daemon for device enumeration and changes. To get informed about changes, connect to the "device-event" signal.
typedef struct _DevkitClient DevkitClient;
The DevkitClient struct is opaque and should not be accessed directly.
typedef struct { GObjectClass parent_class; /* signals */ void (*device_event) (DevkitClient *client, const gchar *action, DevkitDevice *device); } DevkitClientClass;
Class structure for DevkitClient.
GObjectClass |
Parent class. |
|
Signal class handler for the "device-event" signal. |
DevkitClient * devkit_client_new (const gchar **subsystems);
Constructs a DevkitClient object that listen for device events for
devices belonging to subsystems
and emits signals. You need to call
devkit_client_connect()
before it can be used.
|
Either NULL to listen on events on all subsystems or
a NULL terminated string array of of subsystems to listen for
events on.
|
Returns : |
A new DevkitClient object. |
gboolean devkit_client_connect (DevkitClient *client, GError **error);
Connects to the DeviceKit daemon and starts listening for
events. The DeviceKit daemon will be inhibited from shutting down
until client
is disposed.
|
A DevkitClient object. |
|
Return location for error. |
Returns : |
TRUE if the connection was made, FALSE if error is set.
|
GList * devkit_client_enumerate_by_subsystem (DevkitClient *client, const gchar **subsystems, GError **error);
Retrieves an ordered list of the devices belonging to subsystems
from the DeviceKit daemon.
|
A DevkitClient object. |
|
Either NULL to enumerate all devices or a NULL
terminated string array detailing what subsystems to get
information about.
|
|
Return location for error. |
Returns : |
NULL if error is set, otherwise a list of DevkitDevice objects. The caller should free this by using g_object_unref() on each element in the list and then g_list_free() on the list.
|
GList * devkit_client_enumerate_by_native_path (DevkitClient *client, const gchar **native_paths, GError **error);
Retrieves an ordered list of the devices with information about the
devices given in native_paths
from the DeviceKit daemon.
|
A DevkitClient object. |
|
A NULL terminated string array of native paths.
|
|
Return location for error. |
Returns : |
NULL if error is set, otherwise a list of DevkitDevice objects. The caller should free this by using g_object_unref() on each element in the list and then g_list_free() on the list.
|
const gchar * devkit_client_get_daemon_version (DevkitClient *client);
Gets the version of the running daemon.
|
a DevkitClient |
Returns : |
The version of the running daemon. |
"daemon-version"
property"daemon-version" gchar* : Read
The version of the running DeviceKit daemon.
Default value: NULL
"subsystems"
property"subsystems" GStrv* : Read / Write / Construct Only
The subsystems to listen for events on from the DeviceKit
daemon and generate "device-event" signals
from. If NULL
, events from all subsystems will be
reported.
"device-event"
signalvoid user_function (DevkitClient *client, gchar *action, DevkitDevice *device, gpointer user_data) : Run Last
Emitted when an event is happening on a device.
|
a DevkitClient. |
|
an OS-specific string (e.g. "add", "remove", "change") describing the event |
|
details about the DevkitDevice the event is happening on. |
|
user data set when the signal handler was connected. |