![]() |
![]() |
![]() |
Spice-GTK Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#include <usb-device-manager.h> #define SPICE_TYPE_USB_DEVICE struct SpiceUsbDeviceManager; struct SpiceUsbDeviceManagerClass; SpiceUsbDeviceManager * spice_usb_device_manager_get (SpiceSession *session
,GMainContext *main_context
,GError **err
); GPtrArray * spice_usb_device_manager_get_devices (SpiceUsbDeviceManager *manager
); gboolean spice_usb_device_manager_is_device_connected (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
); gboolean spice_usb_device_manager_connect_device (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
,GError **err
); void spice_usb_device_manager_disconnect_device (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
); gchar * spice_usb_device_get_description (SpiceUsbDevice *device
); SpiceUsbDevice;
"auto-connect" gboolean : Read / Write "main-context" gpointer : Read / Write / Construct Only "session" SpiceSession* : Read / Write / Construct Only
SpiceUsbDeviceManager monitors USB redirection channels and USB
devices plugging/unplugging. If "auto-connect"
is set to TRUE
, it will automatically connect newly plugged USB
devices to available channels.
There should always be a 1:1 relation between SpiceUsbDeviceManager objects
and SpiceSession objects. Therefor there is no
spice_usb_device_manager_new, instead there is
spice_usb_device_manager_get()
which ensures this 1:1 relation.
struct SpiceUsbDeviceManager;
The SpiceUsbDeviceManager struct is opaque and should not be accessed directly.
struct SpiceUsbDeviceManagerClass { GObjectClass parent_class; /* signals */ void (*device_added) (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device); void (*device_removed) (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device); void (*auto_connect_failed) (SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *error); };
Class structure for SpiceUsbDeviceManager.
Parent class. | |
Signal class handler for the "device-added" signal. | |
Signal class handler for the "device-removed" signal. | |
Signal class handler for the "auto-connect-failed" signal. |
SpiceUsbDeviceManager * spice_usb_device_manager_get (SpiceSession *session
,GMainContext *main_context
,GError **err
);
Gets the SpiceUsbDeviceManager associated with the passed in SpiceSession. A new SpiceUsbDeviceManager instance will be created the first time this function is called for a certain SpiceSession.
Note that this function returns a weak reference, which should not be used after the SpiceSession itself has been unref-ed by the caller.
|
SpiceSession for which to get the SpiceUsbDeviceManager |
|
GMainContext to use. If NULL , the default context is used. |
Returns : |
a weak reference to the SpiceUsbDeviceManager associated with the passed in SpiceSession. [transfer none] |
GPtrArray * spice_usb_device_manager_get_devices
(SpiceUsbDeviceManager *manager
);
|
the SpiceUsbDeviceManager manager |
Returns : |
a GPtrArray array of SpiceUsbDevice . [element-type SpiceUsbDevice][transfer full]
|
gboolean spice_usb_device_manager_is_device_connected (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
);
|
the SpiceUsbDeviceManager manager |
|
a SpiceUsbDevice |
Returns : |
TRUE if device has an associated USB redirection channel |
gboolean spice_usb_device_manager_connect_device (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
,GError **err
);
|
the SpiceUsbDeviceManager manager |
|
a SpiceUsbDevice to redirect |
Returns : |
TRUE if device has been successfully connected and
associated with a redirection chanel |
void spice_usb_device_manager_disconnect_device (SpiceUsbDeviceManager *manager
,SpiceUsbDevice *device
);
|
the SpiceUsbDeviceManager manager |
|
a SpiceUsbDevice to disconnect |
Returns : |
TRUE if device has an associated USB redirection channel |
gchar * spice_usb_device_get_description (SpiceUsbDevice *device
);
Get a string describing the device which is suitable as a description of
the device for the end user. The returned string should be freed with
g_free()
when no longer needed.
|
SpiceUsbDevice to get the description of |
Returns : |
a newly-allocated string holding the description |
"auto-connect"
property "auto-connect" gboolean : Read / Write
Auto connect plugged in USB devices.
Default value: FALSE
"main-context"
property "main-context" gpointer : Read / Write / Construct Only
GMainContext to use for the event source.
"session"
property"session" SpiceSession* : Read / Write / Construct Only
SpiceSession this SpiceUsbDeviceManager is associated with
"auto-connect-failed"
signalvoid user_function (SpiceUsbDeviceManager *manager,
SpiceUsbDevice *device,
GError *error,
gpointer user_data) : Run First
The "auto-connect-failed" signal is emitted whenever the auto-connect property is true, and a newly plugged in device could not be auto-connected.
|
the SpiceUsbDeviceManager that emitted the signal |
|
SpiceUsbDevice boxed object corresponding to the device which failed to auto connect |
|
GError describing the reason why the autoconnect failed |
|
user data set when the signal handler was connected. |
"device-added"
signalvoid user_function (SpiceUsbDeviceManager *manager,
SpiceUsbDevice *device,
gpointer user_data) : Run First
The "device-added" signal is emitted whenever a new USB device has been plugged in.
|
the SpiceUsbDeviceManager that emitted the signal |
|
SpiceUsbDevice boxed object corresponding to the added device |
|
user data set when the signal handler was connected. |
"device-removed"
signalvoid user_function (SpiceUsbDeviceManager *manager,
SpiceUsbDevice *device,
gpointer user_data) : Run First
The "device-removed" signal is emitted whenever an USB device has been removed.
|
the SpiceUsbDeviceManager that emitted the signal |
|
SpiceUsbDevice boxed object corresponding to the removed device |
|
user data set when the signal handler was connected. |