Constructor

FwupdPluginDeviceLockernew_full

since: 1.0.0

Declaration [src]

FuDeviceLocker*
fu_device_locker_new_full (
  gpointer device,
  FuDeviceLockerFunc open_func,
  FuDeviceLockerFunc close_func,
  GError** error
)

Description [src]

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.

Available since: 1.0.0

Parameters

device

Type: gpointer

A GObject.

The argument can be NULL.
The data is owned by the caller of the function.
open_func

Type: FuDeviceLockerFunc

A function to open the device.

close_func

Type: FuDeviceLockerFunc

A function to close the device.

error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the constructor if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: FuDeviceLocker

A device locker, or NULL if the open_func failed.

The caller of the function takes ownership of the data, and is responsible for freeing it.