aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-04-04 11:18:28 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-04-08 16:35:09 +0200
commit78cad902ef342d6da628f26e1282782aa8361316 (patch)
tree1ad8e46217e316363aa44d9d5d08c053c07b5fe6 /src
parent5b1b33a894e3677dd633f032d5d9a07931096719 (diff)
modem-helpers: remove unused supported capabilities filter
Diffstat (limited to 'src')
-rw-r--r--src/mm-modem-helpers.c28
-rw-r--r--src/mm-modem-helpers.h3
-rw-r--r--src/tests/test-modem-helpers.c94
3 files changed, 0 insertions, 125 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 51577a90..67a5f0a6 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -470,34 +470,6 @@ mm_filter_supported_modes (const GArray *all,
/*****************************************************************************/
-GArray *
-mm_filter_supported_capabilities (MMModemCapability all,
- const GArray *supported_combinations)
-{
- guint i;
- GArray *filtered_combinations;
-
- g_return_val_if_fail (all != MM_MODEM_CAPABILITY_NONE, NULL);
- g_return_val_if_fail (supported_combinations != NULL, NULL);
-
- /* We will filter out all combinations which have modes not listed in 'all' */
- filtered_combinations = g_array_sized_new (FALSE, FALSE, sizeof (MMModemCapability), supported_combinations->len);
- for (i = 0; i < supported_combinations->len; i++) {
- MMModemCapability capability;
-
- capability = g_array_index (supported_combinations, MMModemCapability, i);
- if (!(capability & ~all))
- g_array_append_val (filtered_combinations, capability);
- }
-
- if (filtered_combinations->len == 0)
- mm_warn ("All supported capability combinations were filtered out.");
-
- return filtered_combinations;
-}
-
-/*****************************************************************************/
-
static const gchar bcd_chars[] = "0123456789\0\0\0\0\0\0";
gchar *
diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
index 61da24dd..25d94357 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -87,9 +87,6 @@ GArray *mm_filter_supported_modes (const GArray *all,
const GArray *supported_combinations,
gpointer log_object);
-GArray *mm_filter_supported_capabilities (MMModemCapability all,
- const GArray *supported_combinations);
-
gchar *mm_bcd_to_string (const guint8 *bcd, gsize bcd_len);
/*****************************************************************************/
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index f1b236bd..f991f023 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -3475,98 +3475,6 @@ test_supported_mode_filter (void *f, gpointer d)
}
/*****************************************************************************/
-
-static gboolean
-find_capability_combination (GArray *capabilities,
- MMModemCapability capability)
-{
- guint i;
-
- for (i = 0; i < capabilities->len; i++) {
- MMModemCapability capability_i;
-
- capability_i = g_array_index (capabilities, MMModemCapability, i);
- if (capability_i == capability)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-test_supported_capability_filter (void *f, gpointer d)
-{
- MMModemCapability capability;
- GArray *combinations;
- GArray *filtered;
-
- combinations = g_array_sized_new (FALSE, FALSE, sizeof (MMModemCapability), 6);
-
- /* GSM/UMTS only */
- capability = MM_MODEM_CAPABILITY_GSM_UMTS;
- g_array_append_val (combinations, capability);
- /* CDMA/EVDO only */
- capability = MM_MODEM_CAPABILITY_CDMA_EVDO;
- g_array_append_val (combinations, capability);
- /* GSM/UMTS and CDMA/EVDO */
- capability = (MM_MODEM_CAPABILITY_CDMA_EVDO | MM_MODEM_CAPABILITY_GSM_UMTS);
- g_array_append_val (combinations, capability);
- /* GSM/UMTS+LTE */
- capability = (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_LTE);
- g_array_append_val (combinations, capability);
- /* CDMA/EVDO+LTE */
- capability = (MM_MODEM_CAPABILITY_CDMA_EVDO | MM_MODEM_CAPABILITY_LTE);
- g_array_append_val (combinations, capability);
- /* GSM/UMTS+CDMA/EVDO+LTE */
- capability = (MM_MODEM_CAPABILITY_GSM_UMTS | MM_MODEM_CAPABILITY_CDMA_EVDO | MM_MODEM_CAPABILITY_LTE);
- g_array_append_val (combinations, capability);
-
- /* Only GSM-UMTS supported */
- filtered = mm_filter_supported_capabilities (MM_MODEM_CAPABILITY_GSM_UMTS, combinations);
- g_assert_cmpuint (filtered->len, ==, 1);
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_GSM_UMTS));
- g_array_unref (filtered);
-
- /* Only CDMA-EVDO supported */
- filtered = mm_filter_supported_capabilities (MM_MODEM_CAPABILITY_CDMA_EVDO, combinations);
- g_assert_cmpuint (filtered->len, ==, 1);
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_CDMA_EVDO));
- g_array_unref (filtered);
-
- /* GSM-UMTS and CDMA-EVDO supported */
- filtered = mm_filter_supported_capabilities ((MM_MODEM_CAPABILITY_CDMA_EVDO |
- MM_MODEM_CAPABILITY_GSM_UMTS),
- combinations);
- g_assert_cmpuint (filtered->len, ==, 3);
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_CDMA_EVDO));
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_GSM_UMTS));
- g_assert (find_capability_combination (filtered, (MM_MODEM_CAPABILITY_GSM_UMTS |
- MM_MODEM_CAPABILITY_CDMA_EVDO)));
- g_array_unref (filtered);
-
- /* GSM-UMTS, CDMA-EVDO and LTE supported */
- filtered = mm_filter_supported_capabilities ((MM_MODEM_CAPABILITY_CDMA_EVDO |
- MM_MODEM_CAPABILITY_GSM_UMTS |
- MM_MODEM_CAPABILITY_LTE),
- combinations);
- g_assert_cmpuint (filtered->len, ==, 6);
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_CDMA_EVDO));
- g_assert (find_capability_combination (filtered, MM_MODEM_CAPABILITY_GSM_UMTS));
- g_assert (find_capability_combination (filtered, (MM_MODEM_CAPABILITY_GSM_UMTS |
- MM_MODEM_CAPABILITY_CDMA_EVDO)));
- g_assert (find_capability_combination (filtered, (MM_MODEM_CAPABILITY_GSM_UMTS |
- MM_MODEM_CAPABILITY_LTE)));
- g_assert (find_capability_combination (filtered, (MM_MODEM_CAPABILITY_CDMA_EVDO |
- MM_MODEM_CAPABILITY_LTE)));
- g_assert (find_capability_combination (filtered, (MM_MODEM_CAPABILITY_GSM_UMTS |
- MM_MODEM_CAPABILITY_CDMA_EVDO |
- MM_MODEM_CAPABILITY_LTE)));
- g_array_unref (filtered);
-
- g_array_unref (combinations);
-}
-
-/*****************************************************************************/
/* Test +CCLK responses */
typedef struct {
@@ -4721,8 +4629,6 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_supported_mode_filter, NULL));
- g_test_suite_add (suite, TESTCASE (test_supported_capability_filter, NULL));
-
g_test_suite_add (suite, TESTCASE (test_cclk_response, NULL));
g_test_suite_add (suite, TESTCASE (test_crsm_response, NULL));