fwupd/plugins/dfu/dfu-element.h
Richard Hughes 7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00

38 lines
928 B
C

/*
* Copyright (C) 2015 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <glib-object.h>
#include <gio/gio.h>
G_BEGIN_DECLS
#define DFU_TYPE_ELEMENT (dfu_element_get_type ())
G_DECLARE_DERIVABLE_TYPE (DfuElement, dfu_element, DFU, ELEMENT, GObject)
struct _DfuElementClass
{
GObjectClass parent_class;
};
DfuElement *dfu_element_new (void);
GBytes *dfu_element_get_contents (DfuElement *element);
guint32 dfu_element_get_address (DfuElement *element);
void dfu_element_set_contents (DfuElement *element,
GBytes *contents);
void dfu_element_set_address (DfuElement *element,
guint32 address);
void dfu_element_set_target_size (DfuElement *element,
guint32 target_size);
void dfu_element_set_padding_value (DfuElement *element,
guint8 padding_value);
gchar *dfu_element_to_string (DfuElement *element);
G_END_DECLS