aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/telit/mm-modem-helpers-telit.c90
-rw-r--r--plugins/telit/mm-modem-helpers-telit.h45
-rw-r--r--plugins/telit/mm-shared-telit.c63
-rw-r--r--plugins/telit/mm-shared-telit.h3
-rw-r--r--plugins/telit/tests/test-mm-modem-helpers-telit.c97
5 files changed, 132 insertions, 166 deletions
diff --git a/plugins/telit/mm-modem-helpers-telit.c b/plugins/telit/mm-modem-helpers-telit.c
index 54cd6a0c..5ee8bc6d 100644
--- a/plugins/telit/mm-modem-helpers-telit.c
+++ b/plugins/telit/mm-modem-helpers-telit.c
@@ -195,13 +195,9 @@ initialize_telit_3g_to_mm_band_masks (void)
/* Set current bands helpers */
gchar *
-mm_telit_build_bnd_request (GArray *bands_array,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_ext_4g_bands,
- GError **error)
+mm_telit_build_bnd_request (GArray *bands_array,
+ MMTelitBNDParseConfig *config,
+ GError **error)
{
guint32 mask2g = 0;
guint64 mask3g = 0;
@@ -214,11 +210,14 @@ mm_telit_build_bnd_request (GArray *bands_array,
gchar *cmd;
const guint64 *telit_3g_to_mm_band_mask;
guint telit_3g_to_mm_band_mask_n_elements;
+ gboolean modem_is_2g = config->modem_is_2g;
+ gboolean modem_is_3g = config->modem_is_3g;
+ gboolean modem_is_4g = config->modem_is_4g;
initialize_telit_3g_to_mm_band_masks ();
/* Select correct 3G band mask */
- if (modem_alternate_3g_bands) {
+ if (config->modem_alternate_3g_bands) {
telit_3g_to_mm_band_mask = telit_3g_to_mm_band_mask_alternate;
telit_3g_to_mm_band_mask_n_elements = G_N_ELEMENTS (telit_3g_to_mm_band_mask_alternate);
} else {
@@ -318,24 +317,24 @@ mm_telit_build_bnd_request (GArray *bands_array,
else if (modem_is_2g && modem_is_3g && !modem_is_4g)
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT, flag2g, flag3g);
else if (!modem_is_2g && !modem_is_3g && modem_is_4g) {
- if (!modem_ext_4g_bands)
+ if (!config->modem_ext_4g_bands)
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_FORMAT, flag4g);
else
cmd = g_strdup_printf ("#BND=0,0,%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", mask4g, mask4gext);
} else if (!modem_is_2g && modem_is_3g && modem_is_4g) {
- if (!modem_ext_4g_bands)
+ if (!config->modem_ext_4g_bands)
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag3g, flag4g);
else
cmd = g_strdup_printf ("#BND=0,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag3g, mask4g, mask4gext);
} else if (modem_is_2g && !modem_is_3g && modem_is_4g) {
- if (!modem_ext_4g_bands)
+ if (!config->modem_ext_4g_bands)
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_FORMAT, flag2g, flag4g);
else
cmd = g_strdup_printf ("#BND=%d,0,%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag2g, mask4g, mask4gext);
} else if (modem_is_2g && modem_is_3g && modem_is_4g) {
- if (!modem_ext_4g_bands)
+ if (!config->modem_ext_4g_bands)
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_FORMAT, flag2g, flag3g, flag4g);
- else
+ else
cmd = g_strdup_printf ("#BND=%d,%" G_GINT64_FORMAT ",%" G_GINT64_MODIFIER "x" ",%" G_GINT64_MODIFIER "x", flag2g, flag3g, mask4g, mask4gext);
} else
g_assert_not_reached ();
@@ -690,16 +689,11 @@ bnd_response_has_ext_4g_bands (const gchar *response)
#define MM_CURRENT_BANDS_4G_EXT "(,\\s*(?P<Bands4GHex>[0-9A-F]+))?(,\\s*(?P<Bands4GExt>[0-9A-F]+))?"
static GArray *
-common_parse_bnd_response (const gchar *response,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_has_hex_format_4g_bands,
- gboolean modem_ext_4g_bands,
- LoadBandsType load_type,
- gpointer log_object,
- GError **error)
+common_parse_bnd_response (const gchar *response,
+ MMTelitBNDParseConfig *config,
+ LoadBandsType load_type,
+ gpointer log_object,
+ GError **error)
{
g_autoptr(GMatchInfo) match_info = NULL;
g_autoptr(GRegex) r = NULL;
@@ -721,9 +715,9 @@ common_parse_bnd_response (const gchar *response,
[LOAD_BANDS_TYPE_CURRENT] = "#BND:"MM_CURRENT_BANDS_2G MM_CURRENT_BANDS_3G MM_CURRENT_BANDS_4G_EXT,
};
- if (modem_ext_4g_bands)
+ if (config->modem_ext_4g_bands)
load_bands_regex = load_bands_regex_4g_ext[load_type];
- else if (modem_has_hex_format_4g_bands)
+ else if (config->modem_has_hex_format_4g_bands)
load_bands_regex = load_bands_regex_4g_hex[load_type];
else
load_bands_regex = load_bands_regex_4g_dec[load_type];
@@ -745,16 +739,16 @@ common_parse_bnd_response (const gchar *response,
bands = g_array_new (TRUE, TRUE, sizeof (MMModemBand));
- if (modem_is_2g && !telit_get_2g_mm_bands (match_info, log_object, &bands, &inner_error))
+ if (config->modem_is_2g && !telit_get_2g_mm_bands (match_info, log_object, &bands, &inner_error))
goto out;
- if (modem_is_3g && !telit_get_3g_mm_bands (match_info, log_object, modem_alternate_3g_bands, &bands, &inner_error))
+ if (config->modem_is_3g && !telit_get_3g_mm_bands (match_info, log_object, config->modem_alternate_3g_bands, &bands, &inner_error))
goto out;
- if (modem_is_4g) {
+ if (config->modem_is_4g) {
gboolean ok;
- ok = modem_ext_4g_bands?
+ ok = config->modem_ext_4g_bands?
telit_get_ext_4g_mm_bands (match_info, &bands, &inner_error) :
telit_get_4g_mm_bands (match_info, &bands, &inner_error);
if (!ok)
@@ -771,43 +765,27 @@ out:
}
GArray *
-mm_telit_parse_bnd_query_response (const gchar *response,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_has_hex_format_4g_bands,
- gboolean modem_ext_4g_bands,
- gpointer log_object,
- GError **error)
+mm_telit_parse_bnd_query_response (const gchar *response,
+ MMTelitBNDParseConfig *config,
+ gpointer log_object,
+ GError **error)
{
return common_parse_bnd_response (response,
- modem_is_2g, modem_is_3g, modem_is_4g,
- modem_alternate_3g_bands,
- modem_has_hex_format_4g_bands,
- modem_ext_4g_bands,
+ config,
LOAD_BANDS_TYPE_CURRENT,
log_object,
error);
}
GArray *
-mm_telit_parse_bnd_test_response (const gchar *response,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_has_hex_format_4g_bands,
- gboolean *modem_ext_4g_bands,
- gpointer log_object,
- GError **error)
+mm_telit_parse_bnd_test_response (const gchar *response,
+ MMTelitBNDParseConfig *config,
+ gpointer log_object,
+ GError **error)
{
- *modem_ext_4g_bands = bnd_response_has_ext_4g_bands (response);
+ config->modem_ext_4g_bands = bnd_response_has_ext_4g_bands (response);
return common_parse_bnd_response (response,
- modem_is_2g, modem_is_3g, modem_is_4g,
- modem_alternate_3g_bands,
- modem_has_hex_format_4g_bands,
- *modem_ext_4g_bands,
+ config,
LOAD_BANDS_TYPE_SUPPORTED,
log_object,
error);
diff --git a/plugins/telit/mm-modem-helpers-telit.h b/plugins/telit/mm-modem-helpers-telit.h
index 97eaf474..84dd32b3 100644
--- a/plugins/telit/mm-modem-helpers-telit.h
+++ b/plugins/telit/mm-modem-helpers-telit.h
@@ -28,32 +28,27 @@ typedef enum {
MM_TELIT_MODEL_LN920,
} MMTelitModel;
+typedef struct {
+ gboolean modem_is_2g;
+ gboolean modem_is_3g;
+ gboolean modem_is_4g;
+ gboolean modem_alternate_3g_bands;
+ gboolean modem_has_hex_format_4g_bands;
+ gboolean modem_ext_4g_bands;
+} MMTelitBNDParseConfig;
+
/* #BND response parsers and request builder */
-GArray *mm_telit_parse_bnd_query_response (const gchar *response,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_has_hex_format_4g_bands,
- gboolean modem_ext_4g_bands,
- gpointer log_object,
- GError **error);
-GArray *mm_telit_parse_bnd_test_response (const gchar *response,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_has_hex_format_4g_bands,
- gboolean *modem_ext_4g_bands,
- gpointer log_object,
- GError **error);
-gchar *mm_telit_build_bnd_request (GArray *bands_array,
- gboolean modem_is_2g,
- gboolean modem_is_3g,
- gboolean modem_is_4g,
- gboolean modem_alternate_3g_bands,
- gboolean modem_ext_4g_bands,
- GError **error);
+GArray *mm_telit_parse_bnd_query_response (const gchar *response,
+ MMTelitBNDParseConfig *config,
+ gpointer log_object,
+ GError **error);
+GArray *mm_telit_parse_bnd_test_response (const gchar *response,
+ MMTelitBNDParseConfig *config,
+ gpointer log_object,
+ GError **error);
+gchar *mm_telit_build_bnd_request (GArray *bands_array,
+ MMTelitBNDParseConfig *config,
+ GError **error);
/* #QSS? response parser */
typedef enum { /*< underscore_name=mm_telit_qss_status >*/
diff --git a/plugins/telit/mm-shared-telit.c b/plugins/telit/mm-shared-telit.c
index e5f44133..bf674831 100644
--- a/plugins/telit/mm-shared-telit.c
+++ b/plugins/telit/mm-shared-telit.c
@@ -134,6 +134,21 @@ mm_shared_telit_store_revision (MMSharedTelit *self,
priv->software_package_version = g_strdup (revision);
}
+void
+mm_shared_telit_get_bnd_parse_config (MMIfaceModem *self, MMTelitBNDParseConfig *config)
+{
+ Private *priv;
+
+ priv = get_private (MM_SHARED_TELIT (self));
+
+ config->modem_is_2g = mm_iface_modem_is_2g (self);
+ config->modem_is_3g = mm_iface_modem_is_3g (self);
+ config->modem_is_4g = mm_iface_modem_is_4g (self);
+ config->modem_alternate_3g_bands = priv->alternate_3g_bands;
+ config->modem_has_hex_format_4g_bands = is_bnd_4g_format_hex (MM_BASE_MODEM(self), priv->software_package_version);
+ config->modem_ext_4g_bands = priv->ext_4g_bands;
+}
+
/*****************************************************************************/
/* Load current mode (Modem interface) */
@@ -241,16 +256,13 @@ load_supported_bands_ready (MMBaseModem *self,
g_task_return_error (task, error);
else {
GArray *bands;
+ MMTelitBNDParseConfig config;
+
+ mm_shared_telit_get_bnd_parse_config (MM_IFACE_MODEM (self), &config);
- bands = mm_telit_parse_bnd_test_response (response,
- mm_iface_modem_is_2g (MM_IFACE_MODEM (self)),
- mm_iface_modem_is_3g (MM_IFACE_MODEM (self)),
- mm_iface_modem_is_4g (MM_IFACE_MODEM (self)),
- priv->alternate_3g_bands,
- is_bnd_4g_format_hex (self, priv->software_package_version),
- &priv->ext_4g_bands,
- self,
- &error);
+ bands = mm_telit_parse_bnd_test_response (response, &config, self, &error);
+ /* update ext_4g_bands regardless the bands value */
+ priv->ext_4g_bands = config.modem_ext_4g_bands;
if (!bands)
g_task_return_error (task, error);
else {
@@ -338,25 +350,17 @@ load_current_bands_ready (MMBaseModem *self,
{
const gchar *response;
GError *error = NULL;
- Private *priv;
-
- priv = get_private (MM_SHARED_TELIT (self));
response = mm_base_modem_at_command_finish (self, res, &error);
if (!response)
g_task_return_error (task, error);
else {
GArray *bands;
+ MMTelitBNDParseConfig config;
- bands = mm_telit_parse_bnd_query_response (response,
- mm_iface_modem_is_2g (MM_IFACE_MODEM (self)),
- mm_iface_modem_is_3g (MM_IFACE_MODEM (self)),
- mm_iface_modem_is_4g (MM_IFACE_MODEM (self)),
- priv->alternate_3g_bands,
- is_bnd_4g_format_hex (self, priv->software_package_version),
- priv->ext_4g_bands,
- self,
- &error);
+ mm_shared_telit_get_bnd_parse_config (MM_IFACE_MODEM (self), &config);
+
+ bands = mm_telit_parse_bnd_query_response (response, &config, self, &error);
if (!bands)
g_task_return_error (task, error);
else
@@ -454,15 +458,16 @@ set_current_bands_at (MMIfaceModem *self,
{
GError *error = NULL;
gchar *cmd;
- Private *priv;
GArray *bands_array;
-
- priv = get_private (MM_SHARED_TELIT (self));
+ MMTelitBNDParseConfig config;
bands_array = g_task_get_task_data (task);
g_assert (bands_array);
if (bands_array->len == 1 && g_array_index (bands_array, MMModemBand, 0) == MM_MODEM_BAND_ANY) {
+ Private *priv;
+
+ priv = get_private (MM_SHARED_TELIT (self));
if (!priv->supported_bands) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't build ANY band settings: unknown supported bands");
@@ -472,13 +477,8 @@ set_current_bands_at (MMIfaceModem *self,
bands_array = priv->supported_bands;
}
- cmd = mm_telit_build_bnd_request (bands_array,
- mm_iface_modem_is_2g (self),
- mm_iface_modem_is_3g (self),
- mm_iface_modem_is_4g (self),
- priv->alternate_3g_bands,
- priv->ext_4g_bands,
- &error);
+ mm_shared_telit_get_bnd_parse_config (self, &config);
+ cmd = mm_telit_build_bnd_request (bands_array, &config, &error);
if (!cmd) {
g_task_return_error (task, error);
g_object_unref (task);
@@ -783,3 +783,4 @@ mm_shared_telit_get_type (void)
return shared_telit_type;
}
+
diff --git a/plugins/telit/mm-shared-telit.h b/plugins/telit/mm-shared-telit.h
index 6dfcb63a..bf093ea5 100644
--- a/plugins/telit/mm-shared-telit.h
+++ b/plugins/telit/mm-shared-telit.h
@@ -25,6 +25,7 @@
#include "mm-broadband-modem.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-location.h"
+#include "mm-modem-helpers-telit.h"
#define MM_TYPE_SHARED_TELIT (mm_shared_telit_get_type ())
#define MM_SHARED_TELIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SHARED_TELIT, MMSharedTelit))
@@ -101,4 +102,6 @@ gchar * mm_shared_telit_modem_load_revision_finish (MMIfaceModem *self,
void mm_shared_telit_store_revision (MMSharedTelit *self,
const gchar *revision);
+void mm_shared_telit_get_bnd_parse_config (MMIfaceModem *self,
+ MMTelitBNDParseConfig *config);
#endif /* MM_SHARED_TELIT_H */
diff --git a/plugins/telit/tests/test-mm-modem-helpers-telit.c b/plugins/telit/tests/test-mm-modem-helpers-telit.c
index 1b96d081..11b5e918 100644
--- a/plugins/telit/tests/test-mm-modem-helpers-telit.c
+++ b/plugins/telit/tests/test-mm-modem-helpers-telit.c
@@ -35,26 +35,21 @@
typedef struct {
const gchar *response;
- gboolean modem_is_2g;
- gboolean modem_is_3g;
- gboolean modem_is_4g;
- gboolean modem_alternate_3g_bands;
- gboolean modem_has_4g_bands_hex_format;
- gboolean modem_ext_4g_bands;
+ MMTelitBNDParseConfig config;
guint mm_bands_len;
MMModemBand mm_bands [MAX_BANDS_LIST_LEN];
} BndResponseTest;
static BndResponseTest supported_band_mapping_tests [] = {
{
- "#BND: (0-3)", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, 4,
+ "#BND: (0-3)", {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE}, 4,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
MM_MODEM_BAND_G850 }
},
{
- "#BND: (0-3),(0,2,5,6)", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 7,
+ "#BND: (0-3),(0,2,5,6)", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 7,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
@@ -64,7 +59,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_UTRAN_8 }
},
{
- "#BND: (0,3),(0,2,5,6)", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 7,
+ "#BND: (0,3),(0,2,5,6)", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 7,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
@@ -74,7 +69,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_UTRAN_8 }
},
{
- "#BND: (0,2),(0,2,5,6)", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 6,
+ "#BND: (0,2),(0,2,5,6)", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 6,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_G850,
@@ -83,7 +78,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_UTRAN_8 }
},
{
- "#BND: (0,2),(0-4,5,6)", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 7,
+ "#BND: (0,2),(0-4,5,6)", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 7,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_G850,
@@ -93,7 +88,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_UTRAN_8 }
},
{
- "#BND: (0-3),(0,2,5,6),(1-1)", TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, 8,
+ "#BND: (0-3),(0,2,5,6),(1-1)", {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE}, 8,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
@@ -104,7 +99,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_EUTRAN_1 }
},
{
- "#BND: (0),(0),(1-3)", TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, 5,
+ "#BND: (0),(0),(1-3)", {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE}, 5,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_UTRAN_1,
@@ -112,13 +107,13 @@ static BndResponseTest supported_band_mapping_tests [] = {
MM_MODEM_BAND_EUTRAN_2 }
},
{
- "#BND: (0),(0),(1-3)", FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, 2,
+ "#BND: (0),(0),(1-3)", {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, 2,
{ MM_MODEM_BAND_EUTRAN_1,
MM_MODEM_BAND_EUTRAN_2 }
},
/* 3G alternate band settings: default */
{
- "#BND: (0),(0,2,5,6,12,25)", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, 5,
+ "#BND: (0),(0,2,5,6,12,25)", {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE}, 5,
{ MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_UTRAN_5,
MM_MODEM_BAND_UTRAN_8,
@@ -127,7 +122,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
},
/* 3G alternate band settings: alternate */
{
- "#BND: (0),(0,2,5,6,12,13)", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, 4,
+ "#BND: (0),(0,2,5,6,12,13)", {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE}, 4,
{ MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_UTRAN_3,
MM_MODEM_BAND_UTRAN_5,
@@ -137,7 +132,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
* 168695967: 0xA0E189F: 0000 1010 0000 1110 0001 1000 1001 1111
*/
{
- "#BND: (0-5),(0),(1-168695967)", TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, 17,
+ "#BND: (0-5),(0),(1-168695967)", {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE}, 17,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
@@ -158,7 +153,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
},
/* 4G ext band settings: devices such as LN920 */
{
- "#BND: (0),(0),(1003100185A),(42)", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, 13,
+ "#BND: (0),(0),(1003100185A),(42)", {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE}, 13,
{ MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_EUTRAN_2,
MM_MODEM_BAND_EUTRAN_4,
@@ -175,7 +170,7 @@ static BndResponseTest supported_band_mapping_tests [] = {
},
/* 4G band in hex format: devices such as LE910C1-EUX */
{
- "#BND: (0),(0,5,6,13,15,23),(80800C5)", TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, 11,
+ "#BND: (0),(0,5,6,13,15,23),(80800C5)", {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE}, 11,
{
MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
@@ -199,20 +194,13 @@ test_parse_supported_bands_response (void)
for (i = 0; i < G_N_ELEMENTS (supported_band_mapping_tests); i++) {
GError *error = NULL;
GArray *bands = NULL;
- gboolean modem_ext_4g_bands;
bands = mm_telit_parse_bnd_test_response (supported_band_mapping_tests[i].response,
- supported_band_mapping_tests[i].modem_is_2g,
- supported_band_mapping_tests[i].modem_is_3g,
- supported_band_mapping_tests[i].modem_is_4g,
- supported_band_mapping_tests[i].modem_alternate_3g_bands,
- supported_band_mapping_tests[i].modem_has_4g_bands_hex_format,
- &modem_ext_4g_bands,
+ &supported_band_mapping_tests[i].config,
NULL,
&error);
g_assert_no_error (error);
g_assert (bands);
- g_assert (supported_band_mapping_tests[i].modem_ext_4g_bands == modem_ext_4g_bands);
mm_test_helpers_compare_bands (bands,
supported_band_mapping_tests[i].mm_bands,
@@ -223,18 +211,18 @@ test_parse_supported_bands_response (void)
static BndResponseTest current_band_mapping_tests [] = {
{
- "#BND: 0", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, 2,
+ "#BND: 0", {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE}, 2,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS }
},
{
- "#BND: 0,5", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 3,
+ "#BND: 0,5", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 3,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_UTRAN_8 }
},
{
- "#BND: 1,3", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 5,
+ "#BND: 1,3", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 5,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_PCS,
MM_MODEM_BAND_UTRAN_1,
@@ -242,38 +230,38 @@ static BndResponseTest current_band_mapping_tests [] = {
MM_MODEM_BAND_UTRAN_5 }
},
{
- "#BND: 2,7", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, 3,
+ "#BND: 2,7", {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, 3,
{ MM_MODEM_BAND_DCS,
MM_MODEM_BAND_G850,
MM_MODEM_BAND_UTRAN_4 }
},
{
- "#BND: 3,0,1", TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, 4,
+ "#BND: 3,0,1", {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE}, 4,
{ MM_MODEM_BAND_PCS,
MM_MODEM_BAND_G850,
MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_EUTRAN_1 }
},
{
- "#BND: 0,0,3", TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, 4,
+ "#BND: 0,0,3", {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE}, 4,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_EUTRAN_1,
MM_MODEM_BAND_EUTRAN_2 }
},
{
- "#BND: 0,0,3", FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, 2,
+ "#BND: 0,0,3", {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE}, 2,
{ MM_MODEM_BAND_EUTRAN_1,
MM_MODEM_BAND_EUTRAN_2 }
},
/* 3G alternate band settings: default */
{
- "#BND: 0,12", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, 1,
+ "#BND: 0,12", {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE}, 1,
{ MM_MODEM_BAND_UTRAN_6 }
},
/* 3G alternate band settings: alternate */
{
- "#BND: 0,12", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, 4,
+ "#BND: 0,12", {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE}, 4,
{ MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_UTRAN_3,
MM_MODEM_BAND_UTRAN_5,
@@ -283,7 +271,7 @@ static BndResponseTest current_band_mapping_tests [] = {
* 168695967: 0xA0E189F: 0000 1010 0000 1110 0001 1000 1001 1111
*/
{
- "#BND: 5,0,168695967", TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, 17,
+ "#BND: 5,0,168695967", {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE}, 17,
{ MM_MODEM_BAND_EGSM,
MM_MODEM_BAND_DCS,
MM_MODEM_BAND_PCS,
@@ -304,7 +292,7 @@ static BndResponseTest current_band_mapping_tests [] = {
},
/* 4G ext band settings: devices such as LN920 */
{
- "#BND: 0,0,1003100185A,42", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, 13,
+ "#BND: 0,0,1003100185A,42", {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE}, 13,
{ MM_MODEM_BAND_UTRAN_1,
MM_MODEM_BAND_EUTRAN_2,
MM_MODEM_BAND_EUTRAN_4,
@@ -331,12 +319,7 @@ test_parse_current_bands_response (void)
GArray *bands = NULL;
bands = mm_telit_parse_bnd_query_response (current_band_mapping_tests[i].response,
- current_band_mapping_tests[i].modem_is_2g,
- current_band_mapping_tests[i].modem_is_3g,
- current_band_mapping_tests[i].modem_is_4g,
- current_band_mapping_tests[i].modem_alternate_3g_bands,
- supported_band_mapping_tests[i].modem_has_4g_bands_hex_format,
- current_band_mapping_tests[i].modem_ext_4g_bands,
+ &current_band_mapping_tests[i].config,
NULL,
&error);
g_assert_no_error (error);
@@ -362,12 +345,15 @@ test_common_bnd_cmd (const gchar *expected_cmd,
{
gchar *cmd;
GError *error = NULL;
+ MMTelitBNDParseConfig config = {
+ .modem_is_2g = modem_is_2g,
+ .modem_is_3g = modem_is_3g,
+ .modem_is_4g = modem_is_4g,
+ .modem_alternate_3g_bands = modem_alternate_3g_bands,
+ .modem_ext_4g_bands = modem_ext_4g_bands
+ };
- cmd = mm_telit_build_bnd_request (bands_array,
- modem_is_2g, modem_is_3g, modem_is_4g,
- modem_alternate_3g_bands,
- modem_ext_4g_bands,
- &error);
+ cmd = mm_telit_build_bnd_request (bands_array, &config, &error);
g_assert_no_error (error);
g_assert_cmpstr (cmd, ==, expected_cmd);
g_free (cmd);
@@ -386,11 +372,14 @@ test_common_bnd_cmd_error (gboolean modem_is_2g,
{
gchar *cmd;
GError *error = NULL;
-
- cmd = mm_telit_build_bnd_request (bands_array,
- modem_is_2g, modem_is_3g, modem_is_4g,
- FALSE, FALSE,
- &error);
+ MMTelitBNDParseConfig config = {
+ .modem_is_2g = modem_is_2g,
+ .modem_is_3g = modem_is_3g,
+ .modem_is_4g = modem_is_4g,
+ .modem_alternate_3g_bands = FALSE,
+ .modem_ext_4g_bands = FALSE,
+ };
+ cmd = mm_telit_build_bnd_request (bands_array, &config, &error);
g_assert_error (error, MM_CORE_ERROR, (gint)expected_error);
g_assert (!cmd);
}