/* auto-generated, do not modify */
#include "config.h"

#include "fu-dfu-struct.h"
#include "fu-byte-array.h"
#include "fu-mem-private.h"
#include "fu-string.h"

#ifdef G_LOG_DOMAIN
  #undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "FuStruct"


const gchar *
fu_dfu_status_to_string(FuDfuStatus val)
{
    if (val == FU_DFU_STATUS_OK)
        return "ok";
    if (val == FU_DFU_STATUS_ERR_TARGET)
        return "err-target";
    if (val == FU_DFU_STATUS_ERR_FILE)
        return "err-file";
    if (val == FU_DFU_STATUS_ERR_WRITE)
        return "err-write";
    if (val == FU_DFU_STATUS_ERR_ERASE)
        return "err-erase";
    if (val == FU_DFU_STATUS_ERR_CHECK_ERASED)
        return "err-check-erased";
    if (val == FU_DFU_STATUS_ERR_PROG)
        return "err-prog";
    if (val == FU_DFU_STATUS_ERR_VERIFY)
        return "err-verify";
    if (val == FU_DFU_STATUS_ERR_ADDRESS)
        return "err-address";
    if (val == FU_DFU_STATUS_ERR_NOTDONE)
        return "err-notdone";
    if (val == FU_DFU_STATUS_ERR_FIRMWARE)
        return "err-firmware";
    if (val == FU_DFU_STATUS_ERR_VENDOR)
        return "err-vendor";
    if (val == FU_DFU_STATUS_ERR_USBR)
        return "err-usbr";
    if (val == FU_DFU_STATUS_ERR_POR)
        return "err-por";
    if (val == FU_DFU_STATUS_ERR_UNKNOWN)
        return "err-unknown";
    if (val == FU_DFU_STATUS_ERR_STALLDPKT)
        return "err-stalldpkt";
    return NULL;
}

const gchar *
fu_dfu_state_to_string(FuDfuState val)
{
    if (val == FU_DFU_STATE_APP_IDLE)
        return "app-idle";
    if (val == FU_DFU_STATE_APP_DETACH)
        return "app-detach";
    if (val == FU_DFU_STATE_DFU_IDLE)
        return "dfu-idle";
    if (val == FU_DFU_STATE_DFU_DNLOAD_SYNC)
        return "dfu-dnload-sync";
    if (val == FU_DFU_STATE_DFU_DNBUSY)
        return "dfu-dnbusy";
    if (val == FU_DFU_STATE_DFU_DNLOAD_IDLE)
        return "dfu-dnload-idle";
    if (val == FU_DFU_STATE_DFU_MANIFEST_SYNC)
        return "dfu-manifest-sync";
    if (val == FU_DFU_STATE_DFU_MANIFEST)
        return "dfu-manifest";
    if (val == FU_DFU_STATE_DFU_MANIFEST_WAIT_RESET)
        return "dfu-manifest-wait-reset";
    if (val == FU_DFU_STATE_DFU_UPLOAD_IDLE)
        return "dfu-upload-idle";
    if (val == FU_DFU_STATE_DFU_ERROR)
        return "dfu-error";
    return NULL;
}

gchar *
fu_dfu_sector_cap_to_string(FuDfuSectorCap val)
{
    const gchar *data[4] = {0};
    guint idx = 0;
    if (val == FU_DFU_SECTOR_CAP_NONE)
        return g_strdup("none");
    if (val & FU_DFU_SECTOR_CAP_READABLE)
        data[idx++] = "readable";
    if (val & FU_DFU_SECTOR_CAP_WRITEABLE)
        data[idx++] = "writeable";
    if (val & FU_DFU_SECTOR_CAP_ERASABLE)
        data[idx++] = "erasable";
    return g_strjoinv(",", (gchar **)data);
}
