![]() |
![]() |
![]() |
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 (GMainContext *main_context
,GError **err
); void spice_usb_device_manager_register_channel (SpiceUsbDeviceManager *manager
,SpiceUsbredirChannel *channel
); void spice_usb_device_manager_unregister_channel (SpiceUsbDeviceManager *manager
,SpiceUsbredirChannel *channel
); 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
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.
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.
GObjectClass |
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 (GMainContext *main_context
,GError **err
);
SpiceUsbDeviceManager is a singleton, use this function to get a pointer to it. A new SpiceUsbDeviceManager instance will be created the first time this function is called
|
GMainContext to use. If NULL , the default context is used. |
Returns : |
a weak reference to the SpiceUsbDeviceManager singleton. [transfer none] |
void spice_usb_device_manager_register_channel (SpiceUsbDeviceManager *manager
,SpiceUsbredirChannel *channel
);
Register channel
to be managed by the USB device manager
. When a
new device is added/plugged, the manager
will use an available
channel to establish the redirection with the Spice server.
Note that this function takes a weak reference to the channel, it is the
callers responsibility to call spice_usb_device_manager_unregister_channel()
before it unrefs its own reference.
|
the SpiceUsbDeviceManager manager |
|
a SpiceUsbredirChannel to register |
void spice_usb_device_manager_unregister_channel (SpiceUsbDeviceManager *manager
,SpiceUsbredirChannel *channel
);
Remove channel
from the list of USB channels to be managed by manager
.
|
the SpiceUsbDeviceManager manager |
|
a SpiceUsbredirChannel to unregister |
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.
"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. |