modem-helpers: parse cgdcont test parser to use object logging

This commit is contained in:
Aleksander Morgado
2020-04-03 16:05:17 +02:00
parent f76489cd81
commit 740827bde1
5 changed files with 13 additions and 11 deletions

View File

@@ -828,7 +828,7 @@ cgdcont_test_ready (MMBaseModem *modem,
goto out;
}
ctx->context_format_list = mm_3gpp_parse_cgdcont_test_response (response, &error);
ctx->context_format_list = mm_3gpp_parse_cgdcont_test_response (response, self, &error);
if (error) {
mm_obj_dbg (self, "error parsing +CGDCONT test response: %s", error->message);
g_clear_error (&error);

View File

@@ -1906,7 +1906,7 @@ supported_ip_families_cgdcont_test_ready (MMBaseModem *self,
if (response) {
GList *formats, *l;
formats = mm_3gpp_parse_cgdcont_test_response (response, &error);
formats = mm_3gpp_parse_cgdcont_test_response (response, self, &error);
for (l = formats; l; l = g_list_next (l))
mask |= ((MM3gppPdpContextFormat *)(l->data))->pdp_type;

View File

@@ -1688,8 +1688,9 @@ mm_3gpp_pdp_context_format_list_free (GList *pdp_format_list)
}
GList *
mm_3gpp_parse_cgdcont_test_response (const gchar *response,
GError **error)
mm_3gpp_parse_cgdcont_test_response (const gchar *response,
gpointer log_object,
GError **error)
{
GRegex *r;
GMatchInfo *match_info;
@@ -1717,11 +1718,11 @@ mm_3gpp_parse_cgdcont_test_response (const gchar *response,
pdp_type_str = mm_get_string_unquoted_from_match_info (match_info, 3);
pdp_type = mm_3gpp_get_ip_family_from_pdp_type (pdp_type_str);
if (pdp_type == MM_BEARER_IP_FAMILY_NONE)
mm_dbg ("Unhandled PDP type in CGDCONT=? reply: '%s'", pdp_type_str);
mm_obj_dbg (log_object, "unhandled PDP type in CGDCONT=? reply: '%s'", pdp_type_str);
else {
/* Read min CID */
if (!mm_get_uint_from_match_info (match_info, 1, &min_cid))
mm_warn ("Invalid min CID in CGDCONT=? reply for PDP type '%s'", pdp_type_str);
mm_obj_warn (log_object, "invalid min CID in CGDCONT=? reply for PDP type '%s'", pdp_type_str);
else {
MM3gppPdpContextFormat *format;
@@ -1746,7 +1747,7 @@ mm_3gpp_parse_cgdcont_test_response (const gchar *response,
g_regex_unref (r);
if (inner_error) {
mm_warn ("Unexpected error matching +CGDCONT response: '%s'", inner_error->message);
mm_obj_warn (log_object, "unexpected error matching +CGDCONT response: '%s'", inner_error->message);
g_error_free (inner_error);
}

View File

@@ -184,8 +184,9 @@ typedef struct {
MMBearerIpFamily pdp_type;
} MM3gppPdpContextFormat;
void mm_3gpp_pdp_context_format_list_free (GList *pdp_format_list);
GList *mm_3gpp_parse_cgdcont_test_response (const gchar *reply,
GError **error);
GList *mm_3gpp_parse_cgdcont_test_response (const gchar *reply,
gpointer log_object,
GError **error);
/* AT+CGDCONT? (PDP context query) response parser */
typedef struct {

View File

@@ -2440,7 +2440,7 @@ test_cgdcont_test_results (const gchar *desc,
g_debug ("Testing %s +CGDCONT test response...", desc);
results = mm_3gpp_parse_cgdcont_test_response (reply, &error);
results = mm_3gpp_parse_cgdcont_test_response (reply, NULL, &error);
g_assert (results);
g_assert_no_error (error);
g_assert_cmpuint (g_list_length (results), ==, expected_results_len);
@@ -2859,7 +2859,7 @@ test_cid_selection (void)
test = &cid_selection_tests[i];
context_format_list = test->cgdcont_test ? mm_3gpp_parse_cgdcont_test_response (test->cgdcont_test, NULL) : NULL;
context_format_list = test->cgdcont_test ? mm_3gpp_parse_cgdcont_test_response (test->cgdcont_test, NULL, NULL) : NULL;
context_list = test->cgdcont_query ? mm_3gpp_parse_cgdcont_read_response (test->cgdcont_query, NULL) : NULL;
cid = mm_3gpp_select_best_cid (test->apn, test->ip_family,