FwupdDevice: fwupd Reference Manual

## FwupdDevice FwupdDevice |

## Functions

FwupdDevice * | fwupd_device_new ()
gchar * | fwupd_device_to_string ()
const gchar * | fwupd_device_get_id ()
void | fwupd_device_set_id ()
const gchar * | fwupd_device_get_parent_id ()
void | fwupd_device_set_parent_id ()
const gchar * | fwupd_device_get_composite_id ()
void | fwupd_device_set_composite_id ()
FwupdDevice * | fwupd_device_get_root ()
FwupdDevice * | fwupd_device_get_parent ()
void | fwupd_device_set_parent ()
void | fwupd_device_add_child ()
void | fwupd_device_remove_child ()
GPtrArray * | fwupd_device_get_children ()
const gchar * | fwupd_device_get_name ()
void | fwupd_device_set_name ()
const gchar * | fwupd_device_get_serial ()
void | fwupd_device_set_serial ()
const gchar * | fwupd_device_get_summary ()
void | fwupd_device_set_summary ()
const gchar * | fwupd_device_get_branch ()
void | fwupd_device_set_branch ()
const gchar * | fwupd_device_get_description ()
void | fwupd_device_set_description ()
const gchar * | fwupd_device_get_version ()
void | fwupd_device_set_version ()
const gchar * | fwupd_device_get_version_lowest ()
void | fwupd_device_set_version_lowest ()
guint64 | fwupd_device_get_version_lowest_raw ()
void | fwupd_device_set_version_lowest_raw ()
const gchar * | fwupd_device_get_version_bootloader ()
void | fwupd_device_set_version_bootloader ()
guint64 | fwupd_device_get_version_bootloader_raw ()
void | fwupd_device_set_version_bootloader_raw ()
guint64 | fwupd_device_get_version_raw ()
void | fwupd_device_set_version_raw ()
guint64 | fwupd_device_get_version_build_date ()
void | fwupd_device_set_version_build_date ()
FwupdVersionFormat | fwupd_device_get_version_format ()
void | fwupd_device_set_version_format ()
guint32 | fwupd_device_get_flashes_left ()
void | fwupd_device_set_flashes_left ()
guint32 | fwupd_device_get_install_duration ()
void | fwupd_device_set_install_duration ()
guint64 | fwupd_device_get_flags ()
void | fwupd_device_set_flags ()
void | fwupd_device_add_flag ()
void | fwupd_device_remove_flag ()
gboolean | fwupd_device_has_flag ()
guint64 | fwupd_device_get_created ()
void | fwupd_device_set_created ()
guint64 | fwupd_device_get_modified ()
void | fwupd_device_set_modified ()
GPtrArray * | fwupd_device_get_checksums ()
void | fwupd_device_add_checksum ()
const gchar * | fwupd_device_get_plugin ()
void | fwupd_device_set_plugin ()
const gchar * | fwupd_device_get_protocol ()
void | fwupd_device_set_protocol ()
void | fwupd_device_add_protocol ()
gboolean | fwupd_device_has_protocol ()
GPtrArray * | fwupd_device_get_protocols ()
const gchar * | fwupd_device_get_vendor ()
void | fwupd_device_set_vendor ()
const gchar * | fwupd_device_get_vendor_id ()
void | fwupd_device_set_vendor_id ()
void | fwupd_device_add_vendor_id ()
gboolean | fwupd_device_has_vendor_id ()
GPtrArray * | fwupd_device_get_vendor_ids ()
void | fwupd_device_add_guid ()
gboolean | fwupd_device_has_guid ()
GPtrArray * | fwupd_device_get_guids ()
const gchar * | fwupd_device_get_guid_default ()
void | fwupd_device_add_instance_id ()
gboolean | fwupd_device_has_instance_id ()
GPtrArray * | fwupd_device_get_instance_ids ()
void | fwupd_device_add_icon ()
gboolean | fwupd_device_has_icon ()
GPtrArray * | fwupd_device_get_icons ()
FwupdUpdateState | fwupd_device_get_update_state ()
void | fwupd_device_set_update_state ()
const gchar * | fwupd_device_get_update_error ()
void | fwupd_device_set_update_error ()
const gchar * | fwupd_device_get_update_message ()
void | fwupd_device_set_update_message ()
const gchar * | fwupd_device_get_update_image ()
void | fwupd_device_set_update_image ()
FwupdStatus | fwupd_device_get_status ()
void | fwupd_device_set_status ()
void | fwupd_device_add_release ()
GPtrArray * | fwupd_device_get_releases ()
FwupdRelease * | fwupd_device_get_release_default ()
gint | fwupd_device_compare ()
FwupdDevice * | fwupd_device_from_variant ()
GPtrArray * | fwupd_device_array_from_variant ()
void | fwupd_device_array_ensure_parents ()

## Types and Values

#define | FWUPD_TYPE_DEVICE
struct | FwupdDeviceClass
| FwupdDevice

## Description

## Functions

### fwupd_device_new ()

    FwupdDevice *
    fwupd_device_new (void);

Creates a new device.

#### Returns

a new FwupdDevice

Since: 0.9.3

### fwupd_device_to_string ()

    gchar *
    fwupd_device_to_string (FwupdDevice *self);

Builds a text representation of the object.

#### Parameters

self | a FwupdDevice |

#### Returns

text, or `NULL` for invalid

Since: 0.9.3

### fwupd_device_get_id ()

    const gchar *
    fwupd_device_get_id (FwupdDevice *self);

Gets the ID.

#### Parameters

self | a FwupdDevice |

#### Returns

the ID, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_id ()

    void
    fwupd_device_set_id (FwupdDevice *self,
                         const gchar *id);

Sets the ID.

#### Parameters

self | a FwupdDevice |
id | the device ID, e.g. `USB:foo`. | [nullable]

Since: 0.9.3

### fwupd_device_get_parent_id ()

    const gchar *
    fwupd_device_get_parent_id (FwupdDevice *self);

Gets the parent ID.

#### Parameters

self | a FwupdDevice |

#### Returns

the parent ID, or `NULL` if unset

Since: 1.0.8

### fwupd_device_set_parent_id ()

    void
    fwupd_device_set_parent_id (FwupdDevice *self,
                                const gchar *parent_id);

Sets the parent ID.

#### Parameters

self | a FwupdDevice |
parent_id | the device ID, e.g. `USB:foo`. | [nullable]

Since: 1.0.8

### fwupd_device_get_composite_id ()

    const gchar *
    fwupd_device_get_composite_id (FwupdDevice *self);

Gets the composite ID, falling back to the device ID if unset.

The composite ID will be the same value for all parent, child and sibling devices.

#### Parameters

self | a FwupdDevice |

#### Returns

the composite ID.

[nullable]

Since: 1.6.0

### fwupd_device_set_composite_id ()

    void
    fwupd_device_set_composite_id (FwupdDevice *self,
                                   const gchar *composite_id);

Sets the composite ID, which is usually a SHA1 hash of a grandparent or parent device.

#### Parameters

self | a FwupdDevice |
composite_id | a device ID. | [nullable]

Since: 1.6.0

### fwupd_device_get_root ()

    FwupdDevice *
    fwupd_device_get_root (FwupdDevice *self);

Gets the device root.

#### Parameters

self | a FwupdDevice |

#### Returns

the root device, or `NULL` if unset.

[transfer none]

Since: 1.7.4

### fwupd_device_get_parent ()

    FwupdDevice *
    fwupd_device_get_parent (FwupdDevice *self);

Gets the parent.

#### Parameters

self | a FwupdDevice |

#### Returns

the parent device, or `NULL` if unset.

[transfer none]

Since: 1.0.8

### fwupd_device_set_parent ()

    void
    fwupd_device_set_parent (FwupdDevice *self,
                             FwupdDevice *parent);

Sets the parent. Only used internally.

#### Parameters

self | a FwupdDevice |
parent | another FwupdDevice. | [nullable]

Since: 1.0.8

### fwupd_device_add_child ()

    void
    fwupd_device_add_child (FwupdDevice *self,
                            FwupdDevice *child);

Adds a child device. An child device is logically linked to the primary device in some way.

NOTE: You should never call this function from user code, it is for daemon use only. Only use `fwupd_device_set_parent()` to set up a logical tree.

#### Parameters

self | a FwupdDevice |
child | Another FwupdDevice |

Since: 1.5.1

### fwupd_device_remove_child ()

    void
    fwupd_device_remove_child (FwupdDevice *self,
                               FwupdDevice *child);

Removes a child device.

NOTE: You should never call this function from user code, it is for daemon use only.

#### Parameters

self | a FwupdDevice |
child | Another FwupdDevice |

Since: 1.6.2

### fwupd_device_get_children ()

    GPtrArray *
    fwupd_device_get_children (FwupdDevice *self);

Gets the device children. These can only be assigned using `fwupd_device_set_parent()`.

#### Parameters

self | a FwupdDevice |

#### Returns

the children, which may be empty.

[element-type FwupdDevice][transfer none]

Since: 1.3.7

### fwupd_device_get_name ()

    const gchar *
    fwupd_device_get_name (FwupdDevice *self);

Gets the device name.

#### Parameters

self | a FwupdDevice |

#### Returns

the device name, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_name ()

    void
    fwupd_device_set_name (FwupdDevice *self,
                           const gchar *name);

Sets the device name.

#### Parameters

self | a FwupdDevice |
name | the device name, e.g. `ColorHug2`. | [nullable]

Since: 0.9.3

### fwupd_device_get_serial ()

    const gchar *
    fwupd_device_get_serial (FwupdDevice *self);

Gets the serial number for the device.

#### Parameters

self | a FwupdDevice |

#### Returns

a string value, or `NULL` if never set.

Since: 1.1.2

### fwupd_device_set_serial ()

    void
    fwupd_device_set_serial (FwupdDevice *self,
                             const gchar *serial);

Sets the serial number for the device.

#### Parameters

self | a FwupdDevice |
serial | the device serial number. | [nullable]

Since: 1.1.2

### fwupd_device_get_summary ()

    const gchar *
    fwupd_device_get_summary (FwupdDevice *self);

Gets the device summary.

#### Parameters

self | a FwupdDevice |

#### Returns

the device summary, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_summary ()

    void
    fwupd_device_set_summary (FwupdDevice *self,
                              const gchar *summary);

Sets the device summary.

#### Parameters

self | a FwupdDevice |
summary | the device one line summary. | [nullable]

Since: 0.9.3

### fwupd_device_get_branch ()

    const gchar *
    fwupd_device_get_branch (FwupdDevice *self);

Gets the current device branch.

#### Parameters

self | a FwupdDevice |

#### Returns

the device branch, or `NULL` if unset

Since: 1.5.0

### fwupd_device_set_branch ()

    void
    fwupd_device_set_branch (FwupdDevice *self,
                             const gchar *branch);

Sets the current device branch.

#### Parameters

self | a FwupdDevice |
branch | the device one line branch. | [nullable]

Since: 1.5.0

### fwupd_device_get_description ()

    const gchar *
    fwupd_device_get_description (FwupdDevice *self);

Gets the device description in AppStream markup format.

#### Parameters

self | a FwupdDevice |

#### Returns

the device description, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_description ()

    void
    fwupd_device_set_description (FwupdDevice *self,
                                  const gchar *description);

Sets the device description.

#### Parameters

self | a FwupdDevice |
description | the description in AppStream markup format. | [nullable]

Since: 0.9.3

### fwupd_device_get_version ()

    const gchar *
    fwupd_device_get_version (FwupdDevice *self);

Gets the device version.

#### Parameters

self | a FwupdDevice |

#### Returns

the device version, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_version ()

    void
    fwupd_device_set_version (FwupdDevice *self,
                              const gchar *version);

Sets the device version.

#### Parameters

self | a FwupdDevice |
version | the device version, e.g. `1.2.3`. | [nullable]

Since: 0.9.3

### fwupd_device_get_version_lowest ()

    const gchar *
    fwupd_device_get_version_lowest (FwupdDevice *self);

Gets the lowest version of firmware the device will accept.

#### Parameters

self | a FwupdDevice |

#### Returns

the device version_lowest, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_version_lowest ()

    void
    fwupd_device_set_version_lowest (FwupdDevice *self,
                                     const gchar *version_lowest);

Sets the lowest version of firmware the device will accept.

#### Parameters

self | a FwupdDevice |
version_lowest | the version. | [nullable]

Since: 0.9.3

### fwupd_device_get_version_lowest_raw ()

    guint64
    fwupd_device_get_version_lowest_raw (FwupdDevice *self);

Gets the lowest version of firmware the device will accept in raw format.

#### Parameters

self | a FwupdDevice |

#### Returns

integer version number, or `0` if unset

Since: 1.4.0

### fwupd_device_set_version_lowest_raw ()

    void
    fwupd_device_set_version_lowest_raw (FwupdDevice *self,
                                         guint64 version_lowest_raw);

Sets the raw lowest version number from the hardware before converted to a string.

#### Parameters

self | a FwupdDevice |
version_lowest_raw | the raw hardware version |

Since: 1.4.0

### fwupd_device_get_version_bootloader ()

    const gchar *
    fwupd_device_get_version_bootloader (FwupdDevice *self);

Gets the version of the bootloader.

#### Parameters

self | a FwupdDevice |

#### Returns

the device version_bootloader, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_version_bootloader ()

    void
    fwupd_device_set_version_bootloader (FwupdDevice *self,
                                         const gchar *version_bootloader);

Sets the bootloader version.

#### Parameters

self | a FwupdDevice |
version_bootloader | the version. | [nullable]

Since: 0.9.3

### fwupd_device_get_version_bootloader_raw ()

    guint64
    fwupd_device_get_version_bootloader_raw
                                   (FwupdDevice *self);

Gets the bootloader version of firmware the device will accept in raw format.

#### Parameters

self | a FwupdDevice |

#### Returns

integer version number, or `0` if unset

Since: 1.4.0

### fwupd_device_set_version_bootloader_raw ()

    void
    fwupd_device_set_version_bootloader_raw
                                   (FwupdDevice *self,
                                    guint64 version_bootloader_raw);

Sets the raw bootloader version number from the hardware before converted to a string.

#### Parameters

self | a FwupdDevice |
version_bootloader_raw | the raw hardware version |

Since: 1.4.0

### fwupd_device_get_version_raw ()

    guint64
    fwupd_device_get_version_raw (FwupdDevice *self);

Gets the raw version number from the hardware before converted to a string.

#### Parameters

self | a FwupdDevice |

#### Returns

the hardware version, or 0 if unset

Since: 1.3.6

### fwupd_device_set_version_raw ()

    void
    fwupd_device_set_version_raw (FwupdDevice *self,
                                  guint64 version_raw);

Sets the raw version number from the hardware before converted to a string.

#### Parameters

self | a FwupdDevice |
version_raw | the raw hardware version |

Since: 1.3.6

### fwupd_device_get_version_build_date ()

    guint64
    fwupd_device_get_version_build_date (FwupdDevice *self);

Gets the date when the firmware was built.

#### Parameters

self | a FwupdDevice |

#### Returns

the UNIX time, or 0 if unset

Since: 1.6.2

### fwupd_device_set_version_build_date ()

    void
    fwupd_device_set_version_build_date (FwupdDevice *self,
                                         guint64 version_build_date);

Sets the date when the firmware was built.

#### Parameters

self | a FwupdDevice |
version_build_date | the UNIX time |

Since: 1.6.2

### fwupd_device_get_version_format ()

    FwupdVersionFormat
    fwupd_device_get_version_format (FwupdDevice *self);

Gets the update state.

#### Parameters

self | a FwupdDevice |

#### Returns

the update state, or `FWUPD_VERSION_FORMAT_UNKNOWN` if unset

Since: 1.2.9

### fwupd_device_set_version_format ()

    void
    fwupd_device_set_version_format (FwupdDevice *self,
                                     FwupdVersionFormat version_format);

Sets the update state.

#### Parameters

self | a FwupdDevice |
version_format | the state, e.g. `FWUPD_VERSION_FORMAT_PENDING` |

Since: 1.2.9

### fwupd_device_get_flashes_left ()

    guint32
    fwupd_device_get_flashes_left (FwupdDevice *self);

Gets the number of flash cycles left on the device

#### Parameters

self | a FwupdDevice |

#### Returns

the flash cycles left, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_flashes_left ()

    void
    fwupd_device_set_flashes_left (FwupdDevice *self,
                                   guint32 flashes_left);

Sets the number of flash cycles left on the device

#### Parameters

self | a FwupdDevice |
flashes_left | the description |

Since: 0.9.3

### fwupd_device_get_install_duration ()

    guint32
    fwupd_device_get_install_duration (FwupdDevice *self);

Gets the time estimate for firmware installation (in seconds)

#### Parameters

self | a FwupdDevice |

#### Returns

the estimated time to flash this device (or 0 if unset)

Since: 1.1.3

### fwupd_device_set_install_duration ()

    void
    fwupd_device_set_install_duration (FwupdDevice *self,
                                       guint32 duration);

Sets the time estimate for firmware installation (in seconds)

#### Parameters

self | a FwupdDevice |
duration | the amount of time |

Since: 1.1.3

### fwupd_device_get_flags ()

    guint64
    fwupd_device_get_flags (FwupdDevice *self);

Gets device flags.

#### Parameters

self | a FwupdDevice |

#### Returns

device flags, or 0 if unset

Since: 0.9.3

### fwupd_device_set_flags ()

    void
    fwupd_device_set_flags (FwupdDevice *self,
                            guint64 flags);

Sets device flags.

#### Parameters

self | a FwupdDevice |
flags | device flags, e.g. `FWUPD_DEVICE_FLAG_REQUIRE_AC` |

Since: 0.9.3

### fwupd_device_add_flag ()

    void
    fwupd_device_add_flag (FwupdDevice *self,
                           FwupdDeviceFlags flag);

Adds a specific device flag to the device.

#### Parameters

self | a FwupdDevice |
flag | the FwupdDeviceFlags |

Since: 0.9.3

### fwupd_device_remove_flag ()

    void
    fwupd_device_remove_flag (FwupdDevice *self,
                              FwupdDeviceFlags flag);

Removes a specific device flag from the device.

#### Parameters

self | a FwupdDevice |
flag | the FwupdDeviceFlags |

Since: 0.9.3

### fwupd_device_has_flag ()

    gboolean
    fwupd_device_has_flag (FwupdDevice *self,
                           FwupdDeviceFlags flag);

Finds if the device has a specific device flag.

#### Parameters

self | a FwupdDevice |
flag | the FwupdDeviceFlags |

#### Returns

`TRUE` if the flag is set

Since: 0.9.3

### fwupd_device_get_created ()

    guint64
    fwupd_device_get_created (FwupdDevice *self);

Gets when the device was created.

#### Parameters

self | a FwupdDevice |

#### Returns

the UNIX time, or 0 if unset

Since: 0.9.3

### fwupd_device_set_created ()

    void
    fwupd_device_set_created (FwupdDevice *self,
                              guint64 created);

Sets when the device was created.

#### Parameters

self | a FwupdDevice |
created | the UNIX time |

Since: 0.9.3

### fwupd_device_get_modified ()

    guint64
    fwupd_device_get_modified (FwupdDevice *self);

Gets when the device was modified.

#### Parameters

self | a FwupdDevice |

#### Returns

the UNIX time, or 0 if unset

Since: 0.9.3

### fwupd_device_set_modified ()

    void
    fwupd_device_set_modified (FwupdDevice *self,
                               guint64 modified);

Sets when the device was modified.

#### Parameters

self | a FwupdDevice |
modified | the UNIX time |

Since: 0.9.3

### fwupd_device_get_checksums ()

    GPtrArray *
    fwupd_device_get_checksums (FwupdDevice *self);

Gets the device checksums.

#### Parameters

self | a FwupdDevice |

#### Returns

the checksums, which may be empty.

[element-type utf8][transfer none]

Since: 0.9.3

### fwupd_device_add_checksum ()

    void
    fwupd_device_add_checksum (FwupdDevice *self,
                               const gchar *checksum);

Adds a device checksum.

#### Parameters

self | a FwupdDevice |
checksum | the device checksum. | [not nullable]

Since: 0.9.3

### fwupd_device_get_plugin ()

    const gchar *
    fwupd_device_get_plugin (FwupdDevice *self);

Gets the plugin that created the device.

#### Parameters

self | a FwupdDevice |

#### Returns

the plugin name, or `NULL` if unset

Since: 1.0.0

### fwupd_device_set_plugin ()

    void
    fwupd_device_set_plugin (FwupdDevice *self,
                             const gchar *plugin);

Sets the plugin that created the device.

#### Parameters

self | a FwupdDevice |
plugin | the plugin name, e.g. `colorhug`. | [nullable]

Since: 1.0.0

### fwupd_device_get_protocol ()

    const gchar *
    fwupd_device_get_protocol (FwupdDevice *self);

`fwupd_device_get_protocol` has been deprecated since version 1.5.8 and should not be used in newly-written code.

Use `fwupd_device_get_protocols()` instead.

Gets the protocol name that the device uses for updating.

#### Parameters

self | a FwupdDevice |

#### Returns

the protocol name, or `NULL` if unset

Since: 1.3.6

### fwupd_device_set_protocol ()

    void
    fwupd_device_set_protocol (FwupdDevice *self,
                               const gchar *protocol);

`fwupd_device_set_protocol` has been deprecated since version 1.5.8 and should not be used in newly-written code.

Use `fwupd_device_add_protocol()` instead.

Sets the protocol name that is used to update the device.

#### Parameters

self | a FwupdDevice |
protocol | the protocol name, e.g. `com.hughski.colorhug`. | [not nullable]

Since: 1.3.6

### fwupd_device_add_protocol ()

    void
    fwupd_device_add_protocol (FwupdDevice *self,
                               const gchar *protocol);

Adds a device protocol name.

#### Parameters

self | a FwupdDevice |
protocol | the protocol name, e.g. `com.hughski.colorhug`. | [not nullable]

Since: 1.5.8

### fwupd_device_has_protocol ()

    gboolean
    fwupd_device_has_protocol (FwupdDevice *self,
                               const gchar *protocol);

Finds out if the device has this specific protocol name.

#### Parameters

self | a FwupdDevice |
protocol | the protocol name, e.g. `com.hughski.colorhug`. | [not nullable]

#### Returns

`TRUE` if the protocol name is found

Since: 1.5.8

### fwupd_device_get_protocols ()

    GPtrArray *
    fwupd_device_get_protocols (FwupdDevice *self);

Gets the device protocol names.

#### Parameters

self | a FwupdDevice |

#### Returns

the device protocol names.

[element-type utf8][transfer none]

Since: 1.5.8

### fwupd_device_get_vendor ()

    const gchar *
    fwupd_device_get_vendor (FwupdDevice *self);

Gets the device vendor.

#### Parameters

self | a FwupdDevice |

#### Returns

the device vendor, or `NULL` if unset

Since: 0.9.3

### fwupd_device_set_vendor ()

    void
    fwupd_device_set_vendor (FwupdDevice *self,
                             const gchar *vendor);

Sets the device vendor.

#### Parameters

self | a FwupdDevice |
vendor | the vendor. | [nullable]

Since: 0.9.3

### fwupd_device_get_vendor_id ()

    const gchar *
    fwupd_device_get_vendor_id (FwupdDevice *self);

`fwupd_device_get_vendor_id` has been deprecated since version 1.5.5 and should not be used in newly-written code.

Use `fwupd_device_get_vendor_ids()` instead.

Gets the combined device vendor ID.

#### Parameters

self | a FwupdDevice |

#### Returns

the device vendor, e.g. 'USB:0x1234|PCI:0x5678', or `NULL` if unset

Since: 0.9.4

### fwupd_device_set_vendor_id ()

    void
    fwupd_device_set_vendor_id (FwupdDevice *self,
                                const gchar *vendor_id);

`fwupd_device_set_vendor_id` has been deprecated since version 1.5.5 and should not be used in newly-written code.

Use `fwupd_device_add_vendor_id()` instead.

Sets the device vendor ID.

#### Parameters

self | a FwupdDevice |
vendor_id | the vendor ID, e.g. 'USB:0x1234' or 'USB:0x1234|PCI:0x5678'. | [not nullable]

Since: 0.9.4

### fwupd_device_add_vendor_id ()

    void
    fwupd_device_add_vendor_id (FwupdDevice *self,
                                const gchar *vendor_id);

Adds a device vendor ID.

#### Parameters

self | a FwupdDevice |
vendor_id | the ID, e.g. 'USB:0x1234'. | [not nullable]

Since: 1.5.5

### fwupd_device_has_vendor_id ()

    gboolean
    fwupd_device_has_vendor_id (FwupdDevice *self,
                                const gchar *vendor_id);

Finds out if the device has this specific vendor ID.

#### Parameters

self | a FwupdDevice |
vendor_id | the vendor ID, e.g. 'USB:0x1234'. | [not nullable]

#### Returns

`TRUE` if the vendor ID is found

Since: 1.5.5

### fwupd_device_get_vendor_ids ()

    GPtrArray *
    fwupd_device_get_vendor_ids (FwupdDevice *self);

Gets the device vendor ID.

#### Parameters

self | a FwupdDevice |

#### Returns

the device vendor ID.

[element-type utf8][transfer none]

Since: 1.5.5

### fwupd_device_add_guid ()

    void
    fwupd_device_add_guid (FwupdDevice *self,
                           const gchar *guid);

Adds the GUID if it does not already exist.

#### Parameters

self | a FwupdDevice |
guid | the GUID, e.g. `2082b5e0-7a64-478a-b1b2-e3404fab6dad` |

Since: 0.9.3

### fwupd_device_has_guid ()

    gboolean
    fwupd_device_has_guid (FwupdDevice *self,
                           const gchar *guid);

Finds out if the device has this specific GUID.

#### Parameters

self | a FwupdDevice |
guid | the GUID, e.g. `2082b5e0-7a64-478a-b1b2-e3404fab6dad`. | [not nullable]

#### Returns

`TRUE` if the GUID is found

Since: 0.9.3

### fwupd_device_get_guids ()

    GPtrArray *
    fwupd_device_get_guids (FwupdDevice *self);

Gets the GUIDs.

#### Parameters

self | a FwupdDevice |

#### Returns

the GUIDs.

[element-type utf8][transfer none]

Since: 0.9.3

### fwupd_device_get_guid_default ()

    const gchar *
    fwupd_device_get_guid_default (FwupdDevice *self);

Gets the default GUID.

#### Parameters

self | a FwupdDevice |

#### Returns

the GUID, or `NULL` if unset

Since: 0.9.3

### fwupd_device_add_instance_id ()

    void
    fwupd_device_add_instance_id (FwupdDevice *self,
                                  const gchar *instance_id);

Adds the instance ID if it does not already exist.

#### Parameters

self | a FwupdDevice |
instance_id | the instance ID, e.g. `PCI\VEN_10EC&amp;DEV_525A`. | [not nullable]

Since: 1.2.5

### fwupd_device_has_instance_id ()

    gboolean
    fwupd_device_has_instance_id (FwupdDevice *self,
                                  const gchar *instance_id);

Finds out if the device has this specific instance ID.

#### Parameters

self | a FwupdDevice |
instance_id | the instance ID, e.g. `PCI\VEN_10EC&amp;DEV_525A`. | [not nullable]

#### Returns

`TRUE` if the instance ID is found

Since: 1.2.5

### fwupd_device_get_instance_ids ()

    GPtrArray *
    fwupd_device_get_instance_ids (FwupdDevice *self);

Gets the instance IDs.

#### Parameters

self | a FwupdDevice |

#### Returns

the instance IDs.

[element-type utf8][transfer none]

Since: 1.2.5

### fwupd_device_add_icon ()

    void
    fwupd_device_add_icon (FwupdDevice *self,
                           const gchar *icon);

Adds the icon name if it does not already exist.

#### Parameters

self | a FwupdDevice |
icon | the icon name, e.g. `input-mouse` or `/usr/share/icons/foo.png`. | [not nullable]

Since: 0.9.8

### fwupd_device_has_icon ()

    gboolean
    fwupd_device_has_icon (FwupdDevice *self,
                           const gchar *icon);

Finds out if the device has this specific icon.

#### Parameters

self | a FwupdDevice |
icon | the icon name, e.g. `input-mouse` or `/usr/share/icons/foo.png` |

#### Returns

`TRUE` if the icon name is found

Since: 1.6.2

### fwupd_device_get_icons ()

    GPtrArray *
    fwupd_device_get_icons (FwupdDevice *self);

Gets the icon names to use for the device.

NOTE: Icons specified without a full path are stock icons and should be loaded from the users icon theme.

#### Parameters

self | a FwupdDevice |

#### Returns

an array of icon names.

[element-type utf8][transfer none]

Since: 0.9.8

### fwupd_device_get_update_state ()

    FwupdUpdateState
    fwupd_device_get_update_state (FwupdDevice *self);

Gets the update state.

#### Parameters

self | a FwupdDevice |

#### Returns

the update state, or `FWUPD_UPDATE_STATE_UNKNOWN` if unset

Since: 0.9.8

### fwupd_device_set_update_state ()

    void
    fwupd_device_set_update_state (FwupdDevice *self,
                                   FwupdUpdateState update_state);

Sets the update state.

#### Parameters

self | a FwupdDevice |
update_state | the state, e.g. `FWUPD_UPDATE_STATE_PENDING` |

Since: 0.9.8

### fwupd_device_get_update_error ()

    const gchar *
    fwupd_device_get_update_error (FwupdDevice *self);

Gets the update error string.

#### Parameters

self | a FwupdDevice |

#### Returns

the update error string, or `NULL` if unset

Since: 0.9.8

### fwupd_device_set_update_error ()

    void
    fwupd_device_set_update_error (FwupdDevice *self,
                                   const gchar *update_error);

Sets the update error string.

#### Parameters

self | a FwupdDevice |
update_error | the update error string. | [nullable]

Since: 0.9.8

### fwupd_device_get_update_message ()

    const gchar *
    fwupd_device_get_update_message (FwupdDevice *self);

Gets the update message string.

#### Parameters

self | a FwupdDevice |

#### Returns

the update message string, or `NULL` if unset

Since: 1.2.4

### fwupd_device_set_update_message ()

    void
    fwupd_device_set_update_message (FwupdDevice *self,
                                     const gchar *update_message);

Sets the update message string.

#### Parameters

self | a FwupdDevice |
update_message | the update message string. | [nullable]

Since: 1.2.4

### fwupd_device_get_update_image ()

    const gchar *
    fwupd_device_get_update_image (FwupdDevice *self);

Gets the update image URL.

#### Parameters

self | a FwupdDevice |

#### Returns

the update image URL, or `NULL` if unset

Since: 1.4.5

### fwupd_device_set_update_image ()

    void
    fwupd_device_set_update_image (FwupdDevice *self,
                                   const gchar *update_image);

Sets the update image URL.

#### Parameters

self | a FwupdDevice |
update_image | the update image URL. | [nullable]

Since: 1.4.5

### fwupd_device_get_status ()

    FwupdStatus
    fwupd_device_get_status (FwupdDevice *self);

Returns what the device is currently doing.

#### Parameters

self | a FwupdDevice |

#### Returns

the status value, e.g. `FWUPD_STATUS_DEVICE_WRITE`

Since: 1.4.0

### fwupd_device_set_status ()

    void
    fwupd_device_set_status (FwupdDevice *self,
                             FwupdStatus status);

Sets what the device is currently doing.

#### Parameters

self | a FwupdDevice |
status | the status value, e.g. `FWUPD_STATUS_DEVICE_WRITE` |

Since: 1.4.0

### fwupd_device_add_release ()

    void
    fwupd_device_add_release (FwupdDevice *self,
                              FwupdRelease *release);

Adds a release for this device.

#### Parameters

self | a FwupdDevice |
release | a release. | [not nullable]

Since: 0.9.8

### fwupd_device_get_releases ()

    GPtrArray *
    fwupd_device_get_releases (FwupdDevice *self);

Gets all the releases for this device.

#### Parameters

self | a FwupdDevice |

#### Returns

array of releases.

[transfer none][element-type FwupdRelease]

Since: 0.9.8

### fwupd_device_get_release_default ()

    FwupdRelease *
    fwupd_device_get_release_default (FwupdDevice *self);

Gets the default release for this device.

#### Parameters

self | a FwupdDevice |

#### Returns

the FwupdRelease, or `NULL` if not set.

[transfer none]

Since: 0.9.8

### fwupd_device_compare ()

    gint
    fwupd_device_compare (FwupdDevice *self1,
                          FwupdDevice *self2);

Comparison function for comparing two device objects.

#### Parameters

self1 | a device |
self2 | a different device |

#### Returns

negative, 0 or positive

Since: 1.1.1

### fwupd_device_from_variant ()

    FwupdDevice *
    fwupd_device_from_variant (GVariant *value);

Creates a new device using serialized data.

#### Parameters

value | the serialized data. | [not nullable]

#### Returns

a new FwupdDevice, or `NULL` if `value` was invalid.

[transfer full]

Since: 1.0.0

### fwupd_device_array_from_variant ()

    GPtrArray *
    fwupd_device_array_from_variant (GVariant *value);

Creates an array of new devices using serialized data.

#### Parameters

value | the serialized data. | [not nullable]

#### Returns

devices, or `NULL` if `value` was invalid.

[transfer container][element-type FwupdDevice]

Since: 1.2.10

### fwupd_device_array_ensure_parents ()

    void
    fwupd_device_array_ensure_parents (GPtrArray *devices);

Sets the parent object on all devices in the array using the parent ID.

#### Parameters

devices | devices. | [element-type FwupdDevice]

Since: 1.3.7

## Types and Values

### FWUPD_TYPE_DEVICE

    #define FWUPD_TYPE_DEVICE (fwupd_device_get_type())

### struct FwupdDeviceClass

    struct FwupdDeviceClass {
    	GObjectClass parent_class;
    };

### FwupdDevice

    typedef struct _FwupdDevice FwupdDevice;

A physical device on the host with optionally updatable firmware.

See also: [class`FwupdRelease` ]