modem-helpers: port clcc list parser to use object logging
This commit is contained in:
@@ -79,13 +79,14 @@ mm_simtech_get_clcc_urc_regex (void)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mm_simtech_parse_clcc_list (const gchar *str,
|
mm_simtech_parse_clcc_list (const gchar *str,
|
||||||
|
gpointer log_object,
|
||||||
GList **out_list,
|
GList **out_list,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
/* Parse the URC contents as a plain +CLCC response, but make sure to skip first
|
/* Parse the URC contents as a plain +CLCC response, but make sure to skip first
|
||||||
* EOL in the string because the plain +CLCC response would never have that.
|
* EOL in the string because the plain +CLCC response would never have that.
|
||||||
*/
|
*/
|
||||||
return mm_3gpp_parse_clcc_response (mm_strip_tag (str, "\r\n"), out_list, error);
|
return mm_3gpp_parse_clcc_response (mm_strip_tag (str, "\r\n"), log_object, out_list, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -32,6 +32,7 @@ gboolean mm_simtech_parse_clcc_test (const gchar *response,
|
|||||||
|
|
||||||
GRegex *mm_simtech_get_clcc_urc_regex (void);
|
GRegex *mm_simtech_get_clcc_urc_regex (void);
|
||||||
gboolean mm_simtech_parse_clcc_list (const gchar *str,
|
gboolean mm_simtech_parse_clcc_list (const gchar *str,
|
||||||
|
gpointer log_object,
|
||||||
GList **out_list,
|
GList **out_list,
|
||||||
GError **error);
|
GError **error);
|
||||||
void mm_simtech_call_info_list_free (GList *call_info_list);
|
void mm_simtech_call_info_list_free (GList *call_info_list);
|
||||||
|
@@ -781,7 +781,7 @@ clcc_urc_received (MMPortSerialAt *port,
|
|||||||
|
|
||||||
full = g_match_info_fetch (match_info, 0);
|
full = g_match_info_fetch (match_info, 0);
|
||||||
|
|
||||||
if (!mm_simtech_parse_clcc_list (full, &call_info_list, &error)) {
|
if (!mm_simtech_parse_clcc_list (full, self, &call_info_list, &error)) {
|
||||||
mm_warn ("couldn't parse +CLCC list in URC: %s", error->message);
|
mm_warn ("couldn't parse +CLCC list in URC: %s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
} else
|
} else
|
||||||
|
@@ -52,7 +52,7 @@ common_test_clcc_urc (const gchar *urc,
|
|||||||
str = g_match_info_fetch (match_info, 0);
|
str = g_match_info_fetch (match_info, 0);
|
||||||
g_assert (str);
|
g_assert (str);
|
||||||
|
|
||||||
result = mm_simtech_parse_clcc_list (str, &call_info_list, &error);
|
result = mm_simtech_parse_clcc_list (str, NULL, &call_info_list, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result);
|
g_assert (result);
|
||||||
|
|
||||||
|
@@ -7560,7 +7560,7 @@ modem_voice_load_call_list_finish (MMIfaceModemVoice *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clcc_ready (MMBaseModem *modem,
|
clcc_ready (MMBaseModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
@@ -7568,8 +7568,8 @@ clcc_ready (MMBaseModem *modem,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GList *call_info_list = NULL;
|
GList *call_info_list = NULL;
|
||||||
|
|
||||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
response = mm_base_modem_at_command_finish (self, res, &error);
|
||||||
if (!response || !mm_3gpp_parse_clcc_response (response, &call_info_list, &error))
|
if (!response || !mm_3gpp_parse_clcc_response (response, self, &call_info_list, &error))
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
else
|
else
|
||||||
g_task_return_pointer (task, call_info_list, (GDestroyNotify)mm_3gpp_call_info_list_free);
|
g_task_return_pointer (task, call_info_list, (GDestroyNotify)mm_3gpp_call_info_list_free);
|
||||||
|
@@ -560,6 +560,7 @@ call_info_free (MMCallInfo *info)
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mm_3gpp_parse_clcc_response (const gchar *str,
|
mm_3gpp_parse_clcc_response (const gchar *str,
|
||||||
|
gpointer log_object,
|
||||||
GList **out_list,
|
GList **out_list,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@@ -623,20 +624,20 @@ mm_3gpp_parse_clcc_response (const gchar *str,
|
|||||||
call_info = g_slice_new0 (MMCallInfo);
|
call_info = g_slice_new0 (MMCallInfo);
|
||||||
|
|
||||||
if (!mm_get_uint_from_match_info (match_info, 1, &call_info->index)) {
|
if (!mm_get_uint_from_match_info (match_info, 1, &call_info->index)) {
|
||||||
mm_warn ("couldn't parse call index from +CLCC line");
|
mm_obj_warn (log_object, "couldn't parse call index from +CLCC line");
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mm_get_uint_from_match_info (match_info, 2, &aux) ||
|
if (!mm_get_uint_from_match_info (match_info, 2, &aux) ||
|
||||||
(aux >= G_N_ELEMENTS (call_direction))) {
|
(aux >= G_N_ELEMENTS (call_direction))) {
|
||||||
mm_warn ("couldn't parse call direction from +CLCC line");
|
mm_obj_warn (log_object, "couldn't parse call direction from +CLCC line");
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
call_info->direction = call_direction[aux];
|
call_info->direction = call_direction[aux];
|
||||||
|
|
||||||
if (!mm_get_uint_from_match_info (match_info, 3, &aux) ||
|
if (!mm_get_uint_from_match_info (match_info, 3, &aux) ||
|
||||||
(aux >= G_N_ELEMENTS (call_state))) {
|
(aux >= G_N_ELEMENTS (call_state))) {
|
||||||
mm_warn ("couldn't parse call state from +CLCC line");
|
mm_obj_warn (log_object, "couldn't parse call state from +CLCC line");
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
call_info->state = call_state[aux];
|
call_info->state = call_state[aux];
|
||||||
|
@@ -106,6 +106,7 @@ typedef struct {
|
|||||||
gchar *number; /* optional */
|
gchar *number; /* optional */
|
||||||
} MMCallInfo;
|
} MMCallInfo;
|
||||||
gboolean mm_3gpp_parse_clcc_response (const gchar *str,
|
gboolean mm_3gpp_parse_clcc_response (const gchar *str,
|
||||||
|
gpointer log_object,
|
||||||
GList **out_list,
|
GList **out_list,
|
||||||
GError **error);
|
GError **error);
|
||||||
void mm_3gpp_call_info_list_free (GList *call_info_list);
|
void mm_3gpp_call_info_list_free (GList *call_info_list);
|
||||||
|
@@ -4190,7 +4190,7 @@ common_test_clcc_response (const gchar *str,
|
|||||||
GList *call_info_list = NULL;
|
GList *call_info_list = NULL;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
result = mm_3gpp_parse_clcc_response (str, &call_info_list, &error);
|
result = mm_3gpp_parse_clcc_response (str, NULL, &call_info_list, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (result);
|
g_assert (result);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user