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

#include "config.h"

#include <glib.h>

#include "fu-jabra-gnp-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_struct_jabra_gnp_packet_ref: (skip):
 **/
FuStructJabraGnpPacket *
fu_struct_jabra_gnp_packet_ref(FuStructJabraGnpPacket *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_jabra_gnp_packet_unref: (skip):
 **/
void
fu_struct_jabra_gnp_packet_unref(FuStructJabraGnpPacket *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructJabraGnpPacket refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_jabra_gnp_packet_new_internal: (skip):
 **/
static FuStructJabraGnpPacket *
fu_struct_jabra_gnp_packet_new_internal(void)
{
    FuStructJabraGnpPacket *st = g_new0(FuStructJabraGnpPacket, 1);
    st->refcount = 1;
    return st;
}

/* getters */

/* setters */
/**
 * fu_struct_jabra_gnp_packet_set_iface: (skip):
 **/
static void
fu_struct_jabra_gnp_packet_set_iface(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[0] = value;
}
/**
 * fu_struct_jabra_gnp_packet_set_dst: (skip):
 **/
void
fu_struct_jabra_gnp_packet_set_dst(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[1] = value;
}
/**
 * fu_struct_jabra_gnp_packet_set_sequence_number: (skip):
 **/
void
fu_struct_jabra_gnp_packet_set_sequence_number(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[3] = value;
}
/**
 * fu_struct_jabra_gnp_packet_set_cmd_length: (skip):
 **/
void
fu_struct_jabra_gnp_packet_set_cmd_length(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[4] = value;
}
/**
 * fu_struct_jabra_gnp_packet_set_cmd: (skip):
 **/
void
fu_struct_jabra_gnp_packet_set_cmd(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[5] = value;
}
/**
 * fu_struct_jabra_gnp_packet_set_sub_cmd: (skip):
 **/
void
fu_struct_jabra_gnp_packet_set_sub_cmd(FuStructJabraGnpPacket *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[6] = value;
}
/**
 * fu_struct_jabra_gnp_packet_new: (skip):
 **/
FuStructJabraGnpPacket *
fu_struct_jabra_gnp_packet_new(void)
{
    FuStructJabraGnpPacket *st = fu_struct_jabra_gnp_packet_new_internal();
    st->buf = g_byte_array_sized_new(7);
    fu_byte_array_set_size(st->buf, 7, 0x0);
    fu_struct_jabra_gnp_packet_set_iface(st, 0x05);
    fu_struct_jabra_gnp_packet_set_cmd_length(st, 0x46);
    return st;
}
