libmm-glib: new common helpers to check band types

This commit is contained in:
Aleksander Morgado
2018-08-08 14:05:32 +02:00
committed by Dan Williams
parent 6262e844f5
commit 2e0471fe6a
2 changed files with 31 additions and 0 deletions

View File

@@ -668,6 +668,32 @@ mm_common_bands_garray_sort (GArray *array)
g_array_sort (array, (GCompareFunc) cmp_band);
}
gboolean
mm_common_band_is_gsm (MMModemBand band)
{
return ((band >= MM_MODEM_BAND_EGSM && band <= MM_MODEM_BAND_G850) ||
(band >= MM_MODEM_BAND_G450 && band <= MM_MODEM_BAND_G810));
}
gboolean
mm_common_band_is_utran (MMModemBand band)
{
return ((band >= MM_MODEM_BAND_UTRAN_1 && band <= MM_MODEM_BAND_UTRAN_7) ||
(band >= MM_MODEM_BAND_UTRAN_10 && band <= MM_MODEM_BAND_UTRAN_32));
}
gboolean
mm_common_band_is_eutran (MMModemBand band)
{
return (band >= MM_MODEM_BAND_EUTRAN_1 && band <= MM_MODEM_BAND_EUTRAN_71);
}
gboolean
mm_common_band_is_cdma (MMModemBand band)
{
return (band >= MM_MODEM_BAND_CDMA_BC0 && band <= MM_MODEM_BAND_CDMA_BC19);
}
GArray *
mm_common_mode_combinations_variant_to_garray (GVariant *variant)
{

View File

@@ -106,6 +106,11 @@ GVariant *mm_common_build_bands_unknown (void);
gboolean mm_common_bands_garray_cmp (GArray *a, GArray *b);
void mm_common_bands_garray_sort (GArray *array);
gboolean mm_common_band_is_gsm (MMModemBand band);
gboolean mm_common_band_is_utran (MMModemBand band);
gboolean mm_common_band_is_eutran (MMModemBand band);
gboolean mm_common_band_is_cdma (MMModemBand band);
GArray *mm_common_mode_combinations_variant_to_garray (GVariant *variant);
MMModemModeCombination *mm_common_mode_combinations_variant_to_array (GVariant *variant,
guint *n_modes);