
/* 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 "/build/modemmanager/src/build/../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 }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_FLAGS__

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;
}

/**
 * mm_port_qmi_kernel_data_mode_get_string:
 * @val: a MMPortQmiKernelDataMode.
 *
 * Gets the nickname string for the #MMPortQmiKernelDataMode specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * mm_port_qmi_kernel_data_mode_build_string_from_mask:
 * @mask: bitmask of MMPortQmiKernelDataMode values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortQmiKernelDataMode in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */
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 }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_ENUM__

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;
}

/**
 * m_mport_qmi_flag_get_string:
 * @val: a MMPortQmiFlag.
 *
 * Gets the nickname string for the #MMPortQmiFlag specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * m_mport_qmi_flag_build_string_from_mask:
 * @mask: bitmask of MMPortQmiFlag values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortQmiFlag in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */
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 }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_ENUM__

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;
}

/**
 * m_mport_qmi_setup_data_format_action_get_string:
 * @val: a MMPortQmiSetupDataFormatAction.
 *
 * Gets the nickname string for the #MMPortQmiSetupDataFormatAction specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * m_mport_qmi_setup_data_format_action_build_string_from_mask:
 * @mask: bitmask of MMPortQmiSetupDataFormatAction values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortQmiSetupDataFormatAction in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */
/* enumerations from "/build/modemmanager/src/build/../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 }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_FLAGS__

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;
}

/**
 * mm_port_serial_at_flag_get_string:
 * @val: a MMPortSerialAtFlag.
 *
 * Gets the nickname string for the #MMPortSerialAtFlag specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * mm_port_serial_at_flag_build_string_from_mask:
 * @mask: bitmask of MMPortSerialAtFlag values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortSerialAtFlag in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */
/* enumerations from "/build/modemmanager/src/build/../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 }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_ENUM__

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;
}

/**
 * mm_port_subsys_get_string:
 * @val: a MMPortSubsys.
 *
 * Gets the nickname string for the #MMPortSubsys specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * mm_port_subsys_build_string_from_mask:
 * @mask: bitmask of MMPortSubsys values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortSubsys in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */
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_AUDIO, "MM_PORT_TYPE_AUDIO", "audio" },
    { 0, NULL, NULL }
};

/* Define type-specific symbols */
#undef __MM_IS_ENUM__
#undef __MM_IS_FLAGS__
#define __MM_IS_ENUM__

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;
}

/**
 * mm_port_type_get_string:
 * @val: a MMPortType.
 *
 * Gets the nickname string for the #MMPortType specified at @val.
 *
 * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
 */
#if defined __MM_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 /* __MM_IS_ENUM_ */

/**
 * mm_port_type_build_string_from_mask:
 * @mask: bitmask of MMPortType values.
 *
 * Builds a string containing a comma-separated list of nicknames for
 * each #MMPortType in @mask.
 *
 * Returns: (transfer full): a string with the list of nicknames, or %NULL if none given. The returned value should be freed with g_free().
 */
#if defined __MM_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 /* __MM_IS_FLAGS__ */

/* Generated data ends here */

