
/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */

#include "mm-port-enums-types.h"
/* enumerations from "../ModemManager/src/mm-port-qmi.h" */
static const GFlagsValue mm_port_qmi_kernel_data_mode_values[] = {
    { MM_PORT_QMI_KERNEL_DATA_MODE_NONE, "MM_PORT_QMI_KERNEL_DATA_MODE_NONE", "none" },
    { MM_PORT_QMI_KERNEL_DATA_MODE_802_3, "MM_PORT_QMI_KERNEL_DATA_MODE_802_3", "802-3" },
    { MM_PORT_QMI_KERNEL_DATA_MODE_RAW_IP, "MM_PORT_QMI_KERNEL_DATA_MODE_RAW_IP", "raw-ip" },
    { MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET, "MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET", "mux-rmnet" },
    { MM_PORT_QMI_KERNEL_DATA_MODE_MUX_QMIWWAN, "MM_PORT_QMI_KERNEL_DATA_MODE_MUX_QMIWWAN", "mux-qmiwwan" },
    { 0, NULL, NULL }
};

GType
mm_port_qmi_kernel_data_mode_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_flags_register_static (g_intern_static_string ("MMPortQmiKernelDataMode"),
                                      mm_port_qmi_kernel_data_mode_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __MM_PORT_QMI_KERNEL_DATA_MODE_IS_ENUM__
const gchar *
mm_port_qmi_kernel_data_mode_get_string (MMPortQmiKernelDataMode val)
{
    guint i;

    for (i = 0; mm_port_qmi_kernel_data_mode_values[i].value_nick; i++) {
        if ((gint)val == mm_port_qmi_kernel_data_mode_values[i].value)
            return mm_port_qmi_kernel_data_mode_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __MM_PORT_QMI_KERNEL_DATA_MODE_IS_FLAGS__
gchar *
mm_port_qmi_kernel_data_mode_build_string_from_mask (MMPortQmiKernelDataMode mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; mm_port_qmi_kernel_data_mode_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == mm_port_qmi_kernel_data_mode_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (mm_port_qmi_kernel_data_mode_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & mm_port_qmi_kernel_data_mode_values[i].value) {
            guint c;
            gulong number = mm_port_qmi_kernel_data_mode_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        mm_port_qmi_kernel_data_mode_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif
static const GEnumValue m_mport_qmi_flag_values[] = {
    { MM_PORT_QMI_FLAG_DEFAULT, "MM_PORT_QMI_FLAG_DEFAULT", "default" },
    { MM_PORT_QMI_FLAG_WDS_IPV4, "MM_PORT_QMI_FLAG_WDS_IPV4", "wds-ipv4" },
    { MM_PORT_QMI_FLAG_WDS_IPV6, "MM_PORT_QMI_FLAG_WDS_IPV6", "wds-ipv6" },
    { 0, NULL, NULL }
};

GType
m_mport_qmi_flag_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_enum_register_static (g_intern_static_string ("MMPortQmiFlag"),
                                      m_mport_qmi_flag_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __M_MPORT_QMI_FLAG_IS_ENUM__
const gchar *
m_mport_qmi_flag_get_string (MMPortQmiFlag val)
{
    guint i;

    for (i = 0; m_mport_qmi_flag_values[i].value_nick; i++) {
        if ((gint)val == m_mport_qmi_flag_values[i].value)
            return m_mport_qmi_flag_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __M_MPORT_QMI_FLAG_IS_FLAGS__
gchar *
m_mport_qmi_flag_build_string_from_mask (MMPortQmiFlag mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; m_mport_qmi_flag_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == m_mport_qmi_flag_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (m_mport_qmi_flag_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & m_mport_qmi_flag_values[i].value) {
            guint c;
            gulong number = m_mport_qmi_flag_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        m_mport_qmi_flag_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif
static const GEnumValue m_mport_qmi_setup_data_format_action_values[] = {
    { MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_QUERY, "MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_QUERY", "query" },
    { MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_SET_DEFAULT, "MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_SET_DEFAULT", "set-default" },
    { MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_SET_MULTIPLEX, "MM_PORT_QMI_SETUP_DATA_FORMAT_ACTION_SET_MULTIPLEX", "set-multiplex" },
    { 0, NULL, NULL }
};

GType
m_mport_qmi_setup_data_format_action_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_enum_register_static (g_intern_static_string ("MMPortQmiSetupDataFormatAction"),
                                      m_mport_qmi_setup_data_format_action_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __M_MPORT_QMI_SETUP_DATA_FORMAT_ACTION_IS_ENUM__
const gchar *
m_mport_qmi_setup_data_format_action_get_string (MMPortQmiSetupDataFormatAction val)
{
    guint i;

    for (i = 0; m_mport_qmi_setup_data_format_action_values[i].value_nick; i++) {
        if ((gint)val == m_mport_qmi_setup_data_format_action_values[i].value)
            return m_mport_qmi_setup_data_format_action_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __M_MPORT_QMI_SETUP_DATA_FORMAT_ACTION_IS_FLAGS__
gchar *
m_mport_qmi_setup_data_format_action_build_string_from_mask (MMPortQmiSetupDataFormatAction mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; m_mport_qmi_setup_data_format_action_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == m_mport_qmi_setup_data_format_action_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (m_mport_qmi_setup_data_format_action_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & m_mport_qmi_setup_data_format_action_values[i].value) {
            guint c;
            gulong number = m_mport_qmi_setup_data_format_action_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        m_mport_qmi_setup_data_format_action_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif
/* enumerations from "../ModemManager/src/mm-port-serial-at.h" */
static const GFlagsValue mm_port_serial_at_flag_values[] = {
    { MM_PORT_SERIAL_AT_FLAG_NONE, "MM_PORT_SERIAL_AT_FLAG_NONE", "none" },
    { MM_PORT_SERIAL_AT_FLAG_PRIMARY, "MM_PORT_SERIAL_AT_FLAG_PRIMARY", "primary" },
    { MM_PORT_SERIAL_AT_FLAG_SECONDARY, "MM_PORT_SERIAL_AT_FLAG_SECONDARY", "secondary" },
    { MM_PORT_SERIAL_AT_FLAG_PPP, "MM_PORT_SERIAL_AT_FLAG_PPP", "ppp" },
    { MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL, "MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL", "gps-control" },
    { MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC, "MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC", "none-no-generic" },
    { 0, NULL, NULL }
};

GType
mm_port_serial_at_flag_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_flags_register_static (g_intern_static_string ("MMPortSerialAtFlag"),
                                      mm_port_serial_at_flag_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __MM_PORT_SERIAL_AT_FLAG_IS_ENUM__
const gchar *
mm_port_serial_at_flag_get_string (MMPortSerialAtFlag val)
{
    guint i;

    for (i = 0; mm_port_serial_at_flag_values[i].value_nick; i++) {
        if ((gint)val == mm_port_serial_at_flag_values[i].value)
            return mm_port_serial_at_flag_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __MM_PORT_SERIAL_AT_FLAG_IS_FLAGS__
gchar *
mm_port_serial_at_flag_build_string_from_mask (MMPortSerialAtFlag mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; mm_port_serial_at_flag_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == mm_port_serial_at_flag_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (mm_port_serial_at_flag_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & mm_port_serial_at_flag_values[i].value) {
            guint c;
            gulong number = mm_port_serial_at_flag_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        mm_port_serial_at_flag_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif
/* enumerations from "../ModemManager/src/mm-port.h" */
static const GEnumValue mm_port_subsys_values[] = {
    { MM_PORT_SUBSYS_UNKNOWN, "MM_PORT_SUBSYS_UNKNOWN", "unknown" },
    { MM_PORT_SUBSYS_TTY, "MM_PORT_SUBSYS_TTY", "tty" },
    { MM_PORT_SUBSYS_NET, "MM_PORT_SUBSYS_NET", "net" },
    { MM_PORT_SUBSYS_USBMISC, "MM_PORT_SUBSYS_USBMISC", "usbmisc" },
    { MM_PORT_SUBSYS_UNIX, "MM_PORT_SUBSYS_UNIX", "unix" },
    { MM_PORT_SUBSYS_QRTR, "MM_PORT_SUBSYS_QRTR", "qrtr" },
    { MM_PORT_SUBSYS_RPMSG, "MM_PORT_SUBSYS_RPMSG", "rpmsg" },
    { MM_PORT_SUBSYS_WWAN, "MM_PORT_SUBSYS_WWAN", "wwan" },
    { 0, NULL, NULL }
};

GType
mm_port_subsys_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_enum_register_static (g_intern_static_string ("MMPortSubsys"),
                                      mm_port_subsys_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __MM_PORT_SUBSYS_IS_ENUM__
const gchar *
mm_port_subsys_get_string (MMPortSubsys val)
{
    guint i;

    for (i = 0; mm_port_subsys_values[i].value_nick; i++) {
        if ((gint)val == mm_port_subsys_values[i].value)
            return mm_port_subsys_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __MM_PORT_SUBSYS_IS_FLAGS__
gchar *
mm_port_subsys_build_string_from_mask (MMPortSubsys mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; mm_port_subsys_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == mm_port_subsys_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (mm_port_subsys_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & mm_port_subsys_values[i].value) {
            guint c;
            gulong number = mm_port_subsys_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        mm_port_subsys_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif
static const GEnumValue mm_port_type_values[] = {
    { MM_PORT_TYPE_UNKNOWN, "MM_PORT_TYPE_UNKNOWN", "unknown" },
    { MM_PORT_TYPE_IGNORED, "MM_PORT_TYPE_IGNORED", "ignored" },
    { MM_PORT_TYPE_NET, "MM_PORT_TYPE_NET", "net" },
    { MM_PORT_TYPE_AT, "MM_PORT_TYPE_AT", "at" },
    { MM_PORT_TYPE_QCDM, "MM_PORT_TYPE_QCDM", "qcdm" },
    { MM_PORT_TYPE_GPS, "MM_PORT_TYPE_GPS", "gps" },
    { MM_PORT_TYPE_QMI, "MM_PORT_TYPE_QMI", "qmi" },
    { MM_PORT_TYPE_MBIM, "MM_PORT_TYPE_MBIM", "mbim" },
    { MM_PORT_TYPE_XMMRPC, "MM_PORT_TYPE_XMMRPC", "xmmrpc" },
    { MM_PORT_TYPE_AUDIO, "MM_PORT_TYPE_AUDIO", "audio" },
    { 0, NULL, NULL }
};

GType
mm_port_type_get_type (void)
{
    static gsize g_define_type_id_initialized = 0;

    if (g_once_init_enter (&g_define_type_id_initialized)) {
        GType g_define_type_id =
            g_enum_register_static (g_intern_static_string ("MMPortType"),
                                      mm_port_type_values);
        g_once_init_leave (&g_define_type_id_initialized, g_define_type_id);
    }

    return g_define_type_id_initialized;
}

#if defined __MM_PORT_TYPE_IS_ENUM__
const gchar *
mm_port_type_get_string (MMPortType val)
{
    guint i;

    for (i = 0; mm_port_type_values[i].value_nick; i++) {
        if ((gint)val == mm_port_type_values[i].value)
            return mm_port_type_values[i].value_nick;
    }

    return NULL;
}
#endif

#if defined __MM_PORT_TYPE_IS_FLAGS__
gchar *
mm_port_type_build_string_from_mask (MMPortType mask)
{
    guint i;
    gboolean first = TRUE;
    GString *str = NULL;

    for (i = 0; mm_port_type_values[i].value_nick; i++) {
        /* We also look for exact matches */
        if (mask == mm_port_type_values[i].value) {
            if (str)
                g_string_free (str, TRUE);
            return g_strdup (mm_port_type_values[i].value_nick);
        }

        /* Build list with single-bit masks */
        if (mask & mm_port_type_values[i].value) {
            guint c;
            gulong number = mm_port_type_values[i].value;

            for (c = 0; number; c++)
                number &= number - 1;

            if (c == 1) {
                if (!str)
                    str = g_string_new ("");
                g_string_append_printf (str, "%s%s",
                                        first ? "" : ", ",
                                        mm_port_type_values[i].value_nick);
                if (first)
                    first = FALSE;
            }
        }
    }

    return (str ? g_string_free (str, FALSE) : NULL);
}
#endif

/* Generated data ends here */

