/*
 * This file is auto-generated, do not modify!
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "config.h"

#include <glib.h>

#include "fu-raydium-tp-struct.h"
#include "fu-byte-array.h"
#include "fu-bytes.h"
#include "fu-mem-private.h"
#include "fu-string.h"

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


/**
 * fu_raydium_tp_bl_cmd_to_string:
 * @val: value, e.g. %FU_RAYDIUM_TP_BL_CMD_WRITE_FLASH
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_raydium_tp_bl_cmd_to_string(FuRaydiumTpBlCmd val)
{
    if (val == FU_RAYDIUM_TP_BL_CMD_ERASE_FLASH)
        return "erase-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_WRITE_FLASH)
        return "write-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_SELECT_FLASH)
        return "select-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_WRITE_REGISTER)
        return "write-register";
    if (val == FU_RAYDIUM_TP_BL_CMD_READ_ADDRESS_MEMORY)
        return "read-address-memory";
    if (val == FU_RAYDIUM_TP_BL_CMD_WATCHDOG_FUNCTION_SET)
        return "watchdog-function-set";
    if (val == FU_RAYDIUM_TP_BL_CMD_WRITE_RAM_FLASH)
        return "write-ram-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_WRITE_HID_I2C_FLASH)
        return "write-hid-i2c-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_READ_FLASH_ADDR)
        return "read-flash-addr";
    if (val == FU_RAYDIUM_TP_BL_CMD_TRIGGER_WRITE_FLASH)
        return "trigger-write-flash";
    if (val == FU_RAYDIUM_TP_BL_CMD_SOFTWARE_RESET)
        return "software-reset";
    if (val == FU_RAYDIUM_TP_BL_CMD_IDLE)
        return "idle";
    return NULL;
}




/**
 * fu_raydium_tp_protect_to_string:
 * @val: value, e.g. %FU_RAYDIUM_TP_PROTECT_FW_UNLOCK
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_raydium_tp_protect_to_string(FuRaydiumTpProtect val)
{
    if (val == FU_RAYDIUM_TP_PROTECT_ALL_LOCK)
        return "all-lock";
    if (val == FU_RAYDIUM_TP_PROTECT_FW_UNLOCK)
        return "fw-unlock";
    if (val == FU_RAYDIUM_TP_PROTECT_GD_UNLOCK)
        return "gd-unlock";
    if (val == FU_RAYDIUM_TP_PROTECT_BL_UNLOCK)
        return "bl-unlock";
    return NULL;
}





/**
 * fu_struct_raydium_tp_ft_record_info_ref: (skip):
 **/
FuStructRaydiumTpFtRecordInfo *
fu_struct_raydium_tp_ft_record_info_ref(FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_raydium_tp_ft_record_info_unref: (skip):
 **/
void
fu_struct_raydium_tp_ft_record_info_unref(FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructRaydiumTpFtRecordInfo refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_raydium_tp_ft_record_info_new_internal: (skip):
 **/
static FuStructRaydiumTpFtRecordInfo *
fu_struct_raydium_tp_ft_record_info_new_internal(void)
{
    FuStructRaydiumTpFtRecordInfo *st = g_new0(FuStructRaydiumTpFtRecordInfo, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_raydium_tp_ft_record_info_get_version_major: (skip):
 **/
guint8
fu_struct_raydium_tp_ft_record_info_get_version_major(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[0];
}
/**
 * fu_struct_raydium_tp_ft_record_info_get_version_minor: (skip):
 **/
guint8
fu_struct_raydium_tp_ft_record_info_get_version_minor(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[1];
}
/**
 * fu_struct_raydium_tp_ft_record_info_get_pid: (skip):
 **/
guint16
fu_struct_raydium_tp_ft_record_info_get_pid(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_ft_record_info_get_vid: (skip):
 **/
guint16
fu_struct_raydium_tp_ft_record_info_get_vid(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_ft_record_info_get_slave_id: (skip):
 **/
guint8
fu_struct_raydium_tp_ft_record_info_get_slave_id(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[6];
}

/* setters */
/**
 * fu_struct_raydium_tp_ft_record_info_to_string: (skip):
 **/
static gchar *
fu_struct_raydium_tp_ft_record_info_to_string(const FuStructRaydiumTpFtRecordInfo *st)
{
    g_autoptr(GString) str = g_string_new("FuStructRaydiumTpFtRecordInfo:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  version_major: 0x%x\n",
                           (guint) fu_struct_raydium_tp_ft_record_info_get_version_major(st));
    g_string_append_printf(str, "  version_minor: 0x%x\n",
                           (guint) fu_struct_raydium_tp_ft_record_info_get_version_minor(st));
    g_string_append_printf(str, "  pid: 0x%x\n",
                           (guint) fu_struct_raydium_tp_ft_record_info_get_pid(st));
    g_string_append_printf(str, "  vid: 0x%x\n",
                           (guint) fu_struct_raydium_tp_ft_record_info_get_vid(st));
    g_string_append_printf(str, "  slave_id: 0x%x\n",
                           (guint) fu_struct_raydium_tp_ft_record_info_get_slave_id(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_raydium_tp_ft_record_info_validate_internal(FuStructRaydiumTpFtRecordInfo *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_raydium_tp_ft_record_info_parse_internal(FuStructRaydiumTpFtRecordInfo *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_raydium_tp_ft_record_info_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_raydium_tp_ft_record_info_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_raydium_tp_ft_record_info_parse: (skip):
 **/
FuStructRaydiumTpFtRecordInfo *
fu_struct_raydium_tp_ft_record_info_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructRaydiumTpFtRecordInfo) st = fu_struct_raydium_tp_ft_record_info_new_internal();
    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_literal(error, "invalid struct FuStructRaydiumTpFtRecordInfo: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 8);
    if (!fu_struct_raydium_tp_ft_record_info_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_raydium_tp_desc_record_info_ref: (skip):
 **/
FuStructRaydiumTpDescRecordInfo *
fu_struct_raydium_tp_desc_record_info_ref(FuStructRaydiumTpDescRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_raydium_tp_desc_record_info_unref: (skip):
 **/
void
fu_struct_raydium_tp_desc_record_info_unref(FuStructRaydiumTpDescRecordInfo *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructRaydiumTpDescRecordInfo refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_raydium_tp_desc_record_info_new_internal: (skip):
 **/
static FuStructRaydiumTpDescRecordInfo *
fu_struct_raydium_tp_desc_record_info_new_internal(void)
{
    FuStructRaydiumTpDescRecordInfo *st = g_new0(FuStructRaydiumTpDescRecordInfo, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_raydium_tp_desc_record_info_get_header: (skip):
 **/
const guint8 *
fu_struct_raydium_tp_desc_record_info_get_header(const FuStructRaydiumTpDescRecordInfo *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 20;
    return st->buf->data + 0;
}
/**
 * fu_struct_raydium_tp_desc_record_info_get_vid: (skip):
 **/
guint16
fu_struct_raydium_tp_desc_record_info_get_vid(const FuStructRaydiumTpDescRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 20, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_desc_record_info_get_pid: (skip):
 **/
guint16
fu_struct_raydium_tp_desc_record_info_get_pid(const FuStructRaydiumTpDescRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 22, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_desc_record_info_get_rev: (skip):
 **/
guint16
fu_struct_raydium_tp_desc_record_info_get_rev(const FuStructRaydiumTpDescRecordInfo *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 24, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_raydium_tp_desc_record_info_to_string: (skip):
 **/
static gchar *
fu_struct_raydium_tp_desc_record_info_to_string(const FuStructRaydiumTpDescRecordInfo *st)
{
    g_autoptr(GString) str = g_string_new("FuStructRaydiumTpDescRecordInfo:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_raydium_tp_desc_record_info_get_header(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, "  header: 0x%s\n", tmp->str);
    }
    g_string_append_printf(str, "  vid: 0x%x\n",
                           (guint) fu_struct_raydium_tp_desc_record_info_get_vid(st));
    g_string_append_printf(str, "  pid: 0x%x\n",
                           (guint) fu_struct_raydium_tp_desc_record_info_get_pid(st));
    g_string_append_printf(str, "  rev: 0x%x\n",
                           (guint) fu_struct_raydium_tp_desc_record_info_get_rev(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_raydium_tp_desc_record_info_validate_internal(FuStructRaydiumTpDescRecordInfo *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_raydium_tp_desc_record_info_parse_internal(FuStructRaydiumTpDescRecordInfo *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_raydium_tp_desc_record_info_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_raydium_tp_desc_record_info_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_raydium_tp_desc_record_info_parse: (skip):
 **/
FuStructRaydiumTpDescRecordInfo *
fu_struct_raydium_tp_desc_record_info_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructRaydiumTpDescRecordInfo) st = fu_struct_raydium_tp_desc_record_info_new_internal();
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 27, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructRaydiumTpDescRecordInfo: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 27);
    if (!fu_struct_raydium_tp_desc_record_info_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_raydium_tp_fw_hdr_ref: (skip):
 **/
FuStructRaydiumTpFwHdr *
fu_struct_raydium_tp_fw_hdr_ref(FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_raydium_tp_fw_hdr_unref: (skip):
 **/
void
fu_struct_raydium_tp_fw_hdr_unref(FuStructRaydiumTpFwHdr *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructRaydiumTpFwHdr refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_raydium_tp_fw_hdr_new_internal: (skip):
 **/
static FuStructRaydiumTpFwHdr *
fu_struct_raydium_tp_fw_hdr_new_internal(void)
{
    FuStructRaydiumTpFwHdr *st = g_new0(FuStructRaydiumTpFwHdr, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_raydium_tp_fw_hdr_get_vendor_id: (skip):
 **/
guint16
fu_struct_raydium_tp_fw_hdr_get_vendor_id(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_product_id: (skip):
 **/
guint16
fu_struct_raydium_tp_fw_hdr_get_product_id(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_fw_base: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_fw_base(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_desc_base: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_desc_base(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_start: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_start(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 16, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_length: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_length(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 20, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_desc_start: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_desc_start(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 24, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_fw_hdr_get_desc_length: (skip):
 **/
guint32
fu_struct_raydium_tp_fw_hdr_get_desc_length(const FuStructRaydiumTpFwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 28, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_raydium_tp_fw_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_raydium_tp_fw_hdr_to_string(const FuStructRaydiumTpFwHdr *st)
{
    g_autoptr(GString) str = g_string_new("FuStructRaydiumTpFwHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  vendor_id: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_vendor_id(st));
    g_string_append_printf(str, "  product_id: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_product_id(st));
    g_string_append_printf(str, "  fw_base: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_fw_base(st));
    g_string_append_printf(str, "  desc_base: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_desc_base(st));
    g_string_append_printf(str, "  start: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_start(st));
    g_string_append_printf(str, "  length: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_length(st));
    g_string_append_printf(str, "  desc_start: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_desc_start(st));
    g_string_append_printf(str, "  desc_length: 0x%x\n",
                           (guint) fu_struct_raydium_tp_fw_hdr_get_desc_length(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_raydium_tp_fw_hdr_validate_internal(FuStructRaydiumTpFwHdr *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_raydium_tp_fw_hdr_parse_internal(FuStructRaydiumTpFwHdr *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_raydium_tp_fw_hdr_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_raydium_tp_fw_hdr_validate_internal(st, error))
        return FALSE;
    return TRUE;
}
/**
 * fu_struct_raydium_tp_fw_hdr_parse_stream: (skip):
 **/
FuStructRaydiumTpFwHdr *
fu_struct_raydium_tp_fw_hdr_parse_stream(GInputStream *stream, gsize offset, GError **error)
{
    g_autoptr(FuStructRaydiumTpFwHdr) st = fu_struct_raydium_tp_fw_hdr_new_internal();
    st->buf = fu_input_stream_read_byte_array(stream, offset, 32, NULL, error);
    if (st->buf == NULL) {
        g_prefix_error(error, "FuStructRaydiumTpFwHdr failed read of 0x%x: ", (guint) 32);
        return NULL;
    }
    if (st->buf->len != 32) {
        g_set_error(error,
                    FWUPD_ERROR,
                    FWUPD_ERROR_INVALID_DATA,
                    "FuStructRaydiumTpFwHdr requested 0x%x and got 0x%x",
                    (guint) 32,
                    (guint) st->buf->len);
        return NULL;
    }
    if (!fu_struct_raydium_tp_fw_hdr_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_raydium_tp_hid_packet_ref: (skip):
 **/
FuStructRaydiumTpHidPacket *
fu_struct_raydium_tp_hid_packet_ref(FuStructRaydiumTpHidPacket *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_raydium_tp_hid_packet_unref: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_unref(FuStructRaydiumTpHidPacket *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructRaydiumTpHidPacket refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_raydium_tp_hid_packet_new_internal: (skip):
 **/
static FuStructRaydiumTpHidPacket *
fu_struct_raydium_tp_hid_packet_new_internal(void)
{
    FuStructRaydiumTpHidPacket *st = g_new0(FuStructRaydiumTpHidPacket, 1);
    st->refcount = 1;
    return st;
}

/* getters */

/* setters */
/**
 * fu_struct_raydium_tp_hid_packet_set_header0: (skip):
 **/
static void
fu_struct_raydium_tp_hid_packet_set_header0(FuStructRaydiumTpHidPacket *st, FuRaydiumTpCmd2 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[0] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header1: (skip):
 **/
static void
fu_struct_raydium_tp_hid_packet_set_header1(FuStructRaydiumTpHidPacket *st, FuRaydiumTpHidData value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[1] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header2: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_header2(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[2] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header3: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_header3(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[3] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header4: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_header4(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[4] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header5: (skip):
 **/
static void
fu_struct_raydium_tp_hid_packet_set_header5(FuStructRaydiumTpHidPacket *st, FuRaydiumTpHidData value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[5] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_header6: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_header6(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[6] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data0: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data0(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[7] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data1: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data1(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[8] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data2: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data2(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[9] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data3: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data3(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[10] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data4: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data4(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[11] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_data5: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_data5(FuStructRaydiumTpHidPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[12] = value;
}
/**
 * fu_struct_raydium_tp_hid_packet_set_length: (skip):
 **/
void
fu_struct_raydium_tp_hid_packet_set_length(FuStructRaydiumTpHidPacket *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->buf->data + 13, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_raydium_tp_hid_packet_new: (skip):
 **/
FuStructRaydiumTpHidPacket *
fu_struct_raydium_tp_hid_packet_new(void)
{
    FuStructRaydiumTpHidPacket *st = fu_struct_raydium_tp_hid_packet_new_internal();
    st->buf = g_byte_array_sized_new(64);
    fu_byte_array_set_size(st->buf, 64, 0x0);
    fu_struct_raydium_tp_hid_packet_set_header0(st, FU_RAYDIUM_TP_CMD2_WID);
    fu_struct_raydium_tp_hid_packet_set_header1(st, FU_RAYDIUM_TP_HID_DATA_HEADER1);
    fu_struct_raydium_tp_hid_packet_set_header5(st, FU_RAYDIUM_TP_HID_DATA_HEADER5);
    return st;
}
