Top | ![]() |
![]() |
![]() |
![]() |
gboolean | (*FuDeviceLockerFunc) () |
FuDeviceLocker * | fu_device_locker_new () |
FuDeviceLocker * | fu_device_locker_new_full () |
gboolean | fu_device_locker_close () |
gboolean (*FuDeviceLockerFunc) (GObject *device
,GError **error
);
Callback to use when opening and closing using [ctorDeviceLocker.new_full
].
FuDeviceLocker * fu_device_locker_new (gpointer device
,GError **error
);
Opens the device for use. When the FuDeviceLocker is deallocated the device
will be closed and any error will just be directed to the console.
This object is typically called using g_autoptr()
but the device can also be
manually closed using g_clear_object()
.
The functions used for opening and closing the device are set automatically.
If the device
is not a type or supertype of GUsbDevice or FuDevice then
this function will not work.
For custom objects please use fu_device_locker_new_full()
.
NOTE: If the open_func
failed then the close_func
will not be called.
Think of this object as the device ownership.
Since: 1.0.0
FuDeviceLocker * fu_device_locker_new_full (gpointer device
,FuDeviceLockerFunc open_func
,FuDeviceLockerFunc close_func
,GError **error
);
Opens the device for use. When the FuDeviceLocker is deallocated the device
will be closed and any error will just be directed to the console.
This object is typically called using g_autoptr()
but the device can also be
manually closed using g_clear_object()
.
NOTE: If the open_func
failed then the close_func
will not be called.
Think of this object as the device ownership.
device |
a GObject |
|
open_func |
a function to open the device. |
[scope async] |
close_func |
a function to close the device. |
[scope async] |
error |
optional return location for an error. |
[nullable] |
Since: 1.0.0
gboolean fu_device_locker_close (FuDeviceLocker *self
,GError **error
);
Closes the locker before it gets cleaned up.
This function can be used to manually close a device managed by a locker, and allows the caller to properly handle the error.
Since: 1.4.0