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

#include "config.h"

#include <glib.h>

#include "fu-mediatek-scaler-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_ddcci_priority_to_string:
 * @val: value, e.g. %FU_DDCCI_PRIORITY_UP
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_ddcci_priority_to_string(FuDdcciPriority val)
{
    if (val == FU_DDCCI_PRIORITY_NORMAL)
        return "normal";
    if (val == FU_DDCCI_PRIORITY_UP)
        return "up";
    return NULL;
}

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

/* getters */

/* setters */
/**
 * fu_struct_ddc_cmd_set_opcode: (skip):
 **/
void
fu_struct_ddc_cmd_set_opcode(FuStructDdcCmd *st, FuDdcOpcode value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[0] = value;
}
/**
 * fu_struct_ddc_cmd_set_vcp_code: (skip):
 **/
void
fu_struct_ddc_cmd_set_vcp_code(FuStructDdcCmd *st, FuDdcVcpCode value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[1] = value;
}
/**
 * fu_struct_ddc_cmd_new: (skip):
 **/
FuStructDdcCmd *
fu_struct_ddc_cmd_new(void)
{
    FuStructDdcCmd *st = fu_struct_ddc_cmd_new_internal();
    st->buf = g_byte_array_sized_new(2);
    fu_byte_array_set_size(st->buf, 2, 0x0);
    fu_struct_ddc_cmd_set_opcode(st, FU_DDC_OPCODE_REQ);
    return st;
}
