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

#pragma once
#include <fu-input-stream.h>
/**
 * FuTelinkDfuCmd:
 */
typedef enum {
    /**
     * FU_TELINK_DFU_CMD_OTA_FW_VERSION:
     */
    FU_TELINK_DFU_CMD_OTA_FW_VERSION = 0xff00,
    /**
     * FU_TELINK_DFU_CMD_OTA_START:
     */
    FU_TELINK_DFU_CMD_OTA_START = 0xff01,
    /**
     * FU_TELINK_DFU_CMD_OTA_END:
     */
    FU_TELINK_DFU_CMD_OTA_END = 0xff02,
    /**
     * FU_TELINK_DFU_CMD_OTA_START_REQ:
     */
    FU_TELINK_DFU_CMD_OTA_START_REQ = 0xff03,
    /**
     * FU_TELINK_DFU_CMD_OTA_START_RSP:
     */
    FU_TELINK_DFU_CMD_OTA_START_RSP = 0xff04,
    /**
     * FU_TELINK_DFU_CMD_OTA_TEST:
     */
    FU_TELINK_DFU_CMD_OTA_TEST = 0xff05,
    /**
     * FU_TELINK_DFU_CMD_OTA_TEST_RSP:
     */
    FU_TELINK_DFU_CMD_OTA_TEST_RSP = 0xff06,
    /**
     * FU_TELINK_DFU_CMD_OTA_ERROR:
     */
    FU_TELINK_DFU_CMD_OTA_ERROR = 0xff07,
}  FuTelinkDfuCmd;
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructTelinkDfuEndCheck;

FuStructTelinkDfuEndCheck *fu_struct_telink_dfu_end_check_ref(FuStructTelinkDfuEndCheck *st) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_end_check_unref(FuStructTelinkDfuEndCheck *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructTelinkDfuEndCheck, fu_struct_telink_dfu_end_check_unref)
FuStructTelinkDfuEndCheck *fu_struct_telink_dfu_end_check_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_end_check_get_pkt_index(const FuStructTelinkDfuEndCheck *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_end_check_get_inverted_pkt_index(const FuStructTelinkDfuEndCheck *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_end_check_set_pkt_index(FuStructTelinkDfuEndCheck *st, guint16 value) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_end_check_set_inverted_pkt_index(FuStructTelinkDfuEndCheck *st, guint16 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_END_CHECK_OFFSET_PKT_INDEX 0x0
#define FU_STRUCT_TELINK_DFU_END_CHECK_OFFSET_INVERTED_PKT_INDEX 0x2
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_END_CHECK_SIZE 0x4
#endif

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

FuStructTelinkDfuBlePkt *fu_struct_telink_dfu_ble_pkt_ref(FuStructTelinkDfuBlePkt *st) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_ble_pkt_unref(FuStructTelinkDfuBlePkt *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructTelinkDfuBlePkt, fu_struct_telink_dfu_ble_pkt_unref)
FuStructTelinkDfuBlePkt *fu_struct_telink_dfu_ble_pkt_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_ble_pkt_get_preamble(const FuStructTelinkDfuBlePkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
const guint8 *fu_struct_telink_dfu_ble_pkt_get_payload(const FuStructTelinkDfuBlePkt *st, gsize *bufsz) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_ble_pkt_get_crc(const FuStructTelinkDfuBlePkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_ble_pkt_set_preamble(FuStructTelinkDfuBlePkt *st, guint16 value) G_GNUC_NON_NULL(1);
gboolean fu_struct_telink_dfu_ble_pkt_set_payload(FuStructTelinkDfuBlePkt *st, const guint8 *buf, gsize bufsz, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_ble_pkt_set_crc(FuStructTelinkDfuBlePkt *st, guint16 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_BLE_PKT_OFFSET_PREAMBLE 0x0
#define FU_STRUCT_TELINK_DFU_BLE_PKT_OFFSET_PAYLOAD 0x2
#define FU_STRUCT_TELINK_DFU_BLE_PKT_OFFSET_CRC 0x12
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_BLE_PKT_SIZE_PAYLOAD 0x10
#define FU_STRUCT_TELINK_DFU_BLE_PKT_N_ELEMENTS_PAYLOAD 16
#define FU_STRUCT_TELINK_DFU_BLE_PKT_SIZE 0x14
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_BLE_PKT_DEFAULT_PAYLOAD "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructTelinkDfuHidPktPayload;

FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_pkt_payload_ref(FuStructTelinkDfuHidPktPayload *st) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_hid_pkt_payload_unref(FuStructTelinkDfuHidPktPayload *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructTelinkDfuHidPktPayload, fu_struct_telink_dfu_hid_pkt_payload_unref)
FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_pkt_payload_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_hid_pkt_payload_get_ota_cmd(const FuStructTelinkDfuHidPktPayload *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
const guint8 *fu_struct_telink_dfu_hid_pkt_payload_get_ota_data(const FuStructTelinkDfuHidPktPayload *st, gsize *bufsz) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_hid_pkt_payload_get_crc(const FuStructTelinkDfuHidPktPayload *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_hid_pkt_payload_set_ota_cmd(FuStructTelinkDfuHidPktPayload *st, guint16 value) G_GNUC_NON_NULL(1);
gboolean fu_struct_telink_dfu_hid_pkt_payload_set_ota_data(FuStructTelinkDfuHidPktPayload *st, const guint8 *buf, gsize bufsz, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_hid_pkt_payload_set_crc(FuStructTelinkDfuHidPktPayload *st, guint16 value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_OFFSET_OTA_CMD 0x0
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_OFFSET_OTA_DATA 0x2
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_OFFSET_CRC 0x12
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_SIZE_OTA_DATA 0x10
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_N_ELEMENTS_OTA_DATA 16
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_SIZE 0x14
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_DEFAULT_OTA_CMD 0xFFFF
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_DEFAULT_OTA_DATA "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
#define FU_STRUCT_TELINK_DFU_HID_PKT_PAYLOAD_DEFAULT_CRC 0xFFFF
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructTelinkDfuHidPkt;

FuStructTelinkDfuHidPkt *fu_struct_telink_dfu_hid_pkt_ref(FuStructTelinkDfuHidPkt *st) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_hid_pkt_unref(FuStructTelinkDfuHidPkt *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructTelinkDfuHidPkt, fu_struct_telink_dfu_hid_pkt_unref)
FuStructTelinkDfuHidPkt *fu_struct_telink_dfu_hid_pkt_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_telink_dfu_hid_pkt_get_op_code(const FuStructTelinkDfuHidPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_hid_pkt_get_ota_data_len(const FuStructTelinkDfuHidPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_pkt_get_payload(const FuStructTelinkDfuHidPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_hid_pkt_set_op_code(FuStructTelinkDfuHidPkt *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_hid_pkt_set_ota_data_len(FuStructTelinkDfuHidPkt *st, guint16 value) G_GNUC_NON_NULL(1);
gboolean
fu_struct_telink_dfu_hid_pkt_set_payload(FuStructTelinkDfuHidPkt *st, const FuStructTelinkDfuHidPktPayload *st_donor, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_OFFSET_OP_CODE 0x0
#define FU_STRUCT_TELINK_DFU_HID_PKT_OFFSET_OTA_DATA_LEN 0x1
#define FU_STRUCT_TELINK_DFU_HID_PKT_OFFSET_PAYLOAD 0x3
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_SIZE 0x17
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_PKT_DEFAULT_OP_CODE 0x02
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructTelinkDfuHidLongPkt;

FuStructTelinkDfuHidLongPkt *fu_struct_telink_dfu_hid_long_pkt_ref(FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_hid_long_pkt_unref(FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructTelinkDfuHidLongPkt, fu_struct_telink_dfu_hid_long_pkt_unref)
FuStructTelinkDfuHidLongPkt *fu_struct_telink_dfu_hid_long_pkt_new(void) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_telink_dfu_hid_long_pkt_get_op_code(const FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint16 fu_struct_telink_dfu_hid_long_pkt_get_ota_data_len(const FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_long_pkt_get_payload_1(const FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_long_pkt_get_payload_2(const FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuStructTelinkDfuHidPktPayload *fu_struct_telink_dfu_hid_long_pkt_get_payload_3(const FuStructTelinkDfuHidLongPkt *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_telink_dfu_hid_long_pkt_set_op_code(FuStructTelinkDfuHidLongPkt *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_telink_dfu_hid_long_pkt_set_ota_data_len(FuStructTelinkDfuHidLongPkt *st, guint16 value) G_GNUC_NON_NULL(1);
gboolean
fu_struct_telink_dfu_hid_long_pkt_set_payload_1(FuStructTelinkDfuHidLongPkt *st, const FuStructTelinkDfuHidPktPayload *st_donor, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;
gboolean
fu_struct_telink_dfu_hid_long_pkt_set_payload_2(FuStructTelinkDfuHidLongPkt *st, const FuStructTelinkDfuHidPktPayload *st_donor, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;
gboolean
fu_struct_telink_dfu_hid_long_pkt_set_payload_3(FuStructTelinkDfuHidLongPkt *st, const FuStructTelinkDfuHidPktPayload *st_donor, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_OFFSET_OP_CODE 0x0
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_OFFSET_OTA_DATA_LEN 0x1
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_OFFSET_PAYLOAD_1 0x3
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_OFFSET_PAYLOAD_2 0x17
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_OFFSET_PAYLOAD_3 0x2B
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_SIZE 0x3F
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_TELINK_DFU_HID_LONG_PKT_DEFAULT_OP_CODE 0x02
#endif
