## DfuSector DfuSector — Object representing a sector on a chip |

## Functions

guint32 | dfu_sector_get_id ()
guint32 | dfu_sector_get_address ()
guint32 | dfu_sector_get_size ()
guint32 | dfu_sector_get_size_left ()
guint16 | dfu_sector_get_zone ()
guint16 | dfu_sector_get_number ()
gboolean | dfu_sector_has_cap ()
gchar * | dfu_sector_to_string ()

## Types and Values

#define | DFU_TYPE_SECTOR
struct | DfuSectorClass
enum | DfuSectorCap
| DfuSector

## Description

This object represents an sector of memory at a specific address on the device itself.

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

You can think of these objects as flash segments on devices, where a complete block can be erased and then written to.

See also: DfuElement

## Functions

### dfu_sector_get_id ()

    guint32
    dfu_sector_get_id (DfuSector *sector);

Gets the sector ID which is a combination of the zone and sector number. You can use this number to check if the segment is the 'same' as the last written or read sector.

#### Parameters

sector | a DfuSector |

#### Returns

integer ID, or 0x00 for unset

Since: 0.5.4

### dfu_sector_get_address ()

    guint32
    dfu_sector_get_address (DfuSector *sector);

Gets the alternate setting.

#### Parameters

sector | a DfuSector |

#### Returns

integer, or 0x00 for unset

Since: 0.5.4

### dfu_sector_get_size ()

    guint32
    dfu_sector_get_size (DfuSector *sector);

Gets the sector size.

#### Parameters

sector | a DfuSector |

#### Returns

integer, or 0x00 for unset

Since: 0.5.4

### dfu_sector_get_size_left ()

    guint32
    dfu_sector_get_size_left (DfuSector *sector);

Gets the size of the rest of the sector.

#### Parameters

sector | a DfuSector |

#### Returns

integer, or 0x00 for unset

Since: 0.5.4

### dfu_sector_get_zone ()

    guint16
    dfu_sector_get_zone (DfuSector *sector);

Gets the sector zone number.

#### Parameters

sector | a DfuSector |

#### Returns

integer, or 0x00 for unset

Since: 0.7.5

### dfu_sector_get_number ()

    guint16
    dfu_sector_get_number (DfuSector *sector);

Gets the sector index number.

#### Parameters

sector | a DfuSector |

#### Returns

integer, or 0x00 for unset

Since: 0.7.5

### dfu_sector_has_cap ()

    gboolean
    dfu_sector_has_cap (DfuSector *sector,
                        DfuSectorCap cap);

Finds out if the sector has the required capability.

#### Parameters

sector | a DfuSector |
cap | a DfuSectorCap, e.g. `DFU_SECTOR_CAP_ERASEABLE` |

#### Returns

`TRUE` if the sector has the capabilily

Since: 0.5.4

### dfu_sector_to_string ()

    gchar *
    dfu_sector_to_string (DfuSector *sector);

Returns a string representaiton of the object.

#### Parameters

sector | a DfuSector |

#### Returns

NULL terminated string, or `NULL` for invalid

Since: 0.5.4

## Types and Values

### DFU_TYPE_SECTOR

    #define DFU_TYPE_SECTOR (dfu_sector_get_type ())

### struct DfuSectorClass

    struct DfuSectorClass {
    	GObjectClass		 parent_class;
    };

### enum DfuSectorCap

The flags indicating what the sector can do.

#### Members

DFU_SECTOR_CAP_NONE | No operations possible |
DFU_SECTOR_CAP_READABLE | Sector can be read |
DFU_SECTOR_CAP_WRITEABLE | Sector can be written |
DFU_SECTOR_CAP_ERASEABLE | Sector can be erased |

### DfuSector

    typedef struct _DfuSector DfuSector;