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

#pragma once
#include <fu-input-stream.h>
/**
 * FuLegionHid2Command:
 *
 * Commands sent over XInput, DInput
 */
typedef enum {
    /**
     * FU_LEGION_HID2_COMMAND_GET_VERSION:
     */
    FU_LEGION_HID2_COMMAND_GET_VERSION = 0x01,
    /**
     * FU_LEGION_HID2_COMMAND_GET_PL_TEST:
     */
    FU_LEGION_HID2_COMMAND_GET_PL_TEST = 0xDF,
    /**
     * FU_LEGION_HID2_COMMAND_START_IAP:
     */
    FU_LEGION_HID2_COMMAND_START_IAP = 0xE1,
    /**
     * FU_LEGION_HID2_COMMAND_IC_RESET:
     */
    FU_LEGION_HID2_COMMAND_IC_RESET = 0xEF,
}  FuLegionHid2Command;
/**
 * FuLegionHid2PlTest:
 */
typedef enum {
    /**
     * FU_LEGION_HID2_PL_TEST_TP_MANUFACTURER:
     */
    FU_LEGION_HID2_PL_TEST_TP_MANUFACTURER = 0x2,
    /**
     * FU_LEGION_HID2_PL_TEST_AG_SENSOR_MANUFACTURER:
     */
    FU_LEGION_HID2_PL_TEST_AG_SENSOR_MANUFACTURER = 0x3,
    /**
     * FU_LEGION_HID2_PL_TEST_TP_VERSION:
     */
    FU_LEGION_HID2_PL_TEST_TP_VERSION = 0x4,
}  FuLegionHid2PlTest;
/**
 * FuLegionHid2TpMan:
 */
typedef enum {
    /**
     * FU_LEGION_HID2_TP_MAN_NONE:
     */
    FU_LEGION_HID2_TP_MAN_NONE = 0x0,
    /**
     * FU_LEGION_HID2_TP_MAN_BETTER_LIFE:
     */
    FU_LEGION_HID2_TP_MAN_BETTER_LIFE = 0x1,
    /**
     * FU_LEGION_HID2_TP_MAN_SIPO:
     */
    FU_LEGION_HID2_TP_MAN_SIPO = 0x2,
}  FuLegionHid2TpMan;
/**
 * FuLegionHid2ReportId:
 */
typedef enum {
    /**
     * FU_LEGION_HID2_REPORT_ID_IAP:
     */
    FU_LEGION_HID2_REPORT_ID_IAP = 0x1,
    /**
     * FU_LEGION_HID2_REPORT_ID_COMMUNICATION:
     */
    FU_LEGION_HID2_REPORT_ID_COMMUNICATION = 0x4,
}  FuLegionHid2ReportId;
/**
 * FuLegionIapHostTag:
 *
 * Reset in app mode, unused by fwupd
 * #[derive(New)]
 * #[repr(C, packed)]
 * struct FuStructLegionIcReset {
 * cmd: u8 == 0xEF,
 * data: [char; 7] == "ICRESET",
 * reserved: [u8; 57],
 * }
 * IAP commands
 */
typedef enum {
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_UNLOCK:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_UNLOCK = 0x5A80,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_DATA:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_DATA = 0x5A81,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_SIGNATURE:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_SIGNATURE = 0x5A82,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_UPDATE:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_UPDATE = 0x5A83,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_CARRY:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_CARRY = 0x5A84,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_VERIFY:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_VERIFY = 0x5A85,
    /**
     * FU_LEGION_IAP_HOST_TAG_IAP_RESTART:
     */
    FU_LEGION_IAP_HOST_TAG_IAP_RESTART = 0x5A86,
}  FuLegionIapHostTag;
/**
 * FuLegionIapDeviceTag:
 */
typedef enum {
    /**
     * FU_LEGION_IAP_DEVICE_TAG_IAP_ACK:
     */
    FU_LEGION_IAP_DEVICE_TAG_IAP_ACK = 0xA510,
}  FuLegionIapDeviceTag;
/**
 * FuLegionIapError:
 */
typedef enum {
    /**
     * FU_LEGION_IAP_ERROR_IAP_OK:
     */
    FU_LEGION_IAP_ERROR_IAP_OK = 0x00,
    /**
     * FU_LEGION_IAP_ERROR_IAP_ERR:
     */
    FU_LEGION_IAP_ERROR_IAP_ERR = 0x01,
    /**
     * FU_LEGION_IAP_ERROR_IAP_CERTIFIED:
     */
    FU_LEGION_IAP_ERROR_IAP_CERTIFIED = 0x02,
    /**
     * FU_LEGION_IAP_ERROR_IAP_NOT_CERTIFIED:
     */
    FU_LEGION_IAP_ERROR_IAP_NOT_CERTIFIED = 0x03,
}  FuLegionIapError;
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionGetVersion;

FuStructLegionGetVersion *fu_struct_legion_get_version_ref(FuStructLegionGetVersion *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_get_version_unref(FuStructLegionGetVersion *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionGetVersion, fu_struct_legion_get_version_unref)
FuStructLegionGetVersion *fu_struct_legion_get_version_new(void) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_VERSION_OFFSET_CMD 0x0
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_VERSION_SIZE 0x40
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_VERSION_DEFAULT_CMD 0x01
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionVersion;

FuStructLegionVersion *fu_struct_legion_version_ref(FuStructLegionVersion *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_version_unref(FuStructLegionVersion *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionVersion, fu_struct_legion_version_unref)
FuStructLegionVersion *fu_struct_legion_version_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_legion_version_get_command(const FuStructLegionVersion *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_version_get_version(const FuStructLegionVersion *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_legion_version_set_command(FuStructLegionVersion *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_legion_version_set_version(FuStructLegionVersion *st, guint32 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_VERSION_OFFSET_COMMAND 0x0
#define FU_STRUCT_LEGION_VERSION_OFFSET_VERSION 0x1
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_VERSION_SIZE 0x40
#endif

#ifndef __GI_SCANNER__
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionGetPlTest;

FuStructLegionGetPlTest *fu_struct_legion_get_pl_test_ref(FuStructLegionGetPlTest *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_get_pl_test_unref(FuStructLegionGetPlTest *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionGetPlTest, fu_struct_legion_get_pl_test_unref)
FuStructLegionGetPlTest *fu_struct_legion_get_pl_test_new(void) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_legion_get_pl_test_set_index(FuStructLegionGetPlTest *st, guint8 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_PL_TEST_OFFSET_CMD 0x0
#define FU_STRUCT_LEGION_GET_PL_TEST_OFFSET_INDEX 0x1
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_PL_TEST_SIZE 0x2
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_PL_TEST_DEFAULT_CMD 0xDF
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionGetPlTestResult;

FuStructLegionGetPlTestResult *fu_struct_legion_get_pl_test_result_ref(FuStructLegionGetPlTestResult *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_get_pl_test_result_unref(FuStructLegionGetPlTestResult *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionGetPlTestResult, fu_struct_legion_get_pl_test_result_unref)
FuStructLegionGetPlTestResult *fu_struct_legion_get_pl_test_result_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_legion_get_pl_test_result_get_cmd(const FuStructLegionGetPlTestResult *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_legion_get_pl_test_result_get_index(const FuStructLegionGetPlTestResult *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_legion_get_pl_test_result_get_content(const FuStructLegionGetPlTestResult *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_legion_get_pl_test_result_set_cmd(FuStructLegionGetPlTestResult *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_legion_get_pl_test_result_set_index(FuStructLegionGetPlTestResult *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_legion_get_pl_test_result_set_content(FuStructLegionGetPlTestResult *st, guint8 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_PL_TEST_RESULT_OFFSET_CMD 0x0
#define FU_STRUCT_LEGION_GET_PL_TEST_RESULT_OFFSET_INDEX 0x1
#define FU_STRUCT_LEGION_GET_PL_TEST_RESULT_OFFSET_CONTENT 0x2
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_GET_PL_TEST_RESULT_SIZE 0x40
#endif

#ifndef __GI_SCANNER__
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionStartIap;

FuStructLegionStartIap *fu_struct_legion_start_iap_ref(FuStructLegionStartIap *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_start_iap_unref(FuStructLegionStartIap *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionStartIap, fu_struct_legion_start_iap_unref)
FuStructLegionStartIap *fu_struct_legion_start_iap_new(void) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_START_IAP_OFFSET_CMD 0x0
#define FU_STRUCT_LEGION_START_IAP_OFFSET_DATA 0x1
#define FU_STRUCT_LEGION_START_IAP_OFFSET_RESET 0x8
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_START_IAP_SIZE_DATA 0x7
#define FU_STRUCT_LEGION_START_IAP_N_ELEMENTS_DATA 7
#define FU_STRUCT_LEGION_START_IAP_SIZE 0x41
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_START_IAP_DEFAULT_CMD 0xE1
#define FU_STRUCT_LEGION_START_IAP_DEFAULT_DATA "UPGRADE"
#define FU_STRUCT_LEGION_START_IAP_DEFAULT_RESET 0x01
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionIapResult;

FuStructLegionIapResult *fu_struct_legion_iap_result_ref(FuStructLegionIapResult *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_iap_result_unref(FuStructLegionIapResult *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionIapResult, fu_struct_legion_iap_result_unref)
FuStructLegionIapResult *fu_struct_legion_iap_result_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_legion_iap_result_get_ret(const FuStructLegionIapResult *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_legion_iap_result_set_ret(FuStructLegionIapResult *st, guint8 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_IAP_RESULT_OFFSET_RET 0x0
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_IAP_RESULT_SIZE 0x40
#endif

#ifndef __GI_SCANNER__
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionIapTlv;

FuStructLegionIapTlv *fu_struct_legion_iap_tlv_ref(FuStructLegionIapTlv *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_iap_tlv_unref(FuStructLegionIapTlv *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionIapTlv, fu_struct_legion_iap_tlv_unref)
FuStructLegionIapTlv *fu_struct_legion_iap_tlv_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_legion_iap_tlv_get_tag(const FuStructLegionIapTlv *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_legion_iap_tlv_get_length(const FuStructLegionIapTlv *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
const guint8 *fu_struct_legion_iap_tlv_get_value(const FuStructLegionIapTlv *st, gsize *bufsz) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_legion_iap_tlv_set_tag(FuStructLegionIapTlv *st, guint16 value) G_GNUC_NON_NULL(1);
void fu_struct_legion_iap_tlv_set_length(FuStructLegionIapTlv *st, guint16 value) G_GNUC_NON_NULL(1);
gboolean fu_struct_legion_iap_tlv_set_value(FuStructLegionIapTlv *st, const guint8 *buf, gsize bufsz, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_IAP_TLV_OFFSET_TAG 0x0
#define FU_STRUCT_LEGION_IAP_TLV_OFFSET_LENGTH 0x2
#define FU_STRUCT_LEGION_IAP_TLV_OFFSET_VALUE 0x4
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_IAP_TLV_SIZE_VALUE 0x3C
#define FU_STRUCT_LEGION_IAP_TLV_N_ELEMENTS_VALUE 60
#define FU_STRUCT_LEGION_IAP_TLV_SIZE 0x40
#endif

#ifndef __GI_SCANNER__
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionHid2Header;

FuStructLegionHid2Header *fu_struct_legion_hid2_header_ref(FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_hid2_header_unref(FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionHid2Header, fu_struct_legion_hid2_header_unref)
FuStructLegionHid2Header *fu_struct_legion_hid2_header_parse_stream(GInputStream *stream, gsize offset, GError **error) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_hid2_header_get_sig_add(const FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_hid2_header_get_sig_len(const FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_hid2_header_get_data_add(const FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_hid2_header_get_data_len(const FuStructLegionHid2Header *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_HEADER_OFFSET_MAGIC 0x0
#define FU_STRUCT_LEGION_HID2_HEADER_OFFSET_SIG_ADD 0xE
#define FU_STRUCT_LEGION_HID2_HEADER_OFFSET_SIG_LEN 0x12
#define FU_STRUCT_LEGION_HID2_HEADER_OFFSET_DATA_ADD 0x16
#define FU_STRUCT_LEGION_HID2_HEADER_OFFSET_DATA_LEN 0x1A
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_HEADER_SIZE_MAGIC 0x7
#define FU_STRUCT_LEGION_HID2_HEADER_N_ELEMENTS_MAGIC 7
#define FU_STRUCT_LEGION_HID2_HEADER_SIZE 0x1E
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_HEADER_DEFAULT_MAGIC "#Legion"
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructLegionHid2Version;

FuStructLegionHid2Version *fu_struct_legion_hid2_version_ref(FuStructLegionHid2Version *st) G_GNUC_NON_NULL(1);
void fu_struct_legion_hid2_version_unref(FuStructLegionHid2Version *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructLegionHid2Version, fu_struct_legion_hid2_version_unref)
FuStructLegionHid2Version *fu_struct_legion_hid2_version_parse_stream(GInputStream *stream, gsize offset, GError **error) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_legion_hid2_version_get_version(const FuStructLegionHid2Version *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_VERSION_OFFSET_SIGNATURE 0x0
#define FU_STRUCT_LEGION_HID2_VERSION_OFFSET_VERSION 0x8
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_VERSION_SIZE_SIGNATURE 0x7
#define FU_STRUCT_LEGION_HID2_VERSION_N_ELEMENTS_SIGNATURE 7
#define FU_STRUCT_LEGION_HID2_VERSION_SIZE 0xC
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_LEGION_HID2_VERSION_DEFAULT_SIGNATURE "VERSION"
#endif
