## DfuElement DfuElement — Object representing a binary element |

## Functions

DfuElement * | dfu_element_new ()
GBytes * | dfu_element_get_contents ()
guint32 | dfu_element_get_address ()
void | dfu_element_set_contents ()
void | dfu_element_set_address ()
void | dfu_element_set_target_size ()
void | dfu_element_set_padding_value ()
gchar * | dfu_element_to_string ()

## Types and Values

#define | DFU_TYPE_ELEMENT
struct | DfuElementClass
| DfuElement

## Description

This object represents an binary blob of data at a specific address.

This allows relocatable data segments to be stored in different locations on the device itself.

See also: DfuImage, DfuFirmware

## Functions

### dfu_element_new ()

    DfuElement *
    dfu_element_new (void);

Creates a new DFU element object.

#### Returns

a new DfuElement

Since: 0.5.4

### dfu_element_get_contents ()

    GBytes *
    dfu_element_get_contents (DfuElement *element);

Gets the element data.

#### Parameters

element | a DfuElement |

#### Returns

element data.

[transfer none]

Since: 0.5.4

### dfu_element_get_address ()

    guint32
    dfu_element_get_address (DfuElement *element);

Gets the offset address of the element.

#### Parameters

element | a DfuElement |

#### Returns

memory offset value, or 0x00 for unset

Since: 0.5.4

### dfu_element_set_contents ()

    void
    dfu_element_set_contents (DfuElement *element,
                              GBytes *contents);

Sets the element data.

#### Parameters

element | a DfuElement |
contents | element data |

Since: 0.5.4

### dfu_element_set_address ()

    void
    dfu_element_set_address (DfuElement *element,
                             guint32 address);

Sets the offset address of the element.

#### Parameters

element | a DfuElement |
address | memory offset value |

Since: 0.5.4

### dfu_element_set_target_size ()

    void
    dfu_element_set_target_size (DfuElement *element,
                                 guint32 target_size);

Sets a target size for the element. If the prepared element is smaller than this then it will be padded up to the required size.

If a padding byte other than 0x00 is required then the function `dfu_element_set_padding_value()` should be used before this function is called.

#### Parameters

element | a DfuElement |
target_size | size in bytes |

Since: 0.5.4

### dfu_element_set_padding_value ()

    void
    dfu_element_set_padding_value (DfuElement *element,
                                   guint8 padding_value);

Sets a the value of the padding byte to be used in the function `dfu_element_set_target_size()`.

#### Parameters

element | a DfuElement |
padding_value | char value, typically 0x00 or 0xff |

Since: 0.7.3

### dfu_element_to_string ()

    gchar *
    dfu_element_to_string (DfuElement *element);

Returns a string representaiton of the object.

#### Parameters

element | a DfuElement |

#### Returns

NULL terminated string, or `NULL` for invalid

Since: 0.5.4

## Types and Values

### DFU_TYPE_ELEMENT

    #define DFU_TYPE_ELEMENT (dfu_element_get_type ())

### struct DfuElementClass

    struct DfuElementClass {
    	GObjectClass		 parent_class;
    };

### DfuElement

    typedef struct _DfuElement DfuElement;