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

#include "fu-ccgx-dmc-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_ccgx_dmc_img_status_to_string(FuCcgxDmcImgStatus val)
{
    if (val == FU_CCGX_DMC_IMG_STATUS_UNKNOWN)
        return "unknown";
    if (val == FU_CCGX_DMC_IMG_STATUS_VALID)
        return "valid";
    if (val == FU_CCGX_DMC_IMG_STATUS_INVALID)
        return "invalid";
    if (val == FU_CCGX_DMC_IMG_STATUS_RECOVERY)
        return "recovery";
    if (val == FU_CCGX_DMC_IMG_STATUS_RECOVERED_FROM_SECONDARY)
        return "recovered-from-secondary";
    if (val == FU_CCGX_DMC_IMG_STATUS_NOT_SUPPORTED)
        return "not-supported";
    return NULL;
}

const gchar *
fu_ccgx_dmc_img_mode_to_string(FuCcgxDmcImgMode val)
{
    if (val == FU_CCGX_DMC_IMG_MODE_SINGLE_IMG)
        return "single-img";
    if (val == FU_CCGX_DMC_IMG_MODE_DUAL_IMG_SYM)
        return "dual-img-sym";
    if (val == FU_CCGX_DMC_IMG_MODE_DUAL_IMG_ASYM)
        return "dual-img-asym";
    if (val == FU_CCGX_DMC_IMG_MODE_SINGLE_IMG_WITH_RAM_IMG)
        return "single-img-with-ram-img";
    if (val == FU_CCGX_DMC_IMG_MODE_LAST)
        return "last";
    return NULL;
}

const gchar *
fu_ccgx_dmc_device_status_to_string(FuCcgxDmcDeviceStatus val)
{
    if (val == FU_CCGX_DMC_DEVICE_STATUS_IDLE)
        return "idle";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_IN_PROGRESS)
        return "update-phase1-in-progress";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_PARTIAL)
        return "update-phase1-partial";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_COMPLETE_FULL)
        return "update-complete-full";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_COMPLETE_PARTIAL)
        return "update-phase1-complete-partial";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_COMPLETE_FULL_PHASE2_NOT_DONE)
        return "update-phase1-complete-full-phase2-not-done";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_FW_DOWNLOADED_UPDATE_PEND)
        return "fw-downloaded-update-pend";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_FW_DOWNLOADED_PARTIAL_UPDATE_PEND)
        return "fw-downloaded-partial-update-pend";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_IN_PROGRESS)
        return "phase2-update-in-progress";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_PARTIAL)
        return "phase2-update-partial";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FACTORY_BACKUP)
        return "phase2-update-factory-backup";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_COMPLETE_PARTIAL)
        return "phase2-update-complete-partial";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_COMPLETE_FULL)
        return "phase2-update-complete-full";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_FWCT)
        return "phase2-update-fail-invalid-fwct";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_DOCK_IDENTITY)
        return "phase2-update-fail-invalid-dock-identity";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_COMPOSITE_VER)
        return "phase2-update-fail-invalid-composite-ver";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_AUTHENTICATION_FAILED)
        return "phase2-update-fail-authentication-failed";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_ALGORITHM)
        return "phase2-update-fail-invalid-algorithm";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_SPI_READ_FAILED)
        return "phase2-update-fail-spi-read-failed";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_KEY)
        return "phase2-update-fail-no-valid-key";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_SPI_PACKAGE)
        return "phase2-update-fail-no-valid-spi-package";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_RAM_INIT_FAILED)
        return "phase2-update-fail-ram-init-failed";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_FACTORY_BACKUP_FAILED)
        return "phase2-update-fail-factory-backup-failed";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_FACTORY_PACKAGE)
        return "phase2-update-fail-no-valid-factory-package";
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_FAIL)
        return "update-fail";
    return NULL;
}

const gchar *
fu_ccgx_dmc_devx_device_type_to_string(FuCcgxDmcDevxDeviceType val)
{
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_INVALID)
        return "invalid";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG3)
        return "ccg3";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_DMC)
        return "dmc";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG4)
        return "ccg4";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG5)
        return "ccg5";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_HX3)
        return "hx3";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_HX3_PD)
        return "hx3-pd";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_DMC_PD)
        return "dmc-pd";
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_SPI)
        return "spi";
    return NULL;
}


const gchar *
fu_ccgx_dmc_int_opcode_to_string(FuCcgxDmcIntOpcode val)
{
    if (val == FU_CCGX_DMC_INT_OPCODE_FW_UPGRADE_RQT)
        return "fw-upgrade-rqt";
    if (val == FU_CCGX_DMC_INT_OPCODE_FW_UPGRADE_STATUS)
        return "fw-upgrade-status";
    if (val == FU_CCGX_DMC_INT_OPCODE_IMG_WRITE_STATUS)
        return "img-write-status";
    if (val == FU_CCGX_DMC_INT_OPCODE_REENUM)
        return "reenum";
    if (val == FU_CCGX_DMC_INT_OPCODE_FWCT_ANALYSIS_STATUS)
        return "fwct-analysis-status";
    return NULL;
}

const gchar *
fu_ccgx_dmc_fwct_analysis_status_to_string(FuCcgxDmcFwctAnalysisStatus val)
{
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_FWCT)
        return "invalid-fwct";
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_DOCK_IDENTITY)
        return "invalid-dock-identity";
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_COMPOSITE_VERSION)
        return "invalid-composite-version";
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_AUTHENTICATION_FAILED)
        return "authentication-failed";
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_ALGORITHM)
        return "invalid-algorithm";
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_FENCE)
        return "invalid-fence";
    return NULL;
}

const gchar *
fu_ccgx_dmc_update_model_to_string(FuCcgxDmcUpdateModel val)
{
    if (val == FU_CCGX_DMC_UPDATE_MODEL_NONE)
        return "none";
    if (val == FU_CCGX_DMC_UPDATE_MODEL_DOWNLOAD_TRIGGER)
        return "download-trigger";
    if (val == FU_CCGX_DMC_UPDATE_MODEL_PENDING_RESET)
        return "pending-reset";
    return NULL;
}
/* getters */
/**
 * fu_struct_ccgx_dmc_dock_identity_get_structure_version: (skip):
 **/
guint8
fu_struct_ccgx_dmc_dock_identity_get_structure_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_cdtt_version: (skip):
 **/
guint8
fu_struct_ccgx_dmc_dock_identity_get_cdtt_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_vid: (skip):
 **/
guint16
fu_struct_ccgx_dmc_dock_identity_get_vid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_pid: (skip):
 **/
guint16
fu_struct_ccgx_dmc_dock_identity_get_pid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_device_id: (skip):
 **/
guint16
fu_struct_ccgx_dmc_dock_identity_get_device_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 6, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_vendor_string: (skip):
 **/
gchar *
fu_struct_ccgx_dmc_dock_identity_get_vendor_string(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    return fu_memstrsafe(st->data, st->len, 8, 32, NULL);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_product_string: (skip):
 **/
gchar *
fu_struct_ccgx_dmc_dock_identity_get_product_string(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    return fu_memstrsafe(st->data, st->len, 40, 32, NULL);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_custom_meta_data_flag: (skip):
 **/
guint8
fu_struct_ccgx_dmc_dock_identity_get_custom_meta_data_flag(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[72];
}
/**
 * fu_struct_ccgx_dmc_dock_identity_get_model: (skip):
 **/
guint8
fu_struct_ccgx_dmc_dock_identity_get_model(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[73];
}

/* setters */
/**
 * fu_struct_ccgx_dmc_dock_identity_set_structure_version: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_structure_version(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_cdtt_version: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_cdtt_version(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_vid: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_vid(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_pid: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_pid(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_device_id: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_device_id(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 6, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_vendor_string: (skip):
 **/
gboolean
fu_struct_ccgx_dmc_dock_identity_set_vendor_string(GByteArray *st, const gchar *value, GError **error)
{
    gsize len;
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (value == NULL) {
        memset(st->data + 8, 0x0, 32);
        return TRUE;
    }
    len = strlen(value);
    if (len > 32) {
        g_set_error(error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_DATA,
                    "string '%s' (0x%x bytes) does not fit in CcgxDmcDockIdentity.vendor_string (0x%x bytes)",
                    value, (guint) len, (guint) 32);
        return FALSE;
    }
    return fu_memcpy_safe(st->data, st->len, 8, (const guint8 *)value, len, 0x0, len, error);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_product_string: (skip):
 **/
gboolean
fu_struct_ccgx_dmc_dock_identity_set_product_string(GByteArray *st, const gchar *value, GError **error)
{
    gsize len;
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (value == NULL) {
        memset(st->data + 40, 0x0, 32);
        return TRUE;
    }
    len = strlen(value);
    if (len > 32) {
        g_set_error(error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_DATA,
                    "string '%s' (0x%x bytes) does not fit in CcgxDmcDockIdentity.product_string (0x%x bytes)",
                    value, (guint) len, (guint) 32);
        return FALSE;
    }
    return fu_memcpy_safe(st->data, st->len, 40, (const guint8 *)value, len, 0x0, len, error);
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_custom_meta_data_flag: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_custom_meta_data_flag(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[72] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_identity_set_model: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_identity_set_model(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[73] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_identity_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_dock_identity_new(void)
{
    GByteArray *st = g_byte_array_sized_new(74);
    fu_byte_array_set_size(st, 74, 0x0);
    return st;
}
/* getters */
/**
 * fu_struct_ccgx_dmc_devx_status_get_device_type: (skip):
 **/
FuCcgxDmcDevxDeviceType
fu_struct_ccgx_dmc_devx_status_get_device_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_devx_status_get_component_id: (skip):
 **/
guint8
fu_struct_ccgx_dmc_devx_status_get_component_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_devx_status_get_image_mode: (skip):
 **/
FuCcgxDmcImgMode
fu_struct_ccgx_dmc_devx_status_get_image_mode(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[2];
}
/**
 * fu_struct_ccgx_dmc_devx_status_get_current_image: (skip):
 **/
guint8
fu_struct_ccgx_dmc_devx_status_get_current_image(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[3];
}
/**
 * fu_struct_ccgx_dmc_devx_status_get_img_status: (skip):
 **/
guint8
fu_struct_ccgx_dmc_devx_status_get_img_status(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[4];
}
/**
 * fu_struct_ccgx_dmc_devx_status_get_fw_version: (skip):
 **/
const guint8 *
fu_struct_ccgx_dmc_devx_status_get_fw_version(const GByteArray *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 24;
    return st->data + 8;
}

/* setters */
/**
 * fu_struct_ccgx_dmc_devx_status_to_string: (skip):
 **/
static gchar *
fu_struct_ccgx_dmc_devx_status_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("CcgxDmcDevxStatus:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        const gchar *tmp = fu_ccgx_dmc_devx_device_type_to_string(fu_struct_ccgx_dmc_devx_status_get_device_type(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  device_type: 0x%x [%s]\n", (guint) fu_struct_ccgx_dmc_devx_status_get_device_type(st), tmp);
        } else {
            g_string_append_printf(str, "  device_type: 0x%x\n", (guint) fu_struct_ccgx_dmc_devx_status_get_device_type(st));
        }
    }
    g_string_append_printf(str, "  component_id: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_devx_status_get_component_id(st));
    {
        const gchar *tmp = fu_ccgx_dmc_img_mode_to_string(fu_struct_ccgx_dmc_devx_status_get_image_mode(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  image_mode: 0x%x [%s]\n", (guint) fu_struct_ccgx_dmc_devx_status_get_image_mode(st), tmp);
        } else {
            g_string_append_printf(str, "  image_mode: 0x%x\n", (guint) fu_struct_ccgx_dmc_devx_status_get_image_mode(st));
        }
    }
    g_string_append_printf(str, "  current_image: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_devx_status_get_current_image(st));
    g_string_append_printf(str, "  img_status: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_devx_status_get_img_status(st));
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_ccgx_dmc_devx_status_get_fw_version(st, &bufsz);
        g_autoptr(GString) tmp = g_string_new(NULL);
        for (gsize i = 0; i < bufsz; i++)
            g_string_append_printf(tmp, "%02X", buf[i]);
        g_string_append_printf(str, "  fw_version: 0x%s\n", tmp->str);
    }
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_ccgx_dmc_devx_status_parse: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_devx_status_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 32, error)) {
        g_prefix_error(error, "invalid struct CcgxDmcDevxStatus: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 32);
    str = fu_struct_ccgx_dmc_devx_status_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/* getters */
/**
 * fu_struct_ccgx_dmc_dock_status_get_device_status: (skip):
 **/
FuCcgxDmcDeviceStatus
fu_struct_ccgx_dmc_dock_status_get_device_status(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_dock_status_get_device_count: (skip):
 **/
guint8
fu_struct_ccgx_dmc_dock_status_get_device_count(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_dock_status_get_status_length: (skip):
 **/
guint16
fu_struct_ccgx_dmc_dock_status_get_status_length(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_status_get_composite_version: (skip):
 **/
guint32
fu_struct_ccgx_dmc_dock_status_get_composite_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 4, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_ccgx_dmc_dock_status_set_device_status: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_status_set_device_status(GByteArray *st, FuCcgxDmcDeviceStatus value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_status_set_device_count: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_status_set_device_count(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_ccgx_dmc_dock_status_set_status_length: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_status_set_status_length(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_status_set_composite_version: (skip):
 **/
void
fu_struct_ccgx_dmc_dock_status_set_composite_version(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_dock_status_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_dock_status_new(void)
{
    GByteArray *st = g_byte_array_sized_new(8);
    fu_byte_array_set_size(st, 8, 0x0);
    return st;
}
/* getters */
/**
 * fu_struct_ccgx_dmc_int_rqt_get_opcode: (skip):
 **/
FuCcgxDmcIntOpcode
fu_struct_ccgx_dmc_int_rqt_get_opcode(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_int_rqt_get_length: (skip):
 **/
guint8
fu_struct_ccgx_dmc_int_rqt_get_length(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_int_rqt_get_data: (skip):
 **/
const guint8 *
fu_struct_ccgx_dmc_int_rqt_get_data(const GByteArray *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 8;
    return st->data + 2;
}

/* setters */
/**
 * fu_struct_ccgx_dmc_int_rqt_set_opcode: (skip):
 **/
void
fu_struct_ccgx_dmc_int_rqt_set_opcode(GByteArray *st, FuCcgxDmcIntOpcode value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_ccgx_dmc_int_rqt_set_length: (skip):
 **/
void
fu_struct_ccgx_dmc_int_rqt_set_length(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_ccgx_dmc_int_rqt_set_data: (skip):
 **/
gboolean
fu_struct_ccgx_dmc_int_rqt_set_data(GByteArray *st, const guint8 *buf, gsize bufsz, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(buf != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    return fu_memcpy_safe(st->data, st->len, 2, buf, bufsz, 0x0, bufsz, error);
}
/**
 * fu_struct_ccgx_dmc_int_rqt_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_int_rqt_new(void)
{
    GByteArray *st = g_byte_array_sized_new(10);
    fu_byte_array_set_size(st, 10, 0x0);
    return st;
}
/* getters */
/**
 * fu_struct_ccgx_dmc_fwct_info_get_signature: (skip):
 **/
static guint32
fu_struct_ccgx_dmc_fwct_info_get_signature(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_size: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_info_get_size(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_checksum: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_info_get_checksum(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[6];
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_version: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_info_get_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[7];
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[8];
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_cdtt_version: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_info_get_cdtt_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[9];
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_vid: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_info_get_vid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 10, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_pid: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_info_get_pid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 12, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_device_id: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_info_get_device_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 14, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_composite_version: (skip):
 **/
guint32
fu_struct_ccgx_dmc_fwct_info_get_composite_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 32, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_get_image_count: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_info_get_image_count(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[36];
}

/* setters */
/**
 * fu_struct_ccgx_dmc_fwct_info_set_signature: (skip):
 **/
static void
fu_struct_ccgx_dmc_fwct_info_set_signature(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_size: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_size(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_checksum: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_checksum(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[6] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_version: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_version(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[7] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_custom_meta_type: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_custom_meta_type(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[8] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_cdtt_version: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_cdtt_version(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[9] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_vid: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_vid(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 10, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_pid: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_pid(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 12, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_device_id: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_device_id(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 14, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_composite_version: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_composite_version(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 32, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_set_image_count: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_info_set_image_count(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[36] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_info_new(void)
{
    GByteArray *st = g_byte_array_sized_new(40);
    fu_byte_array_set_size(st, 40, 0x0);
    fu_struct_ccgx_dmc_fwct_info_set_signature(st, 0x54435746);
    return st;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_to_string: (skip):
 **/
static gchar *
fu_struct_ccgx_dmc_fwct_info_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("CcgxDmcFwctInfo:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  size: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_size(st));
    g_string_append_printf(str, "  checksum: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_checksum(st));
    g_string_append_printf(str, "  version: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_version(st));
    g_string_append_printf(str, "  custom_meta_type: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type(st));
    g_string_append_printf(str, "  cdtt_version: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_cdtt_version(st));
    g_string_append_printf(str, "  vid: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_vid(st));
    g_string_append_printf(str, "  pid: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_pid(st));
    g_string_append_printf(str, "  device_id: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_device_id(st));
    g_string_append_printf(str, "  composite_version: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_composite_version(st));
    g_string_append_printf(str, "  image_count: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_image_count(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_parse: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_info_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 40, error)) {
        g_prefix_error(error, "invalid struct CcgxDmcFwctInfo: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 40);
    if (fu_struct_ccgx_dmc_fwct_info_get_signature(st) != 0x54435746) {
        g_set_error_literal(error,
                            G_IO_ERROR,
                            G_IO_ERROR_INVALID_DATA,
                            "constant CcgxDmcFwctInfo.signature was not valid, expected 0x54435746");
        return NULL;
    }
    str = fu_struct_ccgx_dmc_fwct_info_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/**
 * fu_struct_ccgx_dmc_fwct_info_validate: (skip):
 **/
static gboolean
fu_struct_ccgx_dmc_fwct_info_validate(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    GByteArray st = {.data = (guint8 *) buf + offset, .len = bufsz - offset, };
    g_return_val_if_fail(buf != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (!fu_memchk_read(bufsz, offset, 40, error)) {
        g_prefix_error(error, "invalid struct CcgxDmcFwctInfo: ");
        return FALSE;
    }
    if (fu_struct_ccgx_dmc_fwct_info_get_signature(&st) != 0x54435746) {
        g_set_error_literal(error,
                            G_IO_ERROR,
                            G_IO_ERROR_INVALID_DATA,
                            "constant CcgxDmcFwctInfo.signature was not valid");
        return FALSE;
    }
    return TRUE;
}
/**
 * fu_struct_ccgx_dmc_fwct_info_validate_bytes: (skip):
 **/
gboolean
fu_struct_ccgx_dmc_fwct_info_validate_bytes(GBytes *blob, gsize offset, GError **error)
{
    gsize bufsz = 0;
    const guint8 *buf = g_bytes_get_data(blob, &bufsz);
    return fu_struct_ccgx_dmc_fwct_info_validate(buf, bufsz, offset, error);
}
/* getters */
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_device_type: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_image_info_get_device_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_type: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_image_info_get_img_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_comp_id: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[2];
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_row_size: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_image_info_get_row_size(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[3];
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_fw_version: (skip):
 **/
guint32
fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_app_version: (skip):
 **/
guint32
fu_struct_ccgx_dmc_fwct_image_info_get_app_version(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 12, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_offset: (skip):
 **/
guint32
fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 16, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_size: (skip):
 **/
guint32
fu_struct_ccgx_dmc_fwct_image_info_get_img_size(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 20, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_digest: (skip):
 **/
const guint8 *
fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(const GByteArray *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 32;
    return st->data + 24;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[56];
}

/* setters */
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_device_type: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_device_type(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_type: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_img_type(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_comp_id: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_comp_id(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[2] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_row_size: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_row_size(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[3] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_fw_version: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_fw_version(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 8, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_app_version: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_app_version(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 12, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_offset: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_img_offset(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 16, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_size: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_img_size(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 20, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_digest: (skip):
 **/
gboolean
fu_struct_ccgx_dmc_fwct_image_info_set_img_digest(GByteArray *st, const guint8 *buf, gsize bufsz, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(buf != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    return fu_memcpy_safe(st->data, st->len, 24, buf, bufsz, 0x0, bufsz, error);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[56] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_image_info_new(void)
{
    GByteArray *st = g_byte_array_sized_new(60);
    fu_byte_array_set_size(st, 60, 0x0);
    return st;
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_to_string: (skip):
 **/
static gchar *
fu_struct_ccgx_dmc_fwct_image_info_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("CcgxDmcFwctImageInfo:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  device_type: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_device_type(st));
    g_string_append_printf(str, "  img_type: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_type(st));
    g_string_append_printf(str, "  comp_id: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(st));
    g_string_append_printf(str, "  row_size: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_row_size(st));
    g_string_append_printf(str, "  fw_version: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(st));
    g_string_append_printf(str, "  app_version: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_app_version(st));
    g_string_append_printf(str, "  img_offset: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(st));
    g_string_append_printf(str, "  img_size: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_size(st));
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(st, &bufsz);
        g_autoptr(GString) tmp = g_string_new(NULL);
        for (gsize i = 0; i < bufsz; i++)
            g_string_append_printf(tmp, "%02X", buf[i]);
        g_string_append_printf(str, "  img_digest: 0x%s\n", tmp->str);
    }
    g_string_append_printf(str, "  num_img_segments: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_ccgx_dmc_fwct_image_info_parse: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_image_info_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 60, error)) {
        g_prefix_error(error, "invalid struct CcgxDmcFwctImageInfo: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 60);
    str = fu_struct_ccgx_dmc_fwct_image_info_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/* getters */
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_type: (skip):
 **/
guint8
fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows: (skip):
 **/
guint16
fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_type: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_segmentation_info_set_type(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows: (skip):
 **/
void
fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_new: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_segmentation_info_new(void)
{
    GByteArray *st = g_byte_array_sized_new(8);
    fu_byte_array_set_size(st, 8, 0x0);
    return st;
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_to_string: (skip):
 **/
static gchar *
fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("CcgxDmcFwctSegmentationInfo:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  img_id: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(st));
    g_string_append_printf(str, "  type: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(st));
    g_string_append_printf(str, "  start_row: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(st));
    g_string_append_printf(str, "  num_rows: 0x%x\n",
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_ccgx_dmc_fwct_segmentation_info_parse: (skip):
 **/
GByteArray *
fu_struct_ccgx_dmc_fwct_segmentation_info_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 8, error)) {
        g_prefix_error(error, "invalid struct CcgxDmcFwctSegmentationInfo: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 8);
    str = fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
